audio_channel_in/out_mask_from_count

Change-Id: I879d188cf64ea1dbfa1a0574dee77119c2b08e26
This commit is contained in:
Glenn Kasten 2012-03-14 13:45:31 -07:00
parent 1a87808b30
commit 89f7ba3df8
1 changed files with 15 additions and 2 deletions

View File

@ -384,7 +384,7 @@ static inline bool audio_is_output_channel(uint32_t channel)
return false;
}
/* Derive a channel mask from a channel count.
/* Derive an output channel mask 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,
* and not stereo + FC + mono surround. A channel count of 3 is arbitrarily mapped to stereo + FC
@ -392,7 +392,7 @@ static inline bool audio_is_output_channel(uint32_t channel)
* Returns the matching channel mask, or 0 if the number of channels exceeds that of the
* configurations for which a default channel mask is defined.
*/
static inline audio_channel_mask_t audio_channel_mask_from_count(uint32_t channel_count)
static inline audio_channel_mask_t audio_channel_out_mask_from_count(uint32_t channel_count)
{
switch(channel_count) {
case 1:
@ -416,6 +416,19 @@ static inline audio_channel_mask_t audio_channel_mask_from_count(uint32_t channe
}
}
/* Similar to above, but for input. Currently handles only mono and stereo. */
static inline audio_channel_mask_t audio_channel_in_mask_from_count(uint32_t channel_count)
{
switch (channel_count) {
case 1:
return AUDIO_CHANNEL_IN_MONO;
case 2:
return AUDIO_CHANNEL_IN_STEREO;
default:
return 0;
}
}
static inline bool audio_is_valid_format(audio_format_t format)
{
switch (format & AUDIO_FORMAT_MAIN_MASK) {