PipeWire Node

digraph inheritance { rankdir=LR; GObject -> WpObject; WpObject -> WpProxy; WpProxy -> WpGlobalProxy; WpGlobalProxy -> WpNode; GInterface -> WpPipewireObject; WpPipewireObject -> WpNode; }
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

GObject Signals

ports-changed

state-changed

wpnode::WpNodeState

The state of the node.

Values:

1

error state

0

the node is being created

1

the node is suspended, the device might be closed

2

the node is running but there is no active port

3

the node is running

wpnode::WpNodeFeatures

An extension of WpProxyFeatures.

Values:

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

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.

Return
(nullable) (transfer full): the new node or NULL if the core is not connected and therefore the node cannot be created
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

WpNodeState wp_node_get_state(WpNode * self, const gchar ** error)

Gets the current state of the node.

Return
the current state of the node
Parameters
  • self: the node
  • error: (out) (optional) (transfer none): the error

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
Return
the number of input ports of this node, as reported by the node info
Parameters
  • self: the node
  • max: (out) (optional): the maximum supported number of input ports

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
Return
the number of output ports of this node, as reported by the node info
Parameters
  • self: the node
  • max: (out) (optional): the maximum supported number of output ports

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
Return
the number of ports of this node.
Parameters
  • self: the 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
Return
(transfer full): a WpIterator that iterates over WpPort objects
Parameters
  • self: the node

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
Return
(transfer full): a WpIterator that iterates over WpPort objects
Parameters
  • self: the node
  • ...: a list of constraints, terminated by NULL

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
Return
(transfer full): a WpIterator that iterates over WpPort objects
Parameters
  • self: the node
  • interest: (transfer full): the interest

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
Return
(transfer full) (nullable): the first port that matches the constraints, or NULL if there is no such port
Parameters
  • self: the node
  • ...: a list of constraints, terminated by NULL

WpPort* wp_node_lookup_port_full(WpNode * self, WpObjectInterest * interest)

Retrieves the first port that matches the interest.

Remark
Requires WP_NODE_FEATURE_PORTS
Return
(transfer full) (nullable): the first port that matches the interest, or NULL if there is no such port
Parameters
  • self: the node
  • interest: (transfer full): the interest

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.