diff --git a/spa/plugins/alsa/acp/alsa-mixer.h b/spa/plugins/alsa/acp/alsa-mixer.h index 643f03dba..687e8b53d 100644 --- a/spa/plugins/alsa/acp/alsa-mixer.h +++ b/spa/plugins/alsa/acp/alsa-mixer.h @@ -354,7 +354,7 @@ struct pa_alsa_mapping { pa_alsa_device output; pa_alsa_device input; - /* ucm device context*/ + /* ucm device context */ pa_alsa_ucm_mapping_context ucm_context; }; @@ -381,6 +381,9 @@ struct pa_alsa_profile { pa_idxset *input_mappings; pa_idxset *output_mappings; + /* ucm device context */ + pa_alsa_ucm_profile_context ucm_context; + struct { pa_dynarray devices; } out; diff --git a/spa/plugins/alsa/acp/alsa-ucm.c b/spa/plugins/alsa/acp/alsa-ucm.c index 76e1bcedf..6ec09ac05 100644 --- a/spa/plugins/alsa/acp/alsa-ucm.c +++ b/spa/plugins/alsa/acp/alsa-ucm.c @@ -1467,27 +1467,20 @@ int pa_alsa_ucm_set_profile(pa_alsa_ucm_config *ucm, pa_card *card, pa_alsa_prof if (new_profile == old_profile) return 0; - if (new_profile == NULL) + if (new_profile == NULL) { profile = SND_USE_CASE_VERB_INACTIVE; - else + verb = NULL; + } else { profile = new_profile->name; + verb = new_profile->ucm_context.verb; + } /* change verb */ pa_log_info("Set UCM verb to %s", profile); if ((ret = snd_use_case_set(ucm->ucm_mgr, "_verb", profile)) < 0) { pa_log("Failed to set verb %s: %s", profile, snd_strerror(ret)); } - - /* find active verb */ - ucm->active_verb = NULL; - PA_LLIST_FOREACH(verb, ucm->verbs) { - const char *verb_name; - verb_name = pa_proplist_gets(verb->proplist, PA_ALSA_PROP_UCM_NAME); - if (pa_streq(verb_name, profile)) { - ucm->active_verb = verb; - break; - } - } + ucm->active_verb = verb; update_mixer_paths(card->ports, profile); return ret; @@ -1862,6 +1855,7 @@ static int ucm_create_profile( p->profile_set = ps; p->name = pa_xstrdup(verb_name); p->description = pa_xstrdup(verb_desc); + p->ucm_context.verb = verb; p->output_mappings = pa_idxset_new(pa_idxset_trivial_hash_func, pa_idxset_trivial_compare_func); p->input_mappings = pa_idxset_new(pa_idxset_trivial_hash_func, pa_idxset_trivial_compare_func); diff --git a/spa/plugins/alsa/acp/alsa-ucm.h b/spa/plugins/alsa/acp/alsa-ucm.h index dd1694de6..9b664b417 100644 --- a/spa/plugins/alsa/acp/alsa-ucm.h +++ b/spa/plugins/alsa/acp/alsa-ucm.h @@ -142,6 +142,7 @@ typedef struct pa_alsa_ucm_modifier pa_alsa_ucm_modifier; typedef struct pa_alsa_ucm_device pa_alsa_ucm_device; typedef struct pa_alsa_ucm_config pa_alsa_ucm_config; typedef struct pa_alsa_ucm_mapping_context pa_alsa_ucm_mapping_context; +typedef struct pa_alsa_ucm_profile_context pa_alsa_ucm_profile_context; typedef struct pa_alsa_ucm_port_data pa_alsa_ucm_port_data; typedef struct pa_alsa_ucm_volume pa_alsa_ucm_volume; @@ -271,6 +272,10 @@ struct pa_alsa_ucm_mapping_context { pa_idxset *ucm_modifiers; }; +struct pa_alsa_ucm_profile_context { + pa_alsa_ucm_verb *verb; +}; + struct pa_alsa_ucm_port_data { pa_alsa_ucm_config *ucm; pa_device_port *core_port;