diff mbox series

[FFmpeg-devel,09/16] lavfi/f_select: switch to query_func2()

Message ID 20241001105421.28967-9-anton@khirnov.net
State New
Headers show
Series [FFmpeg-devel,01/16] lavfi/buffersink: move the option sanity check to init | expand

Checks

Context Check Description
yinshiyou/make_loongarch64 success Make finished
yinshiyou/make_fate_loongarch64 success Make fate finished
andriy/make_x86 success Make finished
andriy/make_fate_x86 success Make fate finished

Commit Message

Anton Khirnov Oct. 1, 2024, 10:54 a.m. UTC
Also, drop redundant calls that also happen implicitly in generic code.
---
 libavfilter/f_select.c | 15 ++++++++-------
 1 file changed, 8 insertions(+), 7 deletions(-)
diff mbox series

Patch

diff --git a/libavfilter/f_select.c b/libavfilter/f_select.c
index ba0ae31f1b..744fef6906 100644
--- a/libavfilter/f_select.c
+++ b/libavfilter/f_select.c
@@ -515,13 +515,13 @@  const AVFilter ff_af_aselect = {
 
 #if CONFIG_SELECT_FILTER
 
-static int query_formats(AVFilterContext *ctx)
+static int query_formats(const AVFilterContext *ctx,
+                         AVFilterFormatsConfig **cfg_in,
+                         AVFilterFormatsConfig **cfg_out)
 {
-    SelectContext *select = ctx->priv;
+    const SelectContext *select = ctx->priv;
 
-    if (!select->do_scene_detect) {
-        return ff_default_query_formats(ctx);
-    } else {
+    if (select->do_scene_detect) {
         static const enum AVPixelFormat pix_fmts[] = {
             AV_PIX_FMT_RGB24, AV_PIX_FMT_BGR24, AV_PIX_FMT_RGBA,
             AV_PIX_FMT_ABGR, AV_PIX_FMT_BGRA, AV_PIX_FMT_GRAY8,
@@ -530,8 +530,9 @@  static int query_formats(AVFilterContext *ctx)
             AV_PIX_FMT_YUV420P10,
             AV_PIX_FMT_NONE
         };
-        return ff_set_common_formats_from_list(ctx, pix_fmts);
+        return ff_set_common_formats_from_list2(ctx, cfg_in, cfg_out, pix_fmts);
     }
+    return 0;
 }
 
 DEFINE_OPTIONS(select, AV_OPT_FLAG_VIDEO_PARAM|AV_OPT_FLAG_FILTERING_PARAM);
@@ -564,7 +565,7 @@  const AVFilter ff_vf_select = {
     .priv_size     = sizeof(SelectContext),
     .priv_class    = &select_class,
     FILTER_INPUTS(avfilter_vf_select_inputs),
-    FILTER_QUERY_FUNC(query_formats),
+    FILTER_QUERY_FUNC2(query_formats),
     .flags         = AVFILTER_FLAG_DYNAMIC_OUTPUTS | AVFILTER_FLAG_METADATA_ONLY,
 };
 #endif /* CONFIG_SELECT_FILTER */