Skip to content

Commit 4331dc3

Browse files
author
Clement Champetier
committed
Video profiles can force width / height of output
1 parent db4d1c8 commit 4331dc3

File tree

3 files changed

+16
-2
lines changed

3 files changed

+16
-2
lines changed

src/AvTranscoder/ProfileLoader.hpp

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -24,6 +24,8 @@ namespace constants
2424
const std::string avProfilePixelFormat = "pix_fmt";
2525
const std::string avProfileSampleFormat = "sample_fmt";
2626
const std::string avProfileFrameRate = "r";
27+
const std::string avProfileWidth = "width";
28+
const std::string avProfileHeight = "height";
2729
const std::string avProfileSampleRate = "ar";
2830
const std::string avProfileChannel = "ac";
2931
}

src/AvTranscoder/encoder/VideoEncoder.cpp

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -147,7 +147,9 @@ void VideoEncoder::setProfile( const ProfileLoader::Profile& profile, const avtr
147147
(*it).first == constants::avProfileIdentificatorHuman ||
148148
(*it).first == constants::avProfileType ||
149149
(*it).first == constants::avProfileCodec ||
150-
(*it).first == constants::avProfileFrameRate )
150+
(*it).first == constants::avProfileFrameRate ||
151+
(*it).first == constants::avProfileWidth ||
152+
(*it).first == constants::avProfileHeight )
151153
continue;
152154

153155
try
@@ -167,7 +169,9 @@ void VideoEncoder::setProfile( const ProfileLoader::Profile& profile, const avtr
167169
(*it).first == constants::avProfileIdentificatorHuman ||
168170
(*it).first == constants::avProfileType ||
169171
(*it).first == constants::avProfileCodec ||
170-
(*it).first == constants::avProfileFrameRate )
172+
(*it).first == constants::avProfileFrameRate ||
173+
(*it).first == constants::avProfileWidth ||
174+
(*it).first == constants::avProfileHeight )
171175
continue;
172176

173177
try

src/AvTranscoder/frame/VideoFrame.hpp

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -11,6 +11,7 @@ extern "C" {
1111
}
1212

1313
#include <stdexcept>
14+
#include <stdlib.h>
1415

1516
namespace avtranscoder
1617
{
@@ -72,6 +73,13 @@ class AvExport VideoFrameDesc
7273

7374
void setParameters( const ProfileLoader::Profile& profile )
7475
{
76+
// width
77+
if( profile.count( constants::avProfileWidth ) )
78+
setWidth( atoi( profile.find( constants::avProfileWidth )->second.c_str() ) );
79+
// height
80+
if( profile.count( constants::avProfileHeight ) )
81+
setHeight( atoi( profile.find( constants::avProfileHeight )->second.c_str() ) );
82+
// pixel format
7583
if( profile.find( constants::avProfilePixelFormat ) != profile.end() )
7684
setPixelFormat( profile.find( constants::avProfilePixelFormat )->second );
7785
}

0 commit comments

Comments
 (0)