[FFmpeg-devel] [PATCH 25/25] lavfi/af_pan: convert to query_func2()
Anton Khirnov
anton at khirnov.net
Thu Sep 5 13:07:29 EEST 2024
Also, drop redundant calls that also happen implicitly in generic code.
---
libavfilter/af_pan.c | 19 ++++++-------------
1 file changed, 6 insertions(+), 13 deletions(-)
diff --git a/libavfilter/af_pan.c b/libavfilter/af_pan.c
index f2f6daa658..0d20b0307b 100644
--- a/libavfilter/af_pan.c
+++ b/libavfilter/af_pan.c
@@ -243,31 +243,24 @@ fail:
return ret;
}
-static int query_formats(AVFilterContext *ctx)
+static int query_formats(const AVFilterContext *ctx,
+ AVFilterFormatsConfig **cfg_in,
+ AVFilterFormatsConfig **cfg_out)
{
const PanContext *pan = ctx->priv;
- AVFilterLink *inlink = ctx->inputs[0];
- AVFilterLink *outlink = ctx->outputs[0];
AVFilterChannelLayouts *layouts;
int ret;
- /* libswr supports any sample and packing formats */
- if ((ret = ff_set_common_formats(ctx, ff_all_formats(AVMEDIA_TYPE_AUDIO))) < 0)
- return ret;
-
- if ((ret = ff_set_common_all_samplerates(ctx)) < 0)
- return ret;
-
// inlink supports any channel layout
layouts = ff_all_channel_counts();
- if ((ret = ff_channel_layouts_ref(layouts, &inlink->outcfg.channel_layouts)) < 0)
+ if ((ret = ff_channel_layouts_ref(layouts, &cfg_in[0]->channel_layouts)) < 0)
return ret;
// outlink supports only requested output channel layout
layouts = NULL;
if ((ret = ff_add_channel_layout(&layouts, &pan->out_channel_layout)) < 0)
return ret;
- return ff_channel_layouts_ref(layouts, &outlink->incfg.channel_layouts);
+ return ff_channel_layouts_ref(layouts, &cfg_out[0]->channel_layouts);
}
static int config_props(AVFilterLink *link)
@@ -432,5 +425,5 @@ const AVFilter ff_af_pan = {
.uninit = uninit,
FILTER_INPUTS(pan_inputs),
FILTER_OUTPUTS(ff_audio_default_filterpad),
- FILTER_QUERY_FUNC(query_formats),
+ FILTER_QUERY_FUNC2(query_formats),
};
--
2.43.0
More information about the ffmpeg-devel
mailing list