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.
*/
-#include "avcodec.h"
+#include <libavcodec/avcodec.h>
/**
if [ "$svn_ffmpeg" != "" ]
then
- if [ "$gpl" = "true" ]
+ if [ "$gpl" = "true" ]
then
enable_gpl="--enable-gpl"
[ "$swscale" != "" ] && [ "$svn_rev" = "0.5" ] &&
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
[ "$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" ] &&
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
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
#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
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:
c->colorspace = AVCOL_SPC_BT709;
break;
}
+#endif
if ( mlt_properties_get( properties, "aspect" ) )
{
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
#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)
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;
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,
{
AVPicture input;
AVPicture output;
+#ifdef SWSCALE
int flags = SWS_BILINEAR | SWS_ACCURATE_RND;
if ( out_fmt == PIX_FMT_YUYV422 )
#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 );
#include <stdlib.h>
// ffmpeg Header files
-#include <avformat.h>
+#include <libavformat/avformat.h>
#ifdef USE_MMX
#include "mmx.h"
#include <string.h>
// ffmpeg Header files
-#include <avformat.h>
+#include <libavformat/avformat.h>
/** Get the audio.
*/
// ffmpeg Header files
-#include <avformat.h>
-#include <swscale.h>
+#include <libavformat/avformat.h>
+#include <libswscale/swscale.h>
#include <stdio.h>
#include <stdlib.h>
#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
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 )
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
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;
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,
// 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 )
break;
}
}
+#endif
// Let apps get chosen colorspace
mlt_properties_set_int( properties, "colorspace", this->colorspace );
}
* 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>