[alsa-devel] [RFC] Channel mapping API

Takashi Iwai tiwai at suse.de
Tue Aug 21 16:08:40 CEST 2012


At Tue, 21 Aug 2012 14:59:47 +0100,
Mark Brown wrote:
> 
> On Tue, Aug 21, 2012 at 12:31:57PM +0200, Takashi Iwai wrote:
> 
> > snd_pcm_query_chmaps() returns the list of channel maps.  A channel
> > map is represented by an integer array, beginning with the channel map
> > type, followed by the number of channels, and the position of each
> > channel, e.g.
> >   { SND_CHMAP_FIXED, 4, SND_CHMAP_FL, SND_CHMAP_FR, SND_CHMAP_RL, SND_CHMAP_RR }
> 
> Currently only named channel maps are supported.  It'd be nice to also
> support just plain numbered channels, or at least provide a way to say
> to userspace that it needs to do something like chase through a routing
> map to figure out where each channel goes (as opposed to assuming that
> the driver doesn't know what to report).  

The channel map value are basically arbitrary 32bit integer, so we can
define something like:
	#define SND_CHMAP_NUMBERED	0x10000
and pass the channel number with this bit flag.
Then it becomes a matter of definition of chmap values.

(But, hm, then setting UNKNOWN = -1 is a bad idea...
 Maybe I should revert the last change and set UNKNOWN = 0 again.)

> It'd also be nice to be able to express the situation we sometimes get
> in embedded devices where we (for example) play to channels 0 and 1 to
> get headphones and to 2 and 3 for speaker but that usually falls into
> the route tracing case anyway so I'm not sure it's worth worrying about.

Ditto, the value can be set with some bit flags.

Maybe the predefined channel enum should be limited to 8 or 16 bits,
and give the rest for flags.


Takashi


More information about the Alsa-devel mailing list