diff --git a/lib/wp/core.c b/lib/wp/core.c index 5429f2ed..9d98b27c 100644 --- a/lib/wp/core.c +++ b/lib/wp/core.c @@ -653,6 +653,26 @@ wp_core_is_connected (WpCore * self) return self->pw_core != NULL; } +/*! + * \brief Gets the bound id of the client object that is created as a result + * of this core being connected to the PipeWire daemon + * + * \ingroup wpcore + * \since 0.4.16 + * \param self the core + * \returns the bound id of this client + */ +guint32 +wp_core_get_own_bound_id (WpCore * self) +{ + struct pw_client *client; + + g_return_val_if_fail (wp_core_is_connected (self), SPA_ID_INVALID); + + client = pw_core_get_client (self->pw_core); + return pw_proxy_get_bound_id ((struct pw_proxy *) client); +} + /*! * \brief Gets the cookie of the core's connected PipeWire instance * diff --git a/lib/wp/core.h b/lib/wp/core.h index 37997a8c..58eaad2c 100644 --- a/lib/wp/core.h +++ b/lib/wp/core.h @@ -64,6 +64,9 @@ gboolean wp_core_is_connected (WpCore * self); /* Properties */ +WP_API +guint32 wp_core_get_own_bound_id (WpCore * self); + WP_API guint32 wp_core_get_remote_cookie (WpCore * self); diff --git a/modules/module-lua-scripting/api/api.c b/modules/module-lua-scripting/api/api.c index a3ab36ef..a5f13fd4 100644 --- a/modules/module-lua-scripting/api/api.c +++ b/modules/module-lua-scripting/api/api.c @@ -174,6 +174,15 @@ core_get_vm_type (lua_State *L) return 1; } +static int +core_get_own_bound_id (lua_State *L) +{ + WpCore * core = get_wp_core (L); + guint32 id = wp_core_get_own_bound_id (core); + lua_pushinteger (L, id); + return 1; +} + static int core_idle_add (lua_State *L) { @@ -270,6 +279,7 @@ core_require_api (lua_State *L) static const luaL_Reg core_funcs[] = { { "get_info", core_get_info }, { "get_vm_type", core_get_vm_type }, + { "get_own_bound_id", core_get_own_bound_id }, { "idle_add", core_idle_add }, { "timeout_add", core_timeout_add }, { "sync", core_sync },