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

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

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 state

  • new_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

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

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.