Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux

ALSA: Define more channel map positions

For following the standard, define more channel map positions and
shuffle the items a bit:

- As both PulseAudio and gstreamer define MONO channel position
explicitly, we should follow that, too. The mono streams point to
this channel position unless they are explicitly assigned to certain
channel positions.

- Top-front-* and Top-rear-* positions are added, carried from
PulseAudio's definitions.

- Move NA and MONO definitions at the top of table right after
UNKNOWN, since these are more abstract in comparison with other
practical positions.

Signed-off-by: Takashi Iwai <tiwai@suse.de>

+23 -9
+10 -3
Documentation/sound/alsa/Channel-Mapping-API.txt
··· 76 76 77 77 /* channel positions */ 78 78 enum { 79 - /* this follows the alsa-lib mixer channel value + 1 */ 80 79 SNDRV_CHMAP_UNKNOWN = 0, 80 + SNDRV_CHMAP_NA, /* N/A, silent */ 81 + SNDRV_CHMAP_MONO, /* mono stream */ 82 + /* this follows the alsa-lib mixer channel value + 3 */ 81 83 SNDRV_CHMAP_FL, /* front left */ 82 84 SNDRV_CHMAP_FR, /* front right */ 83 85 SNDRV_CHMAP_RL, /* rear left */ ··· 100 98 SNDRV_CHMAP_FCH, /* front center high */ 101 99 SNDRV_CHMAP_FRH, /* front right high */ 102 100 SNDRV_CHMAP_TC, /* top center */ 103 - SNDRV_CHMAP_NA, /* N/A, silent */ 104 - SNDRV_CHMAP_LAST = SNDRV_CHMAP_NA, 101 + SNDRV_CHMAP_TFL, /* top front left */ 102 + SNDRV_CHMAP_TFR, /* top front right */ 103 + SNDRV_CHMAP_TFC, /* top front center */ 104 + SNDRV_CHMAP_TRL, /* top rear left */ 105 + SNDRV_CHMAP_TRR, /* top rear right */ 106 + SNDRV_CHMAP_TRC, /* top rear center */ 107 + SNDRV_CHMAP_LAST = SNDRV_CHMAP_TRC, 105 108 }; 106 109 107 110 When a PCM stream can provide more than one channel map, you can
+10 -3
include/sound/asound.h
··· 474 474 475 475 /* channel positions */ 476 476 enum { 477 - /* this follows the alsa-lib mixer channel value + 1 */ 478 477 SNDRV_CHMAP_UNKNOWN = 0, 478 + SNDRV_CHMAP_NA, /* N/A, silent */ 479 + SNDRV_CHMAP_MONO, /* mono stream */ 480 + /* this follows the alsa-lib mixer channel value + 3 */ 479 481 SNDRV_CHMAP_FL, /* front left */ 480 482 SNDRV_CHMAP_FR, /* front right */ 481 483 SNDRV_CHMAP_RL, /* rear left */ ··· 498 496 SNDRV_CHMAP_FCH, /* front center high */ 499 497 SNDRV_CHMAP_FRH, /* front right high */ 500 498 SNDRV_CHMAP_TC, /* top center */ 501 - SNDRV_CHMAP_NA, /* N/A, silent */ 502 - SNDRV_CHMAP_LAST = SNDRV_CHMAP_NA, 499 + SNDRV_CHMAP_TFL, /* top front left */ 500 + SNDRV_CHMAP_TFR, /* top front right */ 501 + SNDRV_CHMAP_TFC, /* top front center */ 502 + SNDRV_CHMAP_TRL, /* top rear left */ 503 + SNDRV_CHMAP_TRR, /* top rear right */ 504 + SNDRV_CHMAP_TRC, /* top rear center */ 505 + SNDRV_CHMAP_LAST = SNDRV_CHMAP_TRC, 503 506 }; 504 507 505 508 #define SNDRV_CHMAP_POSITION_MASK 0xffff
+3 -3
sound/pci/ctxfi/ctpcm.c
··· 397 397 398 398 static const struct snd_pcm_chmap_elem surround_map[] = { 399 399 { .channels = 1, 400 - .map = { SNDRV_CHMAP_UNKNOWN } }, 400 + .map = { SNDRV_CHMAP_MONO } }, 401 401 { .channels = 2, 402 402 .map = { SNDRV_CHMAP_RL, SNDRV_CHMAP_RR } }, 403 403 { } ··· 405 405 406 406 static const struct snd_pcm_chmap_elem clfe_map[] = { 407 407 { .channels = 1, 408 - .map = { SNDRV_CHMAP_UNKNOWN } }, 408 + .map = { SNDRV_CHMAP_MONO } }, 409 409 { .channels = 2, 410 410 .map = { SNDRV_CHMAP_FC, SNDRV_CHMAP_LFE } }, 411 411 { } ··· 413 413 414 414 static const struct snd_pcm_chmap_elem side_map[] = { 415 415 { .channels = 1, 416 - .map = { SNDRV_CHMAP_UNKNOWN } }, 416 + .map = { SNDRV_CHMAP_MONO } }, 417 417 { .channels = 2, 418 418 .map = { SNDRV_CHMAP_SL, SNDRV_CHMAP_SR } }, 419 419 { }