]> git.sesse.net Git - mlt/commitdiff
Fix avformat build with libavcodec v53.
authorDan Dennedy <dan@dennedy.org>
Thu, 21 Apr 2011 03:15:18 +0000 (20:15 -0700)
committerDan Dennedy <dan@dennedy.org>
Thu, 21 Apr 2011 03:15:18 +0000 (20:15 -0700)
src/modules/avformat/consumer_avformat.c
src/modules/avformat/producer_avformat.c

index e710b0023e9d87927cc2322ead1d59b8f6a87c00..8cab4e6852ffa3063e0a7a0b1f36c49a131a7630 100644 (file)
 #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" );
index 1ea19aa92d1d0a2d538fa0bfd926d6d7a273e62e..8d43c76a7a0d388df4566e68e3e5d5adee166050 100644 (file)
 #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( );