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

lavfi/af_channelmap: convert to query_func2()

Also, drop redundant calls that also happen implicitly in generic code.
This commit is contained in:
Anton Khirnov 2024-08-31 11:21:00 +02:00
parent 3045949945
commit f0f1cf2697

View File

@ -321,21 +321,28 @@ static av_cold int channelmap_init(AVFilterContext *ctx)
return 0;
}
static int channelmap_query_formats(AVFilterContext *ctx)
static int channelmap_query_formats(const AVFilterContext *ctx,
AVFilterFormatsConfig **cfg_in,
AVFilterFormatsConfig **cfg_out)
{
ChannelMapContext *s = ctx->priv;
const ChannelMapContext *s = ctx->priv;
AVFilterChannelLayouts *channel_layouts = NULL;
int ret;
if ((ret = ff_set_common_formats (ctx, ff_planar_sample_fmts())) < 0 ||
(ret = ff_set_common_all_samplerates(ctx )) < 0 ||
(ret = ff_add_channel_layout(&channel_layouts, &s->output_layout)) < 0 ||
(ret = ff_channel_layouts_ref(channel_layouts,
&ctx->outputs[0]->incfg.channel_layouts)) < 0)
ret = ff_set_common_formats2(ctx, cfg_in, cfg_out, ff_planar_sample_fmts());
if (ret < 0)
return ret;
return ff_channel_layouts_ref(ff_all_channel_counts(),
&ctx->inputs[0]->outcfg.channel_layouts);
ret = ff_add_channel_layout(&channel_layouts, &s->output_layout);
if (ret < 0)
return ret;
ret = ff_channel_layouts_ref(channel_layouts, &cfg_out[0]->channel_layouts);
if (ret < 0)
return ret;
return 0;
}
static int channelmap_filter_frame(AVFilterLink *inlink, AVFrame *buf)
@ -425,5 +432,5 @@ const AVFilter ff_af_channelmap = {
.priv_class = &channelmap_class,
FILTER_INPUTS(avfilter_af_channelmap_inputs),
FILTER_OUTPUTS(ff_audio_default_filterpad),
FILTER_QUERY_FUNC(channelmap_query_formats),
FILTER_QUERY_FUNC2(channelmap_query_formats),
};