PipeWire 1.6.8

Loading...
Searching...
No Matches
spa_device_methods Struct Reference
SPA » Device

spa_device_methods: More...

`#include <spa/monitor/device.h>`

## Data Fields
uint32_t | version
int(* | add_listener )(void *object, struct spa_hook *listener, const struct spa_device_events *events, void *data)
| Set events to receive asynchronous notifications from the device.
int(* | sync )(void *object, int seq)
| Perform a sync operation.
int(* | enum_params )(void *object, int seq, uint32_t id, uint32_t index, uint32_t max, const struct spa_pod *filter)
| Enumerate the parameters of a device.
int(* | set_param )(void *object, uint32_t id, uint32_t flags, const struct spa_pod *param)
| Set the configurable parameter in device.

## Detailed Description

spa_device_methods:

## Field Documentation

## ◆ version

uint32_t spa_device_methods::version

## ◆ add_listener

int(* spa_device_methods::add_listener) (void *object, struct spa_hook *listener, const struct spa_device_events *events, void *data)

Set events to receive asynchronous notifications from the device.

Setting the events will trigger the info event and an object_info event for each managed object on the new listener.

Parameters

  object | a Device
  listener | a listener
  events | a struct spa_device_events
  data | data passed as first argument in functions of events

Returns
  0 on success < 0 errno on error

## ◆ sync

int(* spa_device_methods::sync) (void *object, int seq)

Perform a sync operation.

This method will emit the result event with the given sequence number synchronously or with the returned async return value asynchronously.

Because all methods are serialized in the device, this can be used to wait for completion of all previous method calls.

Parameters

  seq | a sequence number

Returns
  0 on success -EINVAL when node is NULL an async result

## ◆ enum_params

int(* spa_device_methods::enum_params) (void *object, int seq, uint32_t id, uint32_t index, uint32_t max, const struct spa_pod *filter)

Enumerate the parameters of a device.

Parameters are identified with an id. Some parameters can have multiple values, see the documentation of the parameter id.

Parameters can be filtered by passing a non-NULL filter.

The result callback will be called at most max times with a struct spa_result_device_params as the result.

This function must be called from the main thread.

Parameters

  device | a Device
  seq | a sequence number to pass to the result function
  id | the param id to enumerate
  index | the index of enumeration, pass 0 for the first item.
  max | the maximum number of items to iterate
  filter | and optional filter to use

Returns
  0 when there are no more parameters to enumerate -EINVAL when invalid arguments are given -ENOENT the parameter id is unknown -ENOTSUP when there are no parameters implemented on device

## ◆ set_param

int(* spa_device_methods::set_param) (void *object, uint32_t id, uint32_t flags, const struct spa_pod *param)

Set the configurable parameter in device.

Usually, param will be obtained from enum_params and then modified but it is also possible to set another spa_pod as long as its keys and types match a supported object.

Objects with property keys that are not known are ignored.

This function must be called from the main thread.

Parameters

  object | Device
  id | the parameter id to configure
  flags | additional flags
  param | the parameter to configure

Returns
  0 on success -EINVAL when invalid arguments are given -ENOTSUP when there are no parameters implemented on device -ENOENT the parameter is unknown

The documentation for this struct was generated from the following file:

- spa/monitor/device.h