PipeWire: pipewire/extensions/session-manager/interfaces.h Source File

PipeWire 1.0.3

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_SESSION_PERM_MASK PW_PERM_RWX
25#define PW_VERSION_SESSION 0
26struct 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
31struct 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
36struct 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
49struct pw_session_events {
50#define PW_VERSION_SESSION_EVENTS 0
51 uint32_t version;
58 void (*info) (void *data, const struct pw_session_info *info);
59
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
83struct pw_session_methods {
84#define PW_VERSION_SESSION_METHODS 0
85 uint32_t version;
87 int (*add_listener) (void *object,
88 struct spa_hook *listener,
89 const struct pw_session_events *events,
90 void *data);
91
103 int (*subscribe_params) (void *object, uint32_t *ids, uint32_t n_ids);
104
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
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
157struct pw_endpoint_events {
158#define PW_VERSION_ENDPOINT_EVENTS 0
159 uint32_t version;
166 void (*info) (void *data, const struct pw_endpoint_info *info);
167
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
191struct pw_endpoint_methods {
192#define PW_VERSION_ENDPOINT_METHODS 0
193 uint32_t version;
195 int (*add_listener) (void *object,
196 struct spa_hook *listener,
197 const struct pw_endpoint_events *events,
198 void *data);
199
211 int (*subscribe_params) (void *object, uint32_t *ids, uint32_t n_ids);
212
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
240 int (*set_param) (void *object, uint32_t id, uint32_t flags,
241 const struct spa_pod *param);
242
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
272struct pw_endpoint_stream_events {
273#define PW_VERSION_ENDPOINT_STREAM_EVENTS 0
274 uint32_t version;
281 void (*info) (void *data, const struct pw_endpoint_stream_info *info);
282
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
305struct pw_endpoint_stream_methods {
306#define PW_VERSION_ENDPOINT_STREAM_METHODS 0
307 uint32_t version;
309 int (*add_listener) (void *object,
310 struct spa_hook *listener,
311 const struct pw_endpoint_stream_events *events,
312 void *data);
313
325 int (*subscribe_params) (void *object, uint32_t *ids, uint32_t n_ids);
326
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
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
378struct pw_endpoint_link_events {
379#define PW_VERSION_ENDPOINT_LINK_EVENTS 0
380 uint32_t version;
387 void (*info) (void *data, const struct pw_endpoint_link_info *info);
388
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
413struct pw_endpoint_link_methods {
414#define PW_VERSION_ENDPOINT_LINK_METHODS 0
415 uint32_t version;
417 int (*add_listener) (void *object,
418 struct spa_hook *listener,
419 const struct pw_endpoint_link_events *events,
420 void *data);
421
433 int (*subscribe_params) (void *object, uint32_t *ids, uint32_t n_ids);
434
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
462 int (*set_param) (void *object, uint32_t id, uint32_t flags,
463 const struct spa_pod *param);
464
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
493#ifdef __cplusplus
494} /* extern "C" */
495#endif
496
497#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:199
pw_endpoint_events::info
void(* info)(void *data, const struct pw_endpoint_info *info)
Notify endpoint info.
Definition interfaces.h:209
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:222
pw_endpoint_events::version
uint32_t version
version of this structure
Definition interfaces.h:202
pw_endpoint_info
Definition introspect.h:50
pw_endpoint_link_events
Definition interfaces.h:459
pw_endpoint_link_events::info
void(* info)(void *data, const struct pw_endpoint_link_info *info)
Notify endpoint link info.
Definition interfaces.h:469
pw_endpoint_link_events::version
uint32_t version
version of this structure
Definition interfaces.h:462
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:482
pw_endpoint_link_info
Definition introspect.h:101
pw_endpoint_link_methods
Definition interfaces.h:502
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:552
pw_endpoint_link_methods::request_state
int(* request_state)(void *object, enum pw_endpoint_link_state state)
Request a state on the link.
Definition interfaces.h:560
pw_endpoint_link_methods::version
uint32_t version
version of this structure
Definition interfaces.h:505
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:507
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:523
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:539
pw_endpoint_link
pw_endpoint_methods
Definition interfaces.h:240
pw_endpoint_methods::version
uint32_t version
version of this structure
Definition interfaces.h:243
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:245
pw_endpoint_methods::subscribe_params
int(* subscribe_params)(void *object, uint32_t *ids, uint32_t n_ids)
Subscribe to parameter changes.
Definition interfaces.h:261
pw_endpoint_methods::create_link
int(* create_link)(void *object, const struct spa_dict *props)
Create a link.
Definition interfaces.h:298
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:290
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:277
pw_endpoint_stream_events
Definition interfaces.h:335
pw_endpoint_stream_events::version
uint32_t version
version of this structure
Definition interfaces.h:338
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:358
pw_endpoint_stream_events::info
void(* info)(void *data, const struct pw_endpoint_stream_info *info)
Notify endpoint stream info.
Definition interfaces.h:345
pw_endpoint_stream_info
Definition introspect.h:79
pw_endpoint_stream_methods
Definition interfaces.h:374
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:379
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:424
pw_endpoint_stream_methods::version
uint32_t version
version of this structure
Definition interfaces.h:377
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:411
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:395
pw_endpoint_stream
pw_endpoint
pw_session_events
Definition interfaces.h:72
pw_session_events::info
void(* info)(void *data, const struct pw_session_info *info)
Notify session info.
Definition interfaces.h:82
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:95
pw_session_events::version
uint32_t version
version of this structure
Definition interfaces.h:75
pw_session_info
Definition introspect.h:33
pw_session_methods
Definition interfaces.h:113
pw_session_methods::version
uint32_t version
version of this structure
Definition interfaces.h:116
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:163
pw_session_methods::subscribe_params
int(* subscribe_params)(void *object, uint32_t *ids, uint32_t n_ids)
Subscribe to parameter changes.
Definition interfaces.h:134
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:150
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:118
pw_session
spa_dict
Definition dict.h:39
spa_hook
A hook, contains the structure with functions and the data passed to the functions.
Definition hook.h:350
spa_pod
Definition pod.h:43