PipeWire: pipewire/extensions/client-node.h Source File

PipeWire 1.6.6

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#include <spa/utils/defs.h>
9#include <spa/param/param.h>
10
11#ifdef __cplusplus
12extern "C" {
13#endif
14
18
23#define PW_TYPE_INTERFACE_ClientNode PW_TYPE_INFO_INTERFACE_BASE "ClientNode"
24
25/*
26 * version 4: new port_set_mix_info event added
27 * version 5: driver nodes are scheduled on the client
28 * version 6: client needs to set activation INACTIVE -> FINISHED
29 */
30#define PW_VERSION_CLIENT_NODE 6
31struct pw_client_node;
32
33#ifndef PW_API_CLIENT_NODE_IMPL
34#define PW_API_CLIENT_NODE_IMPL static inline
35#endif
36
37#define PW_EXTENSION_MODULE_CLIENT_NODE PIPEWIRE_MODULE_PREFIX "module-client-node"
38
40struct pw_client_node_buffer {
41 uint32_t mem_id;
42 uint32_t offset;
43 uint32_t size;
44 struct spa_buffer *buffer;
45};
46
47#define PW_CLIENT_NODE_EVENT_TRANSPORT 0
48#define PW_CLIENT_NODE_EVENT_SET_PARAM 1
49#define PW_CLIENT_NODE_EVENT_SET_IO 2
50#define PW_CLIENT_NODE_EVENT_EVENT 3
51#define PW_CLIENT_NODE_EVENT_COMMAND 4
52#define PW_CLIENT_NODE_EVENT_ADD_PORT 5
53#define PW_CLIENT_NODE_EVENT_REMOVE_PORT 6
54#define PW_CLIENT_NODE_EVENT_PORT_SET_PARAM 7
55#define PW_CLIENT_NODE_EVENT_PORT_USE_BUFFERS 8
56#define PW_CLIENT_NODE_EVENT_PORT_SET_IO 9
57#define PW_CLIENT_NODE_EVENT_SET_ACTIVATION 10
58#define PW_CLIENT_NODE_EVENT_PORT_SET_MIX_INFO 11
59#define PW_CLIENT_NODE_EVENT_NUM 12
60
62struct pw_client_node_events {
63#define PW_VERSION_CLIENT_NODE_EVENTS 1
64 uint32_t version;
76 int (*transport) (void *data,
77 int readfd,
78 int writefd,
79 uint32_t mem_id,
80 uint32_t offset,
81 uint32_t size);
84 *
85 * When the server configures the properties on the node
86 * this event is sent
87 *
88 * \param id the id of the parameter
89 * \param flags parameter flags
90 * \param param the param to set
91 */
92 int (*set_param) (void *data,
93 uint32_t id, uint32_t flags,
94 const struct spa_pod *param);
106 int (*set_io) (void *data,
107 uint32_t id,
108 uint32_t mem_id,
109 uint32_t offset,
110 uint32_t size);
114 int (*event) (void *data, const struct spa_event *event);
120 int (*command) (void *data, const struct spa_command *command);
131 int (*add_port) (void *data,
132 enum spa_direction direction,
133 uint32_t port_id,
134 const struct spa_dict *props);
141 int (*remove_port) (void *data,
142 enum spa_direction direction,
143 uint32_t port_id);
153 int (*port_set_param) (void *data,
154 enum spa_direction direction,
155 uint32_t port_id,
156 uint32_t id, uint32_t flags,
157 const struct spa_pod *param);
167 int (*port_use_buffers) (void *data,
168 enum spa_direction direction,
169 uint32_t port_id,
170 uint32_t mix_id,
171 uint32_t flags,
172 uint32_t n_buffers,
173 struct pw_client_node_buffer *buffers);
185 int (*port_set_io) (void *data,
186 enum spa_direction direction,
187 uint32_t port_id,
188 uint32_t mix_id,
189 uint32_t id,
190 uint32_t mem_id,
191 uint32_t offset,
192 uint32_t size);
193
204 int (*set_activation) (void *data,
205 uint32_t node_id,
206 int signalfd,
207 uint32_t mem_id,
208 uint32_t offset,
209 uint32_t size);
210
222 int (*port_set_mix_info) (void *data,
223 enum spa_direction direction,
224 uint32_t port_id,
225 uint32_t mix_id,
226 uint32_t peer_id,
227 const struct spa_dict *props);
228};
229
230#define PW_CLIENT_NODE_METHOD_ADD_LISTENER 0
231#define PW_CLIENT_NODE_METHOD_GET_NODE 1
232#define PW_CLIENT_NODE_METHOD_UPDATE 2
233#define PW_CLIENT_NODE_METHOD_PORT_UPDATE 3
234#define PW_CLIENT_NODE_METHOD_SET_ACTIVE 4
235#define PW_CLIENT_NODE_METHOD_EVENT 5
236#define PW_CLIENT_NODE_METHOD_PORT_BUFFERS 6
237#define PW_CLIENT_NODE_METHOD_NUM 7
238
240struct pw_client_node_methods {
241#define PW_VERSION_CLIENT_NODE_METHODS 0
242 uint32_t version;
243
244 int (*add_listener) (void *object,
245 struct spa_hook *listener,
246 const struct pw_client_node_events *events,
247 void *data);
250 struct pw_node * (*get_node) (void *object, uint32_t version, size_t user_data_size);
252
261 int (*update) (void *object,
262#define PW_CLIENT_NODE_UPDATE_PARAMS (1 << 0)
263#define PW_CLIENT_NODE_UPDATE_INFO (1 << 1)
264 uint32_t change_mask,
265 uint32_t n_params,
266 const struct spa_pod **params,
267 const struct spa_node_info *info);
268
271 *
272 * Update the information of one port of a node.
273 * \param direction the direction of the port
274 * \param port_id the port id to update
275 * \param change_mask a bitfield of changed items
276 * \param n_params number of port parameters
277 * \param params array of port parameters
278 * \param info port information
279 */
280 int (*port_update) (void *object,
281 enum spa_direction direction,
282 uint32_t port_id,
283#define PW_CLIENT_NODE_PORT_UPDATE_PARAMS (1 << 0)
284#define PW_CLIENT_NODE_PORT_UPDATE_INFO (1 << 1)
285 uint32_t change_mask,
286 uint32_t n_params,
287 const struct spa_pod **params,
288 const struct spa_port_info *info);
292 int (*set_active) (void *object, bool active);
297 int (*event) (void *object, const struct spa_event *event);
298
302 int (*port_buffers) (void *object,
303 enum spa_direction direction,
304 uint32_t port_id,
305 uint32_t mix_id,
306 uint32_t n_buffers,
307 struct spa_buffer **buffers);
308};
309
310 PW_API_CLIENT_NODE_IMPL int pw_client_node_add_listener(struct pw_client_node *object,
311 struct spa_hook *listener,
312 const struct pw_client_node_events *events,
313 void *data)
314{
315 return spa_api_method_r(int, -ENOTSUP, pw_client_node, (struct spa_interface*)object,
316 add_listener, 0, listener, events, data);
317}
318 PW_API_CLIENT_NODE_IMPL struct pw_node *
319 pw_client_node_get_node(struct pw_client_node *p, uint32_t version, size_t user_data_size)
320{
321 return spa_api_method_r(struct pw_node*, NULL, pw_client_node, (struct spa_interface*)p,
322 get_node, 0, version, user_data_size);
323}
324 PW_API_CLIENT_NODE_IMPL int pw_client_node_update(struct pw_client_node *object,
325 uint32_t change_mask,
326 uint32_t n_params, const struct spa_pod **params,
327 const struct spa_node_info *info)
328{
329 return spa_api_method_r(int, -ENOTSUP, pw_client_node, (struct spa_interface*)object,
330 update, 0, change_mask, n_params, params, info);
331}
332 PW_API_CLIENT_NODE_IMPL int pw_client_node_port_update(struct pw_client_node *object,
333 enum spa_direction direction, uint32_t port_id,
334 uint32_t change_mask,
335 uint32_t n_params, const struct spa_pod **params,
336 const struct spa_port_info *info)
337{
338 return spa_api_method_r(int, -ENOTSUP, pw_client_node, (struct spa_interface*)object,
339 port_update, 0, direction, port_id, change_mask, n_params, params, info);
340}
341 PW_API_CLIENT_NODE_IMPL int pw_client_node_set_active(struct pw_client_node *object, bool active)
342{
343 return spa_api_method_r(int, -ENOTSUP, pw_client_node, (struct spa_interface*)object,
344 set_active, 0, active);
345}
346 PW_API_CLIENT_NODE_IMPL int pw_client_node_event(struct pw_client_node *object, const struct spa_event *event)
347{
348 return spa_api_method_r(int, -ENOTSUP, pw_client_node, (struct spa_interface*)object,
349 event, 0, event);
350}
351 PW_API_CLIENT_NODE_IMPL int pw_client_node_port_buffers(struct pw_client_node *object,
352 enum spa_direction direction, uint32_t port_id,
353 uint32_t mix_id, uint32_t n_buffers, struct spa_buffer **buffers)
354{
355 return spa_api_method_r(int, -ENOTSUP, pw_client_node, (struct spa_interface*)object,
356 port_buffers, 0, direction, port_id, mix_id, n_buffers, buffers);
357}
358
360
360 * \}
361 */
362
363#ifdef __cplusplus
364} /* extern "C" */
365#endif
366
367#endif /* PIPEWIRE_EXT_CLIENT_NODE_H */
defs.h
spa/utils/defs.h
pw_client_node_set_active
PW_API_CLIENT_NODE_IMPL int pw_client_node_set_active(struct pw_client_node *object, bool active)
Definition client-node.h:377
pw_client_node_port_update
PW_API_CLIENT_NODE_IMPL int pw_client_node_port_update(struct pw_client_node *object, enum spa_direction direction, uint32_t port_id, uint32_t change_mask, uint32_t n_params, const struct spa_pod **params, const struct spa_port_info *info)
Definition client-node.h:368
pw_client_node_methods::update
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:293
pw_client_node_update
PW_API_CLIENT_NODE_IMPL int pw_client_node_update(struct pw_client_node *object, uint32_t change_mask, uint32_t n_params, const struct spa_pod **params, const struct spa_node_info *info)
Definition client-node.h:360
pw_client_node_add_listener
PW_API_CLIENT_NODE_IMPL int pw_client_node_add_listener(struct pw_client_node *object, struct spa_hook *listener, const struct pw_client_node_events *events, void *data)
Definition client-node.h:346
pw_client_node_methods::port_update
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:314
pw_client_node_port_buffers
PW_API_CLIENT_NODE_IMPL int pw_client_node_port_buffers(struct pw_client_node *object, enum spa_direction direction, uint32_t port_id, uint32_t mix_id, uint32_t n_buffers, struct spa_buffer **buffers)
Definition client-node.h:387
pw_client_node_event
PW_API_CLIENT_NODE_IMPL int pw_client_node_event(struct pw_client_node *object, const struct spa_event *event)
Definition client-node.h:382
pw_client_node_get_node
PW_API_CLIENT_NODE_IMPL 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:355
PW_API_CLIENT_NODE_IMPL
#define PW_API_CLIENT_NODE_IMPL
Definition client-node.h:42
id
uint32_t id
Definition core.h:432
spa_api_method_r
#define spa_api_method_r(rtype, def, type, o, method, version,...)
Definition hook.h:291
spa_direction
spa_direction
Definition defs.h:106
param.h
spa/param/param.h
pw_client_node_buffer
information about a buffer
Definition client-node.h:49
pw_client_node_buffer::size
uint32_t size
size in memory
Definition client-node.h:52
pw_client_node_buffer::mem_id
uint32_t mem_id
the memory id for the metadata
Definition client-node.h:50
pw_client_node_buffer::offset
uint32_t offset
offset in memory
Definition client-node.h:51
pw_client_node_events
Client Node events
Definition client-node.h:84
pw_client_node_events::port_set_io
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:208
pw_client_node_events::port_use_buffers
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:190
pw_client_node_events::remove_port
int(* remove_port)(void *data, enum spa_direction direction, uint32_t port_id)
A port was removed from the node.
Definition client-node.h:164
pw_client_node_events::version
uint32_t version
Definition client-node.h:87
pw_client_node_events::port_set_param
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:176
pw_client_node_events::event
int(* event)(void *data, const struct spa_event *event)
Receive an event from the client node.
Definition client-node.h:137
pw_client_node_events::set_activation
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:227
pw_client_node_events::port_set_mix_info
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:245
pw_client_node_events::command
int(* command)(void *data, const struct spa_command *command)
Notify of a new node command.
Definition client-node.h:143
pw_client_node_events::set_io
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:129
pw_client_node_events::add_port
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:154
pw_client_node_events::set_param
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:115
pw_client_node_events::transport
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:99
pw_client_node_methods
Client Node methods
Definition client-node.h:271
pw_client_node_methods::event
int(* event)(void *object, const struct spa_event *event)
Send an event to the node.
Definition client-node.h:333
pw_client_node_methods::add_listener
int(* add_listener)(void *object, struct spa_hook *listener, const struct pw_client_node_events *events, void *data)
Definition client-node.h:276
pw_client_node_methods::port_buffers
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:338
pw_client_node_methods::version
uint32_t version
Definition client-node.h:274
pw_client_node_methods::set_active
int(* set_active)(void *object, bool active)
Activate or deactivate the node.
Definition client-node.h:328
pw_client_node
pw_node
spa_buffer
A Buffer.
Definition buffer.h:110
spa_command
Definition command.h:29
spa_dict
Definition dict.h:51
spa_event
Definition event.h:28
spa_hook
A hook, contains the structure with functions and the data passed to the functions.
Definition hook.h:427
spa_interface
Definition hook.h:148
spa_node_info
Node information structure.
Definition node.h:58
spa_pod
Definition pod.h:57
spa_port_info
Port information structure.
Definition node.h:103