[FFmpeg-devel] [PATCH 12/20] lavfi/vf_elbg: switch to query_func2()

Anton Khirnov anton at khirnov.net
Fri Oct 4 11:42:22 EEST 2024


---
 libavfilter/vf_elbg.c | 14 ++++++++------
 1 file changed, 8 insertions(+), 6 deletions(-)

diff --git a/libavfilter/vf_elbg.c b/libavfilter/vf_elbg.c
index 453147ca33..5eb5ffed2f 100644
--- a/libavfilter/vf_elbg.c
+++ b/libavfilter/vf_elbg.c
@@ -85,9 +85,11 @@ static av_cold int init(AVFilterContext *ctx)
     return 0;
 }
 
-static int query_formats(AVFilterContext *ctx)
+static int query_formats(const AVFilterContext *ctx,
+                         AVFilterFormatsConfig **cfg_in,
+                         AVFilterFormatsConfig **cfg_out)
 {
-    ELBGFilterContext *const elbg = ctx->priv;
+    const ELBGFilterContext *const elbg = ctx->priv;
     int ret;
 
     static const enum AVPixelFormat pix_fmts[] = {
@@ -96,14 +98,14 @@ static int query_formats(AVFilterContext *ctx)
         AV_PIX_FMT_NONE
     };
     if (!elbg->pal8) {
-        return ff_set_common_formats_from_list(ctx, pix_fmts);
+        return ff_set_common_formats_from_list2(ctx, cfg_in, cfg_out, pix_fmts);
     } else {
         static const enum AVPixelFormat pal8_fmt[] = {
             AV_PIX_FMT_PAL8,
             AV_PIX_FMT_NONE
         };
-        if ((ret = ff_formats_ref(ff_make_format_list(pix_fmts), &ctx->inputs[0]->outcfg.formats)) < 0 ||
-            (ret = ff_formats_ref(ff_make_format_list(pal8_fmt), &ctx->outputs[0]->incfg.formats)) < 0)
+        if ((ret = ff_formats_ref(ff_make_format_list(pix_fmts), &cfg_in[0]->formats)) < 0 ||
+            (ret = ff_formats_ref(ff_make_format_list(pal8_fmt), &cfg_out[0]->formats)) < 0)
             return ret;
     }
     return 0;
@@ -264,5 +266,5 @@ const AVFilter ff_vf_elbg = {
     .uninit        = uninit,
     FILTER_INPUTS(elbg_inputs),
     FILTER_OUTPUTS(ff_video_default_filterpad),
-    FILTER_QUERY_FUNC(query_formats),
+    FILTER_QUERY_FUNC2(query_formats),
 };
-- 
2.43.0



More information about the ffmpeg-devel mailing list