Connection
-
struct WpConnection
The connection wraps a
pw_core, which links a WpContext to the PipeWire server. It is owned by the context. The one of the WpMainContext is available with wp_main_context_get_connection(), and the WpCore that uses that context connects it through WP_CORE_FEATURE_CONNECTED.GObject Properties
- core
-
The core that uses this connection
WpCore *G_PARAM_READWRITE | G_PARAM_CONSTRUCT_ONLY
- context
-
The context that this connection connects to PipeWire
WpContext *G_PARAM_READWRITE | G_PARAM_CONSTRUCT_ONLY
GObject Signals
- connected
- Emitted when the connection to the PipeWire server has finished, once the server has sent its core info.
void connected_callback (WpConnection * self, gpointer user_data)
- disconnected
- Emitted when the PipeWire server has closed the connection. This is not emitted when the connection is closed by deactivating WP_CORE_FEATURE_CONNECTED on the WpCore. The core does not clean up by itself; users must deactivate WP_CORE_FEATURE_CONNECTED when this happens. This is emitted from a PipeWire event, so the core must not be deactivated from within the callback, but later, on an idle callback or after quitting the main loop. An activation of the WpCore that is in progress fails, and new ones fail until the core is deactivated.
void disconnected_callback (WpConnection * self, gpointer user_data)
-
WpCore *wp_connection_get_core(WpConnection *self)
Gets the core that uses the connection.
- Parameters:
self -- the connection
- Returns:
(transfer full) (nullable): the core that uses self, or NULL if that core is gone
-
struct pw_core *wp_connection_get_pw_core(WpConnection *self)
Gets the internal PipeWire core of the connection.
- Parameters:
self -- the connection
- Returns:
(transfer none) (nullable): the internal pw_core object, or NULL if the connection is not connected to PipeWire
-
guint32 wp_connection_get_own_bound_id(WpConnection *self)
Gets the bound id of the client object that is created as a result of this connection being connected to the PipeWire daemon.
- Parameters:
self -- the connection
- Returns:
the bound id of this client
-
guint32 wp_connection_get_remote_cookie(WpConnection *self)
Gets the cookie of the connection's PipeWire instance.
- Parameters:
self -- the connection
- Returns:
The cookie of the PipeWire instance that self is connected to. The cookie is a unique random number for identifying an instance of PipeWire
-
const gchar *wp_connection_get_remote_name(WpConnection *self)
Gets the name of the connection's PipeWire instance.
- Parameters:
self -- the connection
- Returns:
The name of the PipeWire instance that self is connected to
-
const gchar *wp_connection_get_remote_user_name(WpConnection *self)
Gets the user name of the connection's PipeWire instance.
- Parameters:
self -- the connection
- Returns:
The name of the user that started the PipeWire instance that self is connected to
-
const gchar *wp_connection_get_remote_host_name(WpConnection *self)
Gets the host name of the connection's PipeWire instance.
- Parameters:
self -- the connection
- Returns:
The name of the host where the PipeWire instance that self is connected to is running on
-
const gchar *wp_connection_get_remote_version(WpConnection *self)
Gets the version of the connection's PipeWire instance.
- Parameters:
self -- the connection
- Returns:
The version of the PipeWire instance that self is connected to
-
WpProperties *wp_connection_get_remote_properties(WpConnection *self)
Gets the properties of the connection's PipeWire instance.
- Parameters:
self -- the connection
- Returns:
(transfer full): the properties of the PipeWire instance that self is connected to
-
WpProperties *wp_connection_get_properties(WpConnection *self)
Gets the properties of the connection.
- Parameters:
self -- the connection
- Returns:
(transfer full): the properties of self
-
void wp_connection_update_properties(WpConnection *self, WpProperties *updates)
Updates the properties of self on the connection, making them appear on the client object that represents this connection.
If self is not connected yet, these properties are stored and passed to pw_context_connect() when connecting.
- Parameters:
self -- the connection
updates -- (transfer full): updates to apply to the properties of self; this does not need to include properties that have not changed
-
gint wp_connection_sync(WpConnection *self, GCancellable *cancellable, GAsyncReadyCallback callback, gpointer user_data)
Asks the PipeWire server to call the callback via an event.
Since methods are handled in-order and events are delivered in-order, this can be used as a barrier to ensure all previous methods and the resulting events have been handled.
In both success and error cases, callback is always called. Use wp_connection_sync_finish() from within the callback to determine whether the operation completed successfully or if an error occurred.
- Parameters:
self -- the connection
cancellable -- (nullable): a GCancellable to cancel the operation
callback -- (scope async)(closure user_data): a function to call when the operation is done
user_data -- data to pass to callback
- Returns:
the sequence number of the sync operation, or a negative errno if an error occurred before returning from this function
-
gint wp_connection_sync_closure(WpConnection *self, GCancellable *cancellable, GClosure *closure)
Asks the PipeWire server to invoke the closure via an event.
Since methods are handled in-order and events are delivered in-order, this can be used as a barrier to ensure all previous methods and the resulting events have been handled.
In both success and error cases, closure is always invoked. Use wp_connection_sync_finish() from within the closure to determine whether the operation completed successfully or if an error occurred.
- Parameters:
self -- the connection
cancellable -- (nullable): a GCancellable to cancel the operation
closure -- (transfer floating): a closure to invoke when the operation is done
- Returns:
the sequence number of the sync operation, or a negative errno if an error occurred before returning from this function
-
gint wp_connection_sync_finish(WpConnection *self, GAsyncResult *res, GError **error)
This function is meant to be called from within the callback of wp_connection_sync() in order to determine the success or failure of the operation.
- Parameters:
self -- the connection
res -- a GAsyncResult
error -- (out) (optional): the error that occurred, if any
- Returns:
the sequence number of the sync operation that finished, as it was returned by wp_connection_sync(), or a negative value if an error occurred
-
WP_TYPE_CONNECTION (wp_connection_get_type ())
The WpConnection GType.