Lines Matching refs:card
40 "a2dp_source=<Handle a2dp_source card profile (sink role)?> "
41 "ag=<Handle headset_audio_gateway or handsfree_audio_gateway card profile (headset role)?> ");
144 static void card_set_profile(struct userdata *u, pa_card *card, bool revert_to_a2dp)
150 PA_HASHMAP_FOREACH(profile, card->profiles, state) {
163 pa_log_debug("Setting card '%s' to profile '%s'", card->name, profile->name);
165 if (pa_card_set_profile(card, profile, false) != 0) {
170 /* When we are not in revert_to_a2dp phase flag this card for will_need_revert */
172 pa_hashmap_put(u->will_need_revert_card_map, card, PA_INT_TO_PTR(1));
178 /* Switch profile for one card */
179 static void switch_profile(pa_card *card, bool revert_to_a2dp, void *userdata) {
184 s = pa_proplist_gets(card->proplist, PA_PROP_DEVICE_BUS);
190 if (!pa_hashmap_remove(u->will_need_revert_card_map, card))
193 /* Skip card if does not have active headset profile */
194 if (!pa_streq(card->active_profile->name, "headset_head_unit") && !pa_streq(card->active_profile->name, "handsfree_head_unit"))
197 /* Skip card if already has active a2dp profile */
198 if (pa_streq(card->active_profile->name, "a2dp_sink"))
201 /* Skip card if does not have active a2dp profile */
202 if (!pa_streq(card->active_profile->name, "a2dp_sink"))
205 /* Skip card if already has active headset profile */
206 if (pa_streq(card->active_profile->name, "headset_head_unit") || pa_streq(card->active_profile->name, "handsfree_head_unit"))
210 card_set_profile(u, card, revert_to_a2dp);
257 pa_card *card;
260 PA_IDXSET_FOREACH(card, cards, idx)
261 switch_profile(card, revert_to_a2dp, userdata);
292 static pa_hook_result_t card_init_profile_hook_callback(pa_core *c, pa_card *card, void *userdata) {
297 pa_assert(card);
303 s = pa_proplist_gets(card->proplist, PA_PROP_DEVICE_BUS);
307 /* Ignore card if has already set other initial profile than a2dp */
308 if (card->active_profile &&
309 !pa_streq(card->active_profile->name, "a2dp_sink"))
313 card_set_profile(u, card, false);
315 /* Flag this card for will_need_revert */
316 pa_hashmap_put(u->will_need_revert_card_map, card, PA_INT_TO_PTR(1));
320 static pa_hook_result_t card_unlink_hook_callback(pa_core *c, pa_card *card, void *userdata) {
322 pa_assert(card);
323 switch_profile(card, true, userdata);
327 static pa_card_profile *find_best_profile(pa_card *card) {
330 pa_card_profile *result = card->active_profile;
332 PA_HASHMAP_FOREACH(profile, card->profiles, state) {
346 pa_card *card;
353 pa_assert_se((card = profile->card));
356 s = pa_proplist_gets(card->proplist, PA_PROP_DEVICE_BUS);
366 is_active_profile = card->active_profile == profile;
372 if (card->active_profile->available == PA_AVAILABLE_YES && card->active_profile->priority >= profile->priority)
380 pa_assert_se((selected_profile = find_best_profile(card)));
382 if (selected_profile == card->active_profile)
386 pa_log_debug("Setting card '%s' to profile '%s'", card->name, selected_profile->name);
388 if (pa_card_set_profile(card, selected_profile, false) != 0)
395 pa_card *card;
398 PA_IDXSET_FOREACH(card, core->cards, state) {
402 PA_HASHMAP_FOREACH(profile, card->profiles, state2)