PipeWire 1.6.8

Loading...
Searching...
No Matches
Device
Core API

Device interface. More...

## Files
file | device.h
| pipewire/device.h

## Data Structures
struct | pw_device_info
| The device information. More...
struct | pw_device_events
| Device events. More...
struct | pw_device_methods
| Device methods. More...
struct | pw_device

## Macros
#define | PW_TYPE_INTERFACE_Device PW_TYPE_INFO_INTERFACE_BASE "Device"
#define | PW_DEVICE_PERM_MASK PW_PERM_RWXM
#define | PW_VERSION_DEVICE 3
#define | PW_API_DEVICE_IMPL static inline
#define | PW_DEVICE_CHANGE_MASK_PROPS (1 << 0)
#define | PW_DEVICE_CHANGE_MASK_PARAMS (1 << 1)
#define | PW_DEVICE_CHANGE_MASK_ALL ((1 << 2)-1)
#define | PW_DEVICE_EVENT_INFO 0
#define | PW_DEVICE_EVENT_PARAM 1
#define | PW_DEVICE_EVENT_NUM 2
#define | PW_VERSION_DEVICE_EVENTS 0
#define | PW_DEVICE_METHOD_ADD_LISTENER 0
#define | PW_DEVICE_METHOD_SUBSCRIBE_PARAMS 1
#define | PW_DEVICE_METHOD_ENUM_PARAMS 2
#define | PW_DEVICE_METHOD_SET_PARAM 3
#define | PW_DEVICE_METHOD_NUM 4
#define | PW_VERSION_DEVICE_METHODS 0

## Functions
struct pw_device_info * | pw_device_info_update (struct pw_device_info *info, const struct pw_device_info *update)
| Update and existing pw_device_info with update and reset.
struct pw_device_info * | pw_device_info_merge (struct pw_device_info *info, const struct pw_device_info *update, bool reset)
| Merge and existing pw_device_info with update.
void | pw_device_info_free (struct pw_device_info *info)
| Free a pw_device_info.
PW_API_DEVICE_IMPL int | pw_device_add_listener (struct pw_device *object, struct spa_hook *listener, const struct pw_device_events *events, void *data)
PW_API_DEVICE_IMPL int | pw_device_subscribe_params (struct pw_device *object, uint32_t *ids, uint32_t n_ids)
| Subscribe to parameter changes.
PW_API_DEVICE_IMPL int | pw_device_enum_params (struct pw_device *object, int seq, uint32_t id, uint32_t start, uint32_t num, const struct spa_pod *filter)
| Enumerate device parameters.
PW_API_DEVICE_IMPL int | pw_device_set_param (struct pw_device *object, uint32_t id, uint32_t flags, const struct spa_pod *param)
| Set a parameter on the device.

## Detailed Description

Device interface.

## Macro Definition Documentation

## ◆ PW_TYPE_INTERFACE_Device

#define PW_TYPE_INTERFACE_Device PW_TYPE_INFO_INTERFACE_BASE "Device"

Examples
  export-spa-device.c.

## ◆ PW_DEVICE_PERM_MASK

#define PW_DEVICE_PERM_MASK PW_PERM_RWXM

## ◆ PW_VERSION_DEVICE

#define PW_VERSION_DEVICE 3

Examples
  export-spa-device.c.

## ◆ PW_API_DEVICE_IMPL

#define PW_API_DEVICE_IMPL static inline

## ◆ PW_DEVICE_CHANGE_MASK_PROPS

#define PW_DEVICE_CHANGE_MASK_PROPS (1 << 0)

## ◆ PW_DEVICE_CHANGE_MASK_PARAMS

#define PW_DEVICE_CHANGE_MASK_PARAMS (1 << 1)

## ◆ PW_DEVICE_CHANGE_MASK_ALL

#define PW_DEVICE_CHANGE_MASK_ALL ((1 << 2)-1)

## ◆ PW_DEVICE_EVENT_INFO

#define PW_DEVICE_EVENT_INFO 0

## ◆ PW_DEVICE_EVENT_PARAM

#define PW_DEVICE_EVENT_PARAM 1

## ◆ PW_DEVICE_EVENT_NUM

#define PW_DEVICE_EVENT_NUM 2

## ◆ PW_VERSION_DEVICE_EVENTS

#define PW_VERSION_DEVICE_EVENTS 0

## ◆ PW_DEVICE_METHOD_ADD_LISTENER

#define PW_DEVICE_METHOD_ADD_LISTENER 0

## ◆ PW_DEVICE_METHOD_SUBSCRIBE_PARAMS

#define PW_DEVICE_METHOD_SUBSCRIBE_PARAMS 1

## ◆ PW_DEVICE_METHOD_ENUM_PARAMS

#define PW_DEVICE_METHOD_ENUM_PARAMS 2

## ◆ PW_DEVICE_METHOD_SET_PARAM

#define PW_DEVICE_METHOD_SET_PARAM 3

## ◆ PW_DEVICE_METHOD_NUM

#define PW_DEVICE_METHOD_NUM 4

## ◆ PW_VERSION_DEVICE_METHODS

#define PW_VERSION_DEVICE_METHODS 0

## Function Documentation

## ◆ pw_device_info_update()

struct pw_device_info * pw_device_info_update | ( | struct pw_device_info * | info,
|  | const struct pw_device_info * | update )

Update and existing pw_device_info with update and reset.

## ◆ pw_device_info_merge()

struct pw_device_info * pw_device_info_merge | ( | struct pw_device_info * | info,
|  | const struct pw_device_info * | update,
|  | bool | reset )

Merge and existing pw_device_info with update.

## ◆ pw_device_info_free()

void pw_device_info_free | ( | struct pw_device_info * | info | ) |

Free a pw_device_info.

## ◆ pw_device_add_listener()

PW_API_DEVICE_IMPL int pw_device_add_listener | ( | struct pw_device * | object,
|  | struct spa_hook * | listener,
|  | const struct pw_device_events * | events,
|  | void * | data )

See also
  pw_device_methods.add_listener

## ◆ pw_device_subscribe_params()

PW_API_DEVICE_IMPL int pw_device_subscribe_params | ( | struct pw_device * | object,
|  | uint32_t * | ids,
|  | uint32_t | n_ids )

Subscribe to parameter changes.

Automatically emit param events for the given ids when they are changed.

Parameters

  ids | an array of param ids
  n_ids | the number of ids in ids

This requires X permissions on the device.

See also
  pw_device_methods.subscribe_params

## ◆ pw_device_enum_params()

PW_API_DEVICE_IMPL int pw_device_enum_params | ( | struct pw_device * | object,
|  | int | seq,
|  | uint32_t | id,
|  | uint32_t | start,
|  | uint32_t | num,
|  | const struct spa_pod * | filter )

Enumerate device parameters.

Start enumeration of device parameters. For each param, a param event will be emitted.

Parameters

  seq | a sequence number to place in the reply
  id | the parameter id to enum or PW_ID_ANY for all
  start | the start index or 0 for the first param
  num | the maximum number of params to retrieve
  filter | a param filter or NULL

This requires X permissions on the device.

See also
  pw_device_methods.enum_params

## ◆ pw_device_set_param()

PW_API_DEVICE_IMPL int pw_device_set_param | ( | struct pw_device * | object,
|  | uint32_t | id,
|  | uint32_t | flags,
|  | const struct spa_pod * | param )

Set a parameter on the device.

Parameters

  id | the parameter id to set
  flags | extra parameter flags
  param | the parameter to set

This requires W and X permissions on the device.

See also
  pw_device_methods.set_param