Skip to content

Commit a0ba631

Browse files
committed
Merge pull request #48 from cchampet/dev_videoProfiles_width_height
Video profiles can force width / height of output
2 parents 4943351 + 844f228 commit a0ba631

File tree

3 files changed

+16
-4
lines changed

3 files changed

+16
-4
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: 8 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -140,8 +140,10 @@ void VideoEncoder::setProfile( const ProfileLoader::Profile& profile, const avtr
140140
(*it).first == constants::avProfileIdentificatorHuman ||
141141
(*it).first == constants::avProfileType ||
142142
(*it).first == constants::avProfileCodec ||
143-
(*it).first == constants::avProfileFrameRate ||
144-
(*it).first == constants::avProfilePixelFormat )
143+
(*it).first == constants::avProfileWidth ||
144+
(*it).first == constants::avProfileHeight ||
145+
(*it).first == constants::avProfilePixelFormat ||
146+
(*it).first == constants::avProfileFrameRate )
145147
continue;
146148

147149
try
@@ -161,8 +163,10 @@ void VideoEncoder::setProfile( const ProfileLoader::Profile& profile, const avtr
161163
(*it).first == constants::avProfileIdentificatorHuman ||
162164
(*it).first == constants::avProfileType ||
163165
(*it).first == constants::avProfileCodec ||
164-
(*it).first == constants::avProfileFrameRate ||
165-
(*it).first == constants::avProfilePixelFormat )
166+
(*it).first == constants::avProfileWidth ||
167+
(*it).first == constants::avProfileHeight ||
168+
(*it).first == constants::avProfilePixelFormat ||
169+
(*it).first == constants::avProfileFrameRate )
166170
continue;
167171

168172
try

src/AvTranscoder/frame/VideoFrame.hpp

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -63,6 +63,12 @@ class AvExport VideoFrameDesc
6363

6464
void setParameters( const ProfileLoader::Profile& profile )
6565
{
66+
// width
67+
if( profile.count( constants::avProfileWidth ) )
68+
setWidth( atoi( profile.find( constants::avProfileWidth )->second.c_str() ) );
69+
// height
70+
if( profile.count( constants::avProfileHeight ) )
71+
setHeight( atoi( profile.find( constants::avProfileHeight )->second.c_str() ) );
6672
// pixel format
6773
if( profile.count( constants::avProfilePixelFormat ) )
6874
setPixelFormat( profile.find( constants::avProfilePixelFormat )->second );

0 commit comments

Comments
 (0)