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/formats.h | |
parent | 55d9d6767967794edcdd6e1bbd8840fc6f4e9315 (diff) | |
download | ffmpeg-18ec426a861c1a9a2072080796dff146bafecb53.tar.gz |
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/formats.h')
-rw-r--r-- | libavfilter/formats.h | 29 |
1 files changed, 29 insertions, 0 deletions
diff --git a/libavfilter/formats.h b/libavfilter/formats.h index 65acc939e3..ecbbf1ff8f 100644 --- a/libavfilter/formats.h +++ b/libavfilter/formats.h @@ -164,9 +164,32 @@ AVFilterChannelLayouts *ff_make_format64_list(const int64_t *fmts); av_warn_unused_result int ff_set_common_channel_layouts(AVFilterContext *ctx, AVFilterChannelLayouts *layouts); +/** + * Equivalent to ff_set_common_channel_layouts(ctx, ff_make_format64_list(fmts)) + */ +av_warn_unused_result +int ff_set_common_channel_layouts_from_list(AVFilterContext *ctx, + const int64_t *fmts); +/** + * Equivalent to ff_set_common_channel_layouts(ctx, ff_all_channel_counts()) + */ +av_warn_unused_result +int ff_set_common_all_channel_counts(AVFilterContext *ctx); + av_warn_unused_result int ff_set_common_samplerates(AVFilterContext *ctx, AVFilterFormats *samplerates); +/** + * Equivalent to ff_set_common_samplerates(ctx, ff_make_format_list(samplerates)) + */ +av_warn_unused_result +int ff_set_common_samplerates_from_list(AVFilterContext *ctx, + const int *samplerates); +/** + * Equivalent to ff_set_common_samplerates(ctx, ff_all_samplerates()) + */ +av_warn_unused_result +int ff_set_common_all_samplerates(AVFilterContext *ctx); /** * A helper for query_formats() which sets all links to the same list of @@ -176,6 +199,12 @@ int ff_set_common_samplerates(AVFilterContext *ctx, av_warn_unused_result int ff_set_common_formats(AVFilterContext *ctx, AVFilterFormats *formats); +/** + * Equivalent to ff_set_common_formats(ctx, ff_make_format_list(fmts)) + */ +av_warn_unused_result +int ff_set_common_formats_from_list(AVFilterContext *ctx, const int *fmts); + av_warn_unused_result int ff_add_channel_layout(AVFilterChannelLayouts **l, uint64_t channel_layout); |