From 07bcc2e6aa647823e21f8dfad627533fec43be62 Mon Sep 17 00:00:00 2001 From: Dan Dennedy Date: Sat, 28 Jan 2012 15:03:40 -0800 Subject: [PATCH] fix SAMPLE_FMT support for v0.6 and less of libav/ffmpeg --- src/modules/avformat/consumer_avformat.c | 9 +++++++-- src/modules/avformat/filter_avresample.c | 4 +++- src/modules/avformat/producer_avformat.c | 11 +++++++++-- 3 files changed, 19 insertions(+), 5 deletions(-) diff --git a/src/modules/avformat/consumer_avformat.c b/src/modules/avformat/consumer_avformat.c index 5fdf9b3d..a4aa08d2 100644 --- a/src/modules/avformat/consumer_avformat.c +++ b/src/modules/avformat/consumer_avformat.c @@ -45,10 +45,15 @@ #if LIBAVUTIL_VERSION_INT >= ((50<<16)+(8<<8)+0) #include #endif +#include + #if LIBAVUTIL_VERSION_INT >= ((50<<16)+(38<<8)+0) -#include +# include +#else +# define AV_SAMPLE_FMT_S16 SAMPLE_FMT_S16 +# define AV_SAMPLE_FMT_S32 SAMPLE_FMT_S32 +# define AV_SAMPLE_FMT_FLT SAMPLE_FMT_FLT #endif -#include #if LIBAVUTIL_VERSION_INT < (50<<16) #define PIX_FMT_RGB32 PIX_FMT_RGBA32 diff --git a/src/modules/avformat/filter_avresample.c b/src/modules/avformat/filter_avresample.c index 94d677f1..65ea354e 100644 --- a/src/modules/avformat/filter_avresample.c +++ b/src/modules/avformat/filter_avresample.c @@ -29,7 +29,9 @@ // ffmpeg Header files #include #if LIBAVUTIL_VERSION_INT >= ((50<<16)+(38<<8)+0) -#include +# include +#else +# define AV_SAMPLE_FMT_S16 SAMPLE_FMT_S16 #endif /** Get the audio. diff --git a/src/modules/avformat/producer_avformat.c b/src/modules/avformat/producer_avformat.c index 8476f90f..0102b19b 100644 --- a/src/modules/avformat/producer_avformat.c +++ b/src/modules/avformat/producer_avformat.c @@ -34,11 +34,18 @@ #ifdef SWSCALE # include #endif + #if LIBAVUTIL_VERSION_INT >= ((50<<16)+(38<<8)+0) -#include -#elif (LIBAVCODEC_VERSION_INT >= ((51<<16)+(71<<8)+0)) +# include +#else +# define AV_SAMPLE_FMT_S16 SAMPLE_FMT_S16 +# define AV_SAMPLE_FMT_S32 SAMPLE_FMT_S32 +# define AV_SAMPLE_FMT_FLT SAMPLE_FMT_FLT +# if (LIBAVCODEC_VERSION_INT >= ((51<<16)+(71<<8)+0)) const char *avcodec_get_sample_fmt_name(int sample_fmt); +# endif #endif + #ifdef VDPAU # include #endif -- 2.39.2