From: David Henningsson <david.henningsson@canonical.com>
To: Takashi Iwai <tiwai@suse.de>
Cc: alsa-devel@alsa-project.org
Subject: Re: [RFC] Channel mapping API
Date: Tue, 21 Aug 2012 13:24:53 +0200 [thread overview]
Message-ID: <50337005.7090404@canonical.com> (raw)
In-Reply-To: <s5hr4r0359e.wl%tiwai@suse.de>
On 08/21/2012 12:31 PM, Takashi Iwai wrote:
> Hi,
>
> this is a progress report of my longstanding TODO, the channel map API
> implementation. I'm going to cover this at Plumbers audio uconf, so
> we can discuss details there, too.
>
> The channel mapping API provides a method for user-space to query, get
> and set the channel map of a PCM stream. It's required for assigning
> channels properly for multi-channel streams.
>
>
> * KERNEL IMPLEMENTATION
>
> In my latest attempt, I implemented with control elements. A control
> element is created for each PCM substream with the corresponding
> device and substream index. Then it gives a TLV for querying maps, a
> read op for obtaining the current map, and optionally a write op for
> setting the map. The obvious merit by this way is that no extra
> kernel ABI is required.
>
> A couple of new helper functions are provided for assigning standard
> channel maps. Currently, HD-audio and AC97 drivers has some
> implementation.
>
>
> * ALSA-LIB IMPLEMENTATION
>
> The additional alsa-lib API functions look like:
>
> int **snd_pcm_query_chmaps(snd_pcm_t *pcm);
> int *snd_pcm_get_chmap(snd_pcm_t *pcm);
> int snd_pcm_set_chmap(snd_pcm_t *pcm, const int *map);
>
> 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 }
>
> snd_pcm_get_chmap() returns the currently assigned channel map for the
> given PCM stream. If the PCM is before prepared, it fills UNKNOWN.
>
> When a driver allows user to change the channel map, user can call
> snd_pcm_set_chmap(). For example, HDMI allows you to choose whether
> it's 4.0 or 3.1 output.
Interesting. A few thoughts here:
1) You seem to have invented new constants for different channels
(SND_CHMAP_FL for "front left" etc). There is already a channel
enumeration in include/mixer.h, _snd_mixer_selem_channel_id. Is there a
reason we can't just reuse it for this purpose?
If we can't, we should at least make sure that everywhere we have these
declarations, they always correspond to the same value and add comments
that they need to be kept in sync.
2) a chmap struct would probably be more elegant, something like:
struct snd_chmap {
int type; /* or snd_pcm_chmap_type? */
int count;
int channels[SND_MIXER_SCHN_LAST+1]; /* Or variable length? */
}
3) Can you use snd_pcm_set_chmap before snd_pcm_prepare, and if so, it
seems a bit strange that snd_pcm_get_chmap does not return what you have
previously set.
4) The question of memory allocation for _get and _query, who is
supposed to allocate and free the snd_chmap array?
5) I'm not sure I'm getting the _VAR and _PAIRED types, even though I
read the documentation. Is this for the query only? Or if not, what
would it mean to get/set a channelmap with _VAR type?
>
>
> * RESOURCES
>
> The latest kernel patchset is found in sound-unstable tree
> topic/tlv-chmap branch.
> git://git.kernel.org/pub/scm/linux/kernel/git/tiwai/sound-unstable.git topic/tlv-chmap
>
> The alsa-lib portion is found in a tree on github topic/chmap branch.
> git://github.com/tiwai/alsa-lib.git topic/chmap
>
>
>
> thanks,
>
> Takashi
> _______________________________________________
> Alsa-devel mailing list
> Alsa-devel@alsa-project.org
> http://mailman.alsa-project.org/mailman/listinfo/alsa-devel
>
--
David Henningsson, Canonical Ltd.
https://launchpad.net/~diwic
next prev parent reply other threads:[~2012-08-21 11:24 UTC|newest]
Thread overview: 32+ messages / expand[flat|nested] mbox.gz Atom feed top
2012-08-21 10:31 [RFC] Channel mapping API Takashi Iwai
2012-08-21 11:24 ` David Henningsson [this message]
2012-08-21 11:44 ` Clemens Ladisch
2012-08-21 12:06 ` Takashi Iwai
2012-08-21 13:13 ` Takashi Iwai
2012-08-21 11:37 ` Clemens Ladisch
2012-08-21 12:15 ` Takashi Iwai
2012-08-21 12:31 ` Jaroslav Kysela
2012-08-21 12:35 ` Takashi Iwai
2012-08-21 13:14 ` Takashi Iwai
2012-08-21 14:00 ` David Henningsson
2012-08-21 14:06 ` Mark Brown
2012-08-21 14:13 ` David Henningsson
2012-08-21 14:18 ` Mark Brown
2012-08-21 14:49 ` Takashi Iwai
2012-08-21 15:38 ` Clemens Ladisch
2012-08-21 16:27 ` Mark Brown
2012-08-21 17:05 ` Takashi Iwai
2012-08-21 17:11 ` Mark Brown
2012-08-21 19:29 ` Takashi Iwai
2012-08-21 15:49 ` Mark Brown
2012-08-21 14:52 ` David Henningsson
2012-08-21 15:07 ` Mark Brown
2012-08-21 15:38 ` David Henningsson
2012-08-21 16:34 ` Mark Brown
2012-08-21 17:09 ` Takashi Iwai
2012-08-21 17:57 ` Mark Brown
2012-08-21 13:59 ` Mark Brown
2012-08-21 14:08 ` Takashi Iwai
2012-08-21 14:12 ` Mark Brown
2012-08-21 18:03 ` Pierre-Louis Bossart
2012-08-21 19:23 ` Takashi Iwai
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=50337005.7090404@canonical.com \
--to=david.henningsson@canonical.com \
--cc=alsa-devel@alsa-project.org \
--cc=tiwai@suse.de \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.