commit bddad011d457ed59ab856d35a63efa390d9c2e73 Author: elupus Date: Tue Nov 1 21:46:36 2011 +0100 Drop support for ffmpeg version older than our built in version diff --git a/lib/DllAvCodec.h b/lib/DllAvCodec.h index 355b8b2..7993408 100644 --- a/lib/DllAvCodec.h +++ b/lib/DllAvCodec.h @@ -76,28 +76,6 @@ extern "C" { #endif } -/* Some convenience macros introduced at this particular revision of libavcodec. - */ -#if LIBAVCODEC_VERSION_INT < AV_VERSION_INT(52,25,0) -#define CH_LAYOUT_5POINT0_BACK (CH_LAYOUT_SURROUND|CH_BACK_LEFT|CH_BACK_RIGHT) -#define CH_LAYOUT_5POINT1_BACK (CH_LAYOUT_5POINT0_BACK|CH_LOW_FREQUENCY) -#undef CH_LAYOUT_7POINT1_WIDE -#define CH_LAYOUT_7POINT1_WIDE (CH_LAYOUT_5POINT1_BACK|\ - CH_FRONT_LEFT_OF_CENTER|CH_FRONT_RIGHT_OF_CENTER) -#endif - -#if LIBAVCODEC_VERSION_INT < AV_VERSION_INT(52,64,0) -// API added on: 2010-03-31 -#define AVMediaType CodecType -#define AVMEDIA_TYPE_UNKNOWN CODEC_TYPE_UNKNOWN -#define AVMEDIA_TYPE_VIDEO CODEC_TYPE_VIDEO -#define AVMEDIA_TYPE_AUDIO CODEC_TYPE_AUDIO -#define AVMEDIA_TYPE_DATA CODEC_TYPE_DATA -#define AVMEDIA_TYPE_SUBTITLE CODEC_TYPE_SUBTITLE -#define AVMEDIA_TYPE_ATTACHMENT CODEC_TYPE_ATTACHMENT -#define AVMEDIA_TYPE_NB CODEC_TYPE_NB -#endif - #include "threads/SingleLock.h" class DllAvCodecInterface @@ -181,16 +159,9 @@ public: } virtual AVFrame *avcodec_alloc_frame() { return ::avcodec_alloc_frame(); } virtual int avpicture_fill(AVPicture *picture, uint8_t *ptr, PixelFormat pix_fmt, int width, int height) { return ::avpicture_fill(picture, ptr, pix_fmt, width, height); } -#if LIBAVCODEC_VERSION_INT >= AV_VERSION_INT(52,23,0) - // API added on: 2009-04-07 virtual int avcodec_decode_video2(AVCodecContext *avctx, AVFrame *picture, int *got_picture_ptr, AVPacket *avpkt) { return ::avcodec_decode_video2(avctx, picture, got_picture_ptr, avpkt); } virtual int avcodec_decode_audio3(AVCodecContext *avctx, int16_t *samples, int *frame_size_ptr, AVPacket *avpkt) { return ::avcodec_decode_audio3(avctx, samples, frame_size_ptr, avpkt); } virtual int avcodec_decode_subtitle2(AVCodecContext *avctx, AVSubtitle *sub, int *got_sub_ptr, AVPacket *avpkt) { return ::avcodec_decode_subtitle2(avctx, sub, got_sub_ptr, avpkt); } -#else - virtual int avcodec_decode_video2(AVCodecContext *avctx, AVFrame *picture, int *got_picture_ptr, AVPacket *avpkt) { return ::avcodec_decode_video(avctx, picture, got_picture_ptr, avpkt->data, avpkt->size); } - virtual int avcodec_decode_audio3(AVCodecContext *avctx, int16_t *samples, int *frame_size_ptr, AVPacket *avpkt) { return ::avcodec_decode_audio2(avctx, samples, frame_size_ptr, avpkt->data, avpkt->size); } - virtual int avcodec_decode_subtitle2(AVCodecContext *avctx, AVSubtitle *sub, int *got_sub_ptr, AVPacket *avpkt) { return ::avcodec_decode_subtitle(avctx, sub, got_sub_ptr, avpkt->data, avpkt->size); } -#endif virtual int avcodec_encode_audio(AVCodecContext *avctx, uint8_t *buf, int buf_size, const short *samples) { return ::avcodec_encode_audio(avctx, buf, buf_size, samples); } virtual int avpicture_get_size(PixelFormat pix_fmt, int width, int height) { return ::avpicture_get_size(pix_fmt, width, height); } virtual AVCodecContext *avcodec_alloc_context3(AVCodec *codec) { return ::avcodec_alloc_context3(codec); } @@ -202,12 +173,7 @@ public: const uint8_t *buf, int buf_size, int64_t pts, int64_t dts, int64_t pos) { -#if LIBAVCODEC_VERSION_INT >= AV_VERSION_INT(52,21,0) - // API added on : 2009-03-05 return ::av_parser_parse2(s, avctx, poutbuf, poutbuf_size, buf, buf_size, pts, dts, pos); -#else - return ::av_parser_parse(s, avctx, poutbuf, poutbuf_size, buf, buf_size, pts, dts); -#endif } virtual void av_parser_close(AVCodecParserContext *s) { ::av_parser_close(s); } diff --git a/lib/DllAvFilter.h b/lib/DllAvFilter.h index 1e308ac..ea012e8 100644 --- a/lib/DllAvFilter.h +++ b/lib/DllAvFilter.h @@ -46,22 +46,8 @@ extern "C" { #elif (defined HAVE_FFMPEG_AVFILTER_H) #include #endif - /* for av_vsrc_buffer_add_frame */ - #if LIBAVFILTER_VERSION_INT >= AV_VERSION_INT(2,8,0) - #include - #elif LIBAVFILTER_VERSION_INT >= AV_VERSION_INT(2,7,0) - int av_vsrc_buffer_add_frame(AVFilterContext *buffer_filter, - AVFrame *frame); - #elif LIBAVCODEC_VERSION_INT >= AV_VERSION_INT(53,3,0) - int av_vsrc_buffer_add_frame(AVFilterContext *buffer_filter, - AVFrame *frame, int64_t pts); - #else - int av_vsrc_buffer_add_frame(AVFilterContext *buffer_filter, - AVFrame *frame, int64_t pts, AVRational pixel_aspect); - #endif #else #include "libavfilter/avfiltergraph.h" -#define HAVE_AVFILTERBUFFERREFVIDEOPROPS_SAMPLE_ASPECT_RATIO #endif } @@ -83,15 +69,7 @@ public: virtual int avfilter_graph_config(AVFilterGraph *graphctx, void *log_ctx)=0; virtual int avfilter_poll_frame(AVFilterLink *link)=0; virtual int avfilter_request_frame(AVFilterLink *link)=0; -#if LIBAVFILTER_VERSION_INT >= AV_VERSION_INT(2,13,0) virtual int av_vsrc_buffer_add_frame(AVFilterContext *buffer_filter, AVFrame *frame, int flags)=0; -#elif LIBAVFILTER_VERSION_INT >= AV_VERSION_INT(2,7,0) - virtual int av_vsrc_buffer_add_frame(AVFilterContext *buffer_filter, AVFrame *frame)=0; -#elif LIBAVCODEC_VERSION_INT >= AV_VERSION_INT(53,3,0) - virtual int av_vsrc_buffer_add_frame(AVFilterContext *buffer_filter, AVFrame *frame, int64_t pts)=0; -#else - virtual int av_vsrc_buffer_add_frame(AVFilterContext *buffer_filter, AVFrame *frame, int64_t pts, AVRational pixel_aspect)=0; -#endif virtual AVFilterBufferRef *avfilter_get_video_buffer(AVFilterLink *link, int perms, int w, int h)=0; virtual void avfilter_unref_buffer(AVFilterBufferRef *ref)=0; virtual int avfilter_link(AVFilterContext *src, unsigned srcpad, AVFilterContext *dst, unsigned dstpad)=0; @@ -116,12 +94,7 @@ public: virtual void avfilter_graph_free(AVFilterGraph **graph) { CSingleLock lock(DllAvCodec::m_critSection); -#if LIBAVFILTER_VERSION_INT >= AV_VERSION_INT(1,76,0) ::avfilter_graph_free(graph); -#else - ::avfilter_graph_free(*graph); - *graph = NULL; -#endif } void avfilter_register_all() { @@ -134,53 +107,25 @@ public: virtual AVFilterInOut *avfilter_inout_alloc() { CSingleLock lock(DllAvCodec::m_critSection); -#if LIBAVFILTER_VERSION_INT >= AV_VERSION_INT(2,17,0) return ::avfilter_inout_alloc(); -#else - return (AVFilterInOut*)::av_mallocz(sizeof(AVFilterInOut)); -#endif } virtual void avfilter_inout_free(AVFilterInOut **inout) { CSingleLock lock(DllAvCodec::m_critSection); -#if LIBAVFILTER_VERSION_INT >= AV_VERSION_INT(2,17,0) ::avfilter_inout_free(inout); -#else - *inout = NULL; -#endif } virtual int avfilter_graph_parse(AVFilterGraph *graph, const char *filters, AVFilterInOut **inputs, AVFilterInOut **outputs, void *log_ctx) { CSingleLock lock(DllAvCodec::m_critSection); -#if ( LIBAVFILTER_VERSION_INT >= AV_VERSION_INT(1,79,0) \ - && LIBAVFILTER_VERSION_INT < AV_VERSION_INT(2,0,0) ) \ - ||( LIBAVFILTER_VERSION_INT >= AV_VERSION_INT(2,16,0)) return ::avfilter_graph_parse(graph, filters, inputs, outputs, log_ctx); -#elif LIBAVFILTER_VERSION_INT >= AV_VERSION_INT(2,15,1) - return ::avfilter_graph_parse(graph, filters, *inputs, *outputs, log_ctx); -#else - return ::avfilter_graph_parse(graph, filters, *inputs, *outputs, (AVClass*)log_ctx); -#endif } virtual int avfilter_graph_config(AVFilterGraph *graphctx, void *log_ctx) { -#if LIBAVFILTER_VERSION_INT >= AV_VERSION_INT(2,15,1) return ::avfilter_graph_config(graphctx, log_ctx); -#else - return ::avfilter_graph_config(graphctx, (AVClass*)log_ctx); -#endif } virtual int avfilter_poll_frame(AVFilterLink *link) { return ::avfilter_poll_frame(link); } virtual int avfilter_request_frame(AVFilterLink *link) { return ::avfilter_request_frame(link); } -#if LIBAVFILTER_VERSION_INT >= AV_VERSION_INT(2,13,0) virtual int av_vsrc_buffer_add_frame(AVFilterContext *buffer_filter, AVFrame *frame, int flags) { return ::av_vsrc_buffer_add_frame(buffer_filter, frame, flags); } -#elif LIBAVFILTER_VERSION_INT >= AV_VERSION_INT(2,7,0) - virtual int av_vsrc_buffer_add_frame(AVFilterContext *buffer_filter, AVFrame *frame) { return ::av_vsrc_buffer_add_frame(buffer_filter, frame); } -#elif LIBAVCODEC_VERSION_INT >= AV_VERSION_INT(53,3,0) - virtual int av_vsrc_buffer_add_frame(AVFilterContext *buffer_filter, AVFrame *frame, int64_t pts) { return ::av_vsrc_buffer_add_frame(buffer_filter, frame, pts); } -#else - virtual int av_vsrc_buffer_add_frame(AVFilterContext *buffer_filter, AVFrame *frame, int64_t pts, AVRational pixel_aspect) { return ::av_vsrc_buffer_add_frame(buffer_filter, frame, pts, pixel_aspect); } -#endif virtual AVFilterBufferRef *avfilter_get_video_buffer(AVFilterLink *link, int perms, int w, int h) { return ::avfilter_get_video_buffer(link, perms, w, h); } virtual void avfilter_unref_buffer(AVFilterBufferRef *ref) { ::avfilter_unref_buffer(ref); } virtual int avfilter_link(AVFilterContext *src, unsigned srcpad, AVFilterContext *dst, unsigned dstpad) { return ::avfilter_link(src, srcpad, dst, dstpad); } @@ -201,42 +146,18 @@ class DllAvFilter : public DllDynamic, DllAvFilterInterface DEFINE_METHOD3(int, avfilter_open_dont_call, (AVFilterContext **p1, AVFilter *p2, const char *p3)) DEFINE_METHOD1(void, avfilter_free_dont_call, (AVFilterContext *p1)) -#if LIBAVFILTER_VERSION_INT >= AV_VERSION_INT(1,76,0) DEFINE_METHOD1(void, avfilter_graph_free_dont_call, (AVFilterGraph **p1)) -#else - DEFINE_METHOD1(void, avfilter_graph_free_dont_call, (AVFilterGraph *p1)) -#endif DEFINE_METHOD0(void, avfilter_register_all_dont_call) DEFINE_METHOD6(int, avfilter_graph_create_filter, (AVFilterContext **p1, AVFilter *p2, const char *p3, const char *p4, void *p5, AVFilterGraph *p6)) DEFINE_METHOD1(AVFilter*, avfilter_get_by_name, (const char *p1)) DEFINE_METHOD0(AVFilterGraph*, avfilter_graph_alloc) -#if LIBAVFILTER_VERSION_INT >= AV_VERSION_INT(2,17,0) DEFINE_METHOD0(AVFilterInOut*, avfilter_inout_alloc_dont_call) DEFINE_METHOD1(void, avfilter_inout_free_dont_call, (AVFilterInOut **p1)) -#endif -#if LIBAVFILTER_VERSION_INT >= AV_VERSION_INT(2,16,0) DEFINE_METHOD5(int, avfilter_graph_parse_dont_call, (AVFilterGraph *p1, const char *p2, AVFilterInOut **p3, AVFilterInOut **p4, void *p5)) -#elif LIBAVFILTER_VERSION_INT >= AV_VERSION_INT(2,15,1) - DEFINE_METHOD5(int, avfilter_graph_parse_dont_call, (AVFilterGraph *p1, const char *p2, AVFilterInOut *p3, AVFilterInOut *p4, void *p5)) -#else - DEFINE_METHOD5(int, avfilter_graph_parse_dont_call, (AVFilterGraph *p1, const char *p2, AVFilterInOut *p3, AVFilterInOut *p4, AVClass *p5)) -#endif -#if LIBAVFILTER_VERSION_INT >= AV_VERSION_INT(2,15,1) DEFINE_METHOD2(int, avfilter_graph_config_dont_call, (AVFilterGraph *p1, void *p2)) -#else - DEFINE_METHOD2(int, avfilter_graph_config_dont_call, (AVFilterGraph *p1, AVClass *p2)) -#endif DEFINE_FUNC_ALIGNED1(int, __cdecl, avfilter_poll_frame, AVFilterLink *) DEFINE_FUNC_ALIGNED1(int, __cdecl, avfilter_request_frame, AVFilterLink*) -#if LIBAVFILTER_VERSION_INT >= AV_VERSION_INT(2,13,0) DEFINE_METHOD3(int, av_vsrc_buffer_add_frame, (AVFilterContext *p1, AVFrame *p2, int p3)) -#elif LIBAVFILTER_VERSION_INT >= AV_VERSION_INT(2,7,0) - DEFINE_METHOD2(int, av_vsrc_buffer_add_frame, (AVFilterContext *p1, AVFrame *p2)) -#elif LIBAVCODEC_VERSION_INT >= AV_VERSION_INT(53,3,0) - DEFINE_METHOD3(int, av_vsrc_buffer_add_frame, (AVFilterContext *p1, AVFrame *p2, int64_t p3)) -#else - DEFINE_METHOD4(int, av_vsrc_buffer_add_frame, (AVFilterContext *p1, AVFrame *p2, int64_t p3, AVRational p4)) -#endif DEFINE_METHOD4(AVFilterBufferRef*, avfilter_get_video_buffer, (AVFilterLink *p1, int p2, int p3, int p4)) DEFINE_METHOD1(void, avfilter_unref_buffer, (AVFilterBufferRef *p1)) DEFINE_METHOD4(int, avfilter_link, (AVFilterContext *p1, unsigned p2, AVFilterContext *p3, unsigned p4)) @@ -249,10 +170,8 @@ class DllAvFilter : public DllDynamic, DllAvFilterInterface RESOLVE_METHOD(avfilter_graph_create_filter) RESOLVE_METHOD(avfilter_get_by_name) RESOLVE_METHOD(avfilter_graph_alloc) -#if LIBAVFILTER_VERSION_INT >= AV_VERSION_INT(2,17,0) RESOLVE_METHOD_RENAME(avfilter_inout_alloc, avfilter_inout_alloc_dont_call) RESOLVE_METHOD_RENAME(avfilter_inout_free, avfilter_inout_free_dont_call) -#endif RESOLVE_METHOD_RENAME(avfilter_graph_parse, avfilter_graph_parse_dont_call) RESOLVE_METHOD_RENAME(avfilter_graph_config, avfilter_graph_config_dont_call) RESOLVE_METHOD(avfilter_poll_frame) @@ -281,12 +200,7 @@ public: void avfilter_graph_free(AVFilterGraph **graph) { CSingleLock lock(DllAvCodec::m_critSection); -#if LIBAVFILTER_VERSION_INT >= AV_VERSION_INT(1,76,0) avfilter_graph_free_dont_call(graph); -#else - avfilter_graph_free_dont_call(*graph); - m_dllAvUtil.av_freep(graph); -#endif } void avfilter_register_all() { @@ -296,40 +210,22 @@ public: AVFilterInOut* avfilter_inout_alloc() { CSingleLock lock(DllAvCodec::m_critSection); -#if LIBAVFILTER_VERSION_INT >= AV_VERSION_INT(2,17,0) return avfilter_inout_alloc_dont_call(); -#else - return (AVFilterInOut*)m_dllAvUtil.av_mallocz(sizeof(AVFilterInOut)); -#endif } int avfilter_graph_parse(AVFilterGraph *graph, const char *filters, AVFilterInOut **inputs, AVFilterInOut **outputs, void *log_ctx) { CSingleLock lock(DllAvCodec::m_critSection); -#if LIBAVFILTER_VERSION_INT >= AV_VERSION_INT(2,16,0) return avfilter_graph_parse_dont_call(graph, filters, inputs, outputs, log_ctx); -#elif LIBAVFILTER_VERSION_INT >= AV_VERSION_INT(2,15,1) - return avfilter_graph_parse_dont_call(graph, filters, *inputs, *outputs, log_ctx); -#else - return avfilter_graph_parse_dont_call(graph, filters, *inputs, *outputs, (AVClass*)log_ctx); -#endif } void avfilter_inout_free(AVFilterInOut **inout) { CSingleLock lock(DllAvCodec::m_critSection); -#if LIBAVFILTER_VERSION_INT >= AV_VERSION_INT(2,17,0) avfilter_inout_free_dont_call(inout); -#else - *inout = NULL; -#endif } int avfilter_graph_config(AVFilterGraph *graphctx, void *log_ctx) { CSingleLock lock(DllAvCodec::m_critSection); -#if LIBAVFILTER_VERSION_INT >= AV_VERSION_INT(2,15,1) return avfilter_graph_config_dont_call(graphctx, log_ctx); -#else - return avfilter_graph_config_dont_call(graphctx, (AVClass*)log_ctx); -#endif } virtual bool Load() { diff --git a/lib/DllAvFormat.h b/lib/DllAvFormat.h index 9b38c9c..d6753ae 100644 --- a/lib/DllAvFormat.h +++ b/lib/DllAvFormat.h @@ -126,12 +126,7 @@ public: virtual void av_register_all_dont_call() { *(int* )0x0 = 0; } virtual AVInputFormat *av_find_input_format(const char *short_name) { return ::av_find_input_format(short_name); } virtual int url_feof(AVIOContext *s) { return ::url_feof(s); } -#if LIBAVFORMAT_VERSION_INT >= AV_VERSION_INT(52,31,0) - // API added on: 2009-03-01 virtual AVDictionaryEntry *av_metadata_get(AVDictionary *m, const char *key, const AVDictionaryEntry *prev, int flags){ return ::av_metadata_get(m, key, prev, flags); } -#else - virtual AVDictionaryEntry *av_metadata_get(AVDictionary *m, const char *key, const AVDictionaryEntry *prev, int flags){ return NULL; } -#endif virtual void av_close_input_file(AVFormatContext *s) { ::av_close_input_file(s); } virtual void av_close_input_stream(AVFormatContext *s) { ::av_close_input_stream(s); } virtual int av_read_frame(AVFormatContext *s, AVPacket *pkt) { return ::av_read_frame(s, pkt); } @@ -153,12 +148,7 @@ public: offset_t (*seek)(void *opaque, offset_t offset, int whence)) { return ::init_put_byte(s, buffer, buffer_size, write_flag, opaque, read_packet, write_packet, seek); } virtual AVInputFormat *av_probe_input_format(AVProbeData *pd, int is_opened) {return ::av_probe_input_format(pd, is_opened); } virtual AVInputFormat *av_probe_input_format2(AVProbeData *pd, int is_opened, int *score_max) {*score_max = 100; return ::av_probe_input_format(pd, is_opened); } // Use av_probe_input_format, this is not exported by ffmpeg's headers -#if LIBAVFORMAT_VERSION_INT >= AV_VERSION_INT(52,98,0) - // API added on: 2010-02-08 virtual int av_probe_input_buffer(AVIOContext *pb, AVInputFormat **fmt, const char *filename, void *logctx, unsigned int offset, unsigned int max_probe_size) { return ::av_probe_input_buffer(pb, fmt, filename, logctx, offset, max_probe_size); } -#else - virtual int av_probe_input_buffer(AVIOContext *pb, AVInputFormat **fmt, const char *filename, void *logctx, unsigned int offset, unsigned int max_probe_size) { return -1; } -#endif virtual void dump_format(AVFormatContext *ic, int index, const char *url, int is_output) { ::dump_format(ic, index, url, is_output); } virtual int url_fdopen(AVIOContext **s, URLContext *h) { return ::url_fdopen(s, h); } virtual int url_fopen(AVIOContext **s, const char *filename, int flags) { return ::url_fopen(s, filename, flags); } @@ -175,11 +165,7 @@ public: virtual void put_be16(AVIOContext *s, unsigned int val) { ::put_be16(s, val); } virtual AVFormatContext *avformat_alloc_context() { return ::avformat_alloc_context(); } virtual AVStream *avformat_new_stream(AVFormatContext *s, AVCodec *c) { return ::avformat_new_stream(s, c); } -#if LIBAVFORMAT_VERSION_INT < (52<<16 | 45<<8) - virtual AVOutputFormat *av_guess_format(const char *short_name, const char *filename, const char *mime_type) { return ::guess_format(short_name, filename, mime_type); } -#else virtual AVOutputFormat *av_guess_format(const char *short_name, const char *filename, const char *mime_type) { return ::av_guess_format(short_name, filename, mime_type); } -#endif virtual int av_set_parameters(AVFormatContext *s, AVFormatParameters *ap) { return ::av_set_parameters(s, ap); } virtual AVIOContext *av_alloc_put_byte(unsigned char *buffer, int buffer_size, int write_flag, void *opaque, int (*read_packet)(void *opaque, uint8_t *buf, int buf_size), @@ -188,15 +174,7 @@ public: virtual int av_write_header (AVFormatContext *s) { return ::av_write_header (s); } virtual int av_write_trailer(AVFormatContext *s) { return ::av_write_trailer(s); } virtual int av_write_frame (AVFormatContext *s, AVPacket *pkt) { return ::av_write_frame(s, pkt); } -#if LIBAVFORMAT_VERSION_INT >= AV_VERSION_INT(52,43,0) - // API added on: 2009-12-13 virtual int av_metadata_set2(AVDictionary **pm, const char *key, const char *value, int flags) { return ::av_metadata_set2(pm, key, value, flags); } -#elif LIBAVFORMAT_VERSION_INT >= AV_VERSION_INT(52,31,0) - // API added on: 2009-03-01 - virtual int av_metadata_set2(AVDictionary **pm, const char *key, const char *value, int flags) { return ::av_metadata_set(pm, key, value); } -#else - virtual int av_metadata_set2(AVDictionary **pm, const char *key, const char *value, int flags) { return -1; } -#endif // DLL faking. virtual bool ResolveExports() { return true; } @@ -252,11 +230,7 @@ class DllAvFormat : public DllDynamic, DllAvFormatInterface DEFINE_METHOD3(offset_t, url_fseek, (AVIOContext *p1, offset_t p2, int p3)) DEFINE_METHOD0(AVFormatContext *, avformat_alloc_context) DEFINE_METHOD2(AVStream *, avformat_new_stream, (AVFormatContext *p1, AVCodec *p2)) -#if LIBAVFORMAT_VERSION_INT < (52<<16 | 45<<8) - DEFINE_METHOD3(AVOutputFormat *, guess_format, (const char *p1, const char *p2, const char *p3)) -#else DEFINE_METHOD3(AVOutputFormat *, av_guess_format, (const char *p1, const char *p2, const char *p3)) -#endif DEFINE_METHOD2(int, av_set_parameters, (AVFormatContext *p1, AVFormatParameters *p2)); DEFINE_METHOD7(AVIOContext *, av_alloc_put_byte, (unsigned char *p1, int p2, int p3, void *p4, int(*p5)(void *opaque, uint8_t *buf, int buf_size), @@ -301,11 +275,7 @@ class DllAvFormat : public DllDynamic, DllAvFormatInterface RESOLVE_METHOD(put_be16) RESOLVE_METHOD(avformat_alloc_context) RESOLVE_METHOD(avformat_new_stream) -#if LIBAVFORMAT_VERSION_INT < (52<<16 | 45<<8) - RESOLVE_METHOD(guess_format) -#else RESOLVE_METHOD(av_guess_format) -#endif RESOLVE_METHOD(av_set_parameters) RESOLVE_METHOD(av_alloc_put_byte) RESOLVE_METHOD(av_write_header) diff --git a/xbmc/cdrip/EncoderFFmpeg.cpp b/xbmc/cdrip/EncoderFFmpeg.cpp index 0b3ef76..220fe21 100644 --- a/xbmc/cdrip/EncoderFFmpeg.cpp +++ b/xbmc/cdrip/EncoderFFmpeg.cpp @@ -59,11 +59,7 @@ bool CEncoderFFmpeg::Init(const char* strFile, int iInChannels, int iInRate, int CStdString filename = URIUtils::GetFileName(strFile); AVOutputFormat *fmt = NULL; -#if LIBAVFORMAT_VERSION_MAJOR < 52 - fmt = m_dllAvFormat.guess_format(NULL, filename.c_str(), NULL); -#else fmt = m_dllAvFormat.av_guess_format(NULL, filename.c_str(), NULL); -#endif if (!fmt) { CLog::Log(LOGERROR, "CEncoderFFmpeg::Init - Unable to guess the output format for the file %s", filename.c_str()); diff --git a/xbmc/cores/dvdplayer/DVDCodecs/Audio/DVDAudioCodecPassthroughFFmpeg.cpp b/xbmc/cores/dvdplayer/DVDCodecs/Audio/DVDAudioCodecPassthroughFFmpeg.cpp index 440b04b..8fae8bf 100644 --- a/xbmc/cores/dvdplayer/DVDCodecs/Audio/DVDAudioCodecPassthroughFFmpeg.cpp +++ b/xbmc/cores/dvdplayer/DVDCodecs/Audio/DVDAudioCodecPassthroughFFmpeg.cpp @@ -79,11 +79,7 @@ bool CDVDAudioCodecPassthroughFFmpeg::SetupMuxer(CDVDStreamInfo &hints, CStdStri /* get the muxer */ AVOutputFormat *fOut = NULL; -#if LIBAVFORMAT_VERSION_MAJOR < 52 - fOut = m_dllAvFormat.guess_format(muxerName.c_str(), NULL, NULL); -#else fOut = m_dllAvFormat.av_guess_format(muxerName.c_str(), NULL, NULL); -#endif if (!fOut) { CLog::Log(LOGERROR, "CDVDAudioCodecPassthroughFFmpeg::SetupMuxer - Failed to get the FFmpeg %s muxer", muxerName.c_str()); @@ -124,8 +120,6 @@ bool CDVDAudioCodecPassthroughFFmpeg::SetupMuxer(CDVDStreamInfo &hints, CStdStri return false; } -#if LIBAVFORMAT_VERSION_INT >= AV_VERSION_INT(52,92,0) - // API added on: 2011-01-02 /* While this is strictly only needed on big-endian systems, we do it on * both to avoid as much dead code as possible. @@ -139,7 +133,6 @@ bool CDVDAudioCodecPassthroughFFmpeg::SetupMuxer(CDVDStreamInfo &hints, CStdStri /* request output of wanted endianness */ if (!fOut->priv_class || m_dllAvUtil.av_set_string3(muxer.m_pFormat->priv_data, "spdif_flags", spdifFlags, 0, NULL) != 0) -#endif { #if defined(WORDS_BIGENDIAN) && !defined(__APPLE__) CLog::Log(LOGERROR, "CDVDAudioCodecPassthroughFFmpeg::SetupMuxer - Unable to set big-endian stream mode (FFmpeg too old?), disabling passthrough"); diff --git a/xbmc/cores/dvdplayer/DVDCodecs/Overlay/DVDOverlayCodecFFmpeg.cpp b/xbmc/cores/dvdplayer/DVDCodecs/Overlay/DVDOverlayCodecFFmpeg.cpp index 754169e..238c855 100644 --- a/xbmc/cores/dvdplayer/DVDCodecs/Overlay/DVDOverlayCodecFFmpeg.cpp +++ b/xbmc/cores/dvdplayer/DVDCodecs/Overlay/DVDOverlayCodecFFmpeg.cpp @@ -134,19 +134,12 @@ void CDVDOverlayCodecFFmpeg::FreeSubtitle(AVSubtitle& sub) { for(unsigned i=0;i= (52<<10) if(sub.rects[i]) { m_dllAvUtil.av_free(sub.rects[i]->pict.data[0]); m_dllAvUtil.av_free(sub.rects[i]->pict.data[1]); m_dllAvUtil.av_freep(&sub.rects[i]); } -#else - if(sub.rects[i].bitmap) - m_dllAvUtil.av_freep(&sub.rects[i].bitmap); - if(m_Subtitle.rects[i].rgba_palette) - m_dllAvUtil.av_freep(&sub.rects[i].rgba_palette); -#endif } if(sub.rects) m_dllAvUtil.av_freep(&sub.rects); @@ -294,7 +287,6 @@ CDVDOverlay* CDVDOverlayCodecFFmpeg::GetOverlay() overlay->source_width = m_width; overlay->source_height = m_height; -#if LIBAVCODEC_VERSION_INT >= (52<<10) BYTE* s = rect.pict.data[0]; BYTE* t = overlay->data; for(int i=0;idata; - for(int i=0;ilinesize; - } - - memcpy(overlay->palette, rect.rgba_palette, rect.nb_colors*4); - - m_dllAvUtil.av_freep(&rect.bitmap); - m_dllAvUtil.av_freep(&rect.rgba_palette); -#endif m_SubtitleIndex++; return overlay; diff --git a/xbmc/cores/dvdplayer/DVDCodecs/Video/DVDVideoCodecFFmpeg.cpp b/xbmc/cores/dvdplayer/DVDCodecs/Video/DVDVideoCodecFFmpeg.cpp index c792cfd..74f2431 100644 --- a/xbmc/cores/dvdplayer/DVDCodecs/Video/DVDVideoCodecFFmpeg.cpp +++ b/xbmc/cores/dvdplayer/DVDCodecs/Video/DVDVideoCodecFFmpeg.cpp @@ -242,9 +242,7 @@ bool CDVDVideoCodecFFmpeg::Open(CDVDStreamInfo &hints, CDVDCodecOptions &options m_pCodecContext->flags &= CODEC_FLAG_EMU_EDGE; #else if (pCodec->id != CODEC_ID_H264 && pCodec->capabilities & CODEC_CAP_DR1 -#if LIBAVCODEC_VERSION_INT >= AV_VERSION_INT(52,69,0) && pCodec->id != CODEC_ID_VP8 -#endif ) m_pCodecContext->flags |= CODEC_FLAG_EMU_EDGE; #endif @@ -600,11 +598,7 @@ bool CDVDVideoCodecFFmpeg::GetPictureCommon(DVDVideoPicture* pDvdVideoPicture) /* use variable in the frame */ AVRational pixel_aspect = m_pCodecContext->sample_aspect_ratio; if (m_pFilterLink) -#ifdef HAVE_AVFILTERBUFFERREFVIDEOPROPS_SAMPLE_ASPECT_RATIO pixel_aspect = m_pFilterLink->cur_buf->video->sample_aspect_ratio; -#else - pixel_aspect = m_pFilterLink->cur_buf->video->pixel_aspect; -#endif if (pixel_aspect.num == 0) aspect_ratio = 0; @@ -814,16 +808,7 @@ int CDVDVideoCodecFFmpeg::FilterProcess(AVFrame* frame) if (frame) { -#if LIBAVFILTER_VERSION_INT >= AV_VERSION_INT(2,13,0) result = m_dllAvFilter.av_vsrc_buffer_add_frame(m_pFilterIn, frame, 0); -#elif LIBAVFILTER_VERSION_INT >= AV_VERSION_INT(2,7,0) - result = m_dllAvFilter.av_vsrc_buffer_add_frame(m_pFilterIn, frame); -#elif LIBAVCODEC_VERSION_INT >= AV_VERSION_INT(53,3,0) - result = m_dllAvFilter.av_vsrc_buffer_add_frame(m_pFilterIn, frame, frame->pts); -#else - result = m_dllAvFilter.av_vsrc_buffer_add_frame(m_pFilterIn, frame, frame->pts, m_pCodecContext->sample_aspect_ratio); -#endif - if (result < 0) { CLog::Log(LOGERROR, "CDVDVideoCodecFFmpeg::FilterProcess - av_vsrc_buffer_add_frame"); diff --git a/xbmc/cores/dvdplayer/DVDDemuxers/DVDDemuxFFmpeg.cpp b/xbmc/cores/dvdplayer/DVDDemuxers/DVDDemuxFFmpeg.cpp index 68f4358..f1b0119 100644 --- a/xbmc/cores/dvdplayer/DVDDemuxers/DVDDemuxFFmpeg.cpp +++ b/xbmc/cores/dvdplayer/DVDDemuxers/DVDDemuxFFmpeg.cpp @@ -311,14 +311,6 @@ bool CDVDDemuxFFmpeg::Open(CDVDInputStream* pInput) if( iformat == NULL ) { -#if defined(USE_EXTERNAL_FFMPEG) && LIBAVFORMAT_VERSION_INT < AV_VERSION_INT(52,98,0) - // API added on: 2011-02-09 - // Old versions of ffmpeg do not have av_probe_input_format, so we need - // to always probe using the lower-level functions as well. - const bool legacyProbing = true; -#else - const bool legacyProbing = false; -#endif // let ffmpeg decide which demuxer we have to open bool trySPDIFonly = (m_pInput->GetContent() == "audio/x-spdif-compressed"); @@ -331,7 +323,7 @@ bool CDVDDemuxFFmpeg::Open(CDVDInputStream* pInput) // want to probe for spdif (DTS or IEC 61937) compressed audio // specifically, or in case the file is a wav which may contain DTS or // IEC 61937 (e.g. ac3-in-wav) and we want to check for those formats. - if (legacyProbing || trySPDIFonly || (iformat && strcmp(iformat->name, "wav") == 0)) + if (trySPDIFonly || (iformat && strcmp(iformat->name, "wav") == 0)) { AVProbeData pd; BYTE probe_buffer[FFMPEG_FILE_BUFFER_SIZE + AVPROBE_PADDING_SIZE]; @@ -352,9 +344,6 @@ bool CDVDDemuxFFmpeg::Open(CDVDInputStream* pInput) // restore position again m_dllAvFormat.url_fseek(m_ioContext , 0, SEEK_SET); - if (legacyProbing && !trySPDIFonly) - iformat = m_dllAvFormat.av_probe_input_format(&pd, 1); - // the advancedsetting is for allowing the user to force outputting the // 44.1 kHz DTS wav file as PCM, so that an A/V receiver can decode // it (this is temporary until we handle 44.1 kHz passthrough properly)