diff options
author | Nicolas George <nicolas.george@normalesup.org> | 2013-01-02 18:11:30 +0400 |
---|---|---|
committer | Nicolas George <nicolas.george@normalesup.org> | 2013-01-26 14:15:38 +0400 |
commit | b6afb2dde1aa92ff8fac020f34fc436fede388b0 (patch) | |
tree | e6b8473fa897d98a0a0aacd9425c9b2a3c4e7f92 /libavfilter/formats.h | |
parent | fccd8c21c40cf004cacaa6b4bf12695ecb014c1b (diff) |
lavfi: support unknown channel layouts.
Diffstat (limited to 'libavfilter/formats.h')
-rw-r--r-- | libavfilter/formats.h | 31 |
1 files changed, 31 insertions, 0 deletions
diff --git a/libavfilter/formats.h b/libavfilter/formats.h index c5a4e3db2b..438267fc16 100644 --- a/libavfilter/formats.h +++ b/libavfilter/formats.h @@ -69,15 +69,46 @@ struct AVFilterFormats { struct AVFilterFormats ***refs; ///< references to this list }; +/** + * A list of supported channel layouts. + * + * The list works the same as AVFilterFormats, except for the following + * differences: + * - A list with all_layouts = 1 means all channel layouts with a known + * disposition; nb_channel_layouts must then be 0. + * - A list with all_counts = 1 means all channel counts, with a known or + * unknown disposition; nb_channel_layouts must then be 0 and all_layouts 1. + * - The list must not contain a layout with a known disposition and a + * channel count with unknown disposition with the same number of channels + * (e.g. AV_CH_LAYOUT_STEREO and FF_COUNT2LAYOUT(2). + */ typedef struct AVFilterChannelLayouts { uint64_t *channel_layouts; ///< list of channel layouts int nb_channel_layouts; ///< number of channel layouts + char all_layouts; ///< accept any known channel layout + char all_counts; ///< accept any channel layout or count unsigned refcount; ///< number of references to this list struct AVFilterChannelLayouts ***refs; ///< references to this list } AVFilterChannelLayouts; /** + * Encode a channel count as a channel layout. + * FF_COUNT2LAYOUT(c) means any channel layout with c channels, with a known + * or unknown disposition. + * The result is only valid inside AVFilterChannelLayouts and immediately + * related functions. + */ +#define FF_COUNT2LAYOUT(c) (0x8000000000000000ULL | (c)) + +/** + * Decode a channel count encoded as a channel layout. + * Return 0 if the channel layout was a real one. + */ +#define FF_LAYOUT2COUNT(l) (((l) & 0x8000000000000000ULL) ? \ + (int)((l) & 0x7FFFFFFF) : 0) + +/** * Return a channel layouts/samplerates list which contains the intersection of * the layouts/samplerates of a and b. Also, all the references of a, all the * references of b, and a and b themselves will be deallocated. |