Skip to content

Commit c67aef5

Browse files
author
Clement Champetier
committed
OptionLoader: getPixelFormats, manage backward compatibility
1 parent a9515a7 commit c67aef5

File tree

1 file changed

+10
-0
lines changed

1 file changed

+10
-0
lines changed

src/AvTranscoder/OptionLoader.cpp

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -284,7 +284,13 @@ std::vector<std::string> OptionLoader::getPixelFormats ( const std::string& vide
284284
if( videoCodecName == "" )
285285
{
286286
const AVPixFmtDescriptor* pixFmtDesc = NULL;
287+
288+
#if LIBAVUTIL_VERSION_INT < AV_VERSION_INT( 51, 44, 0 )
289+
for( int pix_fmt = 0; pix_fmt < PIX_FMT_NB; ++pix_fmt )
290+
pixFmtDesc = &av_pix_fmt_descriptors[pix_fmt];
291+
#else
287292
while( ( pixFmtDesc = av_pix_fmt_desc_next( pixFmtDesc ) ) != NULL )
293+
#endif
288294
{
289295
if( ! pixFmtDesc->name )
290296
continue;
@@ -301,7 +307,11 @@ std::vector<std::string> OptionLoader::getPixelFormats ( const std::string& vide
301307
size_t pix_fmt = 0;
302308
while( videoCodec->pix_fmts[pix_fmt] != -1 )
303309
{
310+
#if LIBAVUTIL_VERSION_INT < AV_VERSION_INT( 51, 44, 0 )
311+
const AVPixFmtDescriptor* pix_desc = &av_pix_fmt_descriptors[ videoCodec->pix_fmts[pix_fmt] ];
312+
#else
304313
const AVPixFmtDescriptor* pix_desc = av_pix_fmt_desc_get( videoCodec->pix_fmts[pix_fmt] );
314+
#endif
305315
if( ! pix_desc->name )
306316
continue;
307317
pixelFormats.push_back( std::string( pix_desc->name ) );

0 commit comments

Comments
 (0)