@@ -178,9 +178,24 @@ bool OutputVideo::encodeFrame( DataStream& codedFrame )
178
178
179
179
void OutputVideo::setProfile ( Profile::ProfileDesc& desc )
180
180
{
181
+ // if not specified in the profile desc: 1920*1080, 25 fps, with pixel aspect ratio = 1
182
+ const size_t width = ( desc.find ( " width" ) != desc.end () ) ? atoi ( desc[ " width" ].c_str () ) : 1920 ;
183
+ const size_t height = ( desc.find ( " height" ) != desc.end () ) ? atoi ( desc[ " height" ].c_str () ) : 1080 ;
184
+ const size_t frameRate = ( desc.find ( " r" ) != desc.end () ) ? atoi ( desc[ " r" ].c_str () ) : 25 ;
185
+ const size_t par = ( desc.find ( " par" ) != desc.end () ) ? atoi ( desc[ " par" ].c_str () ) : 1 ;
186
+ const AVPixelFormat pix_fmt = static_cast <AVPixelFormat>( atoi ( desc[ " pix_fmt" ].c_str () ) );
187
+
181
188
_videoDesc.setVideoCodec ( desc[ " codec" ] );
182
- _videoDesc.setTimeBase ( 1 , 25 ); // 25 fps
183
- _videoDesc.setImageParameters ( 1920 , 1080 , av_get_pix_fmt ( desc[ " pix_fmt" ].c_str () ) );
189
+ _videoDesc.setTimeBase ( 1 , frameRate );
190
+
191
+ avtranscoder::ImageDesc imageDesc;
192
+ avtranscoder::Pixel pixel ( pix_fmt );
193
+ // @todo: set par of pixel
194
+ imageDesc.setPixel ( pixel );
195
+ imageDesc.setWidth ( width );
196
+ imageDesc.setHeight ( height );
197
+ imageDesc.setDar ( width, height );
198
+ _videoDesc.setImageParameters ( imageDesc );
184
199
185
200
for ( Profile::ProfileDesc::iterator it = desc.begin (); it != desc.end (); ++it )
186
201
{
@@ -198,6 +213,10 @@ void OutputVideo::setProfile( Profile::ProfileDesc& desc )
198
213
continue ;
199
214
if ( (*it).first == " height" )
200
215
continue ;
216
+ if ( (*it).first == " r" )
217
+ continue ;
218
+ if ( (*it).first == " par" )
219
+ continue ;
201
220
202
221
try
203
222
{
@@ -227,6 +246,10 @@ void OutputVideo::setProfile( Profile::ProfileDesc& desc )
227
246
continue ;
228
247
if ( (*it).first == " height" )
229
248
continue ;
249
+ if ( (*it).first == " r" )
250
+ continue ;
251
+ if ( (*it).first == " par" )
252
+ continue ;
230
253
231
254
try
232
255
{
0 commit comments