speaker-test: Show out-of-chmap channels as Unknown

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@iki.fi>
Signed-off-by: Takashi Iwai <tiwai@suse.de>
This commit is contained in:
Anssi Hannula 2013-11-10 20:29:19 +02:00 committed by Takashi Iwai
parent 5b0c6da0d8
commit 58752c3ae3

View file

@ -267,8 +267,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