proxy: add a method to query the interface type
This commit is contained in:
@@ -186,6 +186,29 @@ wp_proxy_get_bound_id (WpProxy * self)
|
|||||||
return priv->pw_proxy ? pw_proxy_get_bound_id (priv->pw_proxy) : SPA_ID_INVALID;
|
return priv->pw_proxy ? pw_proxy_get_bound_id (priv->pw_proxy) : SPA_ID_INVALID;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* wp_proxy_get_interface_type:
|
||||||
|
* @self: the proxy
|
||||||
|
* @version: (out) (optional): the version of the interface
|
||||||
|
*
|
||||||
|
* Returns: the PipeWire type of the interface that is being proxied
|
||||||
|
*/
|
||||||
|
const gchar *
|
||||||
|
wp_proxy_get_interface_type (WpProxy * self, guint32 * version)
|
||||||
|
{
|
||||||
|
g_return_val_if_fail (WP_IS_PROXY (self), NULL);
|
||||||
|
|
||||||
|
WpProxyPrivate *priv = wp_proxy_get_instance_private (self);
|
||||||
|
if (priv->pw_proxy)
|
||||||
|
return pw_proxy_get_type (priv->pw_proxy, version);
|
||||||
|
else {
|
||||||
|
WpProxyClass *klass = WP_PROXY_GET_CLASS (self);
|
||||||
|
if (version)
|
||||||
|
*version = klass->pw_iface_version;
|
||||||
|
return klass->pw_iface_type;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* wp_proxy_get_pw_proxy:
|
* wp_proxy_get_pw_proxy:
|
||||||
*
|
*
|
||||||
|
@@ -91,6 +91,9 @@ struct _WpProxyClass
|
|||||||
WP_API
|
WP_API
|
||||||
guint32 wp_proxy_get_bound_id (WpProxy * self);
|
guint32 wp_proxy_get_bound_id (WpProxy * self);
|
||||||
|
|
||||||
|
WP_API
|
||||||
|
const gchar * wp_proxy_get_interface_type (WpProxy * self, guint32 * version);
|
||||||
|
|
||||||
WP_API
|
WP_API
|
||||||
struct pw_proxy * wp_proxy_get_pw_proxy (WpProxy * self);
|
struct pw_proxy * wp_proxy_get_pw_proxy (WpProxy * self);
|
||||||
|
|
||||||
|
@@ -238,6 +238,24 @@ static const luaL_Reg object_methods[] = {
|
|||||||
{ NULL, NULL }
|
{ NULL, NULL }
|
||||||
};
|
};
|
||||||
|
|
||||||
|
/* WpProxy */
|
||||||
|
|
||||||
|
static int
|
||||||
|
proxy_get_interface_type (lua_State *L)
|
||||||
|
{
|
||||||
|
WpProxy * p = wplua_checkobject (L, 1, WP_TYPE_PROXY);
|
||||||
|
guint32 version = 0;
|
||||||
|
const gchar *type = wp_proxy_get_interface_type (p, &version);
|
||||||
|
lua_pushstring (L, type);
|
||||||
|
lua_pushinteger (L, version);
|
||||||
|
return 2;
|
||||||
|
}
|
||||||
|
|
||||||
|
static const luaL_Reg proxy_methods[] = {
|
||||||
|
{ "get_interface_type", proxy_get_interface_type },
|
||||||
|
{ NULL, NULL }
|
||||||
|
};
|
||||||
|
|
||||||
/* WpGlobalProxy */
|
/* WpGlobalProxy */
|
||||||
|
|
||||||
static int
|
static int
|
||||||
@@ -937,6 +955,8 @@ wp_lua_scripting_api_init (lua_State *L)
|
|||||||
|
|
||||||
wplua_register_type_methods (L, WP_TYPE_OBJECT,
|
wplua_register_type_methods (L, WP_TYPE_OBJECT,
|
||||||
NULL, object_methods);
|
NULL, object_methods);
|
||||||
|
wplua_register_type_methods (L, WP_TYPE_PROXY,
|
||||||
|
NULL, proxy_methods);
|
||||||
wplua_register_type_methods (L, WP_TYPE_GLOBAL_PROXY,
|
wplua_register_type_methods (L, WP_TYPE_GLOBAL_PROXY,
|
||||||
NULL, global_proxy_methods);
|
NULL, global_proxy_methods);
|
||||||
wplua_register_type_methods (L, WP_TYPE_OBJECT_INTEREST,
|
wplua_register_type_methods (L, WP_TYPE_OBJECT_INTEREST,
|
||||||
|
Reference in New Issue
Block a user