acp: use flag for the Off profile

This commit is contained in:
Wim Taymans 2020-09-28 11:32:36 +02:00
parent 9f1d84e37c
commit a97287351c
3 changed files with 4 additions and 3 deletions

View file

@ -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;
}

View file

@ -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;

View file

@ -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;