@@ -65,11 +65,11 @@ OptionLoader::OptionLoader()
65
65
AVCodec* c = NULL ;
66
66
while ( ( c = av_codec_next ( c ) ) != NULL )
67
67
{
68
- #if LIBAVCODEC_VERSION_INT >= AV_VERSION_INT( 53, 34, 0 )
69
- if ( ! c->encode2 )
68
+ #if LIBAVCODEC_VERSION_INT < AV_VERSION_INT( 53, 34, 0 )
69
+ if ( ! c->encode )
70
70
continue ;
71
71
#else
72
- if ( ! c->encode )
72
+ if ( ! c->encode2 )
73
73
continue ;
74
74
#endif
75
75
switch ( c->type )
@@ -153,10 +153,10 @@ OptionLoader::OptionMap OptionLoader::loadVideoCodecOptions()
153
153
// iterate on codecs
154
154
while ( _codec )
155
155
{
156
- #if LIBAVCODEC_VERSION_INT >= AV_VERSION_INT( 53, 34, 0 )
157
- if ( _codec->encode2 )
158
- #else
156
+ #if LIBAVCODEC_VERSION_INT < AV_VERSION_INT( 53, 34, 0 )
159
157
if ( _codec->encode )
158
+ #else
159
+ if ( _codec->encode2 )
160
160
#endif
161
161
{
162
162
// add only video codec
@@ -189,10 +189,10 @@ OptionLoader::OptionMap OptionLoader::loadAudioCodecOptions()
189
189
// iterate on codecs
190
190
while ( _codec )
191
191
{
192
- #if LIBAVCODEC_VERSION_INT >= AV_VERSION_INT( 53, 34, 0 )
193
- if ( _codec->encode2 )
194
- #else
192
+ #if LIBAVCODEC_VERSION_INT < AV_VERSION_INT( 53, 34, 0 )
195
193
if ( _codec->encode )
194
+ #else
195
+ if ( _codec->encode2 )
196
196
#endif
197
197
{
198
198
// add only audio codec
@@ -276,15 +276,21 @@ OptionLoader::OptionArray OptionLoader::loadOptions( void* av_class, int req_fla
276
276
return options;
277
277
}
278
278
279
- std::vector<std::string> OptionLoader::getPixelFormats ( const std::string& videoCodecName ) const
279
+ std::vector<std::string> OptionLoader::getPixelFormats ( const std::string& videoCodecName ) const
280
280
{
281
281
std::vector<std::string> pixelFormats;
282
282
283
283
// all video codec concerned
284
284
if ( videoCodecName == " " )
285
285
{
286
286
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
287
292
while ( ( pixFmtDesc = av_pix_fmt_desc_next ( pixFmtDesc ) ) != NULL )
293
+ #endif
288
294
{
289
295
if ( ! pixFmtDesc->name )
290
296
continue ;
@@ -301,7 +307,11 @@ std::vector<std::string> OptionLoader::getPixelFormats ( const std::string& vide
301
307
size_t pix_fmt = 0 ;
302
308
while ( videoCodec->pix_fmts [pix_fmt] != -1 )
303
309
{
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
304
313
const AVPixFmtDescriptor* pix_desc = av_pix_fmt_desc_get ( videoCodec->pix_fmts [pix_fmt] );
314
+ #endif
305
315
if ( ! pix_desc->name )
306
316
continue ;
307
317
pixelFormats.push_back ( std::string ( pix_desc->name ) );
0 commit comments