Lines Matching refs:card
37 pa_card *card; member
49 static void card_info_new(struct userdata *u, pa_card *card) { in card_info_new() argument
54 info->card = card; in card_info_new()
55 info->active_profile = card->active_profile; in card_info_new()
57 pa_hashmap_put(u->card_infos, card, info); in card_info_new()
61 pa_hashmap_remove(info->userdata->card_infos, info->card); in card_info_free()
66 pa_card *card; in profile_good_for_output() local
72 card = profile->card; in profile_good_for_output()
74 if (!pa_safe_streq(card->active_profile->input_name, profile->input_name)) in profile_good_for_output()
77 if (card->active_profile->n_sources != profile->n_sources) in profile_good_for_output()
80 if (card->active_profile->max_source_channels != profile->max_source_channels) in profile_good_for_output()
83 if (port == card->preferred_output_port) in profile_good_for_output()
86 PA_IDXSET_FOREACH(sink, card->sinks, idx) { in profile_good_for_output()
98 pa_card *card; in profile_good_for_input() local
104 card = profile->card; in profile_good_for_input()
106 if (!pa_safe_streq(card->active_profile->output_name, profile->output_name)) in profile_good_for_input()
109 if (card->active_profile->n_sinks != profile->n_sinks) in profile_good_for_input()
112 if (card->active_profile->max_sink_channels != profile->max_sink_channels) in profile_good_for_input()
115 if (port == card->preferred_input_port) in profile_good_for_input()
118 PA_IDXSET_FOREACH(source, card->sources, idx) { in profile_good_for_input()
174 if (pa_card_set_profile(port->card, best_profile, false) != 0) { in try_to_switch_profile()
202 pa_card *card; in find_port_pointers() local
205 pa_assert_se(card = port->card); in find_port_pointers()
209 PA_IDXSET_FOREACH(pp.sink, card->sinks, state) in find_port_pointers()
215 PA_IDXSET_FOREACH(pp.source, card->sources, state) in find_port_pointers()
222 card->active_profile == pa_hashmap_get(port->profiles, card->active_profile->name); in find_port_pointers()
224 …pa_safe_streq(port->preferred_profile, profile_name_for_dir(card->active_profile, port->direction)… in find_port_pointers()
261 PA_HASHMAP_FOREACH(p, port->card->ports, state) { in switch_from_port()
291 if (!port->card) { in port_available_hook_callback()
301 if (pa_safe_streq(pa_proplist_gets(port->card->proplist, PA_PROP_DEVICE_BUS), "bluetooth")) in port_available_hook_callback()
358 static pa_card_profile *find_best_profile(pa_card *card) { in find_best_profile() argument
362 pa_assert(card); in find_best_profile()
363 best_profile = pa_hashmap_get(card->profiles, "off"); in find_best_profile()
365 PA_HASHMAP_FOREACH(profile, card->profiles, state) { in find_best_profile()
377 pa_card *card; in card_profile_available_hook_callback() local
380 pa_assert_se(card = profile->card); in card_profile_available_hook_callback()
385 if (!pa_streq(profile->name, card->active_profile->name)) in card_profile_available_hook_callback()
388 …rofile %s on card %s became unavailable, switching to another profile", profile->name, card->name); in card_profile_available_hook_callback()
389 pa_card_set_profile(card, find_best_profile(card), false); in card_profile_available_hook_callback()
396 pa_card *card; in handle_all_unavailable() local
399 PA_IDXSET_FOREACH(card, core->cards, state) { in handle_all_unavailable()
403 PA_HASHMAP_FOREACH(port, card->ports, state2) { in handle_all_unavailable()
454 static pa_hook_result_t card_put_hook_callback(pa_core *core, pa_card *card, struct userdata *u) { in card_put_hook_callback() argument
455 card_info_new(u, card); in card_put_hook_callback()
460 static pa_hook_result_t card_unlink_hook_callback(pa_core *core, pa_card *card, struct userdata *u)… in card_unlink_hook_callback() argument
461 card_info_free(pa_hashmap_get(u->card_infos, card)); in card_unlink_hook_callback()
466 static void update_preferred_input_port(pa_card *card, pa_card_profile *old_profile, pa_card_profil… in update_preferred_input_port() argument
477 if (pa_idxset_size(card->sources) != 1) { in update_preferred_input_port()
478 pa_card_set_preferred_port(card, PA_DIRECTION_INPUT, NULL); in update_preferred_input_port()
487 …if (pa_idxset_size(card->sinks) > 0 && !pa_safe_streq(old_profile->output_name, new_profile->outpu… in update_preferred_input_port()
488 pa_card_set_preferred_port(card, PA_DIRECTION_INPUT, NULL); in update_preferred_input_port()
492 source = pa_idxset_first(card->sources, NULL); in update_preferred_input_port()
499 pa_card_set_preferred_port(card, PA_DIRECTION_INPUT, source->active_port); in update_preferred_input_port()
502 static void update_preferred_output_port(pa_card *card, pa_card_profile *old_profile, pa_card_profi… in update_preferred_output_port() argument
513 if (pa_idxset_size(card->sinks) != 1) { in update_preferred_output_port()
514 pa_card_set_preferred_port(card, PA_DIRECTION_OUTPUT, NULL); in update_preferred_output_port()
523 …if (pa_idxset_size(card->sources) > 0 && !pa_safe_streq(old_profile->input_name, new_profile->inpu… in update_preferred_output_port()
524 pa_card_set_preferred_port(card, PA_DIRECTION_OUTPUT, NULL); in update_preferred_output_port()
528 sink = pa_idxset_first(card->sinks, NULL); in update_preferred_output_port()
535 pa_card_set_preferred_port(card, PA_DIRECTION_OUTPUT, sink->active_port); in update_preferred_output_port()
538 static pa_hook_result_t card_profile_changed_callback(pa_core *core, pa_card *card, struct userdata… in card_profile_changed_callback() argument
543 info = pa_hashmap_get(u->card_infos, card); in card_profile_changed_callback()
545 new_profile = card->active_profile; in card_profile_changed_callback()
550 if (!card->save_profile) in card_profile_changed_callback()
553 update_preferred_input_port(card, old_profile, new_profile); in card_profile_changed_callback()
554 update_preferred_output_port(card, old_profile, new_profile); in card_profile_changed_callback()
563 pa_card_set_preferred_port(source->card, PA_DIRECTION_INPUT, source->active_port); in source_port_changed_callback()
572 pa_card_set_preferred_port(sink->card, PA_DIRECTION_OUTPUT, sink->active_port); in sink_port_changed_callback()
579 pa_card *card; in pa__init() local
587 PA_IDXSET_FOREACH(card, m->core->cards, idx) in pa__init()
588 card_info_new(u, card); in pa__init()