core: add wp_core_get_own_bound_id() method
This allows retrieving the bound-id of our own client
This commit is contained in:
@@ -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
|
||||
*
|
||||
|
@@ -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);
|
||||
|
||||
|
@@ -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 },
|
||||
|
Reference in New Issue
Block a user