lavfi/af_sofalizer: convert to query_func2()

This commit is contained in:
Anton Khirnov 2024-09-04 15:11:22 +02:00
parent 449f670a14
commit 4c4199758c
1 changed files with 9 additions and 7 deletions

View File

@ -634,9 +634,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)
{
struct SOFAlizerContext *s = ctx->priv;
const SOFAlizerContext *s = ctx->priv;
AVFilterChannelLayouts *layouts = NULL;
int ret, sample_rates[] = { 48000, -1 };
static const enum AVSampleFormat sample_fmts[] = {
@ -644,7 +646,7 @@ static int query_formats(AVFilterContext *ctx)
AV_SAMPLE_FMT_NONE
};
ret = ff_set_common_formats_from_list(ctx, sample_fmts);
ret = ff_set_common_formats_from_list2(ctx, cfg_in, cfg_out, sample_fmts);
if (ret)
return ret;
@ -652,7 +654,7 @@ static int query_formats(AVFilterContext *ctx)
if (!layouts)
return AVERROR(ENOMEM);
ret = ff_channel_layouts_ref(layouts, &ctx->inputs[0]->outcfg.channel_layouts);
ret = ff_channel_layouts_ref(layouts, &cfg_in[0]->channel_layouts);
if (ret)
return ret;
@ -661,12 +663,12 @@ static int query_formats(AVFilterContext *ctx)
if (ret)
return ret;
ret = ff_channel_layouts_ref(layouts, &ctx->outputs[0]->incfg.channel_layouts);
ret = ff_channel_layouts_ref(layouts, &cfg_out[0]->channel_layouts);
if (ret)
return ret;
sample_rates[0] = s->sample_rate;
return ff_set_common_samplerates_from_list(ctx, sample_rates);
return ff_set_common_samplerates_from_list2(ctx, cfg_in, cfg_out, sample_rates);
}
static int getfilter_float(AVFilterContext *ctx, float x, float y, float z,
@ -1096,6 +1098,6 @@ const AVFilter ff_af_sofalizer = {
.uninit = uninit,
FILTER_INPUTS(inputs),
FILTER_OUTPUTS(ff_audio_default_filterpad),
FILTER_QUERY_FUNC(query_formats),
FILTER_QUERY_FUNC2(query_formats),
.flags = AVFILTER_FLAG_SLICE_THREADS,
};