Skip to content

Commit

Permalink
ALSA: Define more channel map positions
Browse files Browse the repository at this point in the history
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>
  • Loading branch information
Takashi Iwai committed Sep 12, 2012
1 parent 0afdb8f commit 7b31d00
Show file tree
Hide file tree
Showing 3 changed files with 23 additions and 9 deletions.
13 changes: 10 additions & 3 deletions Documentation/sound/alsa/Channel-Mapping-API.txt
Original file line number Diff line number Diff line change
Expand Up @@ -76,8 +76,10 @@ here is a cut:

/* 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 */
Expand All @@ -98,8 +100,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,
};

When a PCM stream can provide more than one channel map, you can
Expand Down
13 changes: 10 additions & 3 deletions include/sound/asound.h
Original file line number Diff line number Diff line change
Expand Up @@ -474,8 +474,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 */
Expand All @@ -496,8 +498,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
Expand Down
6 changes: 3 additions & 3 deletions sound/pci/ctxfi/ctpcm.c
Original file line number Diff line number Diff line change
Expand Up @@ -397,23 +397,23 @@ static struct snd_pcm_ops ct_pcm_capture_ops = {

static const struct snd_pcm_chmap_elem surround_map[] = {
{ .channels = 1,
.map = { SNDRV_CHMAP_UNKNOWN } },
.map = { SNDRV_CHMAP_MONO } },
{ .channels = 2,
.map = { SNDRV_CHMAP_RL, SNDRV_CHMAP_RR } },
{ }
};

static const struct snd_pcm_chmap_elem clfe_map[] = {
{ .channels = 1,
.map = { SNDRV_CHMAP_UNKNOWN } },
.map = { SNDRV_CHMAP_MONO } },
{ .channels = 2,
.map = { SNDRV_CHMAP_FC, SNDRV_CHMAP_LFE } },
{ }
};

static const struct snd_pcm_chmap_elem side_map[] = {
{ .channels = 1,
.map = { SNDRV_CHMAP_UNKNOWN } },
.map = { SNDRV_CHMAP_MONO } },
{ .channels = 2,
.map = { SNDRV_CHMAP_SL, SNDRV_CHMAP_SR } },
{ }
Expand Down

0 comments on commit 7b31d00

Please sign in to comment.