Also, drop redundant calls that also happen implicitly in generic code.
Showing the changes to libavfilter (1 of 1 file). Show all
Unified · Split
| @@ -321,21 +321,28 @@ static av_cold int channelmap_init(AVFilterContext *ctx) · 320 unmodified lines | ||
| 321 | 321 | return 0; |
| 322 | 322 | } |
| 323 | 323 | |
| 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) | |
| 325 | 327 | { |
| 326 | − ChannelMapContext *s = ctx->priv; | |
| 328 | + const ChannelMapContext *s = ctx->priv; | |
| 327 | 329 | AVFilterChannelLayouts *channel_layouts = NULL; |
| 330 | + | |
| 328 | 331 | int ret; |
| 329 | 332 | |
| 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) | |
| 335 | 343 | return ret; |
| 336 | 344 | |
| 337 | − return ff_channel_layouts_ref(ff_all_channel_counts(), | |
| 338 | − &ctx->inputs[0]->outcfg.channel_layouts); | |
| 345 | + return 0; | |
| 339 | 346 | } |
| 340 | 347 | |
| 341 | 348 | static int channelmap_filter_frame(AVFilterLink *inlink, AVFrame *buf) |
| @@ -425,5 +432,5 @@ const AVFilter ff_af_channelmap = { · 83 unmodified lines | ||
| 425 | 432 | .priv_class = &channelmap_class, |
| 426 | 433 | FILTER_INPUTS(avfilter_af_channelmap_inputs), |
| 427 | 434 | FILTER_OUTPUTS(ff_audio_default_filterpad), |
| 428 | − FILTER_QUERY_FUNC(channelmap_query_formats), | |
| 435 | + FILTER_QUERY_FUNC2(channelmap_query_formats), | |
| 429 | 436 | }; |