# Session Items

struct WpSessionItem

  GObject Properties

  id

    The session item unique id

    `guint` | `G_PARAM_READABLE`

  properties

    The session item properties

    `WpProperties *` | `G_PARAM_READABLE`

struct _WpSessionItemClass

  Public Members

  WpObjectClass parent_class
  void (*reset)(WpSessionItem *self)

    See wp_session_item_reset()

  gboolean (*configure)(WpSessionItem *self, WpProperties *props)

    See wp_session_item_configure()

  gpointer (*get_associated_proxy)(WpSessionItem *self, GType proxy_type)

    See wp_session_item_get_associated_proxy()

  void (*disable_active)(WpSessionItem *self)

    disables the active feature of the session item

  void (*disable_exported)(WpSessionItem *self)

    disables the exported feature of the session item

  void (*enable_active)(WpSessionItem *self, WpTransition *transition)

    enables the active feature of the session item

  void (*enable_exported)(WpSessionItem *self, WpTransition *transition)

    enables the exported feature of the session item

enum WpSessionItemFeatures

  Flags to be used as WpObjectFeatures for WpSessionItem subclasses.

  Values:

  enumerator WP_SESSION_ITEM_FEATURE_ACTIVE = (1 << 0)
  enumerator WP_SESSION_ITEM_FEATURE_EXPORTED = (1 << 1)
  enumerator WP_SESSION_ITEM_FEATURE_CUSTOM_START = (1 << 16)

guint wp_session_item_get_id(WpSessionItem *self)

  Gets the unique Id of the session item.

  Parameters

    - self – the session item

void wp_session_item_reset(WpSessionItem *self)

  Resets the session item.

  This essentially removes the configuration and deactivates all active features.

  Parameters

    - self – the session item

gboolean wp_session_item_configure(WpSessionItem *self, WpProperties *props)

  Configures the session item with a set of properties.

  Parameters

    - self – the session item

    - props – (transfer full): the properties used to configure the item

  Returns

    TRUE on success, FALSE if the item could not be configured

gboolean wp_session_item_is_configured(WpSessionItem *self)

  Checks if the session item is configured.

  Parameters

    - self – the session item

  Returns

    TRUE if the item is configured, FALSE otherwise

gpointer wp_session_item_get_associated_proxy(WpSessionItem *self, GType proxy_type)

  An associated proxy is a WpProxy subclass instance that is somehow related to this item. For example:

  - An exported WpSiEndpoint should have at least:

    - an associated WpSiEndpoint

    - an associated WpSession

  - In cases where the item wraps a single PipeWire node, it should also have an associated WpNode

  Parameters

    - self – the session item

    - proxy_type – a WpProxy subclass GType

  Returns

    (nullable) (transfer full) (type WpProxy): the associated proxy of the specified proxy_type, or NULL if there is no association to such a proxy

guint32 wp_session_item_get_associated_proxy_id(WpSessionItem *self, GType proxy_type)

  Gets the bound id of a proxy associated with the session item.

  Parameters

    - self – the session item

    - proxy_type – a WpProxy subclass GType

  Returns

    the bound id of the associated proxy of the specified proxy_type, or `SPA_ID_INVALID` if there is no association to such a proxy

void wp_session_item_register(WpSessionItem *self)

  Registers the session item to its associated core.

  Parameters

    - self – (transfer full): the session item

void wp_session_item_remove(WpSessionItem *self)

  Removes the session item from the registry.

  Parameters

    - self – (transfer none): the session item

WpProperties *wp_session_item_get_properties(WpSessionItem *self)

  Gets the properties of a session item.

  Parameters

    - self – the session item

  Returns

    (transfer full): the item’s properties.

const gchar *wp_session_item_get_property(WpSessionItem *self, const gchar *key)

  Looks up a named session item property value for a given key.

  Parameters

    - self – the session item

    - key – the property key

  Returns

    the item property value for the given key.

void wp_session_item_set_properties(WpSessionItem *self, WpProperties *props)

  Sets the item’s properties.

  This should only be done by sub-classes after the configuration has been done.

  Parameters

    - self – the session item

    - props – (transfer full): the new properties to set

void wp_session_item_handle_proxy_destroyed(WpProxy *proxy, WpSessionItem *item)

  Helper callback for sub-classes that deffers and unexports the session item.

  Only meant to be used when the pipewire proxy destroyed signal is triggered.

  Parameters

    - proxy – the proxy that was destroyed by the server

    - item – the associated session item

WP_TYPE_SESSION_ITEM (wp_session_item_get_type ())

  The WpSessionItem GType.