PipeWire 1.0.5
Loading...
Searching...
No Matches
spa_device_methods Struct Reference

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

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
objecta Device
listenera listener
eventsa struct spa_device_events
datadata 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
seqa 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
devicea Device
seqa sequence number to pass to the result function
idthe param id to enumerate
indexthe index of enumeration, pass 0 for the first item.
maxthe maximum number of items to iterate
filterand 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
objectDevice
idthe parameter id to configure
flagsadditional flags
paramthe 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: