[FFmpeg-devel] [PATCH 02/22] lavfi/asrc_afirsrc: convert to query_func2()

Anton Khirnov anton at khirnov.net
Wed Sep 25 12:38:59 EEST 2024


---
 libavfilter/asrc_afirsrc.c | 16 +++++++++-------
 1 file changed, 9 insertions(+), 7 deletions(-)

diff --git a/libavfilter/asrc_afirsrc.c b/libavfilter/asrc_afirsrc.c
index bc450ec822..0ea611d837 100644
--- a/libavfilter/asrc_afirsrc.c
+++ b/libavfilter/asrc_afirsrc.c
@@ -113,24 +113,26 @@ static av_cold void uninit(AVFilterContext *ctx)
     av_tx_uninit(&s->itx_ctx);
 }
 
-static av_cold int query_formats(AVFilterContext *ctx)
+static av_cold int query_formats(const AVFilterContext *ctx,
+                                 AVFilterFormatsConfig **cfg_in,
+                                 AVFilterFormatsConfig **cfg_out)
 {
-    AudioFIRSourceContext *s = ctx->priv;
+    const AudioFIRSourceContext *s = ctx->priv;
     static const AVChannelLayout chlayouts[] = { AV_CHANNEL_LAYOUT_MONO, { 0 } };
     int sample_rates[] = { s->sample_rate, -1 };
     static const enum AVSampleFormat sample_fmts[] = {
         AV_SAMPLE_FMT_FLT,
         AV_SAMPLE_FMT_NONE
     };
-    int ret = ff_set_common_formats_from_list(ctx, sample_fmts);
+    int ret = ff_set_common_formats_from_list2(ctx, cfg_in, cfg_out, sample_fmts);
     if (ret < 0)
         return ret;
 
-    ret = ff_set_common_channel_layouts_from_list(ctx, chlayouts);
+    ret = ff_set_common_channel_layouts_from_list2(ctx, cfg_in, cfg_out, chlayouts);
     if (ret < 0)
         return ret;
 
-    return ff_set_common_samplerates_from_list(ctx, sample_rates);
+    return ff_set_common_samplerates_from_list2(ctx, cfg_in, cfg_out, sample_rates);
 }
 
 static int parse_string(char *str, float **items, int *nb_items, int *items_size)
@@ -304,7 +306,7 @@ const AVFilter ff_asrc_afirsrc = {
     .priv_size     = sizeof(AudioFIRSourceContext),
     .inputs        = NULL,
     FILTER_OUTPUTS(afirsrc_outputs),
-    FILTER_QUERY_FUNC(query_formats),
+    FILTER_QUERY_FUNC2(query_formats),
     .priv_class    = &afirsrc_class,
 };
 
@@ -585,6 +587,6 @@ const AVFilter ff_asrc_afireqsrc = {
     .priv_size     = sizeof(AudioFIRSourceContext),
     .inputs        = NULL,
     FILTER_OUTPUTS(afireqsrc_outputs),
-    FILTER_QUERY_FUNC(query_formats),
+    FILTER_QUERY_FUNC2(query_formats),
     .priv_class    = &afireqsrc_class,
 };
-- 
2.43.0



More information about the ffmpeg-devel mailing list