PCM: Add chmap options to hw and null plugins

Add a config definition "chmap" to override (or enhance) the channel
maps.  So far, only a single channel map can be provided, and the
channel count consistency isn't strictly tested at all.

Signed-off-by: Takashi Iwai <tiwai@suse.de>
This commit is contained in:
Takashi Iwai 2012-09-12 14:47:17 +02:00
parent 81135aac49
commit e1975d20f5
4 changed files with 111 additions and 1 deletions

View file

@ -7531,6 +7531,35 @@ snd_pcm_chmap_t *snd_pcm_chmap_parse_string(const char *str)
return map;
}
snd_pcm_chmap_query_t **
_snd_pcm_make_single_query_chmaps(snd_pcm_chmap_t *src)
{
snd_pcm_chmap_query_t **maps;
maps = calloc(2, sizeof(*maps));
if (!maps)
return NULL;
*maps = malloc((src->channels + 2) * sizeof(int));
if (!*maps) {
free(maps);
return NULL;
}
(*maps)->type = SND_CHMAP_TYPE_FIXED;
memcpy(&(*maps)->map, src, (src->channels + 1) * sizeof(int));
return maps;
}
snd_pcm_chmap_t *_snd_pcm_copy_chmap(snd_pcm_chmap_t *src)
{
snd_pcm_chmap_t *map;
map = malloc((src->channels + 1) * sizeof(int));
if (!map)
return NULL;
memcpy(map, src, (src->channels + 1) * sizeof(int));
return map;
}
/*
* basic helpers
*/