summaryrefslogtreecommitdiffstats
path: root/src/modules/dbus
diff options
context:
space:
mode:
authorTanu Kaskinen <tanuk@iki.fi>2009-08-17 16:42:58 +0300
committerTanu Kaskinen <tanuk@iki.fi>2009-08-17 16:42:58 +0300
commitefec274b6dcf239f580713f889957c370ac7ffc7 (patch)
tree7420a8d871f3eed771bf90e8bb85e0d12fa28314 /src/modules/dbus
parenta10e8360d72626635de1242cfc2c77207f13d56f (diff)
dbusiface-core: Two new functions: pa_dbusiface_core_get_sink/source().
Diffstat (limited to 'src/modules/dbus')
-rw-r--r--src/modules/dbus/iface-core.c28
-rw-r--r--src/modules/dbus/iface-core.h6
2 files changed, 34 insertions, 0 deletions
diff --git a/src/modules/dbus/iface-core.c b/src/modules/dbus/iface-core.c
index ec87158f..86a8fc7b 100644
--- a/src/modules/dbus/iface-core.c
+++ b/src/modules/dbus/iface-core.c
@@ -2082,3 +2082,31 @@ const char *pa_dbusiface_core_get_client_path(pa_dbusiface_core *c, const pa_cli
return pa_dbusiface_client_get_path(pa_hashmap_get(c->clients, PA_UINT32_TO_PTR(client->index)));
}
+
+pa_sink *pa_dbusiface_core_get_sink(pa_dbusiface_core *c, const char *object_path) {
+ pa_dbusiface_device *device = NULL;
+
+ pa_assert(c);
+ pa_assert(object_path);
+
+ device = pa_hashmap_get(c->sinks_by_path, object_path);
+
+ if (device)
+ return pa_dbusiface_device_get_sink(device);
+ else
+ return NULL;
+}
+
+pa_source *pa_dbusiface_core_get_source(pa_dbusiface_core *c, const char *object_path) {
+ pa_dbusiface_device *device = NULL;
+
+ pa_assert(c);
+ pa_assert(object_path);
+
+ device = pa_hashmap_get(c->sources_by_path, object_path);
+
+ if (device)
+ return pa_dbusiface_device_get_source(device);
+ else
+ return NULL;
+}
diff --git a/src/modules/dbus/iface-core.h b/src/modules/dbus/iface-core.h
index cf2a3b20..900b6d1c 100644
--- a/src/modules/dbus/iface-core.h
+++ b/src/modules/dbus/iface-core.h
@@ -43,4 +43,10 @@ const char *pa_dbusiface_core_get_record_stream_path(pa_dbusiface_core *c, const
const char *pa_dbusiface_core_get_module_path(pa_dbusiface_core *c, const pa_module *module);
const char *pa_dbusiface_core_get_client_path(pa_dbusiface_core *c, const pa_client *client);
+/* Returns NULL if there's no sink with the given path. */
+pa_sink *pa_dbusiface_core_get_sink(pa_dbusiface_core *c, const char *object_path);
+
+/* Returns NULL if there's no source with the given path. */
+pa_source *pa_dbusiface_core_get_source(pa_dbusiface_core *c, const char *object_path);
+
#endif