diff options
author | Glenn Kasten <gkasten@google.com> | 2015-06-08 16:37:40 -0700 |
---|---|---|
committer | Glenn Kasten <gkasten@google.com> | 2015-06-08 16:38:13 -0700 |
commit | 21aa43a5ea032080aee301abc60780887f94665f (patch) | |
tree | 8469fc56001a93e30718ef80b4133fe10697e2f5 /audio/include | |
parent | 7baada2795d6d050d9d86f92ab2ebcfa870b043e (diff) | |
download | android_system_media-21aa43a5ea032080aee301abc60780887f94665f.tar.gz android_system_media-21aa43a5ea032080aee301abc60780887f94665f.tar.bz2 android_system_media-21aa43a5ea032080aee301abc60780887f94665f.zip |
Move audio_channel_mask_for_index_assignment_from_count
Change-Id: I737b9cf9fdaa56eb8be33ea128c73a00ca2c8907
Diffstat (limited to 'audio/include')
-rw-r--r-- | audio/include/system/audio.h | 38 |
1 files changed, 19 insertions, 19 deletions
diff --git a/audio/include/system/audio.h b/audio/include/system/audio.h index 26b44a36..a4a557b4 100644 --- a/audio/include/system/audio.h +++ b/audio/include/system/audio.h @@ -1223,6 +1223,25 @@ static inline uint32_t audio_channel_count_from_out_mask(audio_channel_mask_t ch } } +/* Derive a channel mask for index assignment from a channel count. + * Returns the matching channel mask, + * or AUDIO_CHANNEL_NONE if the channel count is zero, + * or AUDIO_CHANNEL_INVALID if the channel count exceeds AUDIO_CHANNEL_COUNT_MAX. + */ +static inline audio_channel_mask_t audio_channel_mask_for_index_assignment_from_count( + uint32_t channel_count) +{ + if (channel_count == 0) { + return AUDIO_CHANNEL_NONE; + } + if (channel_count > AUDIO_CHANNEL_COUNT_MAX) { + return AUDIO_CHANNEL_INVALID; + } + uint32_t bits = (1 << channel_count) - 1; + return audio_channel_mask_from_representation_and_bits( + AUDIO_CHANNEL_REPRESENTATION_INDEX, bits); +} + /* Derive an output channel mask for position assignment from a channel count. * This is to be used when the content channel mask is unknown. The 1, 2, 4, 5, 6, 7 and 8 channel * cases are mapped to the standard game/home-theater layouts, but note that 4 is mapped to quad, @@ -1297,25 +1316,6 @@ static inline audio_channel_mask_t audio_channel_in_mask_from_count(uint32_t cha AUDIO_CHANNEL_REPRESENTATION_POSITION, bits); } -/* Derive a channel mask for index assignment from a channel count. - * Returns the matching channel mask, - * or AUDIO_CHANNEL_NONE if the channel count is zero, - * or AUDIO_CHANNEL_INVALID if the channel count exceeds AUDIO_CHANNEL_COUNT_MAX. - */ -static inline audio_channel_mask_t audio_channel_mask_for_index_assignment_from_count( - uint32_t channel_count) -{ - if (channel_count == 0) { - return AUDIO_CHANNEL_NONE; - } - if (channel_count > AUDIO_CHANNEL_COUNT_MAX) { - return AUDIO_CHANNEL_INVALID; - } - uint32_t bits = (1 << channel_count) - 1; - return audio_channel_mask_from_representation_and_bits( - AUDIO_CHANNEL_REPRESENTATION_INDEX, bits); -} - static inline bool audio_is_valid_format(audio_format_t format) { switch (format & AUDIO_FORMAT_MAIN_MASK) { |