diff options
author | Stefano Sabatini <stefano.sabatini-lala@poste.it> | 2011-08-18 15:26:21 +0200 |
---|---|---|
committer | Stefano Sabatini <stefasab@gmail.com> | 2011-09-16 00:46:41 +0200 |
commit | ea8de109af46ae8e6751217977ae8f7becf94ba5 (patch) | |
tree | 4c579c879fb69ccb0b143ab2df5cc57a3a315681 /libavfilter/formats.c | |
parent | 9899037dc6b246f2eeb7e0255c316749372fe1ae (diff) | |
download | ffmpeg-ea8de109af46ae8e6751217977ae8f7becf94ba5.tar.gz |
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
Diffstat (limited to 'libavfilter/formats.c')
-rw-r--r-- | libavfilter/formats.c | 41 |
1 files changed, 24 insertions, 17 deletions
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 |