Core
The core is the central object around which everything operates. It is essential to create a WpCore before using any other WirePlumber API.
The core object has the following responsibilities:
- it initializes the PipeWire library
- it creates a
pw_context
and allows connecting to the PipeWire server, creating a localpw_core
- it glues the PipeWire library's event loop system with GMainLoop
- it maintains a list of registered objects, which other classes use to keep objects loaded permanently into memory
- it watches the PipeWire registry and keeps track of remote and local objects that appear in the registry, making them accessible through the WpObjectManager API.
WpCore
GObject
╰──WpCore
Class structure
WpCoreClass
Fields
parent_class
(GObjectClass)
–
Constructors
wp_core_new
WpCore * wp_core_new (GMainContext* context, WpProperties * properties)
Parameters:
context
(
[transfer: none][nullable])
–
the GMainContext to use for events
properties
(
[transfer: full][nullable])
–
additional properties, which are
passed to pw_context_new
and pw_context_connect
a new WpCore
Methods
wp_core_disconnect
wp_core_disconnect (WpCore * self)
Disconnects this core from the PipeWire server. This also effectively
destroys all WpProxy objects that were created through the registry,
destroys the pw_core
and finally emits the disconnected signal.
Parameters:
self
–
the core
wp_core_get_g_main_context
GMainContext* wp_core_get_g_main_context (WpCore * self)
Parameters:
self
–
the core
the GMainContext that is in use by this core for events
wp_core_get_properties
WpProperties * wp_core_get_properties (WpCore * self)
Parameters:
self
–
the core
the properties of self
wp_core_get_pw_context
pw_context* wp_core_get_pw_context (WpCore * self)
Parameters:
self
–
the core
the internal pw_context
object
wp_core_get_pw_core
pw_core* wp_core_get_pw_core (WpCore * self)
Parameters:
self
–
the core
the internal pw_core
object,
or NULL if the core is not connected to PipeWire
wp_core_get_remote_cookie
guint32 wp_core_get_remote_cookie (WpCore * self)
Parameters:
self
–
the core
The cookie of the PipeWire instance that self is connected to. The cookie is a unique random number for identifying an instance of PipeWire
wp_core_get_remote_host_name
const gchar* wp_core_get_remote_host_name (WpCore * self)
Parameters:
self
–
the core
The name of the host where the PipeWire instance that self is connected to is running on
wp_core_get_remote_name
const gchar* wp_core_get_remote_name (WpCore * self)
Parameters:
self
–
the core
The name of the PipeWire instance that self is connected to
wp_core_get_remote_properties
WpProperties * wp_core_get_remote_properties (WpCore * self)
Parameters:
self
–
the core
the properties of the PipeWire instance that self is connected to
wp_core_get_remote_user_name
const gchar* wp_core_get_remote_user_name (WpCore * self)
Parameters:
self
–
the core
The name of the user that started the PipeWire instance that self is connected to
wp_core_get_remote_version
const gchar* wp_core_get_remote_version (WpCore * self)
Parameters:
self
–
the core
The version of the PipeWire instance that self is connected to
wp_core_idle_add
wp_core_idle_add (WpCore * self, GSource** source, GSourceFunc function, gpointer data, GDestroyNotify destroy)
Adds an idle callback to be called in the same GMainContext as the one used by this core. This is essentially the same as g_idle_add_full, but it adds the created GSource on the GMainContext used by this core instead of the default context.
Parameters:
self
–
the core
source
(
[out][optional])
–
the source
function
(
[scope notified])
–
the function to call
data
(
[closure])
–
data to pass to function
destroy
(
[nullable])
–
a function to destroy data
wp_core_idle_add_closure
wp_core_idle_add_closure (WpCore * self, GSource** source, GClosure* closure)
Adds an idle callback to be called in the same GMainContext as the one used by this core.
This is the same as wp_core_idle_add, but it allows you to specify a GClosure instead of a C callback.
Parameters:
self
–
the core
source
(
[out][optional])
–
the source
closure
–
the closure to invoke
wp_core_install_object_manager
wp_core_install_object_manager (WpCore * self, WpObjectManager * om)
Installs the object manager on this core, activating its internal management engine. This will immediately emit signals about objects added on om if objects that the om is interested in were in existence already.
wp_core_is_connected
gboolean wp_core_is_connected (WpCore * self)
Parameters:
self
–
the core
TRUE if the core is connected to PipeWire, FALSE otherwise
wp_core_load_component
gboolean wp_core_load_component (WpCore * self, const gchar* component, const gchar* type, GVariant* args, GError** error)
Parameters:
self
–
the core
component
–
the module name or file name
type
–
the type of the component
args
(
[transfer: floating][nullable])
–
additional arguments for the component, usually a dict or a string
error
(
[out][optional])
–
return location for errors, or NULL to ignore
TRUE if loaded, FALSE if there was an error
wp_core_sync
gboolean wp_core_sync (WpCore * 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_core_sync_finish from within the callback to determine whether the operation completed successfully or if an error occurred.
Parameters:
self
–
the core
cancellable
(
[nullable])
–
a GCancellable to cancel the operation
callback
(
[scope async])
–
a function to call when the operation is done
user_data
(
[closure])
–
data to pass to callback
TRUE if the sync operation was started, FALSE if an error occurred before returning from this function
wp_core_sync_finish
gboolean wp_core_sync_finish (WpCore * self, GAsyncResult* res, GError** error)
This function is meant to be called from within the callback of wp_core_sync in order to determine the success or failure of the operation.
Parameters:
self
–
the core
res
–
a GAsyncResult
error
(
[out][optional])
–
the error that occurred, if any
TRUE if the operation succeeded, FALSE otherwise
wp_core_timeout_add
wp_core_timeout_add (WpCore * self, GSource** source, guint timeout_ms, GSourceFunc function, gpointer data, GDestroyNotify destroy)
Adds a timeout callback to be called at regular intervals in the same GMainContext as the one used by this core. The function is called repeatedly until it returns FALSE, at which point the timeout is automatically destroyed and the function will not be called again. The first call to the function will be at the end of the first interval. This is essentially the same as g_timeout_add_full, but it adds the created GSource on the GMainContext used by this core instead of the default context.
Parameters:
self
–
the core
source
(
[out][optional])
–
the source
timeout_ms
–
the timeout in milliseconds
function
(
[scope notified])
–
the function to call
data
(
[closure])
–
data to pass to function
destroy
(
[nullable])
–
a function to destroy data
wp_core_timeout_add_closure
wp_core_timeout_add_closure (WpCore * self, GSource** source, guint timeout_ms, GClosure* closure)
Adds a timeout callback to be called at regular intervals in the same GMainContext as the one used by this core.
This is the same as wp_core_timeout_add, but it allows you to specify a GClosure instead of a C callback.
Parameters:
self
–
the core
source
(
[out][optional])
–
the source
timeout_ms
–
the timeout in milliseconds
closure
–
the closure to invoke
wp_core_update_properties
wp_core_update_properties (WpCore * 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 core
updates
(
[transfer: full])
–
updates to apply to the properties of self; this does not need to include properties that have not changed
Signals
Properties
g-main-context
“g-main-context” GMainContext*
Flags : Read / Write / Construct Only
pw-context
“pw-context” gpointer
Flags : Read / Write / Construct Only
pw-core
“pw-core” gpointer
Flags : Read
Constants
The results of the search are