PipeWire: interfaces.h Source File

PipeWire 0.3.67

Loading...
Searching...
No Matches
interfaces.h
Go to the documentation of this file.
1/* PipeWire */
2/* SPDX-FileCopyrightText: Copyright © 2019 Collabora Ltd. */
3/* @author George Kiagiadakis <george.kiagiadakis@collabora.com> */
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 <spa/utils/defs.h>
10#include <spa/utils/hook.h>
11
12#include "introspect.h"
13
14#ifdef __cplusplus
15extern "C" {
16#endif
17
23#define PW_TYPE_INTERFACE_Session PW_TYPE_INFO_INTERFACE_BASE "Session"
24#define PW_VERSION_SESSION 0
25struct pw_session;
26
27#define PW_TYPE_INTERFACE_Endpoint PW_TYPE_INFO_INTERFACE_BASE "Endpoint"
28#define PW_VERSION_ENDPOINT 0
29struct pw_endpoint;
30
31#define PW_TYPE_INTERFACE_EndpointStream PW_TYPE_INFO_INTERFACE_BASE "EndpointStream"
32#define PW_VERSION_ENDPOINT_STREAM 0
33struct pw_endpoint_stream;
34
35#define PW_TYPE_INTERFACE_EndpointLink PW_TYPE_INFO_INTERFACE_BASE "EndpointLink"
36#define PW_VERSION_ENDPOINT_LINK 0
37 struct pw_endpoint_link;
38
39/* Session */
40
41#define PW_SESSION_EVENT_INFO 0
42#define PW_SESSION_EVENT_PARAM 1
43#define PW_SESSION_EVENT_NUM 2
44
45 struct pw_session_events {
46#define PW_VERSION_SESSION_EVENTS 0
47 uint32_t version;
54 void (*info) (void *data, const struct pw_session_info *info);
55
67 void (*param) (void *data, int seq,
68 uint32_t id, uint32_t index, uint32_t next,
69 const struct spa_pod *param);
70};
71
72#define PW_SESSION_METHOD_ADD_LISTENER 0
73#define PW_SESSION_METHOD_SUBSCRIBE_PARAMS 1
74#define PW_SESSION_METHOD_ENUM_PARAMS 2
75#define PW_SESSION_METHOD_SET_PARAM 3
76#define PW_SESSION_METHOD_CREATE_LINK 4
77#define PW_SESSION_METHOD_NUM 5
78
79struct pw_session_methods {
80#define PW_VERSION_SESSION_METHODS 0
81 uint32_t version;
83 int (*add_listener) (void *object,
84 struct spa_hook *listener,
85 const struct pw_session_events *events,
86 void *data);
87
97 int (*subscribe_params) (void *object, uint32_t *ids, uint32_t n_ids);
98
111 int (*enum_params) (void *object, int seq,
112 uint32_t id, uint32_t start, uint32_t num,
113 const struct spa_pod *filter);
114
122 int (*set_param) (void *object, uint32_t id, uint32_t flags,
123 const struct spa_pod *param);
124};
125
126#define pw_session_method(o,method,version,...) \
127({ \
128 int _res = -ENOTSUP; \
129 spa_interface_call_res((struct spa_interface*)o, \
130 struct pw_session_methods, _res, \
131 method, version, ##__VA_ARGS__); \
132 _res; \
133})
134
135#define pw_session_add_listener(c,...) pw_session_method(c,add_listener,0,__VA_ARGS__)
136#define pw_session_subscribe_params(c,...) pw_session_method(c,subscribe_params,0,__VA_ARGS__)
137#define pw_session_enum_params(c,...) pw_session_method(c,enum_params,0,__VA_ARGS__)
138#define pw_session_set_param(c,...) pw_session_method(c,set_param,0,__VA_ARGS__)
139
140
141/* Endpoint */
142
143#define PW_ENDPOINT_EVENT_INFO 0
144#define PW_ENDPOINT_EVENT_PARAM 1
145#define PW_ENDPOINT_EVENT_NUM 2
146
147struct pw_endpoint_events {
148#define PW_VERSION_ENDPOINT_EVENTS 0
149 uint32_t version;
156 void (*info) (void *data, const struct pw_endpoint_info *info);
157
169 void (*param) (void *data, int seq,
170 uint32_t id, uint32_t index, uint32_t next,
171 const struct spa_pod *param);
172};
173
174#define PW_ENDPOINT_METHOD_ADD_LISTENER 0
175#define PW_ENDPOINT_METHOD_SUBSCRIBE_PARAMS 1
176#define PW_ENDPOINT_METHOD_ENUM_PARAMS 2
177#define PW_ENDPOINT_METHOD_SET_PARAM 3
178#define PW_ENDPOINT_METHOD_CREATE_LINK 4
179#define PW_ENDPOINT_METHOD_NUM 5
180
181 struct pw_endpoint_methods {
182#define PW_VERSION_ENDPOINT_METHODS 0
183 uint32_t version;
185 int (*add_listener) (void *object,
186 struct spa_hook *listener,
187 const struct pw_endpoint_events *events,
188 void *data);
189
199 int (*subscribe_params) (void *object, uint32_t *ids, uint32_t n_ids);
200
213 int (*enum_params) (void *object, int seq,
214 uint32_t id, uint32_t start, uint32_t num,
215 const struct spa_pod *filter);
216
224 int (*set_param) (void *object, uint32_t id, uint32_t flags,
225 const struct spa_pod *param);
226
227 int (*create_link) (void *object, const struct spa_dict *props);
228};
229
230#define pw_endpoint_method(o,method,version,...) \
231({ \
232 int _res = -ENOTSUP; \
233 spa_interface_call_res((struct spa_interface*)o, \
234 struct pw_endpoint_methods, _res, \
235 method, version, ##__VA_ARGS__); \
236 _res; \
237})
238
239#define pw_endpoint_add_listener(c,...) pw_endpoint_method(c,add_listener,0,__VA_ARGS__)
240#define pw_endpoint_subscribe_params(c,...) pw_endpoint_method(c,subscribe_params,0,__VA_ARGS__)
241#define pw_endpoint_enum_params(c,...) pw_endpoint_method(c,enum_params,0,__VA_ARGS__)
242#define pw_endpoint_set_param(c,...) pw_endpoint_method(c,set_param,0,__VA_ARGS__)
243#define pw_endpoint_create_link(c,...) pw_endpoint_method(c,create_link,0,__VA_ARGS__)
244
245/* Endpoint Stream */
246
247#define PW_ENDPOINT_STREAM_EVENT_INFO 0
248#define PW_ENDPOINT_STREAM_EVENT_PARAM 1
249#define PW_ENDPOINT_STREAM_EVENT_NUM 2
250
251struct pw_endpoint_stream_events {
252#define PW_VERSION_ENDPOINT_STREAM_EVENTS 0
253 uint32_t version;
260 void (*info) (void *data, const struct pw_endpoint_stream_info *info);
261
273 void (*param) (void *data, int seq,
274 uint32_t id, uint32_t index, uint32_t next,
275 const struct spa_pod *param);
276};
277
278#define PW_ENDPOINT_STREAM_METHOD_ADD_LISTENER 0
279#define PW_ENDPOINT_STREAM_METHOD_SUBSCRIBE_PARAMS 1
280#define PW_ENDPOINT_STREAM_METHOD_ENUM_PARAMS 2
281#define PW_ENDPOINT_STREAM_METHOD_SET_PARAM 3
282#define PW_ENDPOINT_STREAM_METHOD_NUM 4
283
284struct pw_endpoint_stream_methods {
285#define PW_VERSION_ENDPOINT_STREAM_METHODS 0
286 uint32_t version;
288 int (*add_listener) (void *object,
289 struct spa_hook *listener,
290 const struct pw_endpoint_stream_events *events,
291 void *data);
292
302 int (*subscribe_params) (void *object, uint32_t *ids, uint32_t n_ids);
303
316 int (*enum_params) (void *object, int seq,
317 uint32_t id, uint32_t start, uint32_t num,
318 const struct spa_pod *filter);
319
327 int (*set_param) (void *object, uint32_t id, uint32_t flags,
328 const struct spa_pod *param);
329};
330
331#define pw_endpoint_stream_method(o,method,version,...) \
332({ \
333 int _res = -ENOTSUP; \
334 spa_interface_call_res((struct spa_interface*)o, \
335 struct pw_endpoint_stream_methods, _res, \
336 method, version, ##__VA_ARGS__); \
337 _res; \
338})
339
340#define pw_endpoint_stream_add_listener(c,...) pw_endpoint_stream_method(c,add_listener,0,__VA_ARGS__)
341#define pw_endpoint_stream_subscribe_params(c,...) pw_endpoint_stream_method(c,subscribe_params,0,__VA_ARGS__)
342#define pw_endpoint_stream_enum_params(c,...) pw_endpoint_stream_method(c,enum_params,0,__VA_ARGS__)
343#define pw_endpoint_stream_set_param(c,...) pw_endpoint_stream_method(c,set_param,0,__VA_ARGS__)
344
345/* Endpoint Link */
346
347#define PW_ENDPOINT_LINK_EVENT_INFO 0
348#define PW_ENDPOINT_LINK_EVENT_PARAM 1
349#define PW_ENDPOINT_LINK_EVENT_NUM 2
350
351 struct pw_endpoint_link_events {
352#define PW_VERSION_ENDPOINT_LINK_EVENTS 0
353 uint32_t version;
360 void (*info) (void *data, const struct pw_endpoint_link_info *info);
361
373 void (*param) (void *data, int seq,
374 uint32_t id, uint32_t index, uint32_t next,
375 const struct spa_pod *param);
376};
377
378#define PW_ENDPOINT_LINK_METHOD_ADD_LISTENER 0
379#define PW_ENDPOINT_LINK_METHOD_SUBSCRIBE_PARAMS 1
380#define PW_ENDPOINT_LINK_METHOD_ENUM_PARAMS 2
381#define PW_ENDPOINT_LINK_METHOD_SET_PARAM 3
382#define PW_ENDPOINT_LINK_METHOD_REQUEST_STATE 4
383#define PW_ENDPOINT_LINK_METHOD_DESTROY 5
384#define PW_ENDPOINT_LINK_METHOD_NUM 6
385
386struct pw_endpoint_link_methods {
387#define PW_VERSION_ENDPOINT_LINK_METHODS 0
388 uint32_t version;
390 int (*add_listener) (void *object,
391 struct spa_hook *listener,
392 const struct pw_endpoint_link_events *events,
393 void *data);
394
404 int (*subscribe_params) (void *object, uint32_t *ids, uint32_t n_ids);
405
418 int (*enum_params) (void *object, int seq,
419 uint32_t id, uint32_t start, uint32_t num,
420 const struct spa_pod *filter);
421
429 int (*set_param) (void *object, uint32_t id, uint32_t flags,
430 const struct spa_pod *param);
431
432 int (*request_state) (void *object, enum pw_endpoint_link_state state);
433};
434
435#define pw_endpoint_link_method(o,method,version,...) \
436({ \
437 int _res = -ENOTSUP; \
438 spa_interface_call_res((struct spa_interface*)o, \
439 struct pw_endpoint_link_methods, _res, \
440 method, version, ##__VA_ARGS__); \
441 _res; \
442})
443
444#define pw_endpoint_link_add_listener(c,...) pw_endpoint_link_method(c,add_listener,0,__VA_ARGS__)
445#define pw_endpoint_link_subscribe_params(c,...) pw_endpoint_link_method(c,subscribe_params,0,__VA_ARGS__)
446#define pw_endpoint_link_enum_params(c,...) pw_endpoint_link_method(c,enum_params,0,__VA_ARGS__)
447#define pw_endpoint_link_set_param(c,...) pw_endpoint_link_method(c,set_param,0,__VA_ARGS__)
448#define pw_endpoint_link_request_state(c,...) pw_endpoint_link_method(c,request_state,0,__VA_ARGS__)
449
450
455#ifdef __cplusplus
456} /* extern "C" */
457#endif
458
459#endif /* PIPEWIRE_EXT_SESSION_MANAGER_INTERFACES_H */
defs.h
spa/utils/defs.h
pw_endpoint_link_state
pw_endpoint_link_state
Definition: introspect.h:26
hook.h
spa/utils/hook.h
introspect.h
pipewire/extensions/session-manager/introspect.h
pw_endpoint_events
Definition: interfaces.h:185
pw_endpoint_events::info
void(* info)(void *data, const struct pw_endpoint_info *info)
Notify endpoint info.
Definition: interfaces.h:195
pw_endpoint_events::param
void(* param)(void *data, int seq, uint32_t id, uint32_t index, uint32_t next, const struct spa_pod *param)
Notify a endpoint param.
Definition: interfaces.h:208
pw_endpoint_events::version
uint32_t version
version of this structure
Definition: interfaces.h:188
pw_endpoint_info
Definition: introspect.h:50
pw_endpoint_link_events
Definition: interfaces.h:428
pw_endpoint_link_events::info
void(* info)(void *data, const struct pw_endpoint_link_info *info)
Notify endpoint link info.
Definition: interfaces.h:438
pw_endpoint_link_events::version
uint32_t version
version of this structure
Definition: interfaces.h:431
pw_endpoint_link_events::param
void(* param)(void *data, int seq, uint32_t id, uint32_t index, uint32_t next, const struct spa_pod *param)
Notify a endpoint link param.
Definition: interfaces.h:451
pw_endpoint_link_info
Definition: introspect.h:101
pw_endpoint_link_methods
Definition: interfaces.h:471
pw_endpoint_link_methods::set_param
int(* set_param)(void *object, uint32_t id, uint32_t flags, const struct spa_pod *param)
Set a parameter on the link.
Definition: interfaces.h:515
pw_endpoint_link_methods::request_state
int(* request_state)(void *object, enum pw_endpoint_link_state state)
Definition: interfaces.h:518
pw_endpoint_link_methods::version
uint32_t version
version of this structure
Definition: interfaces.h:474
pw_endpoint_link_methods::add_listener
int(* add_listener)(void *object, struct spa_hook *listener, const struct pw_endpoint_link_events *events, void *data)
Definition: interfaces.h:476
pw_endpoint_link_methods::subscribe_params
int(* subscribe_params)(void *object, uint32_t *ids, uint32_t n_ids)
Subscribe to parameter changes.
Definition: interfaces.h:490
pw_endpoint_link_methods::enum_params
int(* enum_params)(void *object, int seq, uint32_t id, uint32_t start, uint32_t num, const struct spa_pod *filter)
Enumerate link parameters.
Definition: interfaces.h:504
pw_endpoint_link
pw_endpoint_methods
Definition: interfaces.h:226
pw_endpoint_methods::version
uint32_t version
version of this structure
Definition: interfaces.h:229
pw_endpoint_methods::add_listener
int(* add_listener)(void *object, struct spa_hook *listener, const struct pw_endpoint_events *events, void *data)
Definition: interfaces.h:231
pw_endpoint_methods::subscribe_params
int(* subscribe_params)(void *object, uint32_t *ids, uint32_t n_ids)
Subscribe to parameter changes.
Definition: interfaces.h:245
pw_endpoint_methods::create_link
int(* create_link)(void *object, const struct spa_dict *props)
Definition: interfaces.h:273
pw_endpoint_methods::set_param
int(* set_param)(void *object, uint32_t id, uint32_t flags, const struct spa_pod *param)
Set a parameter on the endpoint.
Definition: interfaces.h:270
pw_endpoint_methods::enum_params
int(* enum_params)(void *object, int seq, uint32_t id, uint32_t start, uint32_t num, const struct spa_pod *filter)
Enumerate endpoint parameters.
Definition: interfaces.h:259
pw_endpoint_stream_events
Definition: interfaces.h:310
pw_endpoint_stream_events::version
uint32_t version
version of this structure
Definition: interfaces.h:313
pw_endpoint_stream_events::param
void(* param)(void *data, int seq, uint32_t id, uint32_t index, uint32_t next, const struct spa_pod *param)
Notify a endpoint stream param.
Definition: interfaces.h:333
pw_endpoint_stream_events::info
void(* info)(void *data, const struct pw_endpoint_stream_info *info)
Notify endpoint stream info.
Definition: interfaces.h:320
pw_endpoint_stream_info
Definition: introspect.h:79
pw_endpoint_stream_methods
Definition: interfaces.h:349
pw_endpoint_stream_methods::add_listener
int(* add_listener)(void *object, struct spa_hook *listener, const struct pw_endpoint_stream_events *events, void *data)
Definition: interfaces.h:354
pw_endpoint_stream_methods::set_param
int(* set_param)(void *object, uint32_t id, uint32_t flags, const struct spa_pod *param)
Set a parameter on the stream.
Definition: interfaces.h:393
pw_endpoint_stream_methods::version
uint32_t version
version of this structure
Definition: interfaces.h:352
pw_endpoint_stream_methods::enum_params
int(* enum_params)(void *object, int seq, uint32_t id, uint32_t start, uint32_t num, const struct spa_pod *filter)
Enumerate stream parameters.
Definition: interfaces.h:382
pw_endpoint_stream_methods::subscribe_params
int(* subscribe_params)(void *object, uint32_t *ids, uint32_t n_ids)
Subscribe to parameter changes.
Definition: interfaces.h:368
pw_endpoint_stream
pw_endpoint
pw_session_events
Definition: interfaces.h:64
pw_session_events::info
void(* info)(void *data, const struct pw_session_info *info)
Notify session info.
Definition: interfaces.h:74
pw_session_events::param
void(* param)(void *data, int seq, uint32_t id, uint32_t index, uint32_t next, const struct spa_pod *param)
Notify a session param.
Definition: interfaces.h:87
pw_session_events::version
uint32_t version
version of this structure
Definition: interfaces.h:67
pw_session_info
Definition: introspect.h:33
pw_session_methods
Definition: interfaces.h:105
pw_session_methods::version
uint32_t version
version of this structure
Definition: interfaces.h:108
pw_session_methods::set_param
int(* set_param)(void *object, uint32_t id, uint32_t flags, const struct spa_pod *param)
Set a parameter on the session.
Definition: interfaces.h:149
pw_session_methods::subscribe_params
int(* subscribe_params)(void *object, uint32_t *ids, uint32_t n_ids)
Subscribe to parameter changes.
Definition: interfaces.h:124
pw_session_methods::enum_params
int(* enum_params)(void *object, int seq, uint32_t id, uint32_t start, uint32_t num, const struct spa_pod *filter)
Enumerate session parameters.
Definition: interfaces.h:138
pw_session_methods::add_listener
int(* add_listener)(void *object, struct spa_hook *listener, const struct pw_session_events *events, void *data)
Definition: interfaces.h:110
pw_session
spa_dict
Definition: utils/dict.h:39
spa_hook
A hook, contains the structure with functions and the data passed to the functions.
Definition: hook.h:331
spa_pod
Definition: pod/pod.h:43