diff options
author | Andy Hung <hunga@google.com> | 2015-06-12 11:26:54 -0700 |
---|---|---|
committer | Andy Hung <hunga@google.com> | 2015-06-12 11:26:54 -0700 |
commit | e7d87cb8c4440080189fdacc98225762ab8e7662 (patch) | |
tree | c546b392fb4a632f0a8888e703a87f9f0cfcc152 /alsa_utils | |
parent | b0f6afbaf89b20530bc733def877fd4b862f54d5 (diff) | |
download | android_system_media-e7d87cb8c4440080189fdacc98225762ab8e7662.tar.gz android_system_media-e7d87cb8c4440080189fdacc98225762ab8e7662.tar.bz2 android_system_media-e7d87cb8c4440080189fdacc98225762ab8e7662.zip |
Update USB alsa to only use channel index masks for multichannel
Bug: 16245854
Change-Id: I76b15c0ee3785fb6cd0af8b016ad1b41895801d3
Diffstat (limited to 'alsa_utils')
-rw-r--r-- | alsa_utils/alsa_device_profile.c | 14 | ||||
-rw-r--r-- | alsa_utils/include/alsa_device_profile.h | 2 |
2 files changed, 12 insertions, 4 deletions
diff --git a/alsa_utils/alsa_device_profile.c b/alsa_utils/alsa_device_profile.c index 9e5b8821..c9f8f998 100644 --- a/alsa_utils/alsa_device_profile.c +++ b/alsa_utils/alsa_device_profile.c @@ -280,7 +280,8 @@ end: static unsigned profile_enum_channel_counts(alsa_device_profile* profile, unsigned min, unsigned max) { - static const unsigned std_channel_counts[] = {8, 4, 2, 1}; + /* modify alsa_device_profile.h if you change the std_channel_counts[] array. */ + static const unsigned std_channel_counts[] = {8, 7, 6, 5, 4, 3, 2, 1}; unsigned num_counts = 0; unsigned index; @@ -454,6 +455,8 @@ char * profile_get_format_strs(alsa_device_profile* profile) char * profile_get_channel_count_strs(alsa_device_profile* profile) { + // FIXME implicit fixed channel count assumption here (FCC_8). + // we use only the canonical even number channel position masks. static const char * const out_chans_strs[] = { /* 0 */"AUDIO_CHANNEL_NONE", /* will never be taken as this is a terminator */ /* 1 */"AUDIO_CHANNEL_OUT_MONO", @@ -463,7 +466,7 @@ char * profile_get_channel_count_strs(alsa_device_profile* profile) /* 5 */ /* "AUDIO_CHANNEL_OUT_QUAD|AUDIO_CHANNEL_OUT_FRONT_CENTER" */ NULL, /* 6 */"AUDIO_CHANNEL_OUT_5POINT1", /* 7 */ /* "AUDIO_CHANNEL_OUT_5POINT1|AUDIO_CHANNEL_OUT_BACK_CENTER" */ NULL, - /* 8 */ "AUDIO_CHANNEL_OUT_7POINT1", + /* 8 */"AUDIO_CHANNEL_OUT_7POINT1", /* channel counts greater than this not considered */ }; @@ -505,6 +508,9 @@ char * profile_get_channel_count_strs(alsa_device_profile* profile) * USB Audio Devices may only announce support for MONO (a headset mic for example), or * The total number of output channels. SO, if the device itself doesn't explicitly * support STEREO, append to the channel config strings we are generating. + * + * The MONO and STEREO positional channel masks are provided for legacy compatibility. + * For multichannel (n > 2) we only expose channel index masks. */ // Always support stereo curStrLen = strlcat(buffer, chans_strs[2], buffSize); @@ -514,9 +520,11 @@ char * profile_get_channel_count_strs(alsa_device_profile* profile) for (index = 0; (channel_count = profile->channel_counts[index]) != 0; index++) { + + /* we only show positional information for mono (stereo handled already) */ if (channel_count < chans_strs_size && chans_strs[channel_count] != NULL - && channel_count != 2 /* stereo already supported */) { + && channel_count < 2 /* positional only for fewer than 2 channels */) { // account for the '|' and the '\0' if (buffSize - curStrLen < strlen(chans_strs[channel_count]) + 2) { /* we don't have room for another, so bail at this point rather than diff --git a/alsa_utils/include/alsa_device_profile.h b/alsa_utils/include/alsa_device_profile.h index 4de8998e..5520b8a7 100644 --- a/alsa_utils/include/alsa_device_profile.h +++ b/alsa_utils/include/alsa_device_profile.h @@ -27,7 +27,7 @@ #define MAX_PROFILE_SAMPLE_RATES 14 /* this number needs to be 1 more than the number of * sample rates in std_sample_rates[] * (in alsa_device_profile.c) */ -#define MAX_PROFILE_CHANNEL_COUNTS 5 /* this number need to be 1 more than the number of +#define MAX_PROFILE_CHANNEL_COUNTS 9 /* this number need to be 1 more than the number of * standard channel formats in std_channel_counts[] * (in alsa_device_profile.c) */ |