Session Item Interfaces
WpSiAcquisition
This interface provides a way to request an item for linking before doing so. This allows item implementations to apply internal policy rules.
A WpSiAcquisition is associated directly with a WpSiPortInfo via wp_si_port_info_get_acquisition. In order to allow switching policies, it is recommended that port info implementations use a separate session item to implement this interface and allow replacing it.
Methods
wp_si_acquisition_acquire
wp_si_acquisition_acquire (WpSiAcquisition * self, WpSiLink * acquisitor, WpSiPortInfo * item, GAsyncReadyCallback callback, gpointer data)
Acquires the item for linking by acquisitor.
When a link is not allowed by policy, this operation should return an error.
When a link needs to be delayed for a short amount of time (ex. to apply a fade out effect on another item), this operation should finish with a delay. It is safe to assume that after this operation completes, the item will be linked immediately.
Parameters:
self
–
the session item
acquisitor
–
the link that is trying to acquire a port info item
item
–
the item that is being acquired
callback
(
[scope async])
–
the callback to call when the operation is done
data
(
[closure])
–
user data for callback
wp_si_acquisition_acquire_finish
gboolean wp_si_acquisition_acquire_finish (WpSiAcquisition * self, GAsyncResult* res, GError** error)
Finishes the operation started by wp_si_acquisition_acquire. This is meant to be called in the callback that was passed to that method.
Parameters:
self
–
the session item
res
–
the async result
error
(
[out][optional])
–
the operation's error, if it occurred
TRUE on success, FALSE if there was an error
wp_si_acquisition_release
wp_si_acquisition_release (WpSiAcquisition * self, WpSiLink * acquisitor, WpSiPortInfo * item)
Releases the item, which means that it is being unlinked.
Parameters:
self
–
the session item
acquisitor
–
the link that had previously acquired the item
item
–
the port info item that is being released
Virtual Methods
acquire
acquire (WpSiAcquisition * self, WpSiLink * acquisitor, WpSiPortInfo * item, GAsyncReadyCallback callback, gpointer data)
Parameters:
self
–
acquisitor
–
item
–
callback
–
data
–
acquire_finish
gboolean acquire_finish (WpSiAcquisition * self, GAsyncResult* res, GError** error)
Parameters:
self
–
res
–
error
–
release
release (WpSiAcquisition * self, WpSiLink * acquisitor, WpSiPortInfo * item)
Parameters:
self
–
acquisitor
–
item
–
WpSiEndpoint
An interface for session items that implement a PipeWire endpoint.
Methods
wp_si_endpoint_get_properties
WpProperties * wp_si_endpoint_get_properties (WpSiEndpoint * self)
Parameters:
self
–
the session item
the properties of the endpoint
wp_si_endpoint_get_registration_info
GVariant* wp_si_endpoint_get_registration_info (WpSiEndpoint * self)
This should return information that is used for registering the endpoint, as a GVariant tuple of type (ssya{ss}) that contains, in order:
- s: the endpoint's name
- s: the media class
- y: the direction
- a{ss}: additional properties to be added to the list of global properties
Parameters:
self
–
the session item
registration info for the endpoint
Signals
endpoint-properties-changed
endpoint_properties_changed_callback (WpSiEndpoint * self, gpointer user_data)
Parameters:
self
–
user_data
–
Flags: Run Last
Virtual Methods
get_properties
WpProperties * get_properties (WpSiEndpoint * self)
Parameters:
self
–
get_registration_info
GVariant* get_registration_info (WpSiEndpoint * self)
Parameters:
self
–
WpSiLink
An interface for session items that provide a PipeWire endpoint link.
Methods
wp_si_link_get_in_item
WpSiPortInfo * wp_si_link_get_in_item (WpSiLink * self)
Parameters:
self
–
the session item
the input item that is linked by this link
wp_si_link_get_out_item
WpSiPortInfo * wp_si_link_get_out_item (WpSiLink * self)
Parameters:
self
–
the session item
the output item that is linked by this link
wp_si_link_get_properties
WpProperties * wp_si_link_get_properties (WpSiLink * self)
Parameters:
self
–
the session item
the properties of the link
wp_si_link_get_registration_info
GVariant* wp_si_link_get_registration_info (WpSiLink * self)
This should return information that is used for registering the link, as a GVariant of type a{ss} that contains additional properties to be added to the list of global properties
Parameters:
self
–
the session item
registration info for the link
Signals
Virtual Methods
get_in_item
WpSiPortInfo * get_in_item (WpSiLink * self)
Parameters:
self
–
get_out_item
WpSiPortInfo * get_out_item (WpSiLink * self)
Parameters:
self
–
get_properties
WpProperties * get_properties (WpSiLink * self)
Parameters:
self
–
get_registration_info
GVariant* get_registration_info (WpSiLink * self)
Parameters:
self
–
WpSiPortInfo
An interface for retrieving PipeWire port information from a session item. This information is used to create links in the nodes graph.
Methods
wp_si_port_info_get_acquisition
WpSiAcquisition * wp_si_port_info_get_acquisition (WpSiPortInfo * self)
Parameters:
self
–
the session item
the acquisition interface associated with this item, or NULL if this item does not require acquiring items before linking them
wp_si_port_info_get_ports
GVariant* wp_si_port_info_get_ports (WpSiPortInfo * self, const gchar* context)
This method returns a variant of type "a(uuu)", where each tuple in the array contains the following information:
- u: (guint32) node id
- u: (guint32) port id (the port must belong on the node specified above)
- u: (guint32) the audio channel (enum spa_audio_channel) that this port makes available, or 0 for non-audio content
The order in which ports appear in this array is important when no channel information is available. The link implementation should link the ports in the order they appear. This is normally a good enough substitute for channel matching.
The context argument can be used to get different sets of ports from the item. The following well-known contexts are defined:
- NULL: get the standard ports to be linked
- "monitor": get the monitor ports
- "control": get the control port
- "reverse": get the reverse direction ports, if this item controls a filter node, which would have ports on both directions
Contexts other than NULL may only be used internally to ease the implementation of more complex item relationships. For example, a WpSessionItem that is in control of an input (sink) adapter node may implement WpSiPortInfo where the NULL context will return the standard input ports and the "monitor" context will return the adapter's monitor ports. When linking this item to another item, the NULL context will always be used, but the item may internally spawn a secondary WpSessionItem that implements the "monitor" item. That secondary item may implement WpSiPortInfo, chaining calls to the WpSiPortInfo of the original item using the "monitor" context. This way, the monitor WpSessionItem does not need to share control of the underlying node; it only proxies calls to satisfy the API.
Parameters:
self
–
the session item
context
(
[nullable])
–
an optional context for the ports
a GVariant containing information about the ports of this item
Virtual Methods
get_acquisition
WpSiAcquisition * get_acquisition (WpSiPortInfo * self)
Parameters:
self
–
get_ports
GVariant* get_ports (WpSiPortInfo * self, const gchar* context)
Parameters:
self
–
context
–
Constants
WP_TYPE_SI_ACQUISITION
#define WP_TYPE_SI_ACQUISITION (wp_si_acquisition_get_type ())
The WpSiAcquisition GType
WP_TYPE_SI_PORT_INFO
#define WP_TYPE_SI_PORT_INFO (wp_si_port_info_get_type ())
The WpSiPortInfo GType
The results of the search are