diff options
author | Andreas Rheinhardt <andreas.rheinhardt@outlook.com> | 2021-08-10 01:25:31 +0200 |
---|---|---|
committer | Andreas Rheinhardt <andreas.rheinhardt@outlook.com> | 2021-08-13 17:36:22 +0200 |
commit | 18ec426a861c1a9a2072080796dff146bafecb53 (patch) | |
tree | d3d8b683db1ff9b6a46fd6e828e0f4c7c94ed1be /libavfilter/f_streamselect.c | |
parent | 55d9d6767967794edcdd6e1bbd8840fc6f4e9315 (diff) |
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 <george@nsup.org>
Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@outlook.com>
Diffstat (limited to 'libavfilter/f_streamselect.c')
-rw-r--r-- | libavfilter/f_streamselect.c | 10 |
1 files changed, 3 insertions, 7 deletions
diff --git a/libavfilter/f_streamselect.c b/libavfilter/f_streamselect.c index 22eb76d4d7..05a8d5f49a 100644 --- a/libavfilter/f_streamselect.c +++ b/libavfilter/f_streamselect.c @@ -305,8 +305,7 @@ static av_cold void uninit(AVFilterContext *ctx) static int query_formats(AVFilterContext *ctx) { - AVFilterFormats *formats, *rates = NULL; - AVFilterChannelLayouts *layouts = NULL; + AVFilterFormats *formats; int ret, i; for (i = 0; i < ctx->nb_inputs; i++) { @@ -315,11 +314,8 @@ static int query_formats(AVFilterContext *ctx) return ret; if (ctx->inputs[i]->type == AVMEDIA_TYPE_AUDIO) { - rates = ff_all_samplerates(); - if ((ret = ff_set_common_samplerates(ctx, rates)) < 0) - return ret; - layouts = ff_all_channel_counts(); - if ((ret = ff_set_common_channel_layouts(ctx, layouts)) < 0) + if ((ret = ff_set_common_all_samplerates (ctx)) < 0 || + (ret = ff_set_common_all_channel_counts(ctx)) < 0) return ret; } } |