Debian Codegraph @

modules/lsp-3rd-party/include/pw-headers/pipewire/extensions/session-manager/interfaces.h

raw
1 /* PipeWire */
2 /* SPDX-FileCopyrightText: Copyright © 2019 Collabora Ltd. */
3 /* @author George Kiagiadakis <[email protected]> */
4 /* SPDX-License-Identifier: MIT */
5
6 #ifndef PIPEWIRE_EXT_SESSION_MANAGER_INTERFACES_H
7 #define PIPEWIRE_EXT_SESSION_MANAGER_INTERFACES_H
8
9 #include <pw-headers/pipewire/extensions/session-manager/introspect.h>
10 #include <pw-headers/spa/utils/defs.h>
11 #include <pw-headers/spa/utils/hook.h>
12
13
14 #ifdef __cplusplus
15 extern "C" {
16 #endif
17
18 /**
19 * \addtogroup pw_session_manager
20 * \{
21 */
22
23 #define PW_TYPE_INTERFACE_Session PW_TYPE_INFO_INTERFACE_BASE "Session"
24 #define PW_SESSION_PERM_MASK PW_PERM_RWX
25 #define PW_VERSION_SESSION 0
26 struct pw_session;
27
28 #define PW_TYPE_INTERFACE_Endpoint PW_TYPE_INFO_INTERFACE_BASE "Endpoint"
29 #define PW_ENDPOINT_PERM_MASK PW_PERM_RWX
30 #define PW_VERSION_ENDPOINT 0
31 struct pw_endpoint;
32
33 #define PW_TYPE_INTERFACE_EndpointStream PW_TYPE_INFO_INTERFACE_BASE "EndpointStream"
34 #define PW_ENDPOINT_STREAM_PERM_MASK PW_PERM_RWX
35 #define PW_VERSION_ENDPOINT_STREAM 0
36 struct pw_endpoint_stream;
37
38 #define PW_TYPE_INTERFACE_EndpointLink PW_TYPE_INFO_INTERFACE_BASE "EndpointLink"
39 #define PW_ENDPOINT_LINK_PERM_MASK PW_PERM_RWX
40 #define PW_VERSION_ENDPOINT_LINK 0
41 struct pw_endpoint_link;
42
43 /* Session */
44
45 #define PW_SESSION_EVENT_INFO 0
46 #define PW_SESSION_EVENT_PARAM 1
47 #define PW_SESSION_EVENT_NUM 2
48
49 struct pw_session_events {
50 #define PW_VERSION_SESSION_EVENTS 0
51 uint32_t version; /**< version of this structure */
52
53 /**
54 * Notify session info
55 *
56 * \param info info about the session
57 */
58 void (*info) (void *data, const struct pw_session_info *info);
59
60 /**
61 * Notify a session param
62 *
63 * Event emitted as a result of the enum_params method.
64 *
65 * \param seq the sequence number of the request
66 * \param id the param id
67 * \param index the param index
68 * \param next the param index of the next param
69 * \param param the parameter
70 */
71 void (*param) (void *data, int seq,
72 uint32_t id, uint32_t index, uint32_t next,
73 const struct spa_pod *param);
74 };
75
76 #define PW_SESSION_METHOD_ADD_LISTENER 0
77 #define PW_SESSION_METHOD_SUBSCRIBE_PARAMS 1
78 #define PW_SESSION_METHOD_ENUM_PARAMS 2
79 #define PW_SESSION_METHOD_SET_PARAM 3
80 #define PW_SESSION_METHOD_CREATE_LINK 4
81 #define PW_SESSION_METHOD_NUM 5
82
83 struct pw_session_methods {
84 #define PW_VERSION_SESSION_METHODS 0
85 uint32_t version; /**< version of this structure */
86
87 int (*add_listener) (void *object,
88 struct spa_hook *listener,
89 const struct pw_session_events *events,
90 void *data);
91
92 /**
93 * Subscribe to parameter changes
94 *
95 * Automatically emit param events for the given ids when
96 * they are changed.
97 *
98 * \param ids an array of param ids
99 * \param n_ids the number of ids in \a ids
100 *
101 * This requires X permissions.
102 */
103 int (*subscribe_params) (void *object, uint32_t *ids, uint32_t n_ids);
104
105 /**
106 * Enumerate session parameters
107 *
108 * Start enumeration of session parameters. For each param, a
109 * param event will be emitted.
110 *
111 * \param seq a sequence number returned in the reply
112 * \param id the parameter id to enumerate
113 * \param start the start index or 0 for the first param
114 * \param num the maximum number of params to retrieve
115 * \param filter a param filter or NULL
116 *
117 * This requires X permissions.
118 */
119 int (*enum_params) (void *object, int seq,
120 uint32_t id, uint32_t start, uint32_t num,
121 const struct spa_pod *filter);
122
123 /**
124 * Set a parameter on the session
125 *
126 * \param id the parameter id to set
127 * \param flags extra parameter flags
128 * \param param the parameter to set
129 *
130 * This requires X and W permissions.
131 */
132 int (*set_param) (void *object, uint32_t id, uint32_t flags,
133 const struct spa_pod *param);
134 };
135
136 #define pw_session_method(o,method,version,...) \
137 ({ \
138 int _res = -ENOTSUP; \
139 spa_interface_call_res((struct spa_interface*)o, \
140 struct pw_session_methods, _res, \
141 method, version, ##__VA_ARGS__); \
142 _res; \
143 })
144
145 #define pw_session_add_listener(c,...) pw_session_method(c,add_listener,0,__VA_ARGS__)
146 #define pw_session_subscribe_params(c,...) pw_session_method(c,subscribe_params,0,__VA_ARGS__)
147 #define pw_session_enum_params(c,...) pw_session_method(c,enum_params,0,__VA_ARGS__)
148 #define pw_session_set_param(c,...) pw_session_method(c,set_param,0,__VA_ARGS__)
149
150
151 /* Endpoint */
152
153 #define PW_ENDPOINT_EVENT_INFO 0
154 #define PW_ENDPOINT_EVENT_PARAM 1
155 #define PW_ENDPOINT_EVENT_NUM 2
156
157 struct pw_endpoint_events {
158 #define PW_VERSION_ENDPOINT_EVENTS 0
159 uint32_t version; /**< version of this structure */
160
161 /**
162 * Notify endpoint info
163 *
164 * \param info info about the endpoint
165 */
166 void (*info) (void *data, const struct pw_endpoint_info *info);
167
168 /**
169 * Notify a endpoint param
170 *
171 * Event emitted as a result of the enum_params method.
172 *
173 * \param seq the sequence number of the request
174 * \param id the param id
175 * \param index the param index
176 * \param next the param index of the next param
177 * \param param the parameter
178 */
179 void (*param) (void *data, int seq,
180 uint32_t id, uint32_t index, uint32_t next,
181 const struct spa_pod *param);
182 };
183
184 #define PW_ENDPOINT_METHOD_ADD_LISTENER 0
185 #define PW_ENDPOINT_METHOD_SUBSCRIBE_PARAMS 1
186 #define PW_ENDPOINT_METHOD_ENUM_PARAMS 2
187 #define PW_ENDPOINT_METHOD_SET_PARAM 3
188 #define PW_ENDPOINT_METHOD_CREATE_LINK 4
189 #define PW_ENDPOINT_METHOD_NUM 5
190
191 struct pw_endpoint_methods {
192 #define PW_VERSION_ENDPOINT_METHODS 0
193 uint32_t version; /**< version of this structure */
194
195 int (*add_listener) (void *object,
196 struct spa_hook *listener,
197 const struct pw_endpoint_events *events,
198 void *data);
199
200 /**
201 * Subscribe to parameter changes
202 *
203 * Automatically emit param events for the given ids when
204 * they are changed.
205 *
206 * \param ids an array of param ids
207 * \param n_ids the number of ids in \a ids
208 *
209 * This requires X permissions.
210 */
211 int (*subscribe_params) (void *object, uint32_t *ids, uint32_t n_ids);
212
213 /**
214 * Enumerate endpoint parameters
215 *
216 * Start enumeration of endpoint parameters. For each param, a
217 * param event will be emitted.
218 *
219 * \param seq a sequence number returned in the reply
220 * \param id the parameter id to enumerate
221 * \param start the start index or 0 for the first param
222 * \param num the maximum number of params to retrieve
223 * \param filter a param filter or NULL
224 *
225 * This requires X permissions.
226 */
227 int (*enum_params) (void *object, int seq,
228 uint32_t id, uint32_t start, uint32_t num,
229 const struct spa_pod *filter);
230
231 /**
232 * Set a parameter on the endpoint
233 *
234 * \param id the parameter id to set
235 * \param flags extra parameter flags
236 * \param param the parameter to set
237 *
238 * This requires X and W permissions.
239 */
240 int (*set_param) (void *object, uint32_t id, uint32_t flags,
241 const struct spa_pod *param);
242
243 /**
244 * Create a link
245 *
246 * This requires X permissions.
247 */
248 int (*create_link) (void *object, const struct spa_dict *props);
249 };
250
251 #define pw_endpoint_method(o,method,version,...) \
252 ({ \
253 int _res = -ENOTSUP; \
254 spa_interface_call_res((struct spa_interface*)o, \
255 struct pw_endpoint_methods, _res, \
256 method, version, ##__VA_ARGS__); \
257 _res; \
258 })
259
260 #define pw_endpoint_add_listener(c,...) pw_endpoint_method(c,add_listener,0,__VA_ARGS__)
261 #define pw_endpoint_subscribe_params(c,...) pw_endpoint_method(c,subscribe_params,0,__VA_ARGS__)
262 #define pw_endpoint_enum_params(c,...) pw_endpoint_method(c,enum_params,0,__VA_ARGS__)
263 #define pw_endpoint_set_param(c,...) pw_endpoint_method(c,set_param,0,__VA_ARGS__)
264 #define pw_endpoint_create_link(c,...) pw_endpoint_method(c,create_link,0,__VA_ARGS__)
265
266 /* Endpoint Stream */
267
268 #define PW_ENDPOINT_STREAM_EVENT_INFO 0
269 #define PW_ENDPOINT_STREAM_EVENT_PARAM 1
270 #define PW_ENDPOINT_STREAM_EVENT_NUM 2
271
272 struct pw_endpoint_stream_events {
273 #define PW_VERSION_ENDPOINT_STREAM_EVENTS 0
274 uint32_t version; /**< version of this structure */
275
276 /**
277 * Notify endpoint stream info
278 *
279 * \param info info about the endpoint stream
280 */
281 void (*info) (void *data, const struct pw_endpoint_stream_info *info);
282
283 /**
284 * Notify a endpoint stream param
285 *
286 * Event emitted as a result of the enum_params method.
287 *
288 * \param seq the sequence number of the request
289 * \param id the param id
290 * \param index the param index
291 * \param next the param index of the next param
292 * \param param the parameter
293 */
294 void (*param) (void *data, int seq,
295 uint32_t id, uint32_t index, uint32_t next,
296 const struct spa_pod *param);
297 };
298
299 #define PW_ENDPOINT_STREAM_METHOD_ADD_LISTENER 0
300 #define PW_ENDPOINT_STREAM_METHOD_SUBSCRIBE_PARAMS 1
301 #define PW_ENDPOINT_STREAM_METHOD_ENUM_PARAMS 2
302 #define PW_ENDPOINT_STREAM_METHOD_SET_PARAM 3
303 #define PW_ENDPOINT_STREAM_METHOD_NUM 4
304
305 struct pw_endpoint_stream_methods {
306 #define PW_VERSION_ENDPOINT_STREAM_METHODS 0
307 uint32_t version; /**< version of this structure */
308
309 int (*add_listener) (void *object,
310 struct spa_hook *listener,
311 const struct pw_endpoint_stream_events *events,
312 void *data);
313
314 /**
315 * Subscribe to parameter changes
316 *
317 * Automatically emit param events for the given ids when
318 * they are changed.
319 *
320 * \param ids an array of param ids
321 * \param n_ids the number of ids in \a ids
322 *
323 * This requires X permissions.
324 */
325 int (*subscribe_params) (void *object, uint32_t *ids, uint32_t n_ids);
326
327 /**
328 * Enumerate stream parameters
329 *
330 * Start enumeration of stream parameters. For each param, a
331 * param event will be emitted.
332 *
333 * \param seq a sequence number returned in the reply
334 * \param id the parameter id to enumerate
335 * \param start the start index or 0 for the first param
336 * \param num the maximum number of params to retrieve
337 * \param filter a param filter or NULL
338 *
339 * This requires X permissions.
340 */
341 int (*enum_params) (void *object, int seq,
342 uint32_t id, uint32_t start, uint32_t num,
343 const struct spa_pod *filter);
344
345 /**
346 * Set a parameter on the stream
347 *
348 * \param id the parameter id to set
349 * \param flags extra parameter flags
350 * \param param the parameter to set
351 *
352 * This requires X and W permissions.
353 */
354 int (*set_param) (void *object, uint32_t id, uint32_t flags,
355 const struct spa_pod *param);
356 };
357
358 #define pw_endpoint_stream_method(o,method,version,...) \
359 ({ \
360 int _res = -ENOTSUP; \
361 spa_interface_call_res((struct spa_interface*)o, \
362 struct pw_endpoint_stream_methods, _res, \
363 method, version, ##__VA_ARGS__); \
364 _res; \
365 })
366
367 #define pw_endpoint_stream_add_listener(c,...) pw_endpoint_stream_method(c,add_listener,0,__VA_ARGS__)
368 #define pw_endpoint_stream_subscribe_params(c,...) pw_endpoint_stream_method(c,subscribe_params,0,__VA_ARGS__)
369 #define pw_endpoint_stream_enum_params(c,...) pw_endpoint_stream_method(c,enum_params,0,__VA_ARGS__)
370 #define pw_endpoint_stream_set_param(c,...) pw_endpoint_stream_method(c,set_param,0,__VA_ARGS__)
371
372 /* Endpoint Link */
373
374 #define PW_ENDPOINT_LINK_EVENT_INFO 0
375 #define PW_ENDPOINT_LINK_EVENT_PARAM 1
376 #define PW_ENDPOINT_LINK_EVENT_NUM 2
377
378 struct pw_endpoint_link_events {
379 #define PW_VERSION_ENDPOINT_LINK_EVENTS 0
380 uint32_t version; /**< version of this structure */
381
382 /**
383 * Notify endpoint link info
384 *
385 * \param info info about the endpoint link
386 */
387 void (*info) (void *data, const struct pw_endpoint_link_info *info);
388
389 /**
390 * Notify a endpoint link param
391 *
392 * Event emitted as a result of the enum_params method.
393 *
394 * \param seq the sequence number of the request
395 * \param id the param id
396 * \param index the param index
397 * \param next the param index of the next param
398 * \param param the parameter
399 */
400 void (*param) (void *data, int seq,
401 uint32_t id, uint32_t index, uint32_t next,
402 const struct spa_pod *param);
403 };
404
405 #define PW_ENDPOINT_LINK_METHOD_ADD_LISTENER 0
406 #define PW_ENDPOINT_LINK_METHOD_SUBSCRIBE_PARAMS 1
407 #define PW_ENDPOINT_LINK_METHOD_ENUM_PARAMS 2
408 #define PW_ENDPOINT_LINK_METHOD_SET_PARAM 3
409 #define PW_ENDPOINT_LINK_METHOD_REQUEST_STATE 4
410 #define PW_ENDPOINT_LINK_METHOD_DESTROY 5
411 #define PW_ENDPOINT_LINK_METHOD_NUM 6
412
413 struct pw_endpoint_link_methods {
414 #define PW_VERSION_ENDPOINT_LINK_METHODS 0
415 uint32_t version; /**< version of this structure */
416
417 int (*add_listener) (void *object,
418 struct spa_hook *listener,
419 const struct pw_endpoint_link_events *events,
420 void *data);
421
422 /**
423 * Subscribe to parameter changes
424 *
425 * Automatically emit param events for the given ids when
426 * they are changed.
427 *
428 * \param ids an array of param ids
429 * \param n_ids the number of ids in \a ids
430 *
431 * This requires X permissions.
432 */
433 int (*subscribe_params) (void *object, uint32_t *ids, uint32_t n_ids);
434
435 /**
436 * Enumerate link parameters
437 *
438 * Start enumeration of link parameters. For each param, a
439 * param event will be emitted.
440 *
441 * \param seq a sequence number returned in the reply
442 * \param id the parameter id to enumerate
443 * \param start the start index or 0 for the first param
444 * \param num the maximum number of params to retrieve
445 * \param filter a param filter or NULL
446 *
447 * This requires X permissions.
448 */
449 int (*enum_params) (void *object, int seq,
450 uint32_t id, uint32_t start, uint32_t num,
451 const struct spa_pod *filter);
452
453 /**
454 * Set a parameter on the link
455 *
456 * \param id the parameter id to set
457 * \param flags extra parameter flags
458 * \param param the parameter to set
459 *
460 * This requires X and W permissions.
461 */
462 int (*set_param) (void *object, uint32_t id, uint32_t flags,
463 const struct spa_pod *param);
464
465 /**
466 * Request a state on the link.
467 *
468 * This requires X and W permissions.
469 */
470 int (*request_state) (void *object, enum pw_endpoint_link_state state);
471 };
472
473 #define pw_endpoint_link_method(o,method,version,...) \
474 ({ \
475 int _res = -ENOTSUP; \
476 spa_interface_call_res((struct spa_interface*)o, \
477 struct pw_endpoint_link_methods, _res, \
478 method, version, ##__VA_ARGS__); \
479 _res; \
480 })
481
482 #define pw_endpoint_link_add_listener(c,...) pw_endpoint_link_method(c,add_listener,0,__VA_ARGS__)
483 #define pw_endpoint_link_subscribe_params(c,...) pw_endpoint_link_method(c,subscribe_params,0,__VA_ARGS__)
484 #define pw_endpoint_link_enum_params(c,...) pw_endpoint_link_method(c,enum_params,0,__VA_ARGS__)
485 #define pw_endpoint_link_set_param(c,...) pw_endpoint_link_method(c,set_param,0,__VA_ARGS__)
486 #define pw_endpoint_link_request_state(c,...) pw_endpoint_link_method(c,request_state,0,__VA_ARGS__)
487
488
489 /**
490 * \}
491 */
492
493 #ifdef __cplusplus
494 } /* extern "C" */
495 #endif
496
497 #endif /* PIPEWIRE_EXT_SESSION_MANAGER_INTERFACES_H */