From efec274b6dcf239f580713f889957c370ac7ffc7 Mon Sep 17 00:00:00 2001 From: Tanu Kaskinen Date: Mon, 17 Aug 2009 16:42:58 +0300 Subject: dbusiface-core: Two new functions: pa_dbusiface_core_get_sink/source(). --- src/modules/dbus/iface-core.c | 28 ++++++++++++++++++++++++++++ src/modules/dbus/iface-core.h | 6 ++++++ 2 files changed, 34 insertions(+) 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 -- cgit