| 1 |
.. _lua_proxies_api: |
| 2 |
|
| 3 |
PipeWire Proxies |
| 4 |
================ |
| 5 |
|
| 6 |
Proxy |
| 7 |
..... |
| 8 |
|
| 9 |
Lua objects that bind a :ref:`WpProxy <proxy_api>` contain the following methods: |
| 10 |
|
| 11 |
.. function:: Proxy.get_interface_type(self) |
| 12 |
|
| 13 |
Binds :c:func:`wp_proxy_get_interface_type` |
| 14 |
|
| 15 |
:param self: the proxy |
| 16 |
:returns: the proxy type, the proxy type version |
| 17 |
:rtype: string, integer |
| 18 |
|
| 19 |
PipeWire Object |
| 20 |
............... |
| 21 |
|
| 22 |
Lua objects that bind a :ref:`WpPipewireObject <pipewire_object_api>` |
| 23 |
contain the following methods: |
| 24 |
|
| 25 |
.. function:: PipewireObject.iterate_params(self, param_name) |
| 26 |
|
| 27 |
Binds :c:func:`wp_pipewire_object_enum_params_sync` |
| 28 |
|
| 29 |
:param self: the proxy |
| 30 |
:param string param_name: the PipeWire param name to enumerate, |
| 31 |
ex "Props", "Route" |
| 32 |
:returns: the available parameters |
| 33 |
:rtype: Iterator; the iteration items are Spa Pod objects |
| 34 |
|
| 35 |
.. function:: PipewireObject.set_param(self, param_name, pod) |
| 36 |
|
| 37 |
Binds :c:func:`wp_pipewire_object_set_param` |
| 38 |
|
| 39 |
:param self: the proxy |
| 40 |
:param string param_name: The PipeWire param name to set, ex "Props", "Route" |
| 41 |
:param Pod pod: A Spa Pod object containing the new params |
| 42 |
|
| 43 |
Global Proxy |
| 44 |
............ |
| 45 |
|
| 46 |
Lua objects that bind a :ref:`WpGlobalProxy <global_proxy_api>` |
| 47 |
contain the following methods: |
| 48 |
|
| 49 |
.. function:: GlobalProxy.request_destroy(self) |
| 50 |
|
| 51 |
Binds :c:func:`wp_global_proxy_request_destroy` |
| 52 |
|
| 53 |
:param self: the proxy |
| 54 |
|
| 55 |
PipeWire Node |
| 56 |
............. |
| 57 |
|
| 58 |
Lua objects that bind a :ref:`WpNode <node_api>` contain the following methods: |
| 59 |
|
| 60 |
.. function:: Node.get_state(self) |
| 61 |
|
| 62 |
Binds :c:func:`wp_node_get_state` |
| 63 |
|
| 64 |
:param self: the proxy |
| 65 |
:returns: the current state of the node and an error message, if any |
| 66 |
:rtype: string (:c:enum:`WpNodeState`), string (error message) |
| 67 |
:since: 0.4.2 |
| 68 |
|
| 69 |
.. function:: Node.get_n_input_ports(self) |
| 70 |
|
| 71 |
Binds :c:func:`wp_node_get_n_input_ports` |
| 72 |
|
| 73 |
:param self: the proxy |
| 74 |
:returns: the current and max numbers of input ports on the node |
| 75 |
:rtype: integer (current), integer (max) |
| 76 |
:since: 0.4.2 |
| 77 |
|
| 78 |
.. function:: Node.get_n_output_ports(self) |
| 79 |
|
| 80 |
Binds :c:func:`wp_node_get_n_output_ports` |
| 81 |
|
| 82 |
:param self: the proxy |
| 83 |
:returns: the current and max numbers of output ports on the node |
| 84 |
:rtype: integer (current), integer (max) |
| 85 |
:since: 0.4.2 |
| 86 |
|
| 87 |
.. function:: Node.get_n_ports(self) |
| 88 |
|
| 89 |
Binds :c:func:`wp_node_get_n_ports` |
| 90 |
|
| 91 |
:param self: the proxy |
| 92 |
:returns: the number of ports on the node |
| 93 |
:since: 0.4.2 |
| 94 |
|
| 95 |
.. function:: Node.iterate_ports(self, interest) |
| 96 |
|
| 97 |
Binds :c:func:`wp_node_iterate_ports` |
| 98 |
|
| 99 |
:param self: the proxy |
| 100 |
:param interest: an interest to filter objects |
| 101 |
:type interest: :ref:`Interest <lua_object_interest_api>` or nil or none |
| 102 |
:returns: all the ports of this node that that match the interest |
| 103 |
:rtype: Iterator; the iteration items are of type :ref:`WpPort <port_api>` |
| 104 |
:since: 0.4.2 |
| 105 |
|
| 106 |
.. function:: Node.lookup_port(self, interest) |
| 107 |
|
| 108 |
Binds :c:func:`wp_node_lookup_port` |
| 109 |
|
| 110 |
:param self: the proxy |
| 111 |
:param interest: the interest to use for the lookup |
| 112 |
:type interest: :ref:`Interest <lua_object_interest_api>` or nil or none |
| 113 |
:returns: the first port of this node that matches the interest |
| 114 |
:rtype: :ref:`WpPort <port_api>` |
| 115 |
:since: 0.4.2 |
| 116 |
|
| 117 |
.. function:: Node.send_command(self, command) |
| 118 |
|
| 119 |
Binds :c:func:`wp_node_send_command` |
| 120 |
|
| 121 |
:param self: the proxy |
| 122 |
:param string command: the command to send to the node (ex "Suspend") |
| 123 |
|
| 124 |
PipeWire Port |
| 125 |
............. |
| 126 |
|
| 127 |
Lua objects that bind a :ref:`WpPort <port_api>` contain the following methods: |
| 128 |
|
| 129 |
.. function:: Port.get_direction(self) |
| 130 |
|
| 131 |
Binds :c:func:`wp_port_get_direction` |
| 132 |
|
| 133 |
:param self: the port |
| 134 |
:returns: the direction of the Port |
| 135 |
:rtype: string (:c:enum:`WpDirection`) |
| 136 |
:since: 0.4.2 |
| 137 |
|
| 138 |
PipeWire Client |
| 139 |
............... |
| 140 |
|
| 141 |
Lua objects that bind a :ref:`WpClient <client_api>` |
| 142 |
contain the following methods: |
| 143 |
|
| 144 |
.. function:: Client.update_permissions(self, perms) |
| 145 |
|
| 146 |
Binds :c:func:`wp_client_update_permissions` |
| 147 |
|
| 148 |
Takes a table where the keys are object identifiers and the values are |
| 149 |
permission strings. |
| 150 |
|
| 151 |
Valid object identifiers are: |
| 152 |
|
| 153 |
- A number, meaning the bound ID of a proxy |
| 154 |
- The string "any" or the string "all", which sets the default permissions |
| 155 |
for this client |
| 156 |
|
| 157 |
The permission strings have a chmod-like syntax (ex. "rwx" or "r-xm"), where: |
| 158 |
|
| 159 |
- "r" means permission to read the object |
| 160 |
- "w" means permission to write data to the object |
| 161 |
- "x" means permission to call methods on the object |
| 162 |
- "m" means permission to set metadata for the object |
| 163 |
- "-" is ignored and can be used to make the string more readable when |
| 164 |
a permission flag is omitted |
| 165 |
|
| 166 |
**Example:** |
| 167 |
|
| 168 |
.. code-block:: lua |
| 169 |
|
| 170 |
client:update_permissions { |
| 171 |
["all"] = "r-x", |
| 172 |
[35] = "rwxm", |
| 173 |
} |
| 174 |
|
| 175 |
:param self: the proxy |
| 176 |
:param table perms: the permissions to update for this client |
| 177 |
|
| 178 |
PipeWire Metadata |
| 179 |
................. |
| 180 |
|
| 181 |
Lua objects that bind a :ref:`WpMetadata <metadata_api>` |
| 182 |
contain the following methods: |
| 183 |
|
| 184 |
.. function:: Metadata.iterate(self, subject) |
| 185 |
|
| 186 |
Binds :c:func:`wp_metadata_new_iterator` |
| 187 |
|
| 188 |
:param self: the proxy |
| 189 |
:param integer subject: the subject id |
| 190 |
:returns: an iterator |
| 191 |
|
| 192 |
.. function:: Metadata.find(self, subject, key) |
| 193 |
|
| 194 |
Binds :c:func:`wp_metadata_find` |
| 195 |
|
| 196 |
:param self: the proxy |
| 197 |
:param string subject: the subject id |
| 198 |
:param string key: the metadata key to find |
| 199 |
:returns: the value for this metadata key, the type of the value |
| 200 |
:rtype: string, string |