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. -#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); } }