PipeWire Metadata

digraph inheritance { rankdir=LR; GObject -> WpObject; WpObject -> WpProxy; WpProxy -> WpGlobalProxy; WpGlobalProxy -> WpMetadata; WpMetadata-> WpImplMetadata; }

struct WpMetadata

The WpMetadata class allows accessing the properties and methods of PipeWire metadata object (struct pw_metadata).

A WpMetadata is constructed internally when a new metadata object appears on the PipeWire registry and it is made available through the WpObjectManager API.

GObject Signals

changed

void
changed_callback (WpMetadata * self,
                  guint subject,
                  gchar * key,
                  gchar * type,
                  gchar * value,
                  gpointer user_data)
Emited when metadata change

Parameters:

  • subject - the metadata subject id

  • key - the metadata key

  • type - the value type

  • value - the metadata value

Flags: G_SIGNAL_RUN_LAST

struct WpImplMetadata

Implementation of the metadata object.

Activate this object with at least WP_PROXY_FEATURE_BOUND to export it to PipeWire.

enum WpMetadataFeatures

An extension of WpProxyFeatures for WpMetadata objects.

Values:

enumerator WP_METADATA_FEATURE_DATA = (WP_PROXY_FEATURE_CUSTOM_START << 0)

caches metadata locally

WpIterator *wp_metadata_new_iterator(WpMetadata *self, guint32 subject)

Iterates over metadata items that matches the given subject.

If no constraints are specified, the returned iterator iterates over all the stored metadata.

Note that this method works on cached metadata. When you change metadata with wp_metadata_set(), this cache will be updated on the next round-trip with the pipewire server.

Parameters:
  • self – a metadata object

  • subject – the metadata subject id, or -1 (PW_ID_ANY)

Returns:

(transfer full): an iterator that iterates over the found metadata. Use wp_metadata_iterator_item_extract() to parse the items returned by this iterator.

void wp_metadata_iterator_item_extract(const GValue *item, guint32 *subject, const gchar **key, const gchar **type, const gchar **value)

Extracts the metadata subject, key, type and value out of a GValue that was returned from the WpIterator of wp_metadata_find()

Parameters:
  • item – a GValue that was returned from the WpIterator of wp_metadata_find()

  • subject – (out)(optional): the subject id of the current item

  • key – (out)(optional)(transfer none): the key of the current item

  • type – (out)(optional)(transfer none): the type of the current item

  • value – (out)(optional)(transfer none): the value of the current item

const gchar *wp_metadata_find(WpMetadata *self, guint32 subject, const gchar *key, const gchar **type)

Finds the metadata value given its subject and key.

Parameters:
  • self – a metadata object

  • subject – the metadata subject id

  • key – the metadata key name

  • type – (out)(optional): the metadata type name

Returns:

the metadata string value, or NULL if not found.

void wp_metadata_set(WpMetadata *self, guint32 subject, const gchar *key, const gchar *type, const gchar *value)

Sets the metadata associated with the given subject and key. Use NULL as a value to unset the given key and use NULL in both key and value to remove all metadata associated with the given subject.

Parameters:
  • self – the metadata object

  • subject – the subject id for which this metadata property is being set

  • key – (nullable): the key to set, or NULL to remove all metadata for subject

  • type – (nullable): the type of the value; NULL is synonymous to “string”

  • value – (nullable): the value to set, or NULL to unset the given key

void wp_metadata_clear(WpMetadata *self)

Clears permanently all stored metadata.

Parameters:
  • self – the metadata object

WpImplMetadata *wp_impl_metadata_new(WpCore *core)

Creates a new metadata implementation.

Parameters:
  • core – the core

Returns:

(transfer full): a new WpImplMetadata

WpImplMetadata *wp_impl_metadata_new_full(WpCore *core, const gchar *name, WpProperties *properties)

Creates a new metadata implementation with name and properties.

Since

0.4.3

Parameters:
  • core – the core

  • name – (nullable): the metadata name

  • properties – (nullable) (transfer full): the metadata properties

Returns:

(transfer full): a new WpImplMetadata

WP_TYPE_METADATA (wp_metadata_get_type ())

The WpMetadata GType.

WP_TYPE_IMPL_METADATA (wp_impl_metadata_get_type ())

The WpImplMetadata GType.