mirror of
https://github.com/alsa-project/alsa-lib.git
synced 2026-02-23 01:40:06 -05:00
PCM: Add the missing query_chmaps for route plugin
Also fix the channel count in get_chmap for route plugin. Signed-off-by: Takashi Iwai <tiwai@suse.de>
This commit is contained in:
parent
e1975d20f5
commit
a102028a5a
1 changed files with 19 additions and 5 deletions
|
|
@ -67,6 +67,7 @@ typedef struct {
|
||||||
int use_getput;
|
int use_getput;
|
||||||
unsigned int src_size;
|
unsigned int src_size;
|
||||||
snd_pcm_format_t dst_sfmt;
|
snd_pcm_format_t dst_sfmt;
|
||||||
|
unsigned int nsrcs;
|
||||||
unsigned int ndsts;
|
unsigned int ndsts;
|
||||||
snd_pcm_route_ttable_dst_t *dsts;
|
snd_pcm_route_ttable_dst_t *dsts;
|
||||||
} snd_pcm_route_params_t;
|
} snd_pcm_route_params_t;
|
||||||
|
|
@ -707,22 +708,23 @@ static snd_pcm_chmap_t *snd_pcm_route_get_chmap(snd_pcm_t *pcm)
|
||||||
{
|
{
|
||||||
snd_pcm_route_t *route = pcm->private_data;
|
snd_pcm_route_t *route = pcm->private_data;
|
||||||
snd_pcm_chmap_t *map, *slave_map;
|
snd_pcm_chmap_t *map, *slave_map;
|
||||||
unsigned int src, dst;
|
unsigned int src, dst, nsrcs;
|
||||||
|
|
||||||
slave_map = snd_pcm_generic_get_chmap(pcm);
|
slave_map = snd_pcm_generic_get_chmap(pcm);
|
||||||
if (!slave_map)
|
if (!slave_map)
|
||||||
return NULL;
|
return NULL;
|
||||||
map = calloc(4, route->schannels + 1);
|
nsrcs = route->params.nsrcs;
|
||||||
|
map = calloc(4, nsrcs + 1);
|
||||||
if (!map) {
|
if (!map) {
|
||||||
free(slave_map);
|
free(slave_map);
|
||||||
return NULL;
|
return NULL;
|
||||||
}
|
}
|
||||||
map->channels = route->schannels;
|
map->channels = nsrcs;
|
||||||
for (dst = 0; dst < route->params.ndsts; dst++) {
|
for (dst = 0; dst < route->params.ndsts; dst++) {
|
||||||
snd_pcm_route_ttable_dst_t *d = &route->params.dsts[dst];
|
snd_pcm_route_ttable_dst_t *d = &route->params.dsts[dst];
|
||||||
for (src = 0; src < d->nsrcs; src++) {
|
for (src = 0; src < d->nsrcs; src++) {
|
||||||
int c = d->srcs[src].channel;
|
int c = d->srcs[src].channel;
|
||||||
if (c < route->schannels && !map->pos[c])
|
if (c < nsrcs && !map->pos[c])
|
||||||
map->pos[c] = slave_map->pos[dst];
|
map->pos[c] = slave_map->pos[dst];
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
@ -730,6 +732,17 @@ static snd_pcm_chmap_t *snd_pcm_route_get_chmap(snd_pcm_t *pcm)
|
||||||
return map;
|
return map;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
static snd_pcm_chmap_query_t **snd_pcm_route_query_chmaps(snd_pcm_t *pcm)
|
||||||
|
{
|
||||||
|
snd_pcm_chmap_query_t **maps;
|
||||||
|
snd_pcm_chmap_t *map = snd_pcm_route_get_chmap(pcm);
|
||||||
|
if (!map)
|
||||||
|
return NULL;
|
||||||
|
maps = _snd_pcm_make_single_query_chmaps(map);
|
||||||
|
free(map);
|
||||||
|
return maps;
|
||||||
|
}
|
||||||
|
|
||||||
static void snd_pcm_route_dump(snd_pcm_t *pcm, snd_output_t *out)
|
static void snd_pcm_route_dump(snd_pcm_t *pcm, snd_output_t *out)
|
||||||
{
|
{
|
||||||
snd_pcm_route_t *route = pcm->private_data;
|
snd_pcm_route_t *route = pcm->private_data;
|
||||||
|
|
@ -787,7 +800,7 @@ static const snd_pcm_ops_t snd_pcm_route_ops = {
|
||||||
.async = snd_pcm_generic_async,
|
.async = snd_pcm_generic_async,
|
||||||
.mmap = snd_pcm_generic_mmap,
|
.mmap = snd_pcm_generic_mmap,
|
||||||
.munmap = snd_pcm_generic_munmap,
|
.munmap = snd_pcm_generic_munmap,
|
||||||
.query_chmaps = NULL, /* NYI */
|
.query_chmaps = snd_pcm_route_query_chmaps,
|
||||||
.get_chmap = snd_pcm_route_get_chmap,
|
.get_chmap = snd_pcm_route_get_chmap,
|
||||||
.set_chmap = NULL, /* NYI */
|
.set_chmap = NULL, /* NYI */
|
||||||
};
|
};
|
||||||
|
|
@ -812,6 +825,7 @@ static int route_load_ttable(snd_pcm_route_params_t *params, snd_pcm_stream_t st
|
||||||
dmul = tt_ssize;
|
dmul = tt_ssize;
|
||||||
}
|
}
|
||||||
params->ndsts = dused;
|
params->ndsts = dused;
|
||||||
|
params->nsrcs = sused;
|
||||||
dptr = calloc(dused, sizeof(*params->dsts));
|
dptr = calloc(dused, sizeof(*params->dsts));
|
||||||
if (!dptr)
|
if (!dptr)
|
||||||
return -ENOMEM;
|
return -ENOMEM;
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue