Stream Links
-
struct WpStreamLink
WpStreamLink is an abstract base class that manages a set of PipeWire links between an output stream and an input stream. It automatically creates and destroys the individual port-level links as needed based on the port configuration of both streams.
This class provides a higher-level abstraction over individual PipeWire links, allowing applications to establish connections between entire streams rather than managing individual ports. It handles the complexity of matching ports with compatible configurations and managing their lifecycle.
WpStreamLink is an abstract class with two concrete implementations:
WpAudioStreamLink: links two audio streams with channel-based port matching
WpVideoStreamLink: links two video streams
When activated, a stream link will establish all necessary port-level links between the output and input streams. If the streams change their port configuration, the stream link will automatically recover and update the underlying PipeWire links accordingly. When deactivated or destroyed, all associated links are cleaned up.
A stream link emits signals when individual PipeWire links are added or removed, allowing applications to monitor the linking status. It also emits link-error when one of those links enters the error state, so that the failure can be reported back to the client that owns the stream.
-
struct WpAudioStreamLink
A WpStreamLink between two WpAudioStream objects. Before it creates the PipeWire links, it configures the ports of both ends: one of the two streams is the main one, whose ports are configured from its own node properties, and the other one is then configured to match it. The stream whose kind is WP_STREAM_KIND_TARGET is the main one; the output stream is used otherwise.
-
struct WpVideoStreamLink
A WpStreamLink between two WpVideoStream objects. Video ports are not configured, so this class only creates and destroys the PipeWire links.
-
enum WpStreamLinkFeatures
Flags to be used as WpObjectFeatures on WpStreamLink.
Values:
-
enumerator WP_STREAM_LINK_FEATURE_ACTIVE = (1 << 0)
Loads the stream link
-
enumerator WP_STREAM_LINK_FEATURE_ACTIVE = (1 << 0)
-
WpStream *wp_stream_link_get_output_stream(WpStreamLink *self, gboolean *is_monitor)
Gets the output stream of the stream link.
- Parameters:
self -- the stream link
is_monitor -- (out) (optional): if the output stream is a monitor or not
- Returns:
(transfer full): the output stream
-
WpStream *wp_stream_link_get_input_stream(WpStreamLink *self)
Gets the input stream of the stream link.
- Parameters:
self -- the stream link
- Returns:
(transfer full): the input stream
-
WpStream *wp_stream_link_get_subject_stream(WpStreamLink *self)
Gets the stream that asked for this link.
This is the stream whose policy decision created the link; it is either the output or the input stream. Links that were discovered on the graph and adopted by the WpStreamLinkManager have no subject.
- Parameters:
self -- the stream link
- Returns:
(transfer full) (nullable): the subject stream
-
guint wp_stream_link_get_links_count(WpStreamLink *self)
Gets the total number of pipewire links.
- Parameters:
self -- the stream link
- Returns:
the total number of pipewire links
-
WpIterator *wp_stream_link_new_links_iterator(WpStreamLink *self)
Iterates through all the pipewire link objects that link both streams.
- Parameters:
self -- the stream link
- Returns:
(transfer full): a WpIterator that iterates over all the pipewire link objects that link both streams.
-
gboolean wp_stream_link_reconfigure_ports(WpStreamLink *self)
Configures the ports of both streams again and recreates the links.
Use this when something that the port configuration depends on has changed, such as a stream.features.audio.* setting. Configuring the ports of one of the two streams directly is not equivalent: the two streams have to agree on one configuration, and it is this object that decides which one that is.
Nothing is done, and FALSE is returned, for a stream link that is not active yet, one whose links were only adopted from the graph and one whose media type needs no port configuration.
- Parameters:
self -- the stream link
- Returns:
TRUE if the ports of both streams are being configured again
-
WP_TYPE_STREAM_LINK (wp_stream_link_get_type ())
The WpStreamLink GType.
-
WP_TYPE_AUDIO_STREAM_LINK (wp_audio_stream_link_get_type ())
The WpAudioStreamLink GType.
-
WP_TYPE_VIDEO_STREAM_LINK (wp_video_stream_link_get_type ())
The WpVideoStreamLink GType.