lavfi/af_sofalizer: convert to query_func2()

release/7.1
Anton Khirnov 4 months ago
parent 449f670a14
commit 4c4199758c
  1. 16
      libavfilter/af_sofalizer.c

@ -634,9 +634,11 @@ static int activate(AVFilterContext *ctx)
return FFERROR_NOT_READY; 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; AVFilterChannelLayouts *layouts = NULL;
int ret, sample_rates[] = { 48000, -1 }; int ret, sample_rates[] = { 48000, -1 };
static const enum AVSampleFormat sample_fmts[] = { static const enum AVSampleFormat sample_fmts[] = {
@ -644,7 +646,7 @@ static int query_formats(AVFilterContext *ctx)
AV_SAMPLE_FMT_NONE 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) if (ret)
return ret; return ret;
@ -652,7 +654,7 @@ static int query_formats(AVFilterContext *ctx)
if (!layouts) if (!layouts)
return AVERROR(ENOMEM); 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) if (ret)
return ret; return ret;
@ -661,12 +663,12 @@ static int query_formats(AVFilterContext *ctx)
if (ret) if (ret)
return 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) if (ret)
return ret; return ret;
sample_rates[0] = s->sample_rate; 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, static int getfilter_float(AVFilterContext *ctx, float x, float y, float z,
@ -1096,6 +1098,6 @@ const AVFilter ff_af_sofalizer = {
.uninit = uninit, .uninit = uninit,
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_SLICE_THREADS, .flags = AVFILTER_FLAG_SLICE_THREADS,
}; };

Loading…
Cancel
Save