mirror of
https://github.com/mpv-player/mpv
synced 2025-01-03 05:22:23 +00:00
Remove some more unneeded version checks
All of these check against things that happened before the latest supported FFmpeg/Libav release.
This commit is contained in:
parent
5506c8d0f6
commit
64c01a814c
@ -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. <Expletive deleted.>
|
||||
#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
|
||||
|
@ -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 */
|
||||
|
@ -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);
|
||||
|
@ -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;
|
||||
|
@ -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;
|
||||
|
@ -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. <Expletive deleted.>
|
||||
#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);
|
||||
}
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user