lavfi/asrc_afdelaysrc: convert to query_func2()

This commit is contained in:
Anton Khirnov 2024-09-09 17:29:04 +02:00
parent 01c47dd235
commit 47f87409e3
1 changed files with 8 additions and 6 deletions

View File

@ -80,22 +80,24 @@ static int activate(AVFilterContext *ctx)
return ff_filter_frame(outlink, frame); return ff_filter_frame(outlink, frame);
} }
static int query_formats(AVFilterContext *ctx) static int query_formats(const AVFilterContext *ctx,
AVFilterFormatsConfig **cfg_in,
AVFilterFormatsConfig **cfg_out)
{ {
AFDelaySrcContext *s = ctx->priv; const AFDelaySrcContext *s = ctx->priv;
AVChannelLayout chlayouts[] = { s->chlayout, { 0 } }; AVChannelLayout chlayouts[] = { s->chlayout, { 0 } };
int sample_rates[] = { s->sample_rate, -1 }; int sample_rates[] = { s->sample_rate, -1 };
static const enum AVSampleFormat sample_fmts[] = { AV_SAMPLE_FMT_FLTP, static const enum AVSampleFormat sample_fmts[] = { AV_SAMPLE_FMT_FLTP,
AV_SAMPLE_FMT_NONE }; 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) if (ret < 0)
return ret; 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) if (ret < 0)
return ret; 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 config_output(AVFilterLink *outlink) static int config_output(AVFilterLink *outlink)
@ -146,5 +148,5 @@ const AVFilter ff_asrc_afdelaysrc = {
.activate = activate, .activate = activate,
.inputs = NULL, .inputs = NULL,
FILTER_OUTPUTS(afdelaysrc_outputs), FILTER_OUTPUTS(afdelaysrc_outputs),
FILTER_QUERY_FUNC(query_formats), FILTER_QUERY_FUNC2(query_formats),
}; };