1
0
mirror of https://github.com/FFmpeg/FFmpeg.git synced 2024-11-26 19:01:44 +02:00

lavfi/avf_showvolume: switch to query_func2()

Also, drop redundant calls that also happen implicitly in generic code.
This commit is contained in:
Anton Khirnov 2024-09-25 10:40:05 +02:00
parent 197a619371
commit fadd1dda8a

View File

@ -110,30 +110,21 @@ static av_cold int init(AVFilterContext *ctx)
return 0; return 0;
} }
static int query_formats(AVFilterContext *ctx) static int query_formats(const AVFilterContext *ctx,
AVFilterFormatsConfig **cfg_in,
AVFilterFormatsConfig **cfg_out)
{ {
AVFilterFormats *formats = NULL; AVFilterFormats *formats = NULL;
AVFilterChannelLayouts *layouts = NULL;
AVFilterLink *inlink = ctx->inputs[0];
AVFilterLink *outlink = ctx->outputs[0];
static const enum AVSampleFormat sample_fmts[] = { AV_SAMPLE_FMT_FLTP, AV_SAMPLE_FMT_NONE }; static const enum AVSampleFormat sample_fmts[] = { AV_SAMPLE_FMT_FLTP, 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 };
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)
return ret;
layouts = ff_all_channel_counts();
if ((ret = ff_channel_layouts_ref(layouts, &inlink->outcfg.channel_layouts)) < 0)
return ret;
formats = ff_all_samplerates();
if ((ret = ff_formats_ref(formats, &inlink->outcfg.samplerates)) < 0)
return ret; return ret;
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[0]->formats)) < 0)
return ret; return ret;
return 0; return 0;
@ -520,6 +511,6 @@ const AVFilter ff_avf_showvolume = {
.priv_size = sizeof(ShowVolumeContext), .priv_size = sizeof(ShowVolumeContext),
FILTER_INPUTS(showvolume_inputs), FILTER_INPUTS(showvolume_inputs),
FILTER_OUTPUTS(showvolume_outputs), FILTER_OUTPUTS(showvolume_outputs),
FILTER_QUERY_FUNC(query_formats), FILTER_QUERY_FUNC2(query_formats),
.priv_class = &showvolume_class, .priv_class = &showvolume_class,
}; };