From f7300682dc0fe9faec94461af6fdcf098047a0d1 Mon Sep 17 00:00:00 2001 From: Takashi Iwai Date: Wed, 12 Sep 2012 18:43:59 +0200 Subject: PCM: Define MONO and other channel map positions Follow the new definitions in the kernel side. MONO and others have been added, and the order of position table was changed again. Signed-off-by: Takashi Iwai --- include/pcm.h | 11 +++++++++-- include/sound/asound.h | 13 ++++++++++--- src/pcm/pcm.c | 14 +++++++++++--- 3 files changed, 30 insertions(+), 8 deletions(-) diff --git a/include/pcm.h b/include/pcm.h index 8129ed34..5fb6130f 100644 --- a/include/pcm.h +++ b/include/pcm.h @@ -489,6 +489,8 @@ enum snd_pcm_chmap_type { /** channel positions */ enum snd_pcm_chmap_position { SND_CHMAP_UNKNOWN = 0, /** unspecified */ + SND_CHMAP_NA, /** N/A, silent */ + SND_CHMAP_MONO, /** mono stream */ SND_CHMAP_FL, /** front left */ SND_CHMAP_FR, /** front right */ SND_CHMAP_RL, /** rear left */ @@ -508,8 +510,13 @@ enum snd_pcm_chmap_position { SND_CHMAP_FCH, /** front center high */ SND_CHMAP_FRH, /** front right high */ SND_CHMAP_TC, /** top center */ - SND_CHMAP_NA, /** N/A, silent */ - SND_CHMAP_LAST = SND_CHMAP_NA, /** last entry */ + SND_CHMAP_TFL, /** top front left */ + SND_CHMAP_TFR, /** top front right */ + SND_CHMAP_TFC, /** top front center */ + SND_CHMAP_TRL, /** top rear left */ + SND_CHMAP_TRR, /** top rear right */ + SND_CHMAP_TRC, /** top rear center */ + SND_CHMAP_LAST = SND_CHMAP_TRC, /** last entry */ }; #define SND_CHMAP_POSITION_MASK 0xffff /** bitmask for channel position */ diff --git a/include/sound/asound.h b/include/sound/asound.h index cb1b9c58..e24d144a 100644 --- a/include/sound/asound.h +++ b/include/sound/asound.h @@ -479,8 +479,10 @@ enum { /* channel positions */ enum { - /* this follows the alsa-lib mixer channel value + 1 */ SNDRV_CHMAP_UNKNOWN = 0, + SNDRV_CHMAP_NA, /* N/A, silent */ + SNDRV_CHMAP_MONO, /* mono stream */ + /* this follows the alsa-lib mixer channel value + 3 */ SNDRV_CHMAP_FL, /* front left */ SNDRV_CHMAP_FR, /* front right */ SNDRV_CHMAP_RL, /* rear left */ @@ -501,8 +503,13 @@ enum { SNDRV_CHMAP_FCH, /* front center high */ SNDRV_CHMAP_FRH, /* front right high */ SNDRV_CHMAP_TC, /* top center */ - SNDRV_CHMAP_NA, /* N/A, silent */ - SNDRV_CHMAP_LAST = SNDRV_CHMAP_NA, + SNDRV_CHMAP_TFL, /* top front left */ + SNDRV_CHMAP_TFR, /* top front right */ + SNDRV_CHMAP_TFC, /* top front center */ + SNDRV_CHMAP_TRL, /* top rear left */ + SNDRV_CHMAP_TRR, /* top rear right */ + SNDRV_CHMAP_TRC, /* top rear center */ + SNDRV_CHMAP_LAST = SNDRV_CHMAP_TRC, }; #define SNDRV_CHMAP_POSITION_MASK 0xffff diff --git a/src/pcm/pcm.c b/src/pcm/pcm.c index 19a9abe4..d01fa90d 100644 --- a/src/pcm/pcm.c +++ b/src/pcm/pcm.c @@ -7375,7 +7375,7 @@ const char *snd_pcm_chmap_type_name(enum snd_pcm_chmap_type val) #define _NAME(n) [SND_CHMAP_##n] = #n static const char *chmap_names[SND_CHMAP_LAST + 1] = { - _NAME(UNKNOWN), + _NAME(UNKNOWN), _NAME(NA), _NAME(MONO), _NAME(FL), _NAME(FR), _NAME(RL), _NAME(RR), _NAME(FC), _NAME(LFE), @@ -7383,7 +7383,8 @@ static const char *chmap_names[SND_CHMAP_LAST + 1] = { _NAME(RC), _NAME(FLC), _NAME(FRC), _NAME(RLC), _NAME(RRC), _NAME(FLW), _NAME(FRW), _NAME(FLH), _NAME(FCH), _NAME(FRH), _NAME(TC), - _NAME(NA), + _NAME(TFL), _NAME(TFR), _NAME(TFC), + _NAME(TRL), _NAME(TRR), _NAME(TRC), }; #undef _NAME @@ -7397,6 +7398,8 @@ const char *snd_pcm_chmap_name(enum snd_pcm_chmap_position val) static const char *chmap_long_names[SND_CHMAP_LAST + 1] = { [SND_CHMAP_UNKNOWN] = "Unknown", + [SND_CHMAP_NA] = "Unused", + [SND_CHMAP_MONO] = "Mono", [SND_CHMAP_FL] = "Front Left", [SND_CHMAP_FR] = "Front Right", [SND_CHMAP_RL] = "Rear Left", @@ -7416,7 +7419,12 @@ static const char *chmap_long_names[SND_CHMAP_LAST + 1] = { [SND_CHMAP_FCH] = "Front Center High", [SND_CHMAP_FRH] = "Front Right High", [SND_CHMAP_TC] = "Top Center", - [SND_CHMAP_NA] = "Unused", + [SND_CHMAP_TFL] = "Top Front Left", + [SND_CHMAP_TFR] = "Top Front Right", + [SND_CHMAP_TFC] = "Top Front Center", + [SND_CHMAP_TRL] = "Top Rear Left", + [SND_CHMAP_TRR] = "Top Rear Right", + [SND_CHMAP_TRC] = "Top Rear Center", }; const char *snd_pcm_chmap_long_name(enum snd_pcm_chmap_position val) -- cgit v1.2.1