PipeWire Node
-
struct WpNode
The WpNode class allows accessing the properties and methods of a PipeWire node object (
struct pw_node
).A WpNode is constructed internally when a new node appears on the PipeWire registry and it is made available through the WpObjectManager API. Alternatively, a WpNode can also be constructed using wp_node_new_from_factory(), which creates a new node object on the remote PipeWire server by calling into a factory.
GObject Properties
- state
-
The current state of the node
WpNodeState
G_PARAM_READABLE
- n-input-ports
-
The number of input ports
uint
G_PARAM_READABLE
- n-output-ports
-
The number of output ports
uint
G_PARAM_READABLE
- max-input-ports
-
The max number of input ports
uint
G_PARAM_READABLE
- max-output-ports
-
The max number of output ports
uint
G_PARAM_READABLE
GObject Signals
- ports-changed
void ports_changed_callback (WpNode * self, gpointer user_data)
Emitted when the node’s ports change. This is only emitted when WP_NODE_FEATURE_PORTS is enabled.
Flags: G_SIGNAL_RUN_LAST
- state-changed
void state_changed_callback (WpNode * self, WpNodeState * old_state, WpNodeState * new_state, gpointer user_data)
Emitted when the node changes state. This is only emitted when WP_PIPEWIRE_OBJECT_FEATURE_INFO is enabled.
Parameters:
old_state
- the old statenew_state
- the new state
Flags: G_SIGNAL_RUN_LAST
-
enum WpNodeState
The state of the node.
Values:
-
enumerator WP_NODE_STATE_ERROR = -1
error state
-
enumerator WP_NODE_STATE_CREATING = 0
the node is being created
-
enumerator WP_NODE_STATE_SUSPENDED = 1
the node is suspended, the device might be closed
-
enumerator WP_NODE_STATE_IDLE = 2
the node is running but there is no active port
-
enumerator WP_NODE_STATE_RUNNING = 3
the node is running
-
enumerator WP_NODE_STATE_ERROR = -1
-
enum WpNodeFeatures
An extension of WpProxyFeatures.
Values:
-
enumerator WP_NODE_FEATURE_PORTS = (WP_PROXY_FEATURE_CUSTOM_START << 0)
caches information about ports, enabling the use of wp_node_get_n_ports(), wp_node_lookup_port(), wp_node_new_ports_iterator() and related methods
-
enumerator WP_NODE_FEATURE_PORTS = (WP_PROXY_FEATURE_CUSTOM_START << 0)
-
WpNode *wp_node_new_from_factory(WpCore *core, const gchar *factory_name, WpProperties *properties)
Constructs a node on the PipeWire server by asking the remote factory factory_name to create it.
Because of the nature of the PipeWire protocol, this operation completes asynchronously at some point in the future. In order to find out when this is done, you should call wp_object_activate(), requesting at least WP_PROXY_FEATURE_BOUND. When this feature is ready, the node is ready for use on the server. If the node cannot be created, this activation operation will fail.
- Parameters:
core – the wireplumber core
factory_name – the pipewire factory name to construct the node
properties – (nullable) (transfer full): the properties to pass to the factory
- Returns:
(nullable) (transfer full): the new node or NULL if the core is not connected and therefore the node cannot be created
-
WpNodeState wp_node_get_state(WpNode *self, const gchar **error)
Gets the current state of the node.
- Parameters:
self – the node
error – (out) (optional) (transfer none): the error
- Returns:
the current state of the node
-
guint wp_node_get_n_input_ports(WpNode *self, guint *max)
Gets the number of input ports of this node.
Remark
Requires WP_PIPEWIRE_OBJECT_FEATURE_INFO
- Parameters:
self – the node
max – (out) (optional): the maximum supported number of input ports
- Returns:
the number of input ports of this node, as reported by the node info
-
guint wp_node_get_n_output_ports(WpNode *self, guint *max)
Gets the number of output ports of this node.
Remark
Requires WP_PIPEWIRE_OBJECT_FEATURE_INFO
- Parameters:
self – the node
max – (out) (optional): the maximum supported number of output ports
- Returns:
the number of output ports of this node, as reported by the node info
-
guint wp_node_get_n_ports(WpNode *self)
Gets the number of ports of this node.
Note that this number may not add up to wp_node_get_n_input_ports() + wp_node_get_n_output_ports() because it is discovered by looking at the number of available ports in the registry, however ports may appear there with a delay or may not appear at all if this client does not have permission to read them
Remark
Requires WP_NODE_FEATURE_PORTS
- Parameters:
self – the node
- Returns:
the number of ports of this node.
-
WpIterator *wp_node_new_ports_iterator(WpNode *self)
Gets a new iterator that iterates over all the ports that belong to this node.
Remark
Requires WP_NODE_FEATURE_PORTS
- Parameters:
self – the node
- Returns:
(transfer full): a WpIterator that iterates over WpPort objects
-
WpIterator *wp_node_new_ports_filtered_iterator(WpNode *self, ...)
Gets a new iterator that iterates over all the ports that belong to this node and match the constraints.
The constraints specified in the variable arguments must follow the rules documented in wp_object_interest_new().
Remark
Requires WP_NODE_FEATURE_PORTS
- Parameters:
self – the node
... – a list of constraints, terminated by NULL
- Returns:
(transfer full): a WpIterator that iterates over WpPort objects
-
WpIterator *wp_node_new_ports_filtered_iterator_full(WpNode *self, WpObjectInterest *interest)
Gets a new iterator that iterates over all the ports that belong to this node and match the interest.
Remark
Requires WP_NODE_FEATURE_PORTS
- Parameters:
self – the node
interest – (transfer full): the interest
- Returns:
(transfer full): a WpIterator that iterates over WpPort objects
-
WpPort *wp_node_lookup_port(WpNode *self, ...)
Retrieves the first port that matches the constraints.
The constraints specified in the variable arguments must follow the rules documented in wp_object_interest_new().
Remark
Requires WP_NODE_FEATURE_PORTS
- Parameters:
self – the node
... – a list of constraints, terminated by NULL
- Returns:
(transfer full) (nullable): the first port that matches the constraints, or NULL if there is no such port
-
WpPort *wp_node_lookup_port_full(WpNode *self, WpObjectInterest *interest)
Retrieves the first port that matches the interest.
Remark
Requires WP_NODE_FEATURE_PORTS
- Parameters:
self – the node
interest – (transfer full): the interest
- Returns:
(transfer full) (nullable): the first port that matches the interest, or NULL if there is no such port
-
void wp_node_send_command(WpNode *self, const gchar *command)
Sends a command to a node.
Valid commands are the short string reprepsentations of
enum spa_node_command
. For example, “Suspend” or “Flush” are valid commands- Parameters:
self – the node
command – the command
-
WP_TYPE_NODE (wp_node_get_type ())
The WpNode GType.