lavfi/asrc_sine: convert to query_func2()

This commit is contained in:
Anton Khirnov 2024-09-09 17:29:04 +02:00
parent ec01d80f2e
commit 194e1ca03f
1 changed files with 8 additions and 6 deletions

View File

@ -178,22 +178,24 @@ static av_cold void uninit(AVFilterContext *ctx)
av_freep(&sine->sin); av_freep(&sine->sin);
} }
static av_cold int query_formats(AVFilterContext *ctx) static av_cold int query_formats(const AVFilterContext *ctx,
AVFilterFormatsConfig **cfg_in,
AVFilterFormatsConfig **cfg_out)
{ {
SineContext *sine = ctx->priv; const SineContext *sine = ctx->priv;
static const AVChannelLayout chlayouts[] = { AV_CHANNEL_LAYOUT_MONO, { 0 } }; static const AVChannelLayout chlayouts[] = { AV_CHANNEL_LAYOUT_MONO, { 0 } };
int sample_rates[] = { sine->sample_rate, -1 }; int sample_rates[] = { sine->sample_rate, -1 };
static const enum AVSampleFormat sample_fmts[] = { AV_SAMPLE_FMT_S16, static const enum AVSampleFormat sample_fmts[] = { AV_SAMPLE_FMT_S16,
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 av_cold int config_props(AVFilterLink *outlink) static av_cold int config_props(AVFilterLink *outlink)
@ -271,6 +273,6 @@ const AVFilter ff_asrc_sine = {
.priv_size = sizeof(SineContext), .priv_size = sizeof(SineContext),
.inputs = NULL, .inputs = NULL,
FILTER_OUTPUTS(sine_outputs), FILTER_OUTPUTS(sine_outputs),
FILTER_QUERY_FUNC(query_formats), FILTER_QUERY_FUNC2(query_formats),
.priv_class = &sine_class, .priv_class = &sine_class,
}; };