Lines Matching refs:card
147 static struct entry *entry_from_card(pa_card *card) { in entry_from_card() argument
153 pa_assert(card); in entry_from_card()
156 if (card->save_profile) in entry_from_card()
157 entry->profile = pa_xstrdup(card->active_profile->name); in entry_from_card()
159 PA_HASHMAP_FOREACH(port, card->ports, state) { in entry_from_card()
378 static void show_full_info(pa_card *card) { in show_full_info() argument
379 pa_assert(card); in show_full_info()
381 if (card->save_profile) in show_full_info()
382 pa_log_info("Storing profile and port latency offsets for card %s.", card->name); in show_full_info()
384 pa_log_info("Storing port latency offsets for card %s.", card->name); in show_full_info()
387 static pa_hook_result_t card_put_hook_callback(pa_core *c, pa_card *card, struct userdata *u) { in card_put_hook_callback() argument
390 pa_assert(card); in card_put_hook_callback()
392 entry = entry_from_card(card); in card_put_hook_callback()
394 if ((old = entry_read(u, card->name))) { in card_put_hook_callback()
395 if (!card->save_profile) in card_put_hook_callback()
401 show_full_info(card); in card_put_hook_callback()
403 if (entry_write(u, card->name, entry)) in card_put_hook_callback()
414 static void update_profile_for_port(struct entry *entry, pa_card *card, pa_device_port *p) { in update_profile_for_port() argument
428 … pa_log_info("Storing profile %s for port %s on card %s.", p_info->profile, p->name, card->name); in update_profile_for_port()
432 static pa_hook_result_t card_profile_changed_callback(pa_core *c, pa_card *card, struct userdata *u… in card_profile_changed_callback() argument
438 pa_assert(card); in card_profile_changed_callback()
440 if (!card->save_profile) in card_profile_changed_callback()
443 if ((entry = entry_read(u, card->name))) { in card_profile_changed_callback()
445 entry->profile = pa_xstrdup(card->active_profile->name); in card_profile_changed_callback()
446 pa_log_info("Storing card profile for card %s.", card->name); in card_profile_changed_callback()
448 entry = entry_from_card(card); in card_profile_changed_callback()
449 show_full_info(card); in card_profile_changed_callback()
452 PA_IDXSET_FOREACH(sink, card->sinks, state) in card_profile_changed_callback()
453 update_profile_for_port(entry, card, sink->active_port); in card_profile_changed_callback()
454 PA_IDXSET_FOREACH(source, card->sources, state) in card_profile_changed_callback()
455 update_profile_for_port(entry, card, source->active_port); in card_profile_changed_callback()
457 if (entry_write(u, card->name, entry)) in card_profile_changed_callback()
472 if (!(entry = entry_read(u, profile->card->name))) in card_profile_added_callback()
476 if (pa_card_set_profile(profile->card, profile, true) >= 0) in card_profile_added_callback()
477 pa_log_info("Restored profile '%s' for card %s.", profile->name, profile->card->name); in card_profile_added_callback()
487 pa_card *card; in port_offset_change_callback() local
490 card = port->card; in port_offset_change_callback()
492 if ((entry = entry_read(u, card->name))) { in port_offset_change_callback()
502 pa_log_info("Storing latency offset for port %s on card %s.", port->name, card->name); in port_offset_change_callback()
505 entry = entry_from_card(card); in port_offset_change_callback()
506 show_full_info(card); in port_offset_change_callback()
509 if (entry_write(u, card->name, entry)) in port_offset_change_callback()
556 static pa_hook_result_t card_choose_initial_profile_callback(pa_core *core, pa_card *card, struct u… in card_choose_initial_profile_callback() argument
559 if (!(e = entry_read(u, card->name))) in card_choose_initial_profile_callback()
563 const char *s = pa_proplist_gets(card->proplist, PA_PROP_DEVICE_BUS); in card_choose_initial_profile_callback()
571 profile = pa_hashmap_get(card->profiles, e->profile); in card_choose_initial_profile_callback()
574 pa_log_info("Restoring profile '%s' for card %s.", profile->name, card->name); in card_choose_initial_profile_callback()
575 pa_card_set_profile(card, profile, true); in card_choose_initial_profile_callback()
578 profile->name, card->name); in card_choose_initial_profile_callback()
581 e->profile, card->name); in card_choose_initial_profile_callback()
594 pa_card *card; in card_preferred_port_changed_callback() local
596 card = data->card; in card_preferred_port_changed_callback()
598 e = entry_read(u, card->name); in card_preferred_port_changed_callback()
600 e = entry_from_card(card); in card_preferred_port_changed_callback()
604 …e->preferred_input_port = pa_xstrdup(card->preferred_input_port ? card->preferred_input_port->name… in card_preferred_port_changed_callback()
607 …e->preferred_output_port = pa_xstrdup(card->preferred_output_port ? card->preferred_output_port->n… in card_preferred_port_changed_callback()
610 if (entry_write(u, card->name, e)) in card_preferred_port_changed_callback()