1
0
mirror of https://github.com/FFmpeg/FFmpeg.git synced 2024-11-26 19:01:44 +02:00

lavfi/asrc_anullsrc: convert to query_func2()

Also, drop a redundant call that also happens implicitly in generic
code.
This commit is contained in:
Anton Khirnov 2024-09-09 17:29:04 +02:00
parent 5b3212e5f7
commit 9335af9acc

View File

@ -61,18 +61,20 @@ static const AVOption anullsrc_options[]= {
AVFILTER_DEFINE_CLASS(anullsrc); AVFILTER_DEFINE_CLASS(anullsrc);
static int query_formats(AVFilterContext *ctx) static int query_formats(const AVFilterContext *ctx,
AVFilterFormatsConfig **cfg_in,
AVFilterFormatsConfig **cfg_out)
{ {
ANullContext *null = ctx->priv; const ANullContext *null = ctx->priv;
const AVChannelLayout chlayouts[] = { null->ch_layout, { 0 } }; const AVChannelLayout chlayouts[] = { null->ch_layout, { 0 } };
int sample_rates[] = { null->sample_rate, -1 }; int sample_rates[] = { null->sample_rate, -1 };
int ret; int ret;
if ((ret = ff_set_common_formats (ctx, ff_all_formats (AVMEDIA_TYPE_AUDIO))) < 0 || ret = ff_set_common_samplerates_from_list2(ctx, cfg_in, cfg_out, sample_rates);
(ret = ff_set_common_samplerates_from_list(ctx, sample_rates)) < 0) if (ret < 0)
return ret; return ret;
return ff_set_common_channel_layouts_from_list(ctx, chlayouts); return ff_set_common_channel_layouts_from_list2(ctx, cfg_in, cfg_out, chlayouts);
} }
static av_cold int config_props(AVFilterLink *outlink) static av_cold int config_props(AVFilterLink *outlink)
@ -124,7 +126,7 @@ const AVFilter ff_asrc_anullsrc = {
.priv_size = sizeof(ANullContext), .priv_size = sizeof(ANullContext),
.inputs = NULL, .inputs = NULL,
FILTER_OUTPUTS(avfilter_asrc_anullsrc_outputs), FILTER_OUTPUTS(avfilter_asrc_anullsrc_outputs),
FILTER_QUERY_FUNC(query_formats), FILTER_QUERY_FUNC2(query_formats),
.activate = activate, .activate = activate,
.priv_class = &anullsrc_class, .priv_class = &anullsrc_class,
}; };