PipeWire Device

WpDevice

GObject
    ╰──WpObject
        ╰──WpProxy
            ╰──WpGlobalProxy
                ╰──WpDevice

The WpDevice class allows accessing the properties and methods of a PipeWire device object (struct pw_device).

A WpDevice is constructed internally when a new device appears on the PipeWire registry and it is made available through the WpObjectManager API. Alternatively, a WpDevice can also be constructed using wp_device_new_from_factory, which creates a new device object on the remote PipeWire server by calling into a factory.


Class structure

WpDeviceClass

Fields
parent_class (WpGlobalProxyClass) –
No description available

Constructors

wp_device_new_from_factory

WpDevice *
wp_device_new_from_factory (WpCore * core,
                            const gchar* factory_name,
                            WpProperties * properties)

Constructs a device 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 device is ready for use on the server. If the device cannot be created, this activation operation will fail.

Parameters:

core

the wireplumber core

factory_name

the pipewire factory name to construct the device

properties ( [nullable][transfer: full])

the properties to pass to the factory

Returns ( [nullable][transfer: full])

the new device or NULL if the core is not connected and therefore the device cannot be created


WpSpaDevice

GObject
    ╰──WpObject
        ╰──WpProxy
            ╰──WpSpaDevice

A WpSpaDevice allows running a spa_device object locally, loading the implementation from a SPA factory. This is useful to run device monitors inside the session manager and have control over creating the actual nodes that the spa_device requests to create.

To enable the spa device, call wp_object_activate requesting WP_SPA_DEVICE_FEATURE_ENABLED.

For actual devices (not device monitors) it also possible and desirable to export the device to PipeWire, which can be done by requesting WP_PROXY_FEATURE_BOUND from wp_object_activate. When exporting, the export should be done before enabling the device, by requesting both features at the same time.


Class structure

WpSpaDeviceClass

Fields
parent_class (WpProxyClass) –
No description available

Constructors

wp_spa_device_new_from_spa_factory

WpSpaDevice *
wp_spa_device_new_from_spa_factory (WpCore * core,
                                    const gchar* factory_name,
                                    WpProperties * properties)

Constructs a SPA_TYPE_INTERFACE_Device by loading the given SPA factory_name.

To export this device to the PipeWire server, you need to call wp_object_activate requesting WP_PROXY_FEATURE_BOUND and wait for the operation to complete.

Parameters:

core

the wireplumber core

factory_name

the name of the SPA factory

properties ( [nullable][transfer: full])

properties to be passed to device constructor

Returns ( [nullable][transfer: full])

A new WpSpaDevice wrapping the device that was constructed by the factory, or NULL if the factory does not exist or was unable to construct the device


wp_spa_device_new_wrap

WpSpaDevice *
wp_spa_device_new_wrap (WpCore * core,
                        gpointer spa_device_handle,
                        WpProperties * properties)

Parameters:

core

the wireplumber core

spa_device_handle

the spa device handle

properties ( [nullable][transfer: full])

additional properties of the device

Returns ( [transfer: full])

A new WpSpaDevice


Methods

wp_spa_device_get_managed_object

GObject*
wp_spa_device_get_managed_object (WpSpaDevice * self,
                                  guint id)

Parameters:

self

the spa device

id

the (device-internal) id of the object to get

Returns ( [transfer: full])

the managed object associated with id


wp_spa_device_get_properties

WpProperties *
wp_spa_device_get_properties (WpSpaDevice * self)

Parameters:

self

the spa device

Returns ( [transfer: full])

the device properties


wp_spa_device_store_managed_object

wp_spa_device_store_managed_object (WpSpaDevice * self,
                                    guint id,
                                    GObject* object)

Parameters:

self

the spa device

id

the (device-internal) id of the object

object ( [transfer: full][nullable])

the object to store or NULL to remove the managed object associated with id


Signals

create-object

create_object_callback (WpSpaDevice * self,
                        guint id,
                        gchar* type,
                        gchar* factory,
                        WpProperties * properties,
                        gpointer user_data)

This signal is emitted when the device is creating a managed object The handler is expected to actually construct the object using the requested SPA factory and with the given properties. The handler should then store the object with wp_spa_device_store_managed_object. The WpSpaDevice will later unref the reference stored by this function when the managed object is to be destroyed.

Parameters:

self

the WpSpaDevice

id

the id of the managed object

type

the SPA type that the managed object should have

factory

the name of the SPA factory to use to construct the managed object

properties

additional properties that the managed object should have

user_data
No description available

Flags: Run First


object-removed

object_removed_callback (WpSpaDevice * self,
                         guint id,
                         gpointer user_data)

This signal is emitted when the device has deleted a managed object. The handler may optionally release additional resources associated with this object.

It is not necessary to call wp_spa_device_store_managed_object to remove the managed object, as this is done internally after this signal is fired.

Parameters:

self

the WpSpaDevice

id

the id of the managed object that was removed

user_data
No description available

Flags: Run First


Properties

properties

“properties” WpProperties *

Flags : Read / Write / Construct Only


spa-device-handle

“spa-device-handle” gpointer

Flags : Read / Write / Construct Only


Enumerations

WpSpaDeviceFeatures

Flags to be used as WpObjectFeatures for WpSpaDevice

Members
WP_SPA_DEVICE_FEATURE_ENABLED (65536) –

enables a device


Constants

WP_TYPE_DEVICE

#define WP_TYPE_DEVICE (wp_device_get_type ())

The WpDevice GType


WP_TYPE_SPA_DEVICE

#define WP_TYPE_SPA_DEVICE (wp_spa_device_get_type ())

The WpSpaDevice GType


The results of the search are