Follow channel position definitions to mixer channel in mixer.h

mixer.h already contains some channel position definitions.
To be more consistent over all systems, better to follow the same
order for the new channel map, too.  But since UNKNOWN channel must be
zero but the definition in mixer.h contains -1 as UNKNOWN, simply
shift the value with 1.

If the conversion is required between SND_CHMAP and SND_MIXER_SCHN,
just increment/decrement 1.  Eventually I'll provide helper functions
for that...

Signed-off-by: Takashi Iwai <tiwai@suse.de>
This commit is contained in:
Takashi Iwai 2012-08-21 15:07:44 +02:00
parent 915b26bfe8
commit 0f36270dd3
3 changed files with 20 additions and 21 deletions

View file

@ -486,18 +486,18 @@ enum snd_pcm_chmap_type {
enum snd_pcm_chmap_position { enum snd_pcm_chmap_position {
SND_CHMAP_UNKNOWN = 0, /** unspecified */ SND_CHMAP_UNKNOWN = 0, /** unspecified */
SND_CHMAP_FL, /** front left */ SND_CHMAP_FL, /** front left */
SND_CHMAP_FC, /** front center */
SND_CHMAP_FR, /** front right */ SND_CHMAP_FR, /** front right */
SND_CHMAP_FLC, /** front left center */
SND_CHMAP_FRC, /* front right center */
SND_CHMAP_RL, /** rear left */ SND_CHMAP_RL, /** rear left */
SND_CHMAP_RC, /** rear center */
SND_CHMAP_RR, /** rear right */ SND_CHMAP_RR, /** rear right */
SND_CHMAP_RLC, /** rear left center */ SND_CHMAP_FC, /** front center */
SND_CHMAP_RRC, /** rear right center */ SND_CHMAP_LFE, /** LFE */
SND_CHMAP_SL, /** side left */ SND_CHMAP_SL, /** side left */
SND_CHMAP_SR, /** side right */ SND_CHMAP_SR, /** side right */
SND_CHMAP_LFE, /** LFE */ 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_FLW, /** front left wide */
SND_CHMAP_FRW, /** front right wide */ SND_CHMAP_FRW, /** front right wide */
SND_CHMAP_FLH, /** front left high */ SND_CHMAP_FLH, /** front left high */

View file

@ -479,20 +479,22 @@ enum {
/* channel positions */ /* channel positions */
enum { enum {
/* this follows the alsa-lib mixer channel value + 1*/
SNDRV_CHMAP_UNKNOWN = 0, SNDRV_CHMAP_UNKNOWN = 0,
SNDRV_CHMAP_FL, /* front left */ SNDRV_CHMAP_FL, /* front left */
SNDRV_CHMAP_FC, /* front center */
SNDRV_CHMAP_FR, /* front right */ SNDRV_CHMAP_FR, /* front right */
SNDRV_CHMAP_FLC, /* front left center */
SNDRV_CHMAP_FRC, /* front right center */
SNDRV_CHMAP_RL, /* rear left */ SNDRV_CHMAP_RL, /* rear left */
SNDRV_CHMAP_RC, /* rear center */
SNDRV_CHMAP_RR, /* rear right */ SNDRV_CHMAP_RR, /* rear right */
SNDRV_CHMAP_RLC, /* rear left center */ SNDRV_CHMAP_FC, /* front center */
SNDRV_CHMAP_RRC, /* rear right center */ SNDRV_CHMAP_LFE, /* LFE */
SNDRV_CHMAP_SL, /* side left */ SNDRV_CHMAP_SL, /* side left */
SNDRV_CHMAP_SR, /* side right */ SNDRV_CHMAP_SR, /* side right */
SNDRV_CHMAP_LFE, /* LFE */ SNDRV_CHMAP_RC, /* rear center */
/* new definitions */
SNDRV_CHMAP_FLC, /* front left center */
SNDRV_CHMAP_FRC, /* front right center */
SNDRV_CHMAP_RLC, /* rear left center */
SNDRV_CHMAP_RRC, /* rear right center */
SNDRV_CHMAP_FLW, /* front left wide */ SNDRV_CHMAP_FLW, /* front left wide */
SNDRV_CHMAP_FRW, /* front right wide */ SNDRV_CHMAP_FRW, /* front right wide */
SNDRV_CHMAP_FLH, /* front left high */ SNDRV_CHMAP_FLH, /* front left high */

View file

@ -23,12 +23,9 @@ static void usage(void)
static const char * const chname[] = { static const char * const chname[] = {
"Unknown", "Unknown",
"FL", "FC", "FR", "FL", "FR", "RL", "RR", "FC", "LFE", "SL", "SR", "RC",
"FLC", "FRC", "RL", "RC", "RR", "FLC", "FRC", "RLC", "RRC", "FLW", "FRW", "FLH",
"RLC", "RRC", "SL", "SR", "LFE", "FCH", "FCH", "FRH", "TC"
"FLW", "FRW", "FLH",
"FCH", "FCH", "FRH",
"TC"
}; };
#define ARRAY_SIZE(x) (sizeof(x) / sizeof(x[0])) #define ARRAY_SIZE(x) (sizeof(x) / sizeof(x[0]))
@ -56,7 +53,7 @@ static int to_channel(const char *name)
for (i = 0; i < ARRAY_SIZE(chname); i++) for (i = 0; i < ARRAY_SIZE(chname); i++)
if (!strcmp(chname[i], name)) if (!strcmp(chname[i], name))
return i; return i;
return 0; return SND_CHMAP_UNKNOWN;
} }
static const char *chmap_type(int type) static const char *chmap_type(int type)