alsa/0015-PCM-Add-snd_pcm_chmap_long_name.patch
Takashi Iwai 8a90d87ca6 Accepting request 138456 from home:tiwai:branches:multimedia:libs
- backport from upstream tree:
  * lots of patches to support the new chmap API
  * fix segfault in rate plugin error path
  * add a couple of test programs
  * fix inifinte loop in htimestamp of dmix & co

OBS-URL: https://build.opensuse.org/request/show/138456
OBS-URL: https://build.opensuse.org/package/show/multimedia:libs/alsa?expand=0&rev=113
2012-10-17 08:17:46 +00:00

66 lines
2.1 KiB
Diff

From 25f3259b48e921886bda58075936de3d53b84bc1 Mon Sep 17 00:00:00 2001
From: Takashi Iwai <tiwai@suse.de>
Date: Tue, 11 Sep 2012 12:48:46 +0200
Subject: [PATCH 15/30] PCM: Add snd_pcm_chmap_long_name()
Just return a more verbose name than snd_pcm_chmap_name(), but
including white spaces.
Signed-off-by: Takashi Iwai <tiwai@suse.de>
---
include/pcm.h | 1 +
src/pcm/pcm.c | 32 ++++++++++++++++++++++++++++++++
2 files changed, 33 insertions(+)
--- a/include/pcm.h
+++ b/include/pcm.h
@@ -539,6 +539,7 @@ int snd_pcm_set_chmap(snd_pcm_t *pcm, co
const char *snd_pcm_chmap_type_name(enum snd_pcm_chmap_type val);
const char *snd_pcm_chmap_name(enum snd_pcm_chmap_position val);
+const char *snd_pcm_chmap_long_name(enum snd_pcm_chmap_position val);
int snd_pcm_chmap_print(const snd_pcm_chmap_t *map, size_t maxlen, char *buf);
unsigned int snd_pcm_chmap_from_string(const char *str);
snd_pcm_chmap_t *snd_pcm_chmap_parse_string(const char *str);
--- a/src/pcm/pcm.c
+++ b/src/pcm/pcm.c
@@ -7395,6 +7395,38 @@ const char *snd_pcm_chmap_name(enum snd_
return NULL;
}
+static const char *chmap_long_names[SND_CHMAP_LAST + 1] = {
+ [SND_CHMAP_UNKNOWN] = "Unknown",
+ [SND_CHMAP_FL] = "Front Left",
+ [SND_CHMAP_FR] = "Front Right",
+ [SND_CHMAP_RL] = "Rear Left",
+ [SND_CHMAP_RR] = "Rear Right",
+ [SND_CHMAP_FC] = "Front Center",
+ [SND_CHMAP_LFE] = "LFE",
+ [SND_CHMAP_SL] = "Side Left",
+ [SND_CHMAP_SR] = "Side Right",
+ [SND_CHMAP_RC] = "Rear Center",
+ [SND_CHMAP_FLC] = "Front Left Center",
+ [SND_CHMAP_FRC] = "Front Right Center",
+ [SND_CHMAP_RLC] = "Rear Left Center",
+ [SND_CHMAP_RRC] = "Rear Right Center",
+ [SND_CHMAP_FLW] = "Front Left Wide",
+ [SND_CHMAP_FRW] = "Front Right Wide",
+ [SND_CHMAP_FLH] = "Front Left High",
+ [SND_CHMAP_FCH] = "Front Center High",
+ [SND_CHMAP_FRH] = "Front Right High",
+ [SND_CHMAP_TC] = "Top Center",
+ [SND_CHMAP_NA] = "Unused",
+};
+
+const char *snd_pcm_chmap_long_name(enum snd_pcm_chmap_position val)
+{
+ if (val <= SND_CHMAP_LAST)
+ return chmap_long_names[val];
+ else
+ return NULL;
+}
+
int snd_pcm_chmap_print(const snd_pcm_chmap_t *map, size_t maxlen, char *buf)
{
unsigned int i, len = 0;