]> git.sesse.net Git - mlt/commitdiff
FFmpeg build improvements (3078007).
authorDan Dennedy <dan@dennedy.org>
Tue, 5 Oct 2010 06:07:44 +0000 (23:07 -0700)
committerDan Dennedy <dan@dennedy.org>
Tue, 5 Oct 2010 06:07:44 +0000 (23:07 -0700)
Handle --avformat-svn-version=0.5.
Fix building without swscale.
Fix compiling new colorspace stuff against FFmpeg <= v0.5.
FFmpeg libs are increasing; only support contemporary header layout.

src/modules/avformat/audioconvert.h
src/modules/avformat/configure
src/modules/avformat/consumer_avformat.c
src/modules/avformat/factory.c
src/modules/avformat/filter_avcolour_space.c
src/modules/avformat/filter_avdeinterlace.c
src/modules/avformat/filter_avresample.c
src/modules/avformat/filter_swscale.c
src/modules/avformat/producer_avformat.c
src/modules/avformat/vdpau.c

index 4b767101a45ebe0e7f5e4b4d15fc829fcc80427c..694b821898b8b9b0922e10e8ce33148569c3a4e0 100644 (file)
@@ -29,7 +29,7 @@
  */
 
 
-#include "avcodec.h"
+#include <libavcodec/avcodec.h>
 
 
 /**
index a21df69d019d369f625295441e9dbfad2c96962a..6fceab57dd1e8bbb8052b4c575a4de38870fd383 100755 (executable)
@@ -87,7 +87,7 @@ else
 
        if [ "$svn_ffmpeg" != "" ]
        then
-               if [ "$gpl" = "true" ]
+               if [ "$gpl" = "true" ]  
                then
                        enable_gpl="--enable-gpl"
                        [ "$swscale" != "" ] && [ "$svn_rev" = "0.5" ] &&
@@ -98,7 +98,8 @@ else
                        echo
                        echo "Checking out ffmpeg/avformat revision $svn_rev - no password required"
                        echo
-                       if [ "$svn_rev" = "0.6" ]; then
+                       if [ "$svn_rev" = "0.6" ] || [ "$svn_rev" = "0.5" ]
+                       then
                                svn checkout svn://svn.mplayerhq.hu/ffmpeg/branches/$svn_rev ffmpeg
                        else
                                svn checkout -r $svn_rev svn://svn.mplayerhq.hu/ffmpeg/trunk ffmpeg
@@ -107,17 +108,15 @@ else
                [ "$devices" = "false" ] && disable_devices="--disable-devices"
                [ -d "ffmpeg" ] && ( cd ffmpeg ; ./configure $enable_gpl $disable_devices $enable_swscale $svn_ffmpeg_extra --extra-cflags=-fPIC )
                #[ ! -f "ffmpeg/ffmpeg.patch" ] && ( cd ffmpeg ; cp ../ffmpeg.patch . ; patch -p0 < ffmpeg.patch )
-               echo "CFLAGS+=-I`pwd`/ffmpeg -I`pwd`/ffmpeg/libavformat -I`pwd`/ffmpeg/libavcodec -I`pwd`/ffmpeg/libavutil" >> config.mak
+               echo "CFLAGS+=-I`pwd`/ffmpeg" >> config.mak
                echo "LDFLAGS+=-L`pwd`/ffmpeg/libavformat -L`pwd`/ffmpeg/libavcodec -L`pwd`/ffmpeg/libavutil" >> config.mak
-               if [ "$swscale" != "" ] || [ "$svn_rev" = "HEAD" ] || [ "$svn_rev" = "0.6" ]
+               if [ "$swscale" != "" ] || [ "$svn_rev" = "HEAD" ] || [ "$svn_rev" = "0.6" ] || [ "$svn_rev" = "0.5" ]
                then
-                       echo "CFLAGS+=-I`pwd`/ffmpeg/libswscale" >> config.mak
                        echo "LDFLAGS+=-L`pwd`/ffmpeg/libswscale" >> config.mak
                        echo "SWSCALE=1" >> config.mak
                fi
                if [ "$devices" = "true" ]
                then
-                       echo "CFLAGS+=-I`pwd`/ffmpeg/libavdevice" >> config.mak
                        echo "LDFLAGS+=-L`pwd`/ffmpeg/libavdevice" >> config.mak
                fi
                [ $targetos = "Darwin" ] &&
@@ -132,19 +131,17 @@ else
        then 
                if [ -d "$static_ffmpeg" ]
                then
-                       echo "CFLAGS+=-I$static_ffmpeg/libavformat -I$static_ffmpeg/libavcodec -I$static_ffmpeg/libavutil" >> config.mak
+                       echo "CFLAGS+=-I$static_ffmpeg" >> config.mak
                        echo "LDFLAGS+=-L$static_ffmpeg/libavformat -L$static_ffmpeg/libavcodec -L$static_ffmpeg/libavutil" >> config.mak
                        [ $targetos = "Darwin" ] &&
                                echo "LDFLAGS+=-single_module" >> config.mak
                        if [ "$swscale" != "" ]
                        then
-                               echo "CFLAGS+=-I$static_ffmpeg/libswscale" >> config.mak
                                echo "LDFLAGS+=-L$static_ffmpeg/libswscale" >> config.mak
                                echo "SWSCALE=1" >> config.mak
                        fi
                        if [ "$devices" = "true" ]
                        then
-                               echo "CFLAGS+=-I$static_ffmpeg/libavdevice" >> config.mak
                                echo "LDFLAGS+=-L$static_ffmpeg/libavdevice" >> config.mak
                        fi
                        echo "LDFLAGS+=-Wl,-Bsymbolic" >> config.mak
@@ -160,24 +157,18 @@ else
        elif [ "$shared_ffmpeg" != "" ]
        then
                echo "PREFIX=$shared_ffmpeg" >> config.mak
-               echo "CFLAGS+=$(pkg-config --cflags libavformat) $TMP_CFLAGS" >> config.mak
+               echo "CFLAGS+=$(pkg-config --cflags libavformat)" >> config.mak
                echo "LDFLAGS+=$(pkg-config --libs-only-L libavformat)" >> config.mak
                if [ "$devices" = "true" ]
                then
-                       echo "CFLAGS+=$(pkg-config --cflags libavdevice) $TMP_CFLAGS" >> config.mak
+                       echo "CFLAGS+=$(pkg-config --cflags libavdevice)" >> config.mak
                        echo "LDFLAGS+=$(pkg-config --libs-only-L libavdevice)" >> config.mak
                fi
-               [ -d "$shared_ffmpeg/include/ffmpeg/libavformat" ] &&
-                       echo "CFLAGS+=-I$shared_ffmpeg/include/ffmpeg/libavformat -I$shared_ffmpeg/include/ffmpeg/libavcodec -I$shared_ffmpeg/include/ffmpeg/libavdevice" >> config.mak
-               [ -d "$shared_ffmpeg/include/libavformat" ] &&
-                       echo "CFLAGS+=-I$shared_ffmpeg/include/libavformat -I$shared_ffmpeg/include/libavcodec -I$shared_ffmpeg/include/libavdevice" >> config.mak
                avcodec_version=$(pkg-config --modversion libavcodec)
                if [ "$swscale" != "" ] || ( [ $(echo $avcodec_version | cut -d. -f1) -ge 52 ] && [ $(echo $avcodec_version | cut -d. -f2) -ge 21 ] )
                then
-                       [ -d "$shared_ffmpeg/include/ffmpeg/libswscale" ] &&
-                               echo "CFLAGS+=-I$shared_ffmpeg/include/ffmpeg/libswscale" >> config.mak
-                       [ -d "$shared_ffmpeg/include/libswscale" ] &&
-                               echo "CFLAGS+=-I$shared_ffmpeg/include/libswscale" >> config.mak
+                       echo "CFLAGS+=$(pkg-config --cflags libswscale)" >> config.mak
+                       echo "LDFLAGS+=$(pkg-config --libs-only-L libswscale)" >> config.mak
                        echo "SWSCALE=1" >> config.mak
                fi
                
index f26c3740da3e98436e7bb6547952e95dea13f6fb..da7719efc9b7a14568dd456bb23d91611221fa14 100644 (file)
 #include <unistd.h>
 
 // avformat header files
-#include <avformat.h>
+#include <libavformat/avformat.h>
 #ifdef SWSCALE
-#include <swscale.h>
+#include <libswscale/swscale.h>
 #endif
-#include <opt.h>
+#include <libavcodec/opt.h>
 #if LIBAVUTIL_VERSION_INT >= ((50<<16)+(8<<8)+0)
 #include <libavutil/pixdesc.h>
 #endif
@@ -563,6 +563,7 @@ static AVStream *add_video_stream( mlt_consumer this, AVFormatContext *oc, int c
                c->pix_fmt = pix_fmt ? avcodec_get_pix_fmt( pix_fmt ) : PIX_FMT_YUV420P;
 #endif
                
+#if LIBAVUTIL_VERSION_INT > ((52<<16)+(28<<8)+0)
                switch ( colorspace )
                {
                case 170:
@@ -581,6 +582,7 @@ static AVStream *add_video_stream( mlt_consumer this, AVFormatContext *oc, int c
                        c->colorspace = AVCOL_SPC_BT709;
                        break;
                }
+#endif
 
                if ( mlt_properties_get( properties, "aspect" ) )
                {
index eec004ba7f2722d4cbc00dbd26730e14f283ab0d..70543343ba362ec63c2d2ac0f2e92bd942fe03d1 100644 (file)
@@ -32,9 +32,9 @@ extern mlt_filter filter_swscale_init( mlt_profile profile, char *arg );
 extern mlt_producer producer_avformat_init( mlt_profile profile, const char *service, char *file );
 
 // ffmpeg Header files
-#include <avformat.h>
+#include <libavformat/avformat.h>
 #ifdef AVDEVICE
-#include <avdevice.h>
+#include <libavdevice/avdevice.h>
 #endif
 
 // A static flag used to determine if avformat has been initialised
index 79c1b157a2fd837fffb1686cc872d0c9f2fefd5a..b9ae5f6560ca6e182c2db780f322510fe19b582a 100644 (file)
@@ -24,9 +24,9 @@
 #include <framework/mlt_profile.h>
 
 // ffmpeg Header files
-#include <avformat.h>
+#include <libavformat/avformat.h>
 #ifdef SWSCALE
-#include <swscale.h>
+#include <libswscale/swscale.h>
 #endif
 
 #if LIBAVUTIL_VERSION_INT < (50<<16)
@@ -75,6 +75,7 @@ static int convert_mlt_to_av_cs( mlt_image_format format )
 
 static void set_luma_transfer( struct SwsContext *context, int colorspace, int use_full_range )
 {
+#if defined(SWSCALE) && (LIBSWSCALE_VERSION_INT >= ((0<<16)+(7<<8)+2))
        int *coefficients;
        int full_range;
        int brightness, contrast, saturation;
@@ -103,6 +104,7 @@ static void set_luma_transfer( struct SwsContext *context, int colorspace, int u
                sws_setColorspaceDetails( context, coefficients, full_range, coefficients, full_range,
                        brightness, contrast, saturation );
        }
+#endif
 }
 
 static void av_convert_image( uint8_t *out, uint8_t *in, int out_fmt, int in_fmt,
@@ -110,6 +112,7 @@ static void av_convert_image( uint8_t *out, uint8_t *in, int out_fmt, int in_fmt
 {
        AVPicture input;
        AVPicture output;
+#ifdef SWSCALE
        int flags = SWS_BILINEAR | SWS_ACCURATE_RND;
 
        if ( out_fmt == PIX_FMT_YUYV422 )
@@ -122,6 +125,7 @@ static void av_convert_image( uint8_t *out, uint8_t *in, int out_fmt, int in_fmt
 #ifdef USE_SSE
        flags |= SWS_CPU_CAPS_MMX2;
 #endif
+#endif /* SWSCALE */
 
        avpicture_fill( &input, in, in_fmt, width, height );
        avpicture_fill( &output, out, out_fmt, width, height );
index 4a46ce4b862baa29723dd7df8066505d0d65e484..94f78661f231fd842292044e82d0e3dc717c7d0f 100644 (file)
@@ -25,7 +25,7 @@
 #include <stdlib.h>
 
 // ffmpeg Header files
-#include <avformat.h>
+#include <libavformat/avformat.h>
 
 #ifdef USE_MMX
 #include "mmx.h"
index fd765b7e4baa585fb31ff901cccd2dd4e9900a24..38e0d57123945923a82c05817cd89ebb49103809 100644 (file)
@@ -26,7 +26,7 @@
 #include <string.h>
 
 // ffmpeg Header files
-#include <avformat.h>
+#include <libavformat/avformat.h>
 
 /** Get the audio.
 */
index a82b5e7ccd5d1338040e0ea9af4cc973a4029178..0fd7f0bdfb7b2885391d90240e02799924112481 100644 (file)
@@ -24,8 +24,8 @@
 
 
 // ffmpeg Header files
-#include <avformat.h>
-#include <swscale.h>
+#include <libavformat/avformat.h>
+#include <libswscale/swscale.h>
 
 #include <stdio.h>
 #include <stdlib.h>
index c695c1fd596dfd7769cc7dd98748f0db20a97157..06dc11024c3a9f4aa4a6ae3dd378354c89816c76 100644 (file)
 #include <framework/mlt_cache.h>
 
 // ffmpeg Header files
-#include <avformat.h>
-#include <opt.h>
+#include <libavformat/avformat.h>
+#include <libavcodec/opt.h>
 #ifdef SWSCALE
-#  include <swscale.h>
+#  include <libswscale/swscale.h>
 #endif
 #if (LIBAVCODEC_VERSION_INT >= ((51<<16)+(71<<8)+0))
 #  include "audioconvert.h"
 #endif
 #ifdef VDPAU
-#include <vdpau.h>
+#include <libavcodec/vdpau.h>
 #endif
 
 // System header files
@@ -283,7 +283,9 @@ static mlt_properties find_default_streams( mlt_properties meta_media, AVFormatC
                                snprintf( key, sizeof(key), "meta.media.%d.codec.sample_aspect_ratio", i );
                                mlt_properties_set_double( meta_media, key, av_q2d( codec_context->sample_aspect_ratio ) );
                                snprintf( key, sizeof(key), "meta.media.%d.codec.colorspace", i );
+#if LIBAVUTIL_VERSION_INT > ((52<<16)+(28<<8)+0)
                                mlt_properties_set_int( meta_media, key, codec_context->colorspace );
+#endif
                                break;
                        case CODEC_TYPE_AUDIO:
                                if ( *audio_index < 0 )
@@ -583,12 +585,14 @@ static int producer_open( producer_avformat this, mlt_profile profile, char *fil
                                        mlt_properties_set_double( properties, "aspect_ratio",
                                                get_aspect_ratio( context->streams[ video_index ], codec_context, NULL ) );
                                }
+#ifdef SWSCALE
                                struct SwsContext *context = sws_getContext( codec_context->width, codec_context->height, codec_context->pix_fmt,
                                        codec_context->width, codec_context->height, PIX_FMT_YUYV422, SWS_BILINEAR, NULL, NULL, NULL);
                                if ( context )
                                        sws_freeContext( context );
                                else
                                        error = 1;
+#endif
                        }
 
                        // Read Metadata
@@ -694,6 +698,7 @@ static void get_audio_streams_info( producer_avformat this )
 
 static void set_luma_transfer( struct SwsContext *context, int colorspace, int use_full_range )
 {
+#if defined(SWSCALE) && (LIBSWSCALE_VERSION_INT >= ((0<<16)+(7<<8)+2))
        int *coefficients;
        int full_range;
        int brightness, contrast, saturation;
@@ -722,6 +727,7 @@ static void set_luma_transfer( struct SwsContext *context, int colorspace, int u
                sws_setColorspaceDetails( context, coefficients, full_range, coefficients, full_range,
                        brightness, contrast, saturation );
        }
+#endif
 }
 
 static inline void convert_image( AVFrame *frame, uint8_t *buffer, int pix_fmt,
@@ -1460,6 +1466,7 @@ static int video_codec_init( producer_avformat this, int index, mlt_properties p
 
                // Set the YUV colorspace from override or detect
                this->colorspace = mlt_properties_get_int( properties, "force_colorspace" );
+#if LIBAVUTIL_VERSION_INT > ((52<<16)+(28<<8)+0)               
                if ( ! this->colorspace )
                {
                        switch ( this->video_codec->colorspace )
@@ -1480,6 +1487,7 @@ static int video_codec_init( producer_avformat this, int index, mlt_properties p
                                break;
                        }
                }
+#endif
                // Let apps get chosen colorspace
                mlt_properties_set_int( properties, "colorspace", this->colorspace );
        }
index 7a059fbc797ca1f822c65c64a73e3c6f8c20b438..13ec6e0022dd1b6ac27fe07b982530e7af0637b1 100644 (file)
@@ -18,7 +18,7 @@
  * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
  */
 
-#include <vdpau.h>
+#include <libavcodec/vdpau.h>
 #include <X11/Xlib.h>
 #include <dlfcn.h>