]> git.sesse.net Git - mlt/commitdiff
Make ffmpeg v53-specific code more readable and searchable.
authorDan Dennedy <dan@dennedy.org>
Fri, 22 Jul 2011 19:15:38 +0000 (12:15 -0700)
committerDan Dennedy <dan@dennedy.org>
Fri, 22 Jul 2011 19:15:38 +0000 (12:15 -0700)
src/modules/avformat/consumer_avformat.c
src/modules/avformat/factory.c
src/modules/avformat/producer_avformat.c

index 18886ebcb1bcb2afb6fbc7bba48bfac102d966cd..6bfff7ae14eed10a0157f866e8f42a354bbdf9f6 100644 (file)
@@ -49,7 +49,7 @@
 #define PIX_FMT_YUYV422 PIX_FMT_YUV422
 #endif
 
-#if LIBAVCODEC_VERSION_MAJOR > 52
+#if LIBAVCODEC_VERSION_MAJOR >= 53
 #include <libavutil/opt.h>
 #define CODEC_TYPE_VIDEO      AVMEDIA_TYPE_VIDEO
 #define CODEC_TYPE_AUDIO      AVMEDIA_TYPE_AUDIO
@@ -522,7 +522,7 @@ static int open_audio( mlt_properties properties, AVFormatContext *oc, AVStream
        else
                codec = avcodec_find_encoder( c->codec_id );
 
-#if LIBAVCODEC_VERSION_MAJOR > 52
+#if LIBAVCODEC_VERSION_MAJOR >= 53
        // Process properties as AVOptions on the AVCodec
        if ( codec && codec->priv_class )
        {
@@ -904,7 +904,7 @@ static int open_video( mlt_properties properties, AVFormatContext *oc, AVStream
        else
                codec = avcodec_find_encoder( video_enc->codec_id );
 
-#if LIBAVCODEC_VERSION_MAJOR > 52
+#if LIBAVCODEC_VERSION_MAJOR >= 53
        // Process properties as AVOptions on the AVCodec
        if ( codec && codec->priv_class )
        {
@@ -1243,14 +1243,14 @@ static void *consumer_thread( void *arg )
                {
                        mlt_properties p = mlt_properties_load( fpre );
                        apply_properties( oc, p, AV_OPT_FLAG_ENCODING_PARAM );
-#if LIBAVFORMAT_VERSION_MAJOR > 52
+#if LIBAVFORMAT_VERSION_MAJOR >= 53
                        if ( oc->oformat && oc->oformat->priv_class && oc->priv_data )
                                apply_properties( oc->priv_data, p, AV_OPT_FLAG_ENCODING_PARAM );
 #endif
                        mlt_properties_close( p );
                }
                apply_properties( oc, properties, AV_OPT_FLAG_ENCODING_PARAM );
-#if LIBAVFORMAT_VERSION_MAJOR > 52
+#if LIBAVFORMAT_VERSION_MAJOR >= 53
                if ( oc->oformat && oc->oformat->priv_class && oc->priv_data )
                        apply_properties( oc->priv_data, properties, AV_OPT_FLAG_ENCODING_PARAM );
 #endif
@@ -1268,7 +1268,7 @@ static void *consumer_thread( void *arg )
                // Open the output file, if needed
                if ( !( fmt->flags & AVFMT_NOFILE ) ) 
                {
-#if LIBAVFORMAT_VERSION_MAJOR > 52
+#if LIBAVFORMAT_VERSION_MAJOR >= 53
                        if ( avio_open( &oc->pb, filename, AVIO_FLAG_WRITE ) < 0 )
 #else
                        if ( url_fopen( &oc->pb, filename, URL_WRONLY ) < 0 )
@@ -1759,9 +1759,9 @@ on_fatal_error:
 
        // Close the output file
        if ( !( fmt->flags & AVFMT_NOFILE ) )
-#if LIBAVFORMAT_VERSION_MAJOR > 52
+#if LIBAVFORMAT_VERSION_MAJOR >= 53
                avio_close( oc->pb );
-#elif LIBAVFORMAT_VERSION_INT >= ((52<<16)+(0<<8)+0)
+#elif LIBAVFORMAT_VERSION_MAJOR >= 52
                url_fclose( oc->pb );
 #else
                url_fclose( &oc->pb );
index e411798c851c86b85d2ed5b79ed01480a60d5ae2..b5a097b7f60ddb14b7e3dc288b795387462365c7 100644 (file)
@@ -37,7 +37,7 @@ extern mlt_producer producer_avformat_init( mlt_profile profile, const char *ser
 #ifdef AVDEVICE
 #include <libavdevice/avdevice.h>
 #endif
-#if LIBAVCODEC_VERSION_MAJOR > 52
+#if LIBAVCODEC_VERSION_MAJOR >= 53
 #include <libavutil/opt.h>
 #else
 #include <libavcodec/opt.h>
@@ -314,7 +314,7 @@ static mlt_properties avformat_metadata( mlt_service_type type, const char *id,
                int flags = ( type == consumer_type )? AV_OPT_FLAG_ENCODING_PARAM : AV_OPT_FLAG_DECODING_PARAM;
 
                add_parameters( params, avformat, flags, NULL, NULL );
-#if LIBAVFORMAT_VERSION_MAJOR > 52
+#if LIBAVFORMAT_VERSION_MAJOR >= 53
                avformat_init();
                if ( type == producer_type )
                {
@@ -333,7 +333,7 @@ static mlt_properties avformat_metadata( mlt_service_type type, const char *id,
 #endif
 
                add_parameters( params, avcodec, flags, NULL, NULL );
-#if LIBAVCODEC_VERSION_MAJOR > 52
+#if LIBAVCODEC_VERSION_MAJOR >= 53
                AVCodec *c = NULL;
                while ( ( c = av_codec_next( c ) ) )
                        if ( c->priv_class )
index 9c97ebac9a8ec39831c13cb7de0cf036570f7631..58fb87cef04e16cb5e53f3340b3df9312d7ed2fd 100644 (file)
@@ -34,7 +34,7 @@
 #ifdef SWSCALE
 #  include <libswscale/swscale.h>
 #endif
-#if LIBAVCODEC_VERSION_MAJOR > 52
+#if LIBAVCODEC_VERSION_MAJOR >= 53
 #include <libavutil/samplefmt.h>
 #elif (LIBAVCODEC_VERSION_INT >= ((51<<16)+(71<<8)+0))
 const char *avcodec_get_sample_fmt_name(int sample_fmt);
@@ -57,7 +57,7 @@ const char *avcodec_get_sample_fmt_name(int sample_fmt);
 #define PIX_FMT_YUYV422 PIX_FMT_YUV422
 #endif
 
-#if LIBAVCODEC_VERSION_MAJOR > 52
+#if LIBAVCODEC_VERSION_MAJOR >= 53
 #include <libavutil/opt.h>
 #define CODEC_TYPE_VIDEO      AVMEDIA_TYPE_VIDEO
 #define CODEC_TYPE_AUDIO      AVMEDIA_TYPE_AUDIO
@@ -342,7 +342,7 @@ static mlt_properties find_default_streams( producer_avformat self )
                                if ( self->audio_index < 0 )
                                        self->audio_index = i;
                                mlt_properties_set( meta_media, key, "audio" );
-#if LIBAVCODEC_VERSION_MAJOR > 52
+#if LIBAVCODEC_VERSION_MAJOR >= 53
                                snprintf( key, sizeof(key), "meta.media.%d.codec.sample_fmt", i );
                                mlt_properties_set( meta_media, key, av_get_sample_fmt_name( codec_context->sample_fmt ) );
 #elif (LIBAVCODEC_VERSION_INT >= ((51<<16)+(71<<8)+0))
@@ -551,7 +551,7 @@ static char* parse_url( mlt_profile profile, const char* URL, AVInputFormat **fo
        char *url = strchr( protocol, ':' );
 
        // Only if there is not a protocol specification that avformat can handle
-#if LIBAVFORMAT_VERSION_MAJOR > 52
+#if LIBAVFORMAT_VERSION_MAJOR >= 53
        if ( url && avio_check( URL, 0 ) < 0 )
 #else
        if ( url && !url_exist( URL ) )
@@ -670,7 +670,7 @@ static int get_basic_info( producer_avformat self, mlt_profile profile, const ch
        if ( format->pb )
        {
                // protocols can indicate if they support seeking
-#if LIBAVFORMAT_VERSION_MAJOR > 52
+#if LIBAVFORMAT_VERSION_MAJOR >= 53
                self->seekable = format->pb->seekable;
 #else
                URLContext *uc = url_fileno( format->pb );
@@ -766,7 +766,7 @@ static int producer_open( producer_avformat self, mlt_profile profile, const cha
        if ( !error && self->video_format )
        {
                apply_properties( self->video_format, properties, AV_OPT_FLAG_DECODING_PARAM );
-#if LIBAVFORMAT_VERSION_MAJOR > 52
+#if LIBAVFORMAT_VERSION_MAJOR >= 53
                if ( self->video_format->iformat && self->video_format->iformat->priv_class && self->video_format->priv_data )
                        apply_properties( self->video_format->priv_data, properties, AV_OPT_FLAG_DECODING_PARAM );
 #endif
@@ -805,7 +805,7 @@ static int producer_open( producer_avformat self, mlt_profile profile, const cha
                                                // And open again for our audio context
                                                av_open_input_file( &self->audio_format, filename, NULL, 0, NULL );
                                                apply_properties( self->audio_format, properties, AV_OPT_FLAG_DECODING_PARAM );
-#if LIBAVFORMAT_VERSION_MAJOR > 52
+#if LIBAVFORMAT_VERSION_MAJOR >= 53
                                                if ( self->audio_format->iformat && self->audio_format->iformat->priv_class && self->audio_format->priv_data )
                                                        apply_properties( self->audio_format->priv_data, properties, AV_OPT_FLAG_DECODING_PARAM );
 #endif
@@ -1739,7 +1739,7 @@ static int video_codec_init( producer_avformat self, int index, mlt_properties p
 
                // Process properties as AVOptions
                apply_properties( codec_context, properties, AV_OPT_FLAG_VIDEO_PARAM | AV_OPT_FLAG_DECODING_PARAM );
-#if LIBAVCODEC_VERSION_MAJOR > 52
+#if LIBAVCODEC_VERSION_MAJOR >= 53
                if ( codec->priv_class && codec_context->priv_data )
                        apply_properties( codec_context->priv_data, properties, AV_OPT_FLAG_VIDEO_PARAM | AV_OPT_FLAG_DECODING_PARAM );
 #endif
@@ -1975,7 +1975,7 @@ static int seek_audio( producer_avformat self, mlt_position position, double tim
 
 static int sample_bytes( AVCodecContext *context )
 {
-#if LIBAVCODEC_VERSION_MAJOR > 52
+#if LIBAVCODEC_VERSION_MAJOR >= 53
        return av_get_bits_per_sample_fmt( context->sample_fmt ) / 8;
 #else
        return av_get_bits_per_sample_format( context->sample_fmt ) / 8;
@@ -2387,7 +2387,7 @@ static int audio_codec_init( producer_avformat self, int index, mlt_properties p
 
                // Process properties as AVOptions
                apply_properties( codec_context, properties, AV_OPT_FLAG_AUDIO_PARAM | AV_OPT_FLAG_DECODING_PARAM );
-#if LIBAVCODEC_VERSION_MAJOR > 52
+#if LIBAVCODEC_VERSION_MAJOR >= 53
                if ( codec && codec->priv_class && codec_context->priv_data )
                        apply_properties( codec_context->priv_data, properties, AV_OPT_FLAG_AUDIO_PARAM | AV_OPT_FLAG_DECODING_PARAM );
 #endif