From 64c01a814c8f7cf4a780b89fe00ed608b1f93e2b Mon Sep 17 00:00:00 2001 From: wm4 Date: Sun, 16 Mar 2014 10:04:46 +0100 Subject: Remove some more unneeded version checks All of these check against things that happened before the latest supported FFmpeg/Libav release. --- audio/filter/af_lavfi.c | 16 +++------------- compat/libav.h | 12 ------------ demux/demux_mkv.c | 15 --------------- stream/stream_lavf.c | 13 ++----------- sub/sd_lavc_conv.c | 6 +----- video/filter/vf_lavfi.c | 14 ++------------ 6 files changed, 8 insertions(+), 68 deletions(-) diff --git a/audio/filter/af_lavfi.c b/audio/filter/af_lavfi.c index 4049e54021..73d093d095 100644 --- a/audio/filter/af_lavfi.c +++ b/audio/filter/af_lavfi.c @@ -41,11 +41,9 @@ #include "options/m_option.h" #include "common/av_opts.h" -#define IS_LIBAV_FORK (LIBAVFILTER_VERSION_MICRO < 100) - // FFmpeg and Libav have slightly different APIs, just enough to cause us // unnecessary pain. -#if IS_LIBAV_FORK +#if LIBAVFILTER_VERSION_MICRO < 100 #define graph_parse(graph, filters, inputs, outputs, log_ctx) \ avfilter_graph_parse(graph, filters, inputs, outputs, log_ctx) #else @@ -53,14 +51,6 @@ avfilter_graph_parse(graph, filters, &(inputs), &(outputs), log_ctx) #endif -// ":" is deprecated, but "|" doesn't work in earlier versions. -#if (IS_LIBAV_FORK && LIBAVFILTER_VERSION_INT >= AV_VERSION_INT(3, 7, 0)) || \ - (!IS_LIBAV_FORK && LIBAVFILTER_VERSION_INT >= AV_VERSION_INT(3, 50, 100)) -#define FMTSEP "|" -#else -#define FMTSEP ":" -#endif - struct priv { AVFilterGraph *graph; AVFilterContext *in; @@ -124,7 +114,7 @@ static bool recreate_graph(struct af_instance *af, struct mp_audio *config) for (int n = 0; sample_fmts[n] != AV_SAMPLE_FMT_NONE; n++) { const char *name = av_get_sample_fmt_name(sample_fmts[n]); if (name) { - const char *s = fmtstr[0] ? FMTSEP : ""; + const char *s = fmtstr[0] ? "|" : ""; fmtstr = talloc_asprintf_append_buffer(fmtstr, "%s%s", s, name); } } @@ -238,7 +228,7 @@ static int filter(struct af_instance *af, struct mp_audio *data, int flags) frame->channel_layout = l_in->channel_layout; frame->sample_rate = l_in->sample_rate; -#if !IS_LIBAV_FORK +#if LIBAVFILTER_VERSION_MICRO >= 100 // FFmpeg being a stupid POS frame->channels = l_in->channels; #endif diff --git a/compat/libav.h b/compat/libav.h index 56876c1336..ba5250b5f3 100644 --- a/compat/libav.h +++ b/compat/libav.h @@ -28,16 +28,4 @@ #define AV_CPU_FLAG_MMX2 AV_CPU_FLAG_MMXEXT #endif -// At least Libav 9 doesn't define the new symbols -#ifndef AV_PIX_FMT_FLAG_BE -#define AV_PIX_FMT_FLAG_BE PIX_FMT_BE -#define AV_PIX_FMT_FLAG_PAL PIX_FMT_PAL -#define AV_PIX_FMT_FLAG_BITSTREAM PIX_FMT_BITSTREAM -#define AV_PIX_FMT_FLAG_HWACCEL PIX_FMT_HWACCEL -#define AV_PIX_FMT_FLAG_PLANAR PIX_FMT_PLANAR -#define AV_PIX_FMT_FLAG_RGB PIX_FMT_RGB -#define AV_PIX_FMT_FLAG_PSEUDOPAL PIX_FMT_PSEUDOPAL -#define AV_PIX_FMT_FLAG_ALPHA PIX_FMT_ALPHA -#endif - #endif /* MPV_LIBAV_COMPAT_H */ diff --git a/demux/demux_mkv.c b/demux/demux_mkv.c index c7526a7421..2b17e7e457 100644 --- a/demux/demux_mkv.c +++ b/demux/demux_mkv.c @@ -77,17 +77,6 @@ static const int cook_fl2bps[COOK_FLAVORS] = { 12016, 16408, 22911, 33506 }; -#define IS_LIBAV_FORK (LIBAVCODEC_VERSION_MICRO < 100) - -// Both of these versions were bumped by unrelated commits. -#if (IS_LIBAV_FORK && LIBAVCODEC_VERSION_INT >= AV_VERSION_INT(55, 7, 1)) || \ - (!IS_LIBAV_FORK && LIBAVCODEC_VERSION_INT >= AV_VERSION_INT(55, 12, 101)) -#define NEED_WAVPACK_PARSE 1 -#else -#define NEED_WAVPACK_PARSE 0 -#endif - - enum { MAX_NUM_LACES = 256, }; @@ -2108,7 +2097,6 @@ static void mkv_seek_reset(demuxer_t *demuxer) } } -#if NEED_WAVPACK_PARSE // Copied from libavformat/matroskadec.c (FFmpeg 310f9dd / 2013-05-30) // Originally added with Libav commit 9b6f47c // License: LGPL v2.1 or later @@ -2189,12 +2177,10 @@ fail: talloc_free(dst); return -1; } -#endif static bool mkv_parse_packet(mkv_track_t *track, bstr *raw, bstr *out) { if (track->a_formattag == MP_FOURCC('W', 'V', 'P', 'K')) { -#if NEED_WAVPACK_PARSE int size = raw->len; uint8_t *parsed; if (libav_parse_wavpack(track, raw->start, &parsed, &size) >= 0) { @@ -2203,7 +2189,6 @@ static bool mkv_parse_packet(mkv_track_t *track, bstr *raw, bstr *out) *raw = (bstr){0}; return true; } -#endif } else if (track->codec_id && strcmp(track->codec_id, MKV_V_PRORES) == 0) { size_t newlen = raw->len + 8; char *data = talloc_size(track->parser_tmp, newlen); diff --git a/stream/stream_lavf.c b/stream/stream_lavf.c index 3c7bf93493..ec46c862f6 100644 --- a/stream/stream_lavf.c +++ b/stream/stream_lavf.c @@ -119,15 +119,6 @@ static int control(stream_t *s, int cmd, void *arg) return STREAM_UNSUPPORTED; } -static bool mp_avio_has_opts(AVIOContext *avio) -{ -#if LIBAVFORMAT_VERSION_INT >= AV_VERSION_INT(54, 0, 0) - return avio->av_class != NULL; -#else - return false; -#endif -} - static const char * const prefix[] = { "lavf://", "ffmpeg://" }; static int open_f(stream_t *stream, int mode) @@ -223,7 +214,7 @@ static int open_f(stream_t *stream, int mode) t->key, t->value); } - if (mp_avio_has_opts(avio)) { + if (avio->av_class) { uint8_t *mt = NULL; if (av_opt_get(avio, "mime_type", AV_OPT_SEARCH_CHILDREN, &mt) >= 0) { stream->mime_type = talloc_strdup(stream, mt); @@ -270,7 +261,7 @@ static char **read_icy(stream_t *s) { AVIOContext *avio = s->priv; - if (!mp_avio_has_opts(avio)) + if (!avio->av_class) return NULL; uint8_t *icy_header = NULL; diff --git a/sub/sd_lavc_conv.c b/sub/sd_lavc_conv.c index 566f412cf5..3414d66b25 100644 --- a/sub/sd_lavc_conv.c +++ b/sub/sd_lavc_conv.c @@ -30,11 +30,7 @@ #include "bstr/bstr.h" #include "sd.h" -#if LIBAVCODEC_VERSION_MICRO >= 100 -#define HAVE_AV_WEBVTT (LIBAVCODEC_VERSION_INT >= AV_VERSION_INT(55, 13, 100)) -#else -#define HAVE_AV_WEBVTT 0 -#endif +#define HAVE_AV_WEBVTT (LIBAVCODEC_VERSION_MICRO >= 100) struct sd_lavc_priv { AVCodecContext *avctx; diff --git a/video/filter/vf_lavfi.c b/video/filter/vf_lavfi.c index 7faf5a5b96..3d22817cb2 100644 --- a/video/filter/vf_lavfi.c +++ b/video/filter/vf_lavfi.c @@ -47,11 +47,9 @@ #include "vf.h" #include "vf_lavfi.h" -#define IS_LIBAV_FORK (LIBAVFILTER_VERSION_MICRO < 100) - // FFmpeg and Libav have slightly different APIs, just enough to cause us // unnecessary pain. -#if IS_LIBAV_FORK +#if LIBAVFILTER_VERSION_MICRO < 100 #define graph_parse(graph, filters, inputs, outputs, log_ctx) \ avfilter_graph_parse(graph, filters, inputs, outputs, log_ctx) #else @@ -59,14 +57,6 @@ avfilter_graph_parse(graph, filters, &(inputs), &(outputs), log_ctx) #endif -// ":" is deprecated, but "|" doesn't work in earlier versions. -#if (IS_LIBAV_FORK && LIBAVFILTER_VERSION_INT >= AV_VERSION_INT(3, 7, 0)) || \ - (!IS_LIBAV_FORK && LIBAVFILTER_VERSION_INT >= AV_VERSION_INT(3, 50, 100)) -#define FMTSEP "|" -#else -#define FMTSEP ":" -#endif - struct vf_priv_s { AVFilterGraph *graph; AVFilterContext *in; @@ -159,7 +149,7 @@ static bool recreate_graph(struct vf_instance *vf, int width, int height, if (vf_next_query_format(vf, n)) { const char *name = av_get_pix_fmt_name(imgfmt2pixfmt(n)); if (name) { - const char *s = fmtstr[0] ? FMTSEP : ""; + const char *s = fmtstr[0] ? "|" : ""; fmtstr = talloc_asprintf_append_buffer(fmtstr, "%s%s", s, name); } } -- cgit v1.2.3