lavfi/af_virtualbass: convert to query_func2()

Also, drop redundant calls that also happen implicitly in generic code.
release/7.1
Anton Khirnov 4 months ago
parent 7887d00ee6
commit 2ee4625d4b
  1. 26
      libavfilter/af_virtualbass.c

@ -48,21 +48,29 @@ static const AVOption virtualbass_options[] = {
AVFILTER_DEFINE_CLASS(virtualbass); AVFILTER_DEFINE_CLASS(virtualbass);
static int query_formats(AVFilterContext *ctx) static int query_formats(const AVFilterContext *ctx,
AVFilterFormatsConfig **cfg_in,
AVFilterFormatsConfig **cfg_out)
{ {
static const enum AVSampleFormat formats[] = {
AV_SAMPLE_FMT_DBLP,
AV_SAMPLE_FMT_NONE,
};
AVFilterChannelLayouts *in_layout = NULL, *out_layout = NULL; AVFilterChannelLayouts *in_layout = NULL, *out_layout = NULL;
AVFilterFormats *formats = NULL;
int ret; int ret;
if ((ret = ff_add_format (&formats, AV_SAMPLE_FMT_DBLP )) < 0 || ret = ff_set_common_formats_from_list2(ctx, cfg_in, cfg_out, formats);
(ret = ff_set_common_formats (ctx, formats )) < 0 || if (ret < 0)
(ret = ff_add_channel_layout (&in_layout, &(AVChannelLayout)AV_CHANNEL_LAYOUT_STEREO)) < 0 || return ret;
(ret = ff_channel_layouts_ref(in_layout, &ctx->inputs[0]->outcfg.channel_layouts)) < 0 ||
if ((ret = ff_add_channel_layout (&in_layout, &(AVChannelLayout)AV_CHANNEL_LAYOUT_STEREO)) < 0 ||
(ret = ff_channel_layouts_ref(in_layout, &cfg_in[0]->channel_layouts)) < 0 ||
(ret = ff_add_channel_layout (&out_layout, &(AVChannelLayout)AV_CHANNEL_LAYOUT_2POINT1)) < 0 || (ret = ff_add_channel_layout (&out_layout, &(AVChannelLayout)AV_CHANNEL_LAYOUT_2POINT1)) < 0 ||
(ret = ff_channel_layouts_ref(out_layout, &ctx->outputs[0]->incfg.channel_layouts)) < 0) (ret = ff_channel_layouts_ref(out_layout, &cfg_out[0]->channel_layouts)) < 0)
return ret; return ret;
return ff_set_common_all_samplerates(ctx); return 0;
} }
static int config_input(AVFilterLink *inlink) static int config_input(AVFilterLink *inlink)
@ -170,7 +178,7 @@ const AVFilter ff_af_virtualbass = {
.priv_class = &virtualbass_class, .priv_class = &virtualbass_class,
FILTER_INPUTS(inputs), FILTER_INPUTS(inputs),
FILTER_OUTPUTS(ff_audio_default_filterpad), FILTER_OUTPUTS(ff_audio_default_filterpad),
FILTER_QUERY_FUNC(query_formats), FILTER_QUERY_FUNC2(query_formats),
.flags = AVFILTER_FLAG_SUPPORT_TIMELINE_INTERNAL, .flags = AVFILTER_FLAG_SUPPORT_TIMELINE_INTERNAL,
.process_command = ff_filter_process_command, .process_command = ff_filter_process_command,
}; };

Loading…
Cancel
Save