From: Dan Dennedy Date: Thu, 21 Apr 2011 03:15:18 +0000 (-0700) Subject: Fix avformat build with libavcodec v53. X-Git-Url: https://git.sesse.net/?a=commitdiff_plain;h=db36bb14e0ea06c612a16dbc8f1702aaf720bcb9;p=mlt Fix avformat build with libavcodec v53. --- diff --git a/src/modules/avformat/consumer_avformat.c b/src/modules/avformat/consumer_avformat.c index e710b002..8cab4e68 100644 --- a/src/modules/avformat/consumer_avformat.c +++ b/src/modules/avformat/consumer_avformat.c @@ -50,6 +50,12 @@ #define PIX_FMT_YUYV422 PIX_FMT_YUV422 #endif +#if LIBAVCODEC_VERSION_MAJOR > 52 +#define CODEC_TYPE_VIDEO AVMEDIA_TYPE_VIDEO +#define CODEC_TYPE_AUDIO AVMEDIA_TYPE_AUDIO +#define PKT_FLAG_KEY AV_PKT_FLAG_KEY +#endif + #define MAX_AUDIO_STREAMS (8) #define AUDIO_ENCODE_BUFFER_SIZE (48000 * 2 * MAX_AUDIO_STREAMS) #define AUDIO_BUFFER_SIZE (1024 * 42) @@ -437,7 +443,7 @@ static AVStream *add_audio_stream( mlt_consumer consumer, AVFormatContext *oc, i if ( thread_count == 0 && getenv( "MLT_AVFORMAT_THREADS" ) ) thread_count = atoi( getenv( "MLT_AVFORMAT_THREADS" ) ); if ( thread_count > 1 ) - avcodec_thread_init( c, thread_count ); + c->thread_count = thread_count; #endif if (oc->oformat->flags & AVFMT_GLOBALHEADER) @@ -477,7 +483,12 @@ static AVStream *add_audio_stream( mlt_consumer consumer, AVFormatContext *oc, i c->channels = channels; if ( mlt_properties_get( properties, "alang" ) != NULL ) +#if LIBAVFORMAT_VERSION_INT >= ((52<<16)+(43<<8)+0) + av_metadata_set2( &oc->metadata, "language", mlt_properties_get( properties, "alang" ), 0 ); +#else + strncpy( st->language, mlt_properties_get( properties, "alang" ), sizeof( st->language ) ); +#endif } else { @@ -582,7 +593,7 @@ static AVStream *add_video_stream( mlt_consumer consumer, AVFormatContext *oc, i if ( thread_count == 0 && getenv( "MLT_AVFORMAT_THREADS" ) ) thread_count = atoi( getenv( "MLT_AVFORMAT_THREADS" ) ); if ( thread_count > 1 ) - avcodec_thread_init( c, thread_count ); + c->thread_count = thread_count; // Process properties as AVOptions char *vpre = mlt_properties_get( properties, "vpre" ); diff --git a/src/modules/avformat/producer_avformat.c b/src/modules/avformat/producer_avformat.c index 1ea19aa9..8d43c76a 100644 --- a/src/modules/avformat/producer_avformat.c +++ b/src/modules/avformat/producer_avformat.c @@ -56,6 +56,12 @@ #define PIX_FMT_YUYV422 PIX_FMT_YUV422 #endif +#if LIBAVCODEC_VERSION_MAJOR > 52 +#define CODEC_TYPE_VIDEO AVMEDIA_TYPE_VIDEO +#define CODEC_TYPE_AUDIO AVMEDIA_TYPE_AUDIO +#define PKT_FLAG_KEY AV_PKT_FLAG_KEY +#endif + #define POSITION_INITIAL (-2) #define POSITION_INVALID (-1) @@ -1547,10 +1553,7 @@ static int video_codec_init( producer_avformat self, int index, mlt_properties p if ( thread_count == 0 && getenv( "MLT_AVFORMAT_THREADS" ) ) thread_count = atoi( getenv( "MLT_AVFORMAT_THREADS" ) ); if ( thread_count > 1 ) - { - avcodec_thread_init( codec_context, thread_count ); codec_context->thread_count = thread_count; - } // If we don't have a codec and we can't initialise it, we can't do much more... avformat_lock( );