From a97287351ca2a71e19673abb5f085decc4b27648 Mon Sep 17 00:00:00 2001 From: Wim Taymans Date: Mon, 28 Sep 2020 11:32:36 +0200 Subject: [PATCH] acp: use flag for the Off profile --- spa/plugins/alsa/acp/acp.c | 5 +++-- spa/plugins/alsa/acp/acp.h | 1 + spa/plugins/alsa/acp/alsa-mixer.h | 1 - 3 files changed, 4 insertions(+), 3 deletions(-) diff --git a/spa/plugins/alsa/acp/acp.c b/spa/plugins/alsa/acp/acp.c index f7fdd4759..8ee52e558 100644 --- a/spa/plugins/alsa/acp/acp.c +++ b/spa/plugins/alsa/acp/acp.c @@ -117,7 +117,7 @@ static void add_profiles(pa_card *impl) ap->profile.name = ap->name = pa_xstrdup("off"); ap->profile.description = ap->description = pa_xstrdup(_("Off")); ap->profile.available = ACP_AVAILABLE_YES; - ap->is_off = true; + ap->profile.flags = ACP_PROFILE_OFF; pa_hashmap_put(impl->profiles, ap->name, ap); PA_HASHMAP_FOREACH(ap, impl->profile_set->profiles, state) { @@ -1047,7 +1047,8 @@ int acp_card_set_profile(struct acp_card *card, uint32_t new_index) /* if UCM is available for this card then update the verb */ if (impl->use_ucm) { - if ((res = pa_alsa_ucm_set_profile(&impl->ucm, impl, np->is_off ? NULL : np->profile.name, + if ((res = pa_alsa_ucm_set_profile(&impl->ucm, impl, + np->profile.flags & ACP_PROFILE_OFF ? NULL : np->profile.name, op ? op->profile.name : NULL)) < 0) { return res; } diff --git a/spa/plugins/alsa/acp/acp.h b/spa/plugins/alsa/acp/acp.h index 65fa13c86..ad10672da 100644 --- a/spa/plugins/alsa/acp/acp.h +++ b/spa/plugins/alsa/acp/acp.h @@ -210,6 +210,7 @@ struct acp_device { struct acp_card_profile { uint32_t index; #define ACP_PROFILE_ACTIVE (1<<0) +#define ACP_PROFILE_OFF (1<<1) /* the Off profile */ uint32_t flags; const char *name; diff --git a/spa/plugins/alsa/acp/alsa-mixer.h b/spa/plugins/alsa/acp/alsa-mixer.h index 0b1820eda..260db2c07 100644 --- a/spa/plugins/alsa/acp/alsa-mixer.h +++ b/spa/plugins/alsa/acp/alsa-mixer.h @@ -369,7 +369,6 @@ struct pa_alsa_profile { bool supported:1; bool fallback_input:1; bool fallback_output:1; - bool is_off:1; char **input_mapping_names; char **output_mapping_names;