PipeWire 0.3.77
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;
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
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
43/* Session */
44
45#define PW_SESSION_EVENT_INFO 0
46#define PW_SESSION_EVENT_PARAM 1
47#define PW_SESSION_EVENT_NUM 2
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);
71 void (*param) (void *data, int seq,
72 uint32_t id, uint32_t index, uint32_t next,
73 const struct spa_pod *param);
74};
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
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);
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
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);
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);
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);
240 int (*set_param) (void *object, uint32_t id, uint32_t flags,
241 const struct spa_pod *param);
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
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};
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
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})
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
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
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
493#ifdef __cplusplus
494} /* extern "C" */
495#endif
497#endif /* PIPEWIRE_EXT_SESSION_MANAGER_INTERFACES_H */
spa/utils/defs.h
pw_endpoint_link_state
Definition: introspect.h:26
spa/utils/hook.h
pipewire/extensions/session-manager/introspect.h
Definition: interfaces.h:199
void(* info)(void *data, const struct pw_endpoint_info *info)
Notify endpoint info.
Definition: interfaces.h:209
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
uint32_t version
version of this structure
Definition: interfaces.h:202
Definition: introspect.h:50
Definition: interfaces.h:240
uint32_t version
version of this structure
Definition: interfaces.h:243
int(* add_listener)(void *object, struct spa_hook *listener, const struct pw_endpoint_events *events, void *data)
Definition: interfaces.h:245
int(* subscribe_params)(void *object, uint32_t *ids, uint32_t n_ids)
Subscribe to parameter changes.
Definition: interfaces.h:261
int(* create_link)(void *object, const struct spa_dict *props)
Create a link.
Definition: interfaces.h:298
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
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
Definition: interfaces.h:335
uint32_t version
version of this structure
Definition: interfaces.h:338
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
void(* info)(void *data, const struct pw_endpoint_stream_info *info)
Notify endpoint stream info.
Definition: interfaces.h:345
Definition: introspect.h:79
Definition: interfaces.h:374
int(* add_listener)(void *object, struct spa_hook *listener, const struct pw_endpoint_stream_events *events, void *data)
Definition: interfaces.h:379
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
uint32_t version
version of this structure
Definition: interfaces.h:377
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
int(* subscribe_params)(void *object, uint32_t *ids, uint32_t n_ids)
Subscribe to parameter changes.
Definition: interfaces.h:395
Definition: interfaces.h:72
void(* info)(void *data, const struct pw_session_info *info)
Notify session info.
Definition: interfaces.h:82
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
uint32_t version
version of this structure
Definition: interfaces.h:75
Definition: introspect.h:33
Definition: interfaces.h:113
uint32_t version
version of this structure
Definition: interfaces.h:116
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
int(* subscribe_params)(void *object, uint32_t *ids, uint32_t n_ids)
Subscribe to parameter changes.
Definition: interfaces.h:134
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
int(* add_listener)(void *object, struct spa_hook *listener, const struct pw_session_events *events, void *data)
Definition: interfaces.h:118
Definition: utils/dict.h:39
A hook, contains the structure with functions and the data passed to the functions.
Definition: hook.h:350
Definition: pod/pod.h:43