mirror of
https://gitlab.freedesktop.org/pulseaudio/pulseaudio.git
synced 2025-10-29 05:40:23 -04:00
alsa-ucm: Make mapping creation independent from indvidual profiles
The ucm_create_mapping() function is not idempotent. It looks like it was meant to be called once per device for the devices of a UCM verb and takes a profile argument simply because a verb has generated a single profile so far. Make sure creating mappings per device and adding those mappings to the profiles happens as separate steps to make it easier to split UCM verbs and profiles as concepts. Signed-off-by: Alper Nebi Yasak <alpernebiyasak@gmail.com> Part-of: <https://gitlab.freedesktop.org/pulseaudio/pulseaudio/-/merge_requests/596>
This commit is contained in:
parent
4527890416
commit
aa5ced3887
1 changed files with 15 additions and 11 deletions
|
|
@ -1627,7 +1627,6 @@ static pa_alsa_mapping* ucm_alsa_mapping_get(pa_alsa_ucm_config *ucm, pa_alsa_pr
|
|||
static int ucm_create_mapping_direction(
|
||||
pa_alsa_ucm_config *ucm,
|
||||
pa_alsa_profile_set *ps,
|
||||
pa_alsa_profile *p,
|
||||
pa_alsa_ucm_device *device,
|
||||
const char *verb_name,
|
||||
const char *device_name,
|
||||
|
|
@ -1657,7 +1656,6 @@ static int ucm_create_mapping_direction(
|
|||
m->device_strings[0] = pa_xstrdup(device_str);
|
||||
m->direction = is_sink ? PA_ALSA_DIRECTION_OUTPUT : PA_ALSA_DIRECTION_INPUT;
|
||||
|
||||
ucm_add_mapping(p, m);
|
||||
if (rate)
|
||||
m->sample_spec.rate = rate;
|
||||
pa_channel_map_init_extend(&m->channel_map, channels, PA_CHANNEL_MAP_ALSA);
|
||||
|
|
@ -1679,7 +1677,6 @@ static int ucm_create_mapping_direction(
|
|||
static int ucm_create_mapping_for_modifier(
|
||||
pa_alsa_ucm_config *ucm,
|
||||
pa_alsa_profile_set *ps,
|
||||
pa_alsa_profile *p,
|
||||
pa_alsa_ucm_modifier *modifier,
|
||||
const char *verb_name,
|
||||
const char *mod_name,
|
||||
|
|
@ -1706,8 +1703,6 @@ static int ucm_create_mapping_for_modifier(
|
|||
m->direction = is_sink ? PA_ALSA_DIRECTION_OUTPUT : PA_ALSA_DIRECTION_INPUT;
|
||||
/* Modifier sinks should not be routed to by default */
|
||||
m->priority = 0;
|
||||
|
||||
ucm_add_mapping(p, m);
|
||||
} else if (!m->ucm_context.ucm_modifiers) /* share pcm with device */
|
||||
m->ucm_context.ucm_modifiers = pa_idxset_new(pa_idxset_trivial_hash_func, pa_idxset_trivial_compare_func);
|
||||
|
||||
|
|
@ -1719,7 +1714,6 @@ static int ucm_create_mapping_for_modifier(
|
|||
static int ucm_create_mapping(
|
||||
pa_alsa_ucm_config *ucm,
|
||||
pa_alsa_profile_set *ps,
|
||||
pa_alsa_profile *p,
|
||||
pa_alsa_ucm_device *device,
|
||||
const char *verb_name,
|
||||
const char *device_name,
|
||||
|
|
@ -1734,9 +1728,9 @@ static int ucm_create_mapping(
|
|||
}
|
||||
|
||||
if (sink)
|
||||
ret = ucm_create_mapping_direction(ucm, ps, p, device, verb_name, device_name, sink, true);
|
||||
ret = ucm_create_mapping_direction(ucm, ps, device, verb_name, device_name, sink, true);
|
||||
if (ret == 0 && source)
|
||||
ret = ucm_create_mapping_direction(ucm, ps, p, device, verb_name, device_name, source, false);
|
||||
ret = ucm_create_mapping_direction(ucm, ps, device, verb_name, device_name, source, false);
|
||||
|
||||
return ret;
|
||||
}
|
||||
|
|
@ -1868,7 +1862,12 @@ static int ucm_create_profile(
|
|||
sink = pa_proplist_gets(dev->proplist, PA_ALSA_PROP_UCM_SINK);
|
||||
source = pa_proplist_gets(dev->proplist, PA_ALSA_PROP_UCM_SOURCE);
|
||||
|
||||
ucm_create_mapping(ucm, ps, p, dev, verb_name, name, sink, source);
|
||||
ucm_create_mapping(ucm, ps, dev, verb_name, name, sink, source);
|
||||
|
||||
if (dev->playback_mapping)
|
||||
ucm_add_mapping(p, dev->playback_mapping);
|
||||
if (dev->capture_mapping)
|
||||
ucm_add_mapping(p, dev->capture_mapping);
|
||||
|
||||
jack = ucm_get_jack(ucm, dev);
|
||||
if (jack)
|
||||
|
|
@ -1919,9 +1918,14 @@ static int ucm_create_profile(
|
|||
source = pa_proplist_gets(mod->proplist, PA_ALSA_PROP_UCM_SOURCE);
|
||||
|
||||
if (sink)
|
||||
ucm_create_mapping_for_modifier(ucm, ps, p, mod, verb_name, name, sink, true);
|
||||
ucm_create_mapping_for_modifier(ucm, ps, mod, verb_name, name, sink, true);
|
||||
else if (source)
|
||||
ucm_create_mapping_for_modifier(ucm, ps, p, mod, verb_name, name, source, false);
|
||||
ucm_create_mapping_for_modifier(ucm, ps, mod, verb_name, name, source, false);
|
||||
|
||||
if (mod->playback_mapping)
|
||||
ucm_add_mapping(p, mod->playback_mapping);
|
||||
if (mod->capture_mapping)
|
||||
ucm_add_mapping(p, mod->capture_mapping);
|
||||
}
|
||||
|
||||
pa_alsa_profile_dump(p);
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue