1
0
mirror of https://github.com/FFmpeg/FFmpeg.git synced 2024-12-23 12:43:46 +02:00

lavfi/avf_aphasemeter: 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 88f3893148
commit 55c1cb847c

View File

@ -90,35 +90,32 @@ static const AVOption aphasemeter_options[] = {
AVFILTER_DEFINE_CLASS(aphasemeter); AVFILTER_DEFINE_CLASS(aphasemeter);
static int query_formats(AVFilterContext *ctx) static int query_formats(const AVFilterContext *ctx,
AVFilterFormatsConfig **cfg_in,
AVFilterFormatsConfig **cfg_out)
{ {
AudioPhaseMeterContext *s = ctx->priv; const AudioPhaseMeterContext *s = ctx->priv;
AVFilterFormats *formats = NULL; 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_FLT, AV_SAMPLE_FMT_NONE }; static const enum AVSampleFormat sample_fmts[] = { AV_SAMPLE_FMT_FLT, AV_SAMPLE_FMT_NONE };
static const enum AVPixelFormat pix_fmts[] = { AV_PIX_FMT_RGBA, AV_PIX_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; int ret;
formats = ff_make_format_list(sample_fmts); formats = ff_make_format_list(sample_fmts);
if ((ret = ff_formats_ref (formats, &inlink->outcfg.formats )) < 0 || if ((ret = ff_formats_ref(formats, &cfg_in[0]->formats)) < 0 ||
(ret = ff_formats_ref (formats, &outlink->incfg.formats )) < 0 || (ret = ff_formats_ref(formats, &cfg_out[0]->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 ||
(ret = ff_channel_layouts_ref (layout , &outlink->incfg.channel_layouts)) < 0)
return ret; return ret;
formats = ff_all_samplerates(); ret = ff_set_common_channel_layouts_from_list2(ctx, cfg_in, cfg_out, layouts);
if ((ret = ff_formats_ref(formats, &inlink->outcfg.samplerates)) < 0 || if (ret < 0)
(ret = ff_formats_ref(formats, &outlink->incfg.samplerates)) < 0)
return ret; return ret;
if (s->do_video) { if (s->do_video) {
AVFilterLink *outlink = ctx->outputs[1];
formats = ff_make_format_list(pix_fmts); 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[1]->formats)) < 0)
return ret; return ret;
} }
@ -440,7 +437,7 @@ const AVFilter ff_avf_aphasemeter = {
FILTER_INPUTS(inputs), FILTER_INPUTS(inputs),
.activate = activate, .activate = activate,
.outputs = NULL, .outputs = NULL,
FILTER_QUERY_FUNC(query_formats), FILTER_QUERY_FUNC2(query_formats),
.priv_class = &aphasemeter_class, .priv_class = &aphasemeter_class,
.flags = AVFILTER_FLAG_DYNAMIC_OUTPUTS, .flags = AVFILTER_FLAG_DYNAMIC_OUTPUTS,
}; };