From 18ec426a861c1a9a2072080796dff146bafecb53 Mon Sep 17 00:00:00 2001 From: Andreas Rheinhardt Date: Tue, 10 Aug 2021 01:25:31 +0200 Subject: avfilter/formats: Factor common function combinations out Several combinations of functions happen quite often in query_format functions; e.g. ff_set_common_formats(ctx, ff_make_format_list(sample_fmts)) is very common. This commit therefore adds functions that are equivalent to commonly used function combinations in order to reduce code duplication. Reviewed-by: Nicolas George Signed-off-by: Andreas Rheinhardt --- libavfilter/af_afwtdn.c | 18 +++--------------- 1 file changed, 3 insertions(+), 15 deletions(-) (limited to 'libavfilter/af_afwtdn.c') diff --git a/libavfilter/af_afwtdn.c b/libavfilter/af_afwtdn.c index a23bb902ea..8d67d6458e 100644 --- a/libavfilter/af_afwtdn.c +++ b/libavfilter/af_afwtdn.c @@ -463,31 +463,19 @@ AVFILTER_DEFINE_CLASS(afwtdn); static int query_formats(AVFilterContext *ctx) { - AVFilterFormats *formats = NULL; - AVFilterChannelLayouts *layouts = NULL; static const enum AVSampleFormat sample_fmts[] = { AV_SAMPLE_FMT_DBLP, AV_SAMPLE_FMT_NONE }; - int ret; - - formats = ff_make_format_list(sample_fmts); - if (!formats) - return AVERROR(ENOMEM); - ret = ff_set_common_formats(ctx, formats); + int ret = ff_set_common_formats_from_list(ctx, sample_fmts); if (ret < 0) return ret; - layouts = ff_all_channel_counts(); - if (!layouts) - return AVERROR(ENOMEM); - - ret = ff_set_common_channel_layouts(ctx, layouts); + ret = ff_set_common_all_channel_counts(ctx); if (ret < 0) return ret; - formats = ff_all_samplerates(); - return ff_set_common_samplerates(ctx, formats); + return ff_set_common_all_samplerates(ctx); } #define pow2(x) (1U << (x)) -- cgit v1.2.3