acp: use auto-profile and auto-port properties

Also disable initial automatic profile selection when auto-profile
is set to false
This commit is contained in:
Wim Taymans 2021-01-27 13:43:12 +01:00
parent 64b078d7bb
commit 3312757706
2 changed files with 11 additions and 0 deletions

View file

@ -1344,6 +1344,8 @@ struct acp_card *acp_card_new(uint32_t index, const struct acp_dict *props)
card->active_profile_index = ACP_INVALID_INDEX;
impl->use_ucm = true;
impl->auto_profile = true;
impl->auto_port = true;
if (props) {
if ((s = acp_dict_lookup(props, "api.alsa.use-ucm")) != NULL)
@ -1356,6 +1358,10 @@ struct acp_card *acp_card_new(uint32_t index, const struct acp_dict *props)
profile_set = s;
if ((s = acp_dict_lookup(props, "device.profile")) != NULL)
profile = s;
if ((s = acp_dict_lookup(props, "api.acp.auto-profile")) != NULL)
impl->auto_profile = (strcmp(s, "true") == 0 || atoi(s) == 1);
if ((s = acp_dict_lookup(props, "api.acp.auto-port")) != NULL)
impl->auto_port = (strcmp(s, "true") == 0 || atoi(s) == 1);
}
impl->ucm.default_sample_spec.format = PA_SAMPLE_S16NE;
@ -1423,6 +1429,9 @@ struct acp_card *acp_card_new(uint32_t index, const struct acp_dict *props)
init_jacks(impl);
if (!impl->auto_profile && profile == NULL)
profile = "off";
profile_index = acp_card_find_best_profile_index(&impl->card, profile);
acp_card_set_profile(&impl->card, profile_index);

View file

@ -44,6 +44,8 @@ struct pa_card {
bool use_ucm;
bool soft_mixer;
bool auto_profile;
bool auto_port;
pa_alsa_ucm_config ucm;
pa_alsa_profile_set *profile_set;