lua: add Port.get_direction() + documentation for it

This commit is contained in:
George Kiagiadakis
2021-06-30 19:49:48 +03:00
parent 532340cc8f
commit 888d6e5033
3 changed files with 32 additions and 0 deletions

View File

@@ -115,6 +115,19 @@ Lua objects that bind a :ref:`WpNode <node_api>` contain the following methods:
:param self: the proxy
:param string command: the command to send to the node (ex "Suspend")
PipeWire Port
.............
Lua objects that bind a :ref:`WpPort <port_api>` contain the following methods:
.. function:: Port.get_direction(self)
Binds :c:func:`wp_port_get_direction`
:param self: the port
:returns: the direction of the Port
:rtype: string (:c:enum:`WpDirection`)
PipeWire Client
...............

View File

@@ -136,6 +136,7 @@ wp_port_pw_object_mixin_priv_interface_init (
/*!
* \brief Gets the current direction of the port
* \remarks Requires WP_PIPEWIRE_OBJECT_FEATURE_INFO
* \ingroup wpport
* \param self the port
* \returns the current direction of the port

View File

@@ -978,6 +978,22 @@ impl_node_new (lua_State *L)
return 1;
}
/* Port */
static int
port_get_direction (lua_State *L)
{
WpPort *port = wplua_checkobject (L, 1, WP_TYPE_PORT);
WpDirection direction = wp_port_get_direction (port);
wplua_enum_to_lua (L, direction, WP_TYPE_DIRECTION);
return 1;
}
static const luaL_Reg port_methods[] = {
{ "get_direction", port_get_direction },
{ NULL, NULL }
};
/* Link */
static int
@@ -1287,6 +1303,8 @@ wp_lua_scripting_api_init (lua_State *L)
node_new, node_methods);
wplua_register_type_methods (L, WP_TYPE_IMPL_NODE,
impl_node_new, NULL);
wplua_register_type_methods (L, WP_TYPE_PORT,
NULL, port_methods);
wplua_register_type_methods (L, WP_TYPE_LINK,
link_new, NULL);
wplua_register_type_methods (L, WP_TYPE_CLIENT,