mirror of
https://github.com/FFmpeg/FFmpeg.git
synced 2024-12-23 12:43:46 +02:00
lavfi/af_afir: convert to query_func2()
Drop redundant ff_set_common_all_channel_counts() / ff_set_common_all_samplerates() calls, since those happen implicitly in generic code.
This commit is contained in:
parent
584be51334
commit
dc488d832c
@ -539,9 +539,11 @@ static int activate(AVFilterContext *ctx)
|
||||
return FFERROR_NOT_READY;
|
||||
}
|
||||
|
||||
static int query_formats(AVFilterContext *ctx)
|
||||
static int query_formats(const AVFilterContext *ctx,
|
||||
AVFilterFormatsConfig **cfg_in,
|
||||
AVFilterFormatsConfig **cfg_out)
|
||||
{
|
||||
AudioFIRContext *s = ctx->priv;
|
||||
const AudioFIRContext *s = ctx->priv;
|
||||
static const enum AVSampleFormat sample_fmts[3][3] = {
|
||||
{ AV_SAMPLE_FMT_FLTP, AV_SAMPLE_FMT_DBLP, AV_SAMPLE_FMT_NONE },
|
||||
{ AV_SAMPLE_FMT_FLTP, AV_SAMPLE_FMT_NONE },
|
||||
@ -549,32 +551,29 @@ static int query_formats(AVFilterContext *ctx)
|
||||
};
|
||||
int ret;
|
||||
|
||||
if (s->ir_format) {
|
||||
ret = ff_set_common_all_channel_counts(ctx);
|
||||
if (ret < 0)
|
||||
return ret;
|
||||
} else {
|
||||
if (!s->ir_format) {
|
||||
AVFilterChannelLayouts *mono = NULL;
|
||||
AVFilterChannelLayouts *layouts = ff_all_channel_counts();
|
||||
|
||||
if ((ret = ff_channel_layouts_ref(layouts, &ctx->inputs[0]->outcfg.channel_layouts)) < 0)
|
||||
if ((ret = ff_channel_layouts_ref(layouts, &cfg_in[0]->channel_layouts)) < 0)
|
||||
return ret;
|
||||
if ((ret = ff_channel_layouts_ref(layouts, &ctx->outputs[0]->incfg.channel_layouts)) < 0)
|
||||
if ((ret = ff_channel_layouts_ref(layouts, &cfg_out[0]->channel_layouts)) < 0)
|
||||
return ret;
|
||||
|
||||
ret = ff_add_channel_layout(&mono, &(AVChannelLayout)AV_CHANNEL_LAYOUT_MONO);
|
||||
if (ret)
|
||||
return ret;
|
||||
for (int i = 1; i < ctx->nb_inputs; i++) {
|
||||
if ((ret = ff_channel_layouts_ref(mono, &ctx->inputs[i]->outcfg.channel_layouts)) < 0)
|
||||
if ((ret = ff_channel_layouts_ref(mono, &cfg_in[i]->channel_layouts)) < 0)
|
||||
return ret;
|
||||
}
|
||||
}
|
||||
|
||||
if ((ret = ff_set_common_formats_from_list(ctx, sample_fmts[s->precision])) < 0)
|
||||
if ((ret = ff_set_common_formats_from_list2(ctx, cfg_in, cfg_out,
|
||||
sample_fmts[s->precision])) < 0)
|
||||
return ret;
|
||||
|
||||
return ff_set_common_all_samplerates(ctx);
|
||||
return 0;
|
||||
}
|
||||
|
||||
static int config_output(AVFilterLink *outlink)
|
||||
@ -783,7 +782,7 @@ const AVFilter ff_af_afir = {
|
||||
.description = NULL_IF_CONFIG_SMALL("Apply Finite Impulse Response filter with supplied coefficients in additional stream(s)."),
|
||||
.priv_size = sizeof(AudioFIRContext),
|
||||
.priv_class = &afir_class,
|
||||
FILTER_QUERY_FUNC(query_formats),
|
||||
FILTER_QUERY_FUNC2(query_formats),
|
||||
FILTER_OUTPUTS(outputs),
|
||||
.init = init,
|
||||
.activate = activate,
|
||||
|
Loading…
Reference in New Issue
Block a user