diff mbox series

[FFmpeg-devel,04/22] lavfi/asrc_anullsrc: convert to query_func2()

Message ID 20240925093919.22929-4-anton@khirnov.net
State New
Headers show
Series [FFmpeg-devel,01/22] lavfi/asrc_afdelaysrc: convert to query_func2() | expand

Checks

Context Check Description
andriy/make_x86 success Make finished
andriy/make_fate_x86 success Make fate finished

Commit Message

Anton Khirnov Sept. 25, 2024, 9:39 a.m. UTC
Also, drop a redundant call that also happens implicitly in generic
code.
---
 libavfilter/asrc_anullsrc.c | 14 ++++++++------
 1 file changed, 8 insertions(+), 6 deletions(-)
diff mbox series

Patch

diff --git a/libavfilter/asrc_anullsrc.c b/libavfilter/asrc_anullsrc.c
index 3249cc33ad..d8fd5e7c06 100644
--- a/libavfilter/asrc_anullsrc.c
+++ b/libavfilter/asrc_anullsrc.c
@@ -61,18 +61,20 @@  static const AVOption anullsrc_options[]= {
 
 AVFILTER_DEFINE_CLASS(anullsrc);
 
-static int query_formats(AVFilterContext *ctx)
+static int query_formats(const AVFilterContext *ctx,
+                         AVFilterFormatsConfig **cfg_in,
+                         AVFilterFormatsConfig **cfg_out)
 {
-    ANullContext *null = ctx->priv;
+    const ANullContext *null = ctx->priv;
     const AVChannelLayout chlayouts[] = { null->ch_layout, { 0 } };
     int sample_rates[] = { null->sample_rate, -1 };
     int ret;
 
-    if ((ret = ff_set_common_formats         (ctx, ff_all_formats              (AVMEDIA_TYPE_AUDIO))) < 0 ||
-        (ret = ff_set_common_samplerates_from_list(ctx, sample_rates)) < 0)
+    ret = ff_set_common_samplerates_from_list2(ctx, cfg_in, cfg_out, sample_rates);
+    if (ret < 0)
         return ret;
 
-    return ff_set_common_channel_layouts_from_list(ctx, chlayouts);
+    return ff_set_common_channel_layouts_from_list2(ctx, cfg_in, cfg_out, chlayouts);
 }
 
 static av_cold int config_props(AVFilterLink *outlink)
@@ -124,7 +126,7 @@  const AVFilter ff_asrc_anullsrc = {
     .priv_size     = sizeof(ANullContext),
     .inputs        = NULL,
     FILTER_OUTPUTS(avfilter_asrc_anullsrc_outputs),
-    FILTER_QUERY_FUNC(query_formats),
+    FILTER_QUERY_FUNC2(query_formats),
     .activate      = activate,
     .priv_class    = &anullsrc_class,
 };