PipeWire 1.1.0
Loading...
Searching...
No Matches
client-node.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_EXT_CLIENT_NODE_H
6#define PIPEWIRE_EXT_CLIENT_NODE_H
7
8#ifdef __cplusplus
9extern "C" {
10#endif
11
12#include <spa/utils/defs.h>
13#include <spa/param/param.h>
14
23#define PW_TYPE_INTERFACE_ClientNode PW_TYPE_INFO_INTERFACE_BASE "ClientNode"
24
25#define PW_VERSION_CLIENT_NODE 5
26struct pw_client_node;
27
28#define PW_EXTENSION_MODULE_CLIENT_NODE PIPEWIRE_MODULE_PREFIX "module-client-node"
29
32 uint32_t mem_id;
33 uint32_t offset;
34 uint32_t size;
35 struct spa_buffer *buffer;
36};
37
38#define PW_CLIENT_NODE_EVENT_TRANSPORT 0
39#define PW_CLIENT_NODE_EVENT_SET_PARAM 1
40#define PW_CLIENT_NODE_EVENT_SET_IO 2
41#define PW_CLIENT_NODE_EVENT_EVENT 3
42#define PW_CLIENT_NODE_EVENT_COMMAND 4
43#define PW_CLIENT_NODE_EVENT_ADD_PORT 5
44#define PW_CLIENT_NODE_EVENT_REMOVE_PORT 6
45#define PW_CLIENT_NODE_EVENT_PORT_SET_PARAM 7
46#define PW_CLIENT_NODE_EVENT_PORT_USE_BUFFERS 8
47#define PW_CLIENT_NODE_EVENT_PORT_SET_IO 9
48#define PW_CLIENT_NODE_EVENT_SET_ACTIVATION 10
49#define PW_CLIENT_NODE_EVENT_PORT_SET_MIX_INFO 11
50#define PW_CLIENT_NODE_EVENT_NUM 12
54#define PW_VERSION_CLIENT_NODE_EVENTS 1
55 uint32_t version;
67 int (*transport) (void *data,
68 int readfd,
69 int writefd,
70 uint32_t mem_id,
71 uint32_t offset,
72 uint32_t size);
83 int (*set_param) (void *data,
84 uint32_t id, uint32_t flags,
85 const struct spa_pod *param);
97 int (*set_io) (void *data,
98 uint32_t id,
99 uint32_t mem_id,
100 uint32_t offset,
101 uint32_t size);
105 int (*event) (void *data, const struct spa_event *event);
111 int (*command) (void *data, const struct spa_command *command);
122 int (*add_port) (void *data,
123 enum spa_direction direction,
124 uint32_t port_id,
125 const struct spa_dict *props);
132 int (*remove_port) (void *data,
133 enum spa_direction direction,
134 uint32_t port_id);
144 int (*port_set_param) (void *data,
145 enum spa_direction direction,
146 uint32_t port_id,
147 uint32_t id, uint32_t flags,
148 const struct spa_pod *param);
158 int (*port_use_buffers) (void *data,
159 enum spa_direction direction,
160 uint32_t port_id,
161 uint32_t mix_id,
162 uint32_t flags,
163 uint32_t n_buffers,
164 struct pw_client_node_buffer *buffers);
176 int (*port_set_io) (void *data,
177 enum spa_direction direction,
178 uint32_t port_id,
179 uint32_t mix_id,
180 uint32_t id,
181 uint32_t mem_id,
182 uint32_t offset,
183 uint32_t size);
184
195 int (*set_activation) (void *data,
196 uint32_t node_id,
197 int signalfd,
198 uint32_t mem_id,
199 uint32_t offset,
200 uint32_t size);
201
213 int (*port_set_mix_info) (void *data,
214 enum spa_direction direction,
215 uint32_t port_id,
216 uint32_t mix_id,
217 uint32_t peer_id,
218 const struct spa_dict *props);
219};
220
221#define PW_CLIENT_NODE_METHOD_ADD_LISTENER 0
222#define PW_CLIENT_NODE_METHOD_GET_NODE 1
223#define PW_CLIENT_NODE_METHOD_UPDATE 2
224#define PW_CLIENT_NODE_METHOD_PORT_UPDATE 3
225#define PW_CLIENT_NODE_METHOD_SET_ACTIVE 4
226#define PW_CLIENT_NODE_METHOD_EVENT 5
227#define PW_CLIENT_NODE_METHOD_PORT_BUFFERS 6
228#define PW_CLIENT_NODE_METHOD_NUM 7
229
232#define PW_VERSION_CLIENT_NODE_METHODS 0
233 uint32_t version;
234
235 int (*add_listener) (void *object,
236 struct spa_hook *listener,
237 const struct pw_client_node_events *events,
238 void *data);
241 struct pw_node * (*get_node) (void *object, uint32_t version, size_t user_data_size);
252 int (*update) (void *object,
253#define PW_CLIENT_NODE_UPDATE_PARAMS (1 << 0)
254#define PW_CLIENT_NODE_UPDATE_INFO (1 << 1)
255 uint32_t change_mask,
256 uint32_t n_params,
257 const struct spa_pod **params,
258 const struct spa_node_info *info);
259
271 int (*port_update) (void *object,
272 enum spa_direction direction,
273 uint32_t port_id,
274#define PW_CLIENT_NODE_PORT_UPDATE_PARAMS (1 << 0)
275#define PW_CLIENT_NODE_PORT_UPDATE_INFO (1 << 1)
276 uint32_t change_mask,
277 uint32_t n_params,
278 const struct spa_pod **params,
279 const struct spa_port_info *info);
283 int (*set_active) (void *object, bool active);
288 int (*event) (void *object, const struct spa_event *event);
289
293 int (*port_buffers) (void *object,
294 enum spa_direction direction,
295 uint32_t port_id,
296 uint32_t mix_id,
297 uint32_t n_buffers,
298 struct spa_buffer **buffers);
299};
300
301
302#define pw_client_node_method(o,method,version,...) \
303({ \
304 int _res = -ENOTSUP; \
305 spa_interface_call_res((struct spa_interface*)o, \
306 struct pw_client_node_methods, _res, \
307 method, version, ##__VA_ARGS__); \
308 _res; \
309})
310
311#define pw_client_node_add_listener(c,...) pw_client_node_method(c,add_listener,0,__VA_ARGS__)
312
313static inline struct pw_node *
314pw_client_node_get_node(struct pw_client_node *p, uint32_t version, size_t user_data_size)
315{
316 struct pw_node *res = NULL;
319 get_node, 0, version, user_data_size);
320 return res;
321}
322
323#define pw_client_node_update(c,...) pw_client_node_method(c,update,0,__VA_ARGS__)
324#define pw_client_node_port_update(c,...) pw_client_node_method(c,port_update,0,__VA_ARGS__)
325#define pw_client_node_set_active(c,...) pw_client_node_method(c,set_active,0,__VA_ARGS__)
326#define pw_client_node_event(c,...) pw_client_node_method(c,event,0,__VA_ARGS__)
327#define pw_client_node_port_buffers(c,...) pw_client_node_method(c,port_buffers,0,__VA_ARGS__)
333#ifdef __cplusplus
334} /* extern "C" */
335#endif
336
337#endif /* PIPEWIRE_EXT_CLIENT_NODE_H */
spa/utils/defs.h
static struct pw_node * pw_client_node_get_node(struct pw_client_node *p, uint32_t version, size_t user_data_size)
Definition client-node.h:351
int(* update)(void *object, #define PW_CLIENT_NODE_UPDATE_PARAMS #define PW_CLIENT_NODE_UPDATE_INFO uint32_t change_mask, uint32_t n_params, const struct spa_pod **params, const struct spa_node_info *info)
Update the node ports and properties.
Definition client-node.h:283
int(* port_update)(void *object, enum spa_direction direction, uint32_t port_id, #define PW_CLIENT_NODE_PORT_UPDATE_PARAMS #define PW_CLIENT_NODE_PORT_UPDATE_INFO uint32_t change_mask, uint32_t n_params, const struct spa_pod **params, const struct spa_port_info *info)
Update a node port.
Definition client-node.h:304
#define spa_interface_call_res(iface, method_type, res, method, vers,...)
Invoke method named method in the callbacks on the given interface object.
Definition hook.h:251
spa_direction
Definition defs.h:106
spa/param/param.h
information about a buffer
Definition client-node.h:39
uint32_t size
size in memory
Definition client-node.h:42
uint32_t mem_id
the memory id for the metadata
Definition client-node.h:40
uint32_t offset
offset in memory
Definition client-node.h:41
struct spa_buffer * buffer
buffer describing metadata and buffer memory
Definition client-node.h:43
Client Node events
Definition client-node.h:74
int(* port_set_io)(void *data, enum spa_direction direction, uint32_t port_id, uint32_t mix_id, uint32_t id, uint32_t mem_id, uint32_t offset, uint32_t size)
Configure the io area with id of port_id.
Definition client-node.h:198
int(* port_use_buffers)(void *data, enum spa_direction direction, uint32_t port_id, uint32_t mix_id, uint32_t flags, uint32_t n_buffers, struct pw_client_node_buffer *buffers)
Notify the port of buffers.
Definition client-node.h:180
int(* remove_port)(void *data, enum spa_direction direction, uint32_t port_id)
A port was removed from the node.
Definition client-node.h:154
uint32_t version
Definition client-node.h:77
int(* port_set_param)(void *data, enum spa_direction direction, uint32_t port_id, uint32_t id, uint32_t flags, const struct spa_pod *param)
A parameter was configured on the port.
Definition client-node.h:166
int(* event)(void *data, const struct spa_event *event)
Receive an event from the client node.
Definition client-node.h:127
int(* set_activation)(void *data, uint32_t node_id, int signalfd, uint32_t mem_id, uint32_t offset, uint32_t size)
Notify the activation record of the next node to trigger.
Definition client-node.h:217
int(* port_set_mix_info)(void *data, enum spa_direction direction, uint32_t port_id, uint32_t mix_id, uint32_t peer_id, const struct spa_dict *props)
Notify about the peer of mix_id.
Definition client-node.h:235
int(* command)(void *data, const struct spa_command *command)
Notify of a new node command.
Definition client-node.h:133
int(* set_io)(void *data, uint32_t id, uint32_t mem_id, uint32_t offset, uint32_t size)
Configure an IO area for the client.
Definition client-node.h:119
int(* add_port)(void *data, enum spa_direction direction, uint32_t port_id, const struct spa_dict *props)
A new port was added to the node.
Definition client-node.h:144
int(* set_param)(void *data, uint32_t id, uint32_t flags, const struct spa_pod *param)
Notify of a property change.
Definition client-node.h:105
int(* transport)(void *data, int readfd, int writefd, uint32_t mem_id, uint32_t offset, uint32_t size)
Notify of a new transport area.
Definition client-node.h:89
Client Node methods
Definition client-node.h:261
int(* event)(void *object, const struct spa_event *event)
Send an event to the node.
Definition client-node.h:323
int(* add_listener)(void *object, struct spa_hook *listener, const struct pw_client_node_events *events, void *data)
Definition client-node.h:266
int(* port_buffers)(void *object, enum spa_direction direction, uint32_t port_id, uint32_t mix_id, uint32_t n_buffers, struct spa_buffer **buffers)
Send allocated buffers.
Definition client-node.h:328
uint32_t version
Definition client-node.h:264
int(* set_active)(void *object, bool active)
Activate or deactivate the node.
Definition client-node.h:318
A Buffer.
Definition buffer.h:90
Definition command.h:29
Definition dict.h:39
Definition event.h:28
A hook, contains the structure with functions and the data passed to the functions.
Definition hook.h:350
Definition hook.h:138
Node information structure.
Definition node.h:48
Definition pod.h:43
Port information structure.
Definition node.h:93