Lines Matching full:profile
39 /* We need to cache the active profile, because we want to compare the old
41 * have access to the new profile. */
65 static bool profile_good_for_output(pa_card_profile *profile, pa_device_port *port) { in profile_good_for_output() argument
70 pa_assert(profile); in profile_good_for_output()
72 card = profile->card; in profile_good_for_output()
77 if (!pa_safe_streq(card->active_profile->input_name, profile->input_name)) in profile_good_for_output()
80 if (card->active_profile->n_sources != profile->n_sources) in profile_good_for_output()
83 if (card->active_profile->max_source_channels != profile->max_source_channels) in profile_good_for_output()
100 static bool profile_good_for_input(pa_card_profile *profile, pa_device_port *port) { in profile_good_for_input() argument
105 pa_assert(profile); in profile_good_for_input()
107 card = profile->card; in profile_good_for_input()
112 if (!pa_safe_streq(card->active_profile->output_name, profile->output_name)) in profile_good_for_input()
115 if (card->active_profile->n_sinks != profile->n_sinks) in profile_good_for_input()
118 if (card->active_profile->max_sink_channels != profile->max_sink_channels) in profile_good_for_input()
136 pa_card_profile *best_profile = NULL, *profile; in try_to_switch_profile() local
141 pa_log_info("Keeping sticky card profile '%s'", port->card->active_profile->name); in try_to_switch_profile()
145 pa_log_debug("Finding best profile for port %s, preferred = %s", in try_to_switch_profile()
148 PA_HASHMAP_FOREACH(profile, port->profiles, state) { in try_to_switch_profile()
151 unsigned prio = profile->priority; in try_to_switch_profile()
156 name = profile->output_name; in try_to_switch_profile()
157 good = profile_good_for_output(profile, port); in try_to_switch_profile()
161 name = profile->input_name; in try_to_switch_profile()
162 good = profile_good_for_input(profile, port); in try_to_switch_profile()
169 /* Give a high bonus in case this is the preferred profile */ in try_to_switch_profile()
170 if (pa_safe_streq(name ? name : profile->name, port->preferred_profile)) in try_to_switch_profile()
176 best_profile = profile; in try_to_switch_profile()
181 pa_log_debug("No suitable profile found"); in try_to_switch_profile()
186 pa_log_debug("Could not set profile %s", best_profile->name); in try_to_switch_profile()
253 /* Now that profile has changed, our sink and source pointers must be updated */ in switch_to_port()
289 * profile is still available in the in switch_from_port()
291 * the profile availability hasn't been updated yet. */ in switch_from_port()
307 /* Our profile switching logic caused trouble with bluetooth headsets (see in port_available_hook_callback()
309 * module-bluetooth-policy takes care of automatic profile switching in port_available_hook_callback()
370 pa_card_profile *profile, *best_profile; in find_best_profile() local
376 PA_HASHMAP_FOREACH(profile, card->profiles, state) { in find_best_profile()
377 if (profile->available == PA_AVAILABLE_NO) in find_best_profile()
380 if (profile->priority > best_profile->priority) in find_best_profile()
381 best_profile = profile; in find_best_profile()
387 static pa_hook_result_t card_profile_available_hook_callback(pa_core *c, pa_card_profile *profile, … in card_profile_available_hook_callback() argument
390 pa_assert(profile); in card_profile_available_hook_callback()
391 pa_assert_se(card = profile->card); in card_profile_available_hook_callback()
393 if (profile->available != PA_AVAILABLE_NO) in card_profile_available_hook_callback()
396 if (!pa_streq(profile->name, card->active_profile->name)) in card_profile_available_hook_callback()
400 pa_log_info("Keeping sticky card profile '%s'", profile->name); in card_profile_available_hook_callback()
404 …pa_log_debug("Active profile %s on card %s became unavailable, switching to another profile", prof… in card_profile_available_hook_callback()
485 /* If the profile change didn't affect input, it doesn't indicate change in in update_preferred_input_port()
498 /* If the profile change modified the set of sinks, then it's unclear in update_preferred_input_port()
501 * profile contains no sinks, though, then we know the user only cares in update_preferred_input_port()
521 /* If the profile change didn't affect output, it doesn't indicate change in in update_preferred_output_port()
534 /* If the profile change modified the set of sources, then it's unclear in update_preferred_output_port()
537 * new profile contains no sources, though, then we know the user only in update_preferred_output_port()
564 /* This profile change wasn't initiated by the user, so it doesn't signal in card_profile_changed_callback()