History

lavfi/af_channelmap: convert to query_func2()

Also, drop redundant calls that also happen implicitly in generic code.

Anton Khirnov committed 2 years ago

Commit f0f1cf21 parent 30459491 file · +17 −10Browse files

Unified · Split

libavfilter/af_channelmap.c+17−10
@@ -321,21 +321,28 @@ static av_cold int channelmap_init(AVFilterContext *ctx) · 320 unmodified lines
321321 return 0;
322322 }
323323
324−static int channelmap_query_formats(AVFilterContext *ctx)
324+static int channelmap_query_formats(const AVFilterContext *ctx,
325+ AVFilterFormatsConfig **cfg_in,
326+ AVFilterFormatsConfig **cfg_out)
325327 {
326− ChannelMapContext *s = ctx->priv;
328+ const ChannelMapContext *s = ctx->priv;
327329 AVFilterChannelLayouts *channel_layouts = NULL;
330+
328331 int ret;
329332
330− if ((ret = ff_set_common_formats (ctx, ff_planar_sample_fmts())) < 0 ||
331− (ret = ff_set_common_all_samplerates(ctx )) < 0 ||
332− (ret = ff_add_channel_layout(&channel_layouts, &s->output_layout)) < 0 ||
333− (ret = ff_channel_layouts_ref(channel_layouts,
334− &ctx->outputs[0]->incfg.channel_layouts)) < 0)
333+ ret = ff_set_common_formats2(ctx, cfg_in, cfg_out, ff_planar_sample_fmts());
334+ if (ret < 0)
335+ return ret;
336+
337+ ret = ff_add_channel_layout(&channel_layouts, &s->output_layout);
338+ if (ret < 0)
339+ return ret;
340+
341+ ret = ff_channel_layouts_ref(channel_layouts, &cfg_out[0]->channel_layouts);
342+ if (ret < 0)
335343 return ret;
336344
337− return ff_channel_layouts_ref(ff_all_channel_counts(),
338− &ctx->inputs[0]->outcfg.channel_layouts);
345+ return 0;
339346 }
340347
341348 static int channelmap_filter_frame(AVFilterLink *inlink, AVFrame *buf)
@@ -425,5 +432,5 @@ const AVFilter ff_af_channelmap = { · 83 unmodified lines
425432 .priv_class = &channelmap_class,
426433 FILTER_INPUTS(avfilter_af_channelmap_inputs),
427434 FILTER_OUTPUTS(ff_audio_default_filterpad),
428− FILTER_QUERY_FUNC(channelmap_query_formats),
435+ FILTER_QUERY_FUNC2(channelmap_query_formats),
429436 };

Keyboard shortcuts

General

Show keyboard shortcuts
?
Focus the current search
/

Issues and pull requests

Open filters
f

Issues, pull requests and Inbox

Select next item
j↓
Select previous item
k↑
Open selected item
Enter
Dismiss filters or clear selection
Esc

Repository code

Go to file
t