From ea8de109af46ae8e6751217977ae8f7becf94ba5 Mon Sep 17 00:00:00 2001 From: Stefano Sabatini Date: Thu, 18 Aug 2011 15:26:21 +0200 Subject: lavfi: add avfilter_all_channel_layouts public symbol This list is mainly useful to be directly used as a parameter by the audio sink buffer, when there is no need to force a specific channel layout. The list of formats is generated programmatically, and avoids channel layouts not supported by libavfilter (with more than 8 channels). We preferred to avoid compile-time generation in order to avoid some unnecessary complexity (build hacks, generating code maintainance etc.). A more compact way to express this list through the use of macros should be possible when libavfilter will support more than 8 channels, as there will be no need to filter out channel layouts with more than 8 channels. See thread: Subject: [FFmpeg-devel] [PATCH] lavfi: add ff_all_channel_layouts internal symbol Date: Sat, 20 Aug 2011 15:33:16 +0200 --- libavfilter/formats.c | 41 ++++++++++++++++++++++++----------------- 1 file changed, 24 insertions(+), 17 deletions(-) (limited to 'libavfilter/formats.c') diff --git a/libavfilter/formats.c b/libavfilter/formats.c index 0efa1aad77..33be69bedd 100644 --- a/libavfilter/formats.c +++ b/libavfilter/formats.c @@ -160,25 +160,14 @@ AVFilterFormats *avfilter_make_all_formats(enum AVMediaType type) return ret; } +const int64_t avfilter_all_channel_layouts[] = { +#include "all_channel_layouts.h" + -1 +}; + AVFilterFormats *avfilter_make_all_channel_layouts(void) { - static int64_t chlayouts[] = { - AV_CH_LAYOUT_MONO, - AV_CH_LAYOUT_STEREO, - AV_CH_LAYOUT_4POINT0, - AV_CH_LAYOUT_QUAD, - AV_CH_LAYOUT_5POINT0, - AV_CH_LAYOUT_5POINT0_BACK, - AV_CH_LAYOUT_5POINT1, - AV_CH_LAYOUT_5POINT1_BACK, - AV_CH_LAYOUT_5POINT1|AV_CH_LAYOUT_STEREO_DOWNMIX, - AV_CH_LAYOUT_7POINT1, - AV_CH_LAYOUT_7POINT1_WIDE, - AV_CH_LAYOUT_7POINT1|AV_CH_LAYOUT_STEREO_DOWNMIX, - -1, - }; - - return avfilter_make_format64_list(chlayouts); + return avfilter_make_format64_list(avfilter_all_channel_layouts); } AVFilterFormats *avfilter_make_all_packing_formats(void) @@ -317,3 +306,21 @@ int ff_parse_packing_format(int *ret, const char *arg, void *log_ctx) return 0; } +#ifdef TEST + +#undef printf + +int main(void) +{ + const int64_t *cl; + char buf[512]; + + for (cl = avfilter_all_channel_layouts_int64; *cl != -1; cl++) { + av_get_channel_layout_string(buf, sizeof(buf), -1, *cl); + printf("%s\n", buf); + } + + return 0; +} + +#endif -- cgit v1.2.3