mirror of
				https://gitlab.freedesktop.org/pipewire/pipewire.git
				synced 2025-11-03 09:01:54 -05:00 
			
		
		
		
	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:
		
							parent
							
								
									64b078d7bb
								
							
						
					
					
						commit
						3312757706
					
				
					 2 changed files with 11 additions and 0 deletions
				
			
		| 
						 | 
					@ -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;
 | 
						card->active_profile_index = ACP_INVALID_INDEX;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
	impl->use_ucm = true;
 | 
						impl->use_ucm = true;
 | 
				
			||||||
 | 
						impl->auto_profile = true;
 | 
				
			||||||
 | 
						impl->auto_port = true;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
	if (props) {
 | 
						if (props) {
 | 
				
			||||||
		if ((s = acp_dict_lookup(props, "api.alsa.use-ucm")) != NULL)
 | 
							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;
 | 
								profile_set = s;
 | 
				
			||||||
		if ((s = acp_dict_lookup(props, "device.profile")) != NULL)
 | 
							if ((s = acp_dict_lookup(props, "device.profile")) != NULL)
 | 
				
			||||||
			profile = s;
 | 
								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;
 | 
						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);
 | 
						init_jacks(impl);
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
						if (!impl->auto_profile && profile == NULL)
 | 
				
			||||||
 | 
							profile = "off";
 | 
				
			||||||
 | 
					
 | 
				
			||||||
	profile_index = acp_card_find_best_profile_index(&impl->card, profile);
 | 
						profile_index = acp_card_find_best_profile_index(&impl->card, profile);
 | 
				
			||||||
	acp_card_set_profile(&impl->card, profile_index);
 | 
						acp_card_set_profile(&impl->card, profile_index);
 | 
				
			||||||
 | 
					
 | 
				
			||||||
| 
						 | 
					
 | 
				
			||||||
| 
						 | 
					@ -44,6 +44,8 @@ struct pa_card {
 | 
				
			||||||
 | 
					
 | 
				
			||||||
	bool use_ucm;
 | 
						bool use_ucm;
 | 
				
			||||||
	bool soft_mixer;
 | 
						bool soft_mixer;
 | 
				
			||||||
 | 
						bool auto_profile;
 | 
				
			||||||
 | 
						bool auto_port;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
	pa_alsa_ucm_config ucm;
 | 
						pa_alsa_ucm_config ucm;
 | 
				
			||||||
	pa_alsa_profile_set *profile_set;
 | 
						pa_alsa_profile_set *profile_set;
 | 
				
			||||||
| 
						 | 
					
 | 
				
			||||||
		Loading…
	
	Add table
		Add a link
		
	
		Reference in a new issue