PipeWire Object¶
-
struct
WpPipewireObject
¶ An interface for standard PipeWire objects.
The common characteristic of all objects that implement this interface is the presence of an “info” structure that contains additional properties for this object (in the form of a spa_dict / pw_properties) and optionally also some parameters that can be enumerated and set on the object.
GObject Properties
GObject Signals
- params-changed
-
struct
_WpPipewireObjectInterface
¶ Public Members
-
GTypeInterface
parent_iface
¶
-
gconstpointer
get_native_info)
(WpPipewireObject *self)¶
-
WpProperties*
get_properties)
(WpPipewireObject *self)¶
-
GVariant*
get_param_info)
(WpPipewireObject *self)¶
-
void
enum_params)
(WpPipewireObject *self, const gchar *id, WpSpaPod *filter, GCancellable *cancellable, GAsyncReadyCallback callback, gpointer user_data)¶
-
WpIterator*
enum_params_finish)
(WpPipewireObject *self, GAsyncResult *res, GError **error)¶
-
WpIterator*
enum_params_sync)
(WpPipewireObject *self, const gchar *id, WpSpaPod *filter)¶
-
gboolean
set_param)
(WpPipewireObject *self, const gchar *id, guint32 flags, WpSpaPod *param)¶
-
GTypeInterface
-
gconstpointer
wp_pipewire_object_get_native_info
(WpPipewireObject * self)¶ Retrieves the native info structure of this object (pw_node_info, pw_port_info, etc…)
- Remark
Requires WP_PIPEWIRE_OBJECT_FEATURE_INFO
- Return
(nullable): the native pipewire info structure of this object
- Parameters
self
: the pipewire object
-
WpProperties*
wp_pipewire_object_get_properties
(WpPipewireObject * self)¶ Retrieves the PipeWire properties of this object.
- Remark
Requires WP_PIPEWIRE_OBJECT_FEATURE_INFO
- Return
(transfer full): the pipewire properties of this object; normally these are the properties that are part of the info structure
- Parameters
self
: the pipewire object
-
WpIterator*
wp_pipewire_object_new_properties_iterator
(WpPipewireObject * self)¶ Iterates over the object’s PipeWire properties.
- Remark
Requires WP_PIPEWIRE_OBJECT_FEATURE_INFO
- Return
(transfer full): an iterator that iterates over the pipewire properties of this object. Use wp_properties_iterator_item_get_key() and wp_properties_iterator_item_get_value() to parse the items returned by this iterator.
- Parameters
self
: the pipewire object
-
const gchar*
wp_pipewire_object_get_property
(WpPipewireObject * self, const gchar * key)¶ Returns the value of a single pipewire property.
This is the same as getting the whole properties structure with wp_pipewire_object_get_properties() and accessing a single property with wp_properties_get(), but saves one call and having to clean up the WpProperties reference count afterwards.
The value is owned by the proxy, but it is guaranteed to stay alive until execution returns back to the event loop.
- Remark
Requires WP_PIPEWIRE_OBJECT_FEATURE_INFO
- Return
(transfer none) (nullable): the value of the pipewire property key or NULL if the property doesn’t exist
- Parameters
self
: the pipewire objectkey
: the property name
-
GVariant*
wp_pipewire_object_get_param_info
(WpPipewireObject * self)¶ Returns the available parameters of this pipewire object.
The return value is a GVariant of type
a{ss}
, where the key of each map entry is a spa param type id (the same ids that you can pass in wp_pipewire_object_enum_params()) and the value is a string that can contain the following letters, each of them representing a flag:r
: the param is readable (SPA_PARAM_INFO_READ
)w
: the param is writable (SPA_PARAM_INFO_WRITE
)
For params that are readable, you can query them with wp_pipewire_object_enum_params()
Params that are writable can be set with wp_pipewire_object_set_param()
- Remark
Requires WP_PIPEWIRE_OBJECT_FEATURE_INFO
- Return
(transfer full) (nullable): a variant of type
a{ss}
or NULL if the object does not support params at all- Parameters
self
: the pipewire object
-
void
wp_pipewire_object_enum_params
(WpPipewireObject * self, const gchar * id, WpSpaPod * filter, GCancellable * cancellable, GAsyncReadyCallback callback, gpointer user_data)¶ Enumerate object parameters.
This will asynchronously return the result, or an error, by calling the given callback. The result is going to be a WpIterator containing WpSpaPod objects, which can be retrieved with wp_pipewire_object_enum_params_finish().
- Parameters
self
: the pipewire objectid
: (nullable): the parameter id to enumerate or NULL for all parametersfilter
: (nullable): a param filter or NULLcancellable
: (nullable): a cancellable for the async operationcallback
: (scope async): a callback to call with the resultuser_data
: (closure): data to pass to callback
-
WpIterator*
wp_pipewire_object_enum_params_finish
(WpPipewireObject * self, GAsyncResult * res, GError ** error)¶ Finishes an asynchronous parameter enumeration operation.
- Return
(transfer full) (nullable): an iterator to iterate over the collected params, or NULL if the operation resulted in error; the items in the iterator are WpSpaPod
- Parameters
self
: the pipewire objectres
: the async resulterror
: (out) (optional): the reported error of the operation, if any
-
WpIterator*
wp_pipewire_object_enum_params_sync
(WpPipewireObject * self, const gchar * id, WpSpaPod * filter)¶ This method can be used to retrieve object parameters in a synchronous way (in contrast with wp_pipewire_object_enum_params(), which is async).
The
WP_PIPEWIRE_OBJECT_FEATURE_PARAM_<something>
feature that corresponds to the specified id must have been activated earlier. These features enable monitoring and caching of params underneath, so that they are always available for retrieval with this method.Note, however, that cached params may be out-of-date if they have changed very recently on the remote object and the caching mechanism hasn’t been able to update them yet, so if you really need up-to-date information you should only rely on wp_pipewire_object_enum_params() instead.
- Return
(transfer full) (nullable): an iterator to iterate over cached parameters, or NULL if parameters for this id are not cached; the items in the iterator are WpSpaPod
- Parameters
self
: the pipewire objectid
: the parameter id to enumeratefilter
: (nullable): a param filter or NULL
-
gboolean
wp_pipewire_object_set_param
(WpPipewireObject * self, const gchar * id, guint32 flags, WpSpaPod * param)¶ Sets a parameter on the object.
- Return
TRUE on success, FALSE if setting the param failed
- Parameters
self
: the pipewire objectid
: the parameter id to setflags
: optional flags or 0param
: (transfer full): the parameter to set
-
WP_TYPE_PIPEWIRE_OBJECT
(wp_pipewire_object_get_type ())¶ The WpPipewireObject GType.