dbusiface-core: Two new functions: pa_dbusiface_core_get_sink/source().
authorTanu Kaskinen <tanuk@iki.fi>
Mon, 17 Aug 2009 13:42:58 +0000 (16:42 +0300)
committerTanu Kaskinen <tanuk@iki.fi>
Mon, 17 Aug 2009 13:42:58 +0000 (16:42 +0300)
src/modules/dbus/iface-core.c
src/modules/dbus/iface-core.h

index ec87158..86a8fc7 100644 (file)
@@ -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;
+}
index cf2a3b2..900b6d1 100644 (file)
@@ -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