mirror of
https://gitlab.freedesktop.org/pipewire/pipewire.git
synced 2025-10-31 22:25:38 -04:00
acp: sync with pulseaudio
This commit is contained in:
parent
2f4c589d5b
commit
b63a6a1b66
5 changed files with 93 additions and 60 deletions
|
|
@ -779,6 +779,14 @@ int pa_alsa_ucm_query_profiles(pa_alsa_ucm_config *ucm, int card_index) {
|
|||
|
||||
pa_log_info("UCM available for card %s", card_name);
|
||||
|
||||
if (snd_use_case_get(ucm->ucm_mgr, "_alibpref", &value) == 0) {
|
||||
if (value[0]) {
|
||||
ucm->alib_prefix = pa_xstrdup(value);
|
||||
pa_log_debug("UCM _alibpref=%s", ucm->alib_prefix);
|
||||
}
|
||||
free((void *)value);
|
||||
}
|
||||
|
||||
/* get a list of all UCM verbs (profiles) for this card */
|
||||
num_verbs = snd_use_case_verb_list(ucm->ucm_mgr, &verb_list);
|
||||
if (num_verbs < 0) {
|
||||
|
|
@ -806,16 +814,12 @@ int pa_alsa_ucm_query_profiles(pa_alsa_ucm_config *ucm, int card_index) {
|
|||
err = -PA_ALSA_ERR_UCM_NO_VERB;
|
||||
}
|
||||
|
||||
snd_use_case_get(ucm->ucm_mgr, "_alibpref", (const char**)&ucm->alibpref);
|
||||
|
||||
snd_use_case_free_list(verb_list, num_verbs);
|
||||
|
||||
ucm_verb_fail:
|
||||
if (err < 0) {
|
||||
snd_use_case_mgr_close(ucm->ucm_mgr);
|
||||
ucm->ucm_mgr = NULL;
|
||||
free(ucm->alibpref);
|
||||
ucm->alibpref = NULL;
|
||||
}
|
||||
|
||||
ucm_mgr_fail:
|
||||
|
|
@ -1324,6 +1328,11 @@ void pa_alsa_ucm_add_ports(
|
|||
/* now set up volume paths if any */
|
||||
probe_volumes(*p, is_sink, pcm_handle, context->ucm->mixers, ignore_dB);
|
||||
|
||||
/* probe_volumes() removes per-profile paths from ports if probing them
|
||||
* fails. The path for the current profile is cached in
|
||||
* pa_alsa_ucm_port_data.path, which is not cleared by probe_volumes() if
|
||||
* the path gets removed, so we have to call update_mixer_paths() here to
|
||||
* unset the cached path if needed. */
|
||||
if (card->card.active_profile_index < card->card.n_profiles)
|
||||
update_mixer_paths(*p, card->card.profiles[card->card.active_profile_index]->name);
|
||||
|
||||
|
|
@ -1541,8 +1550,9 @@ static pa_alsa_mapping* ucm_alsa_mapping_get(pa_alsa_ucm_config *ucm, pa_alsa_pr
|
|||
size_t ucm_alibpref_len = 0;
|
||||
|
||||
/* find private alsa-lib's configuration device prefix */
|
||||
if (ucm->alibpref != NULL && ucm->alibpref[0] && pa_startswith(device_str, ucm->alibpref))
|
||||
ucm_alibpref_len = strlen(ucm->alibpref);
|
||||
|
||||
if (ucm->alib_prefix && pa_startswith(device_str, ucm->alib_prefix))
|
||||
ucm_alibpref_len = strlen(ucm->alib_prefix);
|
||||
|
||||
mapping_name = pa_sprintf_malloc("Mapping %s: %s: %s", verb_name, device_str + ucm_alibpref_len, is_sink ? "sink" : "source");
|
||||
|
||||
|
|
@ -1865,7 +1875,7 @@ static void mapping_init_eld(pa_alsa_mapping *m, snd_pcm_t *pcm)
|
|||
pa_alsa_ucm_mapping_context *context = &m->ucm_context;
|
||||
pa_alsa_ucm_device *dev;
|
||||
uint32_t idx;
|
||||
char *mdev;
|
||||
char *mdev, *alib_prefix;
|
||||
snd_pcm_info_t *info;
|
||||
int pcm_card, pcm_device;
|
||||
|
||||
|
|
@ -1878,8 +1888,10 @@ static void mapping_init_eld(pa_alsa_mapping *m, snd_pcm_t *pcm)
|
|||
if ((pcm_device = snd_pcm_info_get_device(info)) < 0)
|
||||
return;
|
||||
|
||||
alib_prefix = context->ucm->alib_prefix;
|
||||
|
||||
PA_IDXSET_FOREACH(dev, context->ucm_devices, idx) {
|
||||
mdev = pa_sprintf_malloc("hw:%i", pcm_card);
|
||||
mdev = pa_sprintf_malloc("%shw:%i", alib_prefix ? alib_prefix : "", pcm_card);
|
||||
if (mdev == NULL)
|
||||
continue;
|
||||
dev->eld_mixer_device_name = mdev;
|
||||
|
|
@ -2149,8 +2161,8 @@ void pa_alsa_ucm_free(pa_alsa_ucm_config *ucm) {
|
|||
snd_use_case_mgr_close(ucm->ucm_mgr);
|
||||
ucm->ucm_mgr = NULL;
|
||||
}
|
||||
free(ucm->alibpref);
|
||||
ucm->alibpref = NULL;
|
||||
pa_xfree(ucm->alib_prefix);
|
||||
ucm->alib_prefix = NULL;
|
||||
}
|
||||
|
||||
void pa_alsa_ucm_mapping_context_free(pa_alsa_ucm_mapping_context *context) {
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue