summaryrefslogtreecommitdiff
path: root/src/modules/dbus
diff options
context:
space:
mode:
authorTanu Kaskinen <tanuk@iki.fi>2018-06-26 16:25:58 +0300
committerTanu Kaskinen <tanuk@iki.fi>2018-07-02 21:23:13 +0300
commit6665b466d28ca6f166c22846777f541f5bc9cef7 (patch)
tree32c37a04ae188ef0690adfe69967bd262efa9253 /src/modules/dbus
parentb4a36453da7647ece7797dcca1628f7878aab870 (diff)
downloadpulseaudio-6665b466d28ca6f166c22846777f541f5bc9cef7.tar.gz
sink, source: remove the state getters
pa_sink_get_state() and pa_source_get_state() just return the state variable. We can as well access the state variable directly. There are no behaviour changes, except that module-virtual-source accessed the main thread's sink state variable from its push() callback. I fixed the module so that it uses the thread_info.state variable instead. Also, the compiler started to complain about comparing a sink state variable to a source state enum value in protocol-esound.c. The underlying bug was that a source pointer was assigned to a variable whose type was a sink pointer (somehow using the pa_source_get_state() macro confused the compiler enough so that it didn't complain before). I fixed the variable type.
Diffstat (limited to 'src/modules/dbus')
-rw-r--r--src/modules/dbus/iface-device.c12
1 files changed, 6 insertions, 6 deletions
diff --git a/src/modules/dbus/iface-device.c b/src/modules/dbus/iface-device.c
index 2c370a822..775cf3ff6 100644
--- a/src/modules/dbus/iface-device.c
+++ b/src/modules/dbus/iface-device.c
@@ -849,7 +849,7 @@ static void handle_get_all(DBusConnection *conn, DBusMessage *msg, void *userdat
latency = pa_sink_get_latency(d->sink);
is_hardware_device = !!(d->sink->flags & PA_SINK_HARDWARE);
is_network_device = !!(d->sink->flags & PA_SINK_NETWORK);
- state = pa_sink_get_state(d->sink);
+ state = d->sink->state;
} else {
idx = d->source->index;
name = d->source->name;
@@ -870,7 +870,7 @@ static void handle_get_all(DBusConnection *conn, DBusMessage *msg, void *userdat
latency = pa_source_get_latency(d->source);
is_hardware_device = !!(d->source->flags & PA_SOURCE_HARDWARE);
is_network_device = !!(d->source->flags & PA_SOURCE_NETWORK);
- state = pa_source_get_state(d->source);
+ state = d->source->state;
}
if (owner_module)
owner_module_path = pa_dbusiface_core_get_module_path(d->core, owner_module);
@@ -1158,9 +1158,9 @@ static pa_hook_result_t state_changed_cb(void *hook_data, void *call_data, void
return PA_HOOK_OK;
if (d->type == PA_DEVICE_TYPE_SINK)
- new_sink_state = pa_sink_get_state(d->sink);
+ new_sink_state = d->sink->state;
else
- new_source_state = pa_source_get_state(d->source);
+ new_source_state = d->source->state;
if ((d->type == PA_DEVICE_TYPE_SINK && d->sink_state != new_sink_state)
|| (d->type == PA_DEVICE_TYPE_SOURCE && d->source_state != new_source_state)) {
@@ -1258,7 +1258,7 @@ pa_dbusiface_device *pa_dbusiface_device_new_sink(pa_dbusiface_core *core, pa_si
d->path = pa_sprintf_malloc("%s/%s%u", PA_DBUS_CORE_OBJECT_PATH, SINK_OBJECT_NAME, sink->index);
d->volume = *pa_sink_get_volume(sink, false);
d->mute = pa_sink_get_mute(sink, false);
- d->sink_state = pa_sink_get_state(sink);
+ d->sink_state = sink->state;
d->ports = pa_hashmap_new_full(pa_idxset_string_hash_func, pa_idxset_string_compare_func, NULL, (pa_free_cb_t) pa_dbusiface_device_port_free);
d->next_port_index = 0;
d->active_port = sink->active_port;
@@ -1301,7 +1301,7 @@ pa_dbusiface_device *pa_dbusiface_device_new_source(pa_dbusiface_core *core, pa_
d->path = pa_sprintf_malloc("%s/%s%u", PA_DBUS_CORE_OBJECT_PATH, SOURCE_OBJECT_NAME, source->index);
d->volume = *pa_source_get_volume(source, false);
d->mute = pa_source_get_mute(source, false);
- d->source_state = pa_source_get_state(source);
+ d->source_state = source->state;
d->ports = pa_hashmap_new_full(pa_idxset_string_hash_func, pa_idxset_string_compare_func, NULL, (pa_free_cb_t) pa_dbusiface_device_port_free);
d->next_port_index = 0;
d->active_port = source->active_port;