Skip to content

Commit cf40e09

Browse files
author
Clement Champetier
committed
OptionLoader: update getSampleFormats
* Add const. * Fix if videoCodec is NULL (no codec corresponding to the videoCodecName).
1 parent 39314e1 commit cf40e09

File tree

1 file changed

+2
-2
lines changed

1 file changed

+2
-2
lines changed

src/AvTranscoder/OptionLoader.cpp

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -301,9 +301,9 @@ std::vector<std::string> OptionLoader::getPixelFormats( const std::string& video
301301
// specific video codec
302302
else
303303
{
304-
AVCodec* videoCodec = avcodec_find_encoder_by_name( videoCodecName.c_str() );
304+
const AVCodec* videoCodec = avcodec_find_encoder_by_name( videoCodecName.c_str() );
305305

306-
if( videoCodec->pix_fmts != NULL )
306+
if( videoCodec && videoCodec->pix_fmts != NULL )
307307
{
308308
size_t pix_fmt = 0;
309309
while( videoCodec->pix_fmts[pix_fmt] != -1 )

0 commit comments

Comments
 (0)