Lines Matching refs:entry

118 struct entry {
136 static struct entry* entry_new(void);
137 static void entry_free(struct entry *e);
138 static struct entry *entry_read(struct userdata *u, const char *name);
139 static bool entry_write(struct userdata *u, const char *name, const struct entry *e, bool replace);
140 static struct entry* entry_copy(const struct entry *e);
141 static void entry_apply(struct userdata *u, const char *name, struct entry *e);
147 #define ENTRY_OBJECT_NAME "entry"
226 { "entry", "o", "out" } };
227 static pa_dbus_arg_info get_entry_by_name_args[] = { { "name", "s", "in" }, { "entry", "o", "out" } };
263 static pa_dbus_arg_info new_entry_args[] = { { "entry", "o", NULL } };
264 static pa_dbus_arg_info entry_removed_args[] = { { "entry", "o", NULL } };
404 static void append_volume(DBusMessageIter *iter, struct entry *e) {
431 static void append_volume_variant(DBusMessageIter *iter, struct entry *e) {
444 static void send_new_entry_signal(struct dbus_entry *entry) {
447 pa_assert(entry);
450 pa_assert_se(dbus_message_append_args(signal_msg, DBUS_TYPE_OBJECT_PATH, &entry->object_path, DBUS_TYPE_INVALID));
451 pa_dbus_protocol_send_signal(entry->userdata->dbus_protocol, signal_msg);
455 static void send_entry_removed_signal(struct dbus_entry *entry) {
458 pa_assert(entry);
461 pa_assert_se(dbus_message_append_args(signal_msg, DBUS_TYPE_OBJECT_PATH, &entry->object_path, DBUS_TYPE_INVALID));
462 pa_dbus_protocol_send_signal(entry->userdata->dbus_protocol, signal_msg);
466 static void send_device_updated_signal(struct dbus_entry *de, struct entry *e) {
481 static void send_volume_updated_signal(struct dbus_entry *de, struct entry *e) {
495 static void send_mute_updated_signal(struct dbus_entry *de, struct entry *e) {
603 struct entry *e = NULL;
625 pa_dbus_send_error(conn, msg, DBUS_ERROR_INVALID_ARGS, "An empty string was given as the entry name.");
696 pa_dbus_send_error(conn, msg, PA_DBUS_ERROR_NOT_FOUND, "No such stream restore entry.");
725 struct entry *e;
744 struct entry *e;
779 struct entry *e;
801 struct entry *e = NULL;
835 struct entry *e;
854 struct entry *e;
886 struct entry *e;
968 static struct entry* entry_new(void) {
969 struct entry *r = pa_xnew0(struct entry, 1);
973 static void entry_free(struct entry* e) {
981 static bool entry_write(struct userdata *u, const char *name, const struct entry *e, bool replace) {
1017 static struct entry *legacy_entry_read(struct userdata *u, const char *name) {
1031 struct entry *e;
1112 static struct entry *entry_read(struct userdata *u, const char *name) {
1114 struct entry *e = NULL;
1229 static struct entry* entry_copy(const struct entry *e) {
1230 struct entry* r;
1263 static bool entries_equal(const struct entry *a, const struct entry *b) {
1291 struct entry *entry, *old = NULL;
1328 entry = entry_copy(old);
1331 entry = entry_new();
1336 entry->channel_map = sink_input->channel_map;
1337 pa_sink_input_get_volume(sink_input, &entry->volume, false);
1338 entry->volume_valid = true;
1342 || !pa_channel_map_equal(&entry->channel_map, &old->channel_map)
1343 || !pa_cvolume_equal(&entry->volume, &old->volume));
1347 entry->muted = sink_input->muted;
1348 entry->muted_valid = true;
1350 mute_updated = !created_new_entry && (!old->muted_valid || entry->muted != old->muted);
1369 entry = entry_copy(old);
1372 entry = entry_new();
1377 entry->channel_map = source_output->channel_map;
1378 pa_source_output_get_volume(source_output, &entry->volume, false);
1379 entry->volume_valid = true;
1383 || !pa_channel_map_equal(&entry->channel_map, &old->channel_map)
1384 || !pa_cvolume_equal(&entry->volume, &old->volume));
1388 entry->muted = source_output->muted;
1389 entry->muted_valid = true;
1391 mute_updated = !created_new_entry && (!old->muted_valid || entry->muted != old->muted);
1395 pa_assert(entry);
1399 if (entries_equal(old, entry)) {
1401 entry_free(entry);
1411 if (entry_write(u, name, entry, true)) {
1424 send_volume_updated_signal(de, entry);
1426 send_mute_updated_signal(de, entry);
1434 entry_free(entry);
1440 struct entry *e;
1488 struct entry *e;
1543 struct entry *old;
1544 struct entry *entry;
1554 entry = entry_copy(old);
1556 entry = entry_new();
1562 pa_xfree(entry->device);
1563 entry->device = pa_xstrdup(device);
1564 entry->device_valid = !!device;
1566 pa_xfree(entry->card);
1567 entry->card = pa_xstrdup(card);
1568 entry->card_valid = !!card;
1572 entry_write(u, name, entry, true);
1584 if (!created_new_entry && !pa_safe_streq(entry->device, old->device))
1585 send_device_updated_signal(de, entry);
1589 entry_free(entry);
1617 struct entry *e;
1669 struct entry *e;
1792 struct entry e;
1802 pa_log_warn("[%s:%u] Positive dB values are not allowed, not setting entry %s.", fn, n, ln);
1804 pa_log_warn("[%s:%u] Couldn't parse '%s' as a double, not setting entry %s.", fn, n, v, ln);
1819 static void entry_apply(struct userdata *u, const char *name, struct entry *e) {
1924 struct entry *e;
1992 struct entry *e;
2050 struct entry *entry;
2052 struct entry *old;
2055 entry = entry_new();
2058 pa_tagstruct_get_channel_map(t, &entry->channel_map) ||
2059 pa_tagstruct_get_cvolume(t, &entry->volume) < 0 ||
2062 entry_free(entry);
2067 entry_free(entry);
2071 entry->volume_valid = entry->volume.channels > 0;
2073 if (entry->volume_valid)
2074 if (!pa_cvolume_compatible_with_channel_map(&entry->volume, &entry->channel_map)) {
2075 entry_free(entry);
2079 entry->muted = muted;
2080 entry->muted_valid = true;
2082 entry->device = pa_xstrdup(device);
2083 entry->device_valid = device && !!entry->device[0];
2085 if (entry->device_valid && !pa_namereg_is_valid_name(entry->device)) {
2086 entry_free(entry);
2096 if (entry->device_valid && ((m->core->default_sink && pa_safe_streq(device, m->core->default_sink->name)) ||
2098 entry_free(entry);
2107 pa_log_debug("Client %s changes entry %s.",
2111 if (entry_write(u, name, entry, mode == PA_UPDATE_REPLACE)) {
2118 if ((old->device_valid != entry->device_valid)
2119 || (entry->device_valid && !pa_streq(entry->device, old->device)))
2120 send_device_updated_signal(de, entry);
2122 if ((old->volume_valid != entry->volume_valid)
2123 || (entry->volume_valid && (!pa_cvolume_equal(&entry->volume, &old->volume)
2124 || !pa_channel_map_equal(&entry->channel_map, &old->channel_map))))
2125 send_volume_updated_signal(de, entry);
2127 if (!old->muted_valid || (entry->muted != old->muted))
2128 send_mute_updated_signal(de, entry);
2138 entry_apply(u, name, entry);
2145 entry_free(entry);
2226 struct entry *entry;
2254 struct entry *e = NULL;
2258 /* Use entry_read() to check whether this entry is valid. */
2267 /* Not a legacy entry either, let's remove this. */
2270 /* Yay, it's valid after all! Now let's convert the entry to the current format. */
2271 item->entry = e;
2275 /* Invalid entry, let's remove this. */
2292 pa_log_debug("Removing an invalid entry: %s", item->entry_name);
2304 pa_log_debug("Upgrading a legacy entry to the current format: %s", item->entry_name);
2306 pa_assert_se(entry_write(u, item->entry_name, item->entry, true));
2311 entry_free(item->entry);