summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--src/modules/alsa/alsa-ucm.c15
-rw-r--r--src/modules/alsa/alsa-ucm.h2
-rw-r--r--src/modules/alsa/module-alsa-card.c5
3 files changed, 10 insertions, 12 deletions
diff --git a/src/modules/alsa/alsa-ucm.c b/src/modules/alsa/alsa-ucm.c
index 7b857785d..a40c3d764 100644
--- a/src/modules/alsa/alsa-ucm.c
+++ b/src/modules/alsa/alsa-ucm.c
@@ -1430,19 +1430,18 @@ void pa_alsa_ucm_add_ports(
}
/* Change UCM verb and device to match selected card profile */
-int pa_alsa_ucm_set_profile(pa_alsa_ucm_config *ucm, pa_card *card, const char *new_profile, const char *old_profile) {
+int pa_alsa_ucm_set_profile(pa_alsa_ucm_config *ucm, pa_card *card, pa_alsa_profile *new_profile, pa_alsa_profile *old_profile) {
int ret = 0;
const char *profile;
pa_alsa_ucm_verb *verb;
if (new_profile == old_profile)
- return ret;
- else if (new_profile == NULL || old_profile == NULL)
- profile = new_profile ? new_profile : SND_USE_CASE_VERB_INACTIVE;
- else if (!pa_streq(new_profile, old_profile))
- profile = new_profile;
+ return 0;
+
+ if (new_profile == NULL)
+ profile = SND_USE_CASE_VERB_INACTIVE;
else
- return ret;
+ profile = new_profile->name;
/* change verb */
pa_log_info("Set UCM verb to %s", profile);
@@ -2430,7 +2429,7 @@ pa_alsa_profile_set* pa_alsa_ucm_add_profile_set(pa_alsa_ucm_config *ucm, pa_cha
return NULL;
}
-int pa_alsa_ucm_set_profile(pa_alsa_ucm_config *ucm, pa_card *card, const char *new_profile, const char *old_profile) {
+int pa_alsa_ucm_set_profile(pa_alsa_ucm_config *ucm, pa_card *card, pa_alsa_profile *new_profile, pa_alsa_profile *old_profile) {
return -1;
}
diff --git a/src/modules/alsa/alsa-ucm.h b/src/modules/alsa/alsa-ucm.h
index cb72837de..e411a9262 100644
--- a/src/modules/alsa/alsa-ucm.h
+++ b/src/modules/alsa/alsa-ucm.h
@@ -145,7 +145,7 @@ typedef struct pa_alsa_ucm_volume pa_alsa_ucm_volume;
int pa_alsa_ucm_query_profiles(pa_alsa_ucm_config *ucm, int card_index);
pa_alsa_profile_set* pa_alsa_ucm_add_profile_set(pa_alsa_ucm_config *ucm, pa_channel_map *default_channel_map);
-int pa_alsa_ucm_set_profile(pa_alsa_ucm_config *ucm, pa_card *card, const char *new_profile, const char *old_profile);
+int pa_alsa_ucm_set_profile(pa_alsa_ucm_config *ucm, pa_card *card, pa_alsa_profile *new_profile, pa_alsa_profile *old_profile);
int pa_alsa_ucm_get_verb(snd_use_case_mgr_t *uc_mgr, const char *verb_name, const char *verb_desc, pa_alsa_ucm_verb **p_verb);
diff --git a/src/modules/alsa/module-alsa-card.c b/src/modules/alsa/module-alsa-card.c
index 0fe8893f4..2efa96a0f 100644
--- a/src/modules/alsa/module-alsa-card.c
+++ b/src/modules/alsa/module-alsa-card.c
@@ -249,8 +249,7 @@ static int card_set_profile(pa_card *c, pa_card_profile *new_profile) {
/* if UCM is available for this card then update the verb */
if (u->use_ucm) {
- if (pa_alsa_ucm_set_profile(&u->ucm, c, nd->profile ? nd->profile->name : NULL,
- od->profile ? od->profile->name : NULL) < 0) {
+ if (pa_alsa_ucm_set_profile(&u->ucm, c, nd->profile, od->profile) < 0) {
ret = -1;
goto finish;
}
@@ -302,7 +301,7 @@ static void init_profile(struct userdata *u) {
if (d->profile && u->use_ucm) {
/* Set initial verb */
- if (pa_alsa_ucm_set_profile(ucm, u->card, d->profile->name, NULL) < 0) {
+ if (pa_alsa_ucm_set_profile(ucm, u->card, d->profile, NULL) < 0) {
pa_log("Failed to set ucm profile %s", d->profile->name);
return;
}