diff --git a/src/AvTranscoder/OptionLoader.cpp b/src/AvTranscoder/OptionLoader.cpp index 53630c91..00867a01 100644 --- a/src/AvTranscoder/OptionLoader.cpp +++ b/src/AvTranscoder/OptionLoader.cpp @@ -65,11 +65,11 @@ OptionLoader::OptionLoader() AVCodec* c = NULL; while( ( c = av_codec_next( c ) ) != NULL ) { -#if LIBAVCODEC_VERSION_INT >= AV_VERSION_INT( 53, 34, 0 ) - if( ! c->encode2 ) +#if LIBAVCODEC_VERSION_INT < AV_VERSION_INT( 53, 34, 0 ) + if( ! c->encode ) continue; #else - if( ! c->encode ) + if( ! c->encode2 ) continue; #endif switch( c->type ) @@ -153,10 +153,10 @@ OptionLoader::OptionMap OptionLoader::loadVideoCodecOptions() // iterate on codecs while( _codec ) { -#if LIBAVCODEC_VERSION_INT >= AV_VERSION_INT( 53, 34, 0 ) - if( _codec->encode2 ) -#else +#if LIBAVCODEC_VERSION_INT < AV_VERSION_INT( 53, 34, 0 ) if( _codec->encode ) +#else + if( _codec->encode2 ) #endif { // add only video codec @@ -189,10 +189,10 @@ OptionLoader::OptionMap OptionLoader::loadAudioCodecOptions() // iterate on codecs while( _codec ) { -#if LIBAVCODEC_VERSION_INT >= AV_VERSION_INT( 53, 34, 0 ) - if( _codec->encode2 ) -#else +#if LIBAVCODEC_VERSION_INT < AV_VERSION_INT( 53, 34, 0 ) if( _codec->encode ) +#else + if( _codec->encode2 ) #endif { // add only audio codec @@ -276,7 +276,7 @@ OptionLoader::OptionArray OptionLoader::loadOptions( void* av_class, int req_fla return options; } -std::vector OptionLoader::getPixelFormats ( const std::string& videoCodecName ) const +std::vector OptionLoader::getPixelFormats( const std::string& videoCodecName ) const { std::vector pixelFormats; @@ -284,7 +284,13 @@ std::vector OptionLoader::getPixelFormats ( const std::string& vide if( videoCodecName == "" ) { const AVPixFmtDescriptor* pixFmtDesc = NULL; + +#if LIBAVUTIL_VERSION_INT < AV_VERSION_INT( 51, 44, 0 ) + for( int pix_fmt = 0; pix_fmt < PIX_FMT_NB; ++pix_fmt ) + pixFmtDesc = &av_pix_fmt_descriptors[pix_fmt]; +#else while( ( pixFmtDesc = av_pix_fmt_desc_next( pixFmtDesc ) ) != NULL ) +#endif { if( ! pixFmtDesc->name ) continue; @@ -301,7 +307,11 @@ std::vector OptionLoader::getPixelFormats ( const std::string& vide size_t pix_fmt = 0; while( videoCodec->pix_fmts[pix_fmt] != -1 ) { +#if LIBAVUTIL_VERSION_INT < AV_VERSION_INT( 51, 44, 0 ) + const AVPixFmtDescriptor* pix_desc = &av_pix_fmt_descriptors[ videoCodec->pix_fmts[pix_fmt] ]; +#else const AVPixFmtDescriptor* pix_desc = av_pix_fmt_desc_get( videoCodec->pix_fmts[pix_fmt] ); +#endif if( ! pix_desc->name ) continue; pixelFormats.push_back( std::string( pix_desc->name ) );