lavfi/avf_avectorscope: switch to query_func2()

Also, drop redundant calls that also happen implicitly in generic code.
This commit is contained in:
Anton Khirnov 2024-09-11 12:21:46 +02:00
parent 55c1cb847c
commit a36cea452f

View File

@ -230,28 +230,29 @@ static int fade(AVFilterContext *ctx, void *arg, int jobnr, int nb_jobs)
return 0;
}
static int query_formats(AVFilterContext *ctx)
static int query_formats(const AVFilterContext *ctx,
AVFilterFormatsConfig **cfg_in,
AVFilterFormatsConfig **cfg_out)
{
AVFilterFormats *formats = NULL;
AVFilterChannelLayouts *layout = NULL;
AVFilterLink *inlink = ctx->inputs[0];
AVFilterLink *outlink = ctx->outputs[0];
static const enum AVSampleFormat sample_fmts[] = { AV_SAMPLE_FMT_S16, AV_SAMPLE_FMT_FLT, AV_SAMPLE_FMT_NONE };
static const enum AVPixelFormat pix_fmts[] = { AV_PIX_FMT_RGBA, AV_PIX_FMT_NONE };
static const AVChannelLayout layouts[] = {
AV_CHANNEL_LAYOUT_STEREO,
{ .nb_channels = 0 },
};
int ret;
formats = ff_make_format_list(sample_fmts);
if ((ret = ff_formats_ref (formats, &inlink->outcfg.formats )) < 0 ||
(ret = ff_add_channel_layout (&layout, &(AVChannelLayout)AV_CHANNEL_LAYOUT_STEREO)) < 0 ||
(ret = ff_channel_layouts_ref (layout , &inlink->outcfg.channel_layouts)) < 0)
if ((ret = ff_formats_ref (formats, &cfg_in[0]->formats )) < 0)
return ret;
formats = ff_all_samplerates();
if ((ret = ff_formats_ref(formats, &inlink->outcfg.samplerates)) < 0)
ret = ff_set_common_channel_layouts_from_list2(ctx, cfg_in, cfg_out, layouts);
if (ret < 0)
return ret;
formats = ff_make_format_list(pix_fmts);
if ((ret = ff_formats_ref(formats, &outlink->incfg.formats)) < 0)
if ((ret = ff_formats_ref(formats, &cfg_out[0]->formats)) < 0)
return ret;
return 0;
@ -493,7 +494,7 @@ const AVFilter ff_avf_avectorscope = {
.activate = activate,
FILTER_INPUTS(audiovectorscope_inputs),
FILTER_OUTPUTS(audiovectorscope_outputs),
FILTER_QUERY_FUNC(query_formats),
FILTER_QUERY_FUNC2(query_formats),
.priv_class = &avectorscope_class,
.flags = AVFILTER_FLAG_SLICE_THREADS,
.process_command = ff_filter_process_command,