mirror of
https://gitlab.freedesktop.org/pipewire/pipewire.git
synced 2025-11-01 22:58:50 -04:00
alsa-ucm: Set profiles by their struct instance, not their name
While switching profiles, it's possible that we will want to do more work besides switching UCM verbs. The alsa-card module already has our profiles as structs, but passes in only the names instead of the entire struct. Make things work with the struct instead, so we can add other things (like a UCM context) to it and use those here. Co-authored-by: Tanu Kaskinen <tanuk@iki.fi> [Alper: Split into its own commit and integrated Tanu's snippet.] Signed-off-by: Alper Nebi Yasak <alpernebiyasak@gmail.com>
This commit is contained in:
parent
3dce92e580
commit
4d08c9ad60
3 changed files with 9 additions and 11 deletions
|
|
@ -1418,19 +1418,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);
|
||||
|
|
@ -2420,7 +2419,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;
|
||||
}
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue