summaryrefslogtreecommitdiffstats
path: root/video/filter
diff options
context:
space:
mode:
authorwm4 <wm4@nowhere>2013-04-26 12:17:43 +0200
committerwm4 <wm4@nowhere>2013-04-26 20:40:24 +0200
commit3ffeeee411614ebc93bb5dbdd2a71a85279af3b2 (patch)
tree847391fa4142bd056643e19fdf999fa9fc3aad04 /video/filter
parent3765cfcf57e0232b5e96e77d9dd628755f1c0518 (diff)
downloadmpv-3ffeeee411614ebc93bb5dbdd2a71a85279af3b2.tar.bz2
mpv-3ffeeee411614ebc93bb5dbdd2a71a85279af3b2.tar.xz
vf_lavfi: silence stupid deprecation warning
libavfilter changed the way a format list is passed to vf_format. Now you have to separate formats with "|" instead of ":". If you use "|", it prints an annoying message on every reinit: [format @ 0x8bbaaa0]This syntax is deprecated. Use '|' to separate the list items. ...and it will probably stop working without warning at some point in the future. We need some very annoying ifdeffery to detect this case, because libavfilter version numbers are just plain incompatible between Libav and ffmpeg. There is no other way to detect this. (Sometimes I wonder whether ffmpeg and especially Libav actually like causing unnecessary pain for their users, and intentionally break stuff in the most annoying way possible. Sigh...)
Diffstat (limited to 'video/filter')
-rw-r--r--video/filter/vf_lavfi.c14
1 files changed, 12 insertions, 2 deletions
diff --git a/video/filter/vf_lavfi.c b/video/filter/vf_lavfi.c
index 6fb9ae0cd3..6dbbeca8f2 100644
--- a/video/filter/vf_lavfi.c
+++ b/video/filter/vf_lavfi.c
@@ -45,6 +45,8 @@
#include "video/fmt-conversion.h"
#include "vf.h"
+#define IS_LIBAV_FORK (LIBAVFILTER_VERSION_MICRO < 100)
+
struct vf_priv_s {
AVFilterGraph *graph;
AVFilterContext *in;
@@ -72,7 +74,7 @@ static void destroy_graph(struct vf_instance *vf)
// FFmpeg and Libav have slightly different APIs, just enough to cause us
// unnecessary pain. <Expletive deleted.>
-#if LIBAVFILTER_VERSION_MICRO < 100
+#if IS_LIBAV_FORK
#define graph_parse(graph, filters, inputs, outputs, log_ctx) \
avfilter_graph_parse(graph, filters, inputs, outputs, log_ctx)
#else
@@ -80,6 +82,14 @@ static void destroy_graph(struct vf_instance *vf)
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
+
static AVRational par_from_sar_dar(int width, int height,
int d_width, int d_height)
{
@@ -133,7 +143,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] ? ":" : "";
+ const char *s = fmtstr[0] ? FMTSEP : "";
fmtstr = talloc_asprintf_append_buffer(fmtstr, "%s%s", s, name);
}
}