[alsa-devel] [PATCH 3/3] speaker-test: Show out-of-chmap channels as Unknown
Anssi Hannula
anssi.hannula at iki.fi
Sun Nov 10 19:29:19 CET 2013
Currently speaker-test falls back to ALSA default channel names for
channels out-of-chmap.
This causes e.g. the 4th channel of
$ speaker-test -c4 -Dhdmi -m "FR,FL,FC"
to be shown as "Rear Right".
Change the code to show such channels as Unknown instead, similar to
when snd_pcm_chmap_long_name() does not know the name.
Signed-off-by: Anssi Hannula <anssi.hannula at iki.fi>
---
speaker-test/speaker-test.c | 6 ++++--
1 file changed, 4 insertions(+), 2 deletions(-)
diff --git a/speaker-test/speaker-test.c b/speaker-test/speaker-test.c
index 82cc3b1..8ab5011 100644
--- a/speaker-test/speaker-test.c
+++ b/speaker-test/speaker-test.c
@@ -254,8 +254,10 @@ static int get_speaker_channel(int chn)
static const char *get_channel_name(int chn)
{
#ifdef CONFIG_SUPPORT_CHMAP
- if (channel_map && chn < channel_map->channels) {
- const char *name = snd_pcm_chmap_long_name(channel_map->pos[chn]);
+ if (channel_map) {
+ const char *name = NULL;
+ if (chn < channel_map->channels)
+ name = snd_pcm_chmap_long_name(channel_map->pos[chn]);
return name ? name : "Unknown";
}
#endif
--
1.8.1.5
More information about the Alsa-devel
mailing list