aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorAnton Khirnov <anton@khirnov.net>2024-09-04 14:43:33 +0200
committerAnton Khirnov <anton@khirnov.net>2024-09-09 17:26:17 +0200
commitc9c6f074362115d20867b44583ac9354b855f00d (patch)
treed17594a494443bae51a02dda822bf64b59b2b24a
parent0ec382f4948e3b60ac36e433f294b5c200945f11 (diff)
downloadffmpeg-c9c6f074362115d20867b44583ac9354b855f00d.tar.gz
lavfi/af_hdcd: convert to query_func2()
-rw-r--r--libavfilter/af_hdcd.c29
1 files changed, 13 insertions, 16 deletions
diff --git a/libavfilter/af_hdcd.c b/libavfilter/af_hdcd.c
index 40d62c8793..c9d992d017 100644
--- a/libavfilter/af_hdcd.c
+++ b/libavfilter/af_hdcd.c
@@ -1601,8 +1601,15 @@ static int filter_frame(AVFilterLink *inlink, AVFrame *in)
return ff_filter_frame(outlink, out);
}
-static int query_formats(AVFilterContext *ctx)
+static int query_formats(const AVFilterContext *ctx,
+ AVFilterFormatsConfig **cfg_in,
+ AVFilterFormatsConfig **cfg_out)
{
+ static const AVChannelLayout layouts[] = {
+ AV_CHANNEL_LAYOUT_MONO,
+ AV_CHANNEL_LAYOUT_STEREO,
+ { .nb_channels = 0 },
+ };
static const int sample_rates[] = {
44100, 48000,
88200, 96000,
@@ -1611,9 +1618,6 @@ static int query_formats(AVFilterContext *ctx)
};
AVFilterFormats *in_formats;
AVFilterFormats *out_formats;
- AVFilterChannelLayouts *layouts = NULL;
- AVFilterLink *inlink = ctx->inputs[0];
- AVFilterLink *outlink = ctx->outputs[0];
static const enum AVSampleFormat sample_fmts_in[] = {
AV_SAMPLE_FMT_S16,
@@ -1628,28 +1632,21 @@ static int query_formats(AVFilterContext *ctx)
};
int ret;
- ret = ff_add_channel_layout(&layouts, &(AVChannelLayout)AV_CHANNEL_LAYOUT_MONO);
- if (ret < 0)
- return ret;
- ret = ff_add_channel_layout(&layouts, &(AVChannelLayout)AV_CHANNEL_LAYOUT_STEREO);
- if (ret < 0)
- return ret;
-
- ret = ff_set_common_channel_layouts(ctx, layouts);
+ ret = ff_set_common_channel_layouts_from_list2(ctx, cfg_in, cfg_out, layouts);
if (ret < 0)
return ret;
in_formats = ff_make_format_list(sample_fmts_in);
- ret = ff_formats_ref(in_formats, &inlink->outcfg.formats);
+ ret = ff_formats_ref(in_formats, &cfg_in[0]->formats);
if (ret < 0)
return ret;
out_formats = ff_make_format_list(sample_fmts_out);
- ret = ff_formats_ref(out_formats, &outlink->incfg.formats);
+ ret = ff_formats_ref(out_formats, &cfg_out[0]->formats);
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 av_cold void uninit(AVFilterContext *ctx)
@@ -1770,5 +1767,5 @@ const AVFilter ff_af_hdcd = {
.uninit = uninit,
FILTER_INPUTS(avfilter_af_hdcd_inputs),
FILTER_OUTPUTS(ff_audio_default_filterpad),
- FILTER_QUERY_FUNC(query_formats),
+ FILTER_QUERY_FUNC2(query_formats),
};