Lines Matching refs:entry
78 struct entry {
116 static struct entry* entry_new(void) {
117 struct entry *r = pa_xnew0(struct entry, 1);
137 static void entry_free(struct entry* e) {
148 static struct entry *entry_from_card(pa_card *card) {
150 struct entry *entry;
156 entry = entry_new();
157 entry->profile_is_sticky = card->profile_is_sticky;
158 if (card->save_profile || entry->profile_is_sticky)
159 entry->profile = pa_xstrdup(card->active_profile->name);
162 entry->preferred_input_port = pa_xstrdup(card->preferred_input_port->name);
164 entry->preferred_output_port = pa_xstrdup(card->preferred_output_port->name);
168 pa_assert_se(pa_hashmap_put(entry->ports, p_info->name, p_info) >= 0);
171 return entry;
174 static bool entrys_equal(struct entry *a, struct entry *b) {
205 static bool entry_write(struct userdata *u, const char *name, const struct entry *e) {
247 static struct entry* legacy_entry_read(struct userdata *u, pa_datum *data) {
253 struct entry *e;
281 static struct entry* entry_read(struct userdata *u, const char *name) {
283 struct entry *e = NULL;
408 struct entry *entry, *old;
412 entry = entry_from_card(card);
416 entry->profile = pa_xstrdup(old->profile);
417 if (entrys_equal(entry, old))
423 if (entry_write(u, card->name, entry))
427 entry_free(entry);
434 static void update_profile_for_port(struct entry *entry, pa_card *card, pa_device_port *p) {
440 if (!(p_info = pa_hashmap_get(entry->ports, p->name))) {
442 pa_assert_se(pa_hashmap_put(entry->ports, p_info->name, p_info) >= 0);
453 struct entry *entry;
463 if ((entry = entry_read(u, card->name))) {
464 pa_xfree(entry->profile);
465 entry->profile_is_sticky = card->profile_is_sticky;
466 entry->profile = pa_xstrdup(card->active_profile->name);
469 entry = entry_from_card(card);
474 update_profile_for_port(entry, card, sink->active_port);
476 update_profile_for_port(entry, card, source->active_port);
478 if (entry_write(u, card->name, entry))
481 entry_free(entry);
486 struct entry *entry;
493 if (!(entry = entry_read(u, profile->card->name)))
496 if (pa_safe_streq(entry->profile, profile->name)) {
501 entry_free(entry);
507 struct entry *entry;
513 if ((entry = entry_read(u, card->name))) {
516 if ((p_info = pa_hashmap_get(entry->ports, port->name)))
520 pa_assert_se(pa_hashmap_put(entry->ports, p_info->name, p_info) >= 0);
526 entry = entry_from_card(card);
530 if (entry_write(u, card->name, entry))
533 entry_free(entry);
538 struct entry *e;
578 struct entry *e;
620 struct entry *e;