PipeWire Metadata — WirePlumber 0.5.17 documentation

# PipeWire Metadata

struct WpMetadataItem

  WpMetadataItem holds the subject, key, type and value of a metadata entry.

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)

    Emitted 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

WpMetadataItem *wp_metadata_item_ref(WpMetadataItem *self)

  Increases the reference count of a metadata item object.

  Since

    0.5.0

  Parameters:

    - self -- a metadata item object

  Returns:

    (transfer full): self with an additional reference count on it

void wp_metadata_item_unref(WpMetadataItem *self)

  Decreases the reference count on self and frees it when the ref count reaches zero.

  Since

    0.5.0

  Parameters:

    - self -- (transfer full): a metadata item object

guint32 wp_metadata_item_get_subject(WpMetadataItem *self)

  Gets the subject from a metadata item.

  Since

    0.5.0

  Parameters:

    - self -- the item held by the GValue that was returned from the WpIterator of wp_metadata_new_iterator()

  Returns:

    the metadata subject of the item

const gchar *wp_metadata_item_get_key(WpMetadataItem *self)

  Gets the key from a metadata item.

  Since

    0.5.0

  Parameters:

    - self -- the item held by the GValue that was returned from the WpIterator of wp_metadata_new_iterator()

  Returns:

    (transfer none): the metadata key of the item

const gchar *wp_metadata_item_get_value_type(WpMetadataItem *self)

  Gets the value type from a metadata item.

  Since

    0.5.0

  Parameters:

    - self -- the item held by the GValue that was returned from the WpIterator of wp_metadata_new_iterator()

  Returns:

    (transfer none): the metadata value type of the item

const gchar *wp_metadata_item_get_value(WpMetadataItem *self)

  Gets the value from a metadata item.

  Since

    0.5.0

  Parameters:

    - self -- the item held by the GValue that was returned from the WpIterator of wp_metadata_new_iterator()

  Returns:

    (transfer none): the metadata value of the item

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. The type of the iterator item is WpMetadataItem.

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_ITEM (wp_metadata_item_get_type ())

  The WpMetadataItem GType.

WP_TYPE_METADATA (wp_metadata_get_type ())

  The WpMetadata GType.

WP_TYPE_IMPL_METADATA (wp_impl_metadata_get_type ())

  The WpImplMetadata GType.