PipeWire 1.2.7
Loading...
Searching...
No Matches
device.h
Go to the documentation of this file.
1/* PipeWire */
2/* SPDX-FileCopyrightText: Copyright © 2018 Wim Taymans */
3/* SPDX-License-Identifier: MIT */
4
5#ifndef PIPEWIRE_DEVICE_H
6#define PIPEWIRE_DEVICE_H
7
8#ifdef __cplusplus
9extern "C" {
10#endif
11
12#include <spa/utils/defs.h>
13#include <spa/utils/hook.h>
14
15#include <pipewire/proxy.h>
16
26#define PW_TYPE_INTERFACE_Device PW_TYPE_INFO_INTERFACE_BASE "Device"
27
28#define PW_DEVICE_PERM_MASK PW_PERM_RWXM
29
30#define PW_VERSION_DEVICE 3
31struct pw_device;
32
35 uint32_t id;
36#define PW_DEVICE_CHANGE_MASK_PROPS (1 << 0)
37#define PW_DEVICE_CHANGE_MASK_PARAMS (1 << 1)
38#define PW_DEVICE_CHANGE_MASK_ALL ((1 << 2)-1)
39 uint64_t change_mask;
40 struct spa_dict *props;
41 struct spa_param_info *params;
42 uint32_t n_params;
43};
44
46struct pw_device_info *
48 const struct pw_device_info *update);
52 const struct pw_device_info *update, bool reset);
54void pw_device_info_free(struct pw_device_info *info);
55
56#define PW_DEVICE_EVENT_INFO 0
57#define PW_DEVICE_EVENT_PARAM 1
58#define PW_DEVICE_EVENT_NUM 2
59
61struct pw_device_events {
62#define PW_VERSION_DEVICE_EVENTS 0
63 uint32_t version;
69 void (*info) (void *data, const struct pw_device_info *info);
81 void (*param) (void *data, int seq,
82 uint32_t id, uint32_t index, uint32_t next,
83 const struct spa_pod *param);
84};
85
86
87#define PW_DEVICE_METHOD_ADD_LISTENER 0
88#define PW_DEVICE_METHOD_SUBSCRIBE_PARAMS 1
89#define PW_DEVICE_METHOD_ENUM_PARAMS 2
90#define PW_DEVICE_METHOD_SET_PARAM 3
91#define PW_DEVICE_METHOD_NUM 4
92
94struct pw_device_methods {
95#define PW_VERSION_DEVICE_METHODS 0
96 uint32_t version;
97
98 int (*add_listener) (void *object,
99 struct spa_hook *listener,
100 const struct pw_device_events *events,
101 void *data);
113 int (*subscribe_params) (void *object, uint32_t *ids, uint32_t n_ids);
129 int (*enum_params) (void *object, int seq, uint32_t id, uint32_t start, uint32_t num,
130 const struct spa_pod *filter);
140 int (*set_param) (void *object, uint32_t id, uint32_t flags,
141 const struct spa_pod *param);
142};
143
144#define pw_device_method(o,method,version,...) \
145({ \
146 int _res = -ENOTSUP; \
147 spa_interface_call_res((struct spa_interface*)o, \
148 struct pw_device_methods, _res, \
149 method, version, ##__VA_ARGS__); \
150 _res; \
151})
152
153#define pw_device_add_listener(c,...) pw_device_method(c,add_listener,0,__VA_ARGS__)
154#define pw_device_subscribe_params(c,...) pw_device_method(c,subscribe_params,0,__VA_ARGS__)
155#define pw_device_enum_params(c,...) pw_device_method(c,enum_params,0,__VA_ARGS__)
156#define pw_device_set_param(c,...) pw_device_method(c,set_param,0,__VA_ARGS__)
157
162#ifdef __cplusplus
163} /* extern "C" */
164#endif
166#endif /* PIPEWIRE_DEVICE_H */
spa/utils/defs.h
void pw_device_info_free(struct pw_device_info *info)
Free a pw_device_info.
Definition introspect.c:471
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.
Definition introspect.c:409
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.
Definition introspect.c:464
spa/utils/hook.h
pipewire/proxy.h
Device events.
Definition device.h:75
void(* info)(void *data, const struct pw_device_info *info)
Notify device info.
Definition device.h:84
uint32_t version
Definition device.h:78
void(* param)(void *data, int seq, uint32_t id, uint32_t index, uint32_t next, const struct spa_pod *param)
Notify a device param.
Definition device.h:96
The device information.
Definition device.h:42
uint32_t id
id of the global
Definition device.h:43
uint64_t change_mask
bitfield of changed fields since last call
Definition device.h:50
uint32_t n_params
number of items in params
Definition device.h:53
struct spa_param_info * params
parameters
Definition device.h:52
Device methods.
Definition device.h:114
int(* subscribe_params)(void *object, uint32_t *ids, uint32_t n_ids)
Subscribe to parameter changes.
Definition device.h:134
int(* enum_params)(void *object, int seq, uint32_t id, uint32_t start, uint32_t num, const struct spa_pod *filter)
Enumerate device parameters.
Definition device.h:150
int(* set_param)(void *object, uint32_t id, uint32_t flags, const struct spa_pod *param)
Set a parameter on the device.
Definition device.h:161
uint32_t version
Definition device.h:117
int(* add_listener)(void *object, struct spa_hook *listener, const struct pw_device_events *events, void *data)
Definition device.h:119
Definition dict.h:39
A hook, contains the structure with functions and the data passed to the functions.
Definition hook.h:350
information about a parameter
Definition param.h:51
Definition pod.h:43