PipeWire  0.3.45
impl-interfaces.h
Go to the documentation of this file.
1 /* PipeWire
2  *
3  * Copyright © 2019 Collabora Ltd.
4  * @author George Kiagiadakis <george.kiagiadakis@collabora.com>
5  *
6  * Permission is hereby granted, free of charge, to any person obtaining a
7  * copy of this software and associated documentation files (the "Software"),
8  * to deal in the Software without restriction, including without limitation
9  * the rights to use, copy, modify, merge, publish, distribute, sublicense,
10  * and/or sell copies of the Software, and to permit persons to whom the
11  * Software is furnished to do so, subject to the following conditions:
12  *
13  * The above copyright notice and this permission notice (including the next
14  * paragraph) shall be included in all copies or substantial portions of the
15  * Software.
16  *
17  * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
18  * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
19  * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
20  * THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
21  * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
22  * FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
23  * DEALINGS IN THE SOFTWARE.
24  */
25 
26 #ifndef PIPEWIRE_EXT_SESSION_MANAGER_IMPL_INTERFACES_H
27 #define PIPEWIRE_EXT_SESSION_MANAGER_IMPL_INTERFACES_H
28 
29 #include <spa/utils/defs.h>
30 #include <spa/utils/hook.h>
31 #include <errno.h>
32 
33 #include "introspect.h"
34 
35 #ifdef __cplusplus
36 extern "C" {
37 #endif
38 
44 #define PW_TYPE_INTERFACE_ClientEndpoint PW_TYPE_INFO_INTERFACE_BASE "ClientEndpoint"
45 
46 #define PW_VERSION_CLIENT_ENDPOINT 0
47 struct pw_client_endpoint;
48 
49 #define PW_CLIENT_ENDPOINT_EVENT_SET_SESSION_ID 0
50 #define PW_CLIENT_ENDPOINT_EVENT_SET_PARAM 1
51 #define PW_CLIENT_ENDPOINT_EVENT_STREAM_SET_PARAM 2
52 #define PW_CLIENT_ENDPOINT_EVENT_CREATE_LINK 3
53 #define PW_CLIENT_ENDPOINT_EVENT_NUM 4
54 
56 #define PW_VERSION_CLIENT_ENDPOINT_EVENTS 0
57  uint32_t version;
74  int (*set_session_id) (void *object, uint32_t session_id);
75 
97  int (*set_param) (void *object,
98  uint32_t id, uint32_t flags,
99  const struct spa_pod *param);
100 
121  int (*stream_set_param) (void *object, uint32_t stream_id,
122  uint32_t id, uint32_t flags,
123  const struct spa_pod *param);
124 
125  int (*create_link) (void *object, const struct spa_dict *props);
126 };
127 
128 #define PW_CLIENT_ENDPOINT_METHOD_ADD_LISTENER 0
129 #define PW_CLIENT_ENDPOINT_METHOD_UPDATE 1
130 #define PW_CLIENT_ENDPOINT_METHOD_STREAM_UPDATE 2
131 #define PW_CLIENT_ENDPOINT_METHOD_NUM 3
132 
134 #define PW_VERSION_CLIENT_ENDPOINT_METHODS 0
135  uint32_t version;
137  int (*add_listener) (void *object,
138  struct spa_hook *listener,
139  const struct pw_client_endpoint_events *events,
140  void *data);
141 
143  int (*update) (void *object,
144 #define PW_CLIENT_ENDPOINT_UPDATE_PARAMS (1 << 0)
145 #define PW_CLIENT_ENDPOINT_UPDATE_INFO (1 << 1)
146  uint32_t change_mask,
147  uint32_t n_params,
148  const struct spa_pod **params,
149  const struct pw_endpoint_info *info);
150 
152  int (*stream_update) (void *object,
153  uint32_t stream_id,
154 #define PW_CLIENT_ENDPOINT_STREAM_UPDATE_PARAMS (1 << 0)
155 #define PW_CLIENT_ENDPOINT_STREAM_UPDATE_INFO (1 << 1)
156 #define PW_CLIENT_ENDPOINT_STREAM_UPDATE_DESTROYED (1 << 2)
157  uint32_t change_mask,
158  uint32_t n_params,
159  const struct spa_pod **params,
160  const struct pw_endpoint_stream_info *info);
161 };
162 
163 #define pw_client_endpoint_method(o,method,version,...) \
164 ({ \
165  int _res = -ENOTSUP; \
166  spa_interface_call_res((struct spa_interface*)o, \
167  struct pw_client_endpoint_methods, _res, \
168  method, version, ##__VA_ARGS__); \
169  _res; \
170 })
171 
172 #define pw_client_endpoint_add_listener(o,...) pw_client_endpoint_method(o,add_listener,0,__VA_ARGS__)
173 #define pw_client_endpoint_update(o,...) pw_client_endpoint_method(o,update,0,__VA_ARGS__)
174 #define pw_client_endpoint_stream_update(o,...) pw_client_endpoint_method(o,stream_update,0,__VA_ARGS__)
175 
176 #define PW_TYPE_INTERFACE_ClientSession PW_TYPE_INFO_INTERFACE_BASE "ClientSession"
177 
178 #define PW_VERSION_CLIENT_SESSION 0
179 struct pw_client_session;
180 
181 #define PW_CLIENT_SESSION_EVENT_SET_PARAM 0
182 #define PW_CLIENT_SESSION_EVENT_LINK_SET_PARAM 1
183 #define PW_CLIENT_SESSION_EVENT_LINK_REQUEST_STATE 2
184 #define PW_CLIENT_SESSION_EVENT_NUM 3
185 
187 #define PW_VERSION_CLIENT_SESSION_EVENTS 0
188  uint32_t version;
211  int (*set_param) (void *object,
212  uint32_t id, uint32_t flags,
213  const struct spa_pod *param);
214 
235  int (*link_set_param) (void *object, uint32_t link_id,
236  uint32_t id, uint32_t flags,
237  const struct spa_pod *param);
238 
239  int (*link_request_state) (void *object, uint32_t link_id, uint32_t state);
240 };
241 
242 #define PW_CLIENT_SESSION_METHOD_ADD_LISTENER 0
243 #define PW_CLIENT_SESSION_METHOD_UPDATE 1
244 #define PW_CLIENT_SESSION_METHOD_LINK_UPDATE 2
245 #define PW_CLIENT_SESSION_METHOD_NUM 3
246 
248 #define PW_VERSION_CLIENT_SESSION_METHODS 0
249  uint32_t version;
251  int (*add_listener) (void *object,
252  struct spa_hook *listener,
253  const struct pw_client_session_events *events,
254  void *data);
255 
257  int (*update) (void *object,
258 #define PW_CLIENT_SESSION_UPDATE_PARAMS (1 << 0)
259 #define PW_CLIENT_SESSION_UPDATE_INFO (1 << 1)
260  uint32_t change_mask,
261  uint32_t n_params,
262  const struct spa_pod **params,
263  const struct pw_session_info *info);
264 
266  int (*link_update) (void *object,
267  uint32_t link_id,
268 #define PW_CLIENT_SESSION_LINK_UPDATE_PARAMS (1 << 0)
269 #define PW_CLIENT_SESSION_LINK_UPDATE_INFO (1 << 1)
270 #define PW_CLIENT_SESSION_LINK_UPDATE_DESTROYED (1 << 2)
271  uint32_t change_mask,
272  uint32_t n_params,
273  const struct spa_pod **params,
274  const struct pw_endpoint_link_info *info);
275 };
276 
277 #define pw_client_session_method(o,method,version,...) \
278 ({ \
279  int _res = -ENOTSUP; \
280  spa_interface_call_res((struct spa_interface*)o, \
281  struct pw_client_session_methods, _res, \
282  method, version, ##__VA_ARGS__); \
283  _res; \
284 })
285 
286 #define pw_client_session_add_listener(o,...) pw_client_session_method(o,add_listener,0,__VA_ARGS__)
287 #define pw_client_session_update(o,...) pw_client_session_method(o,update,0,__VA_ARGS__)
288 #define pw_client_session_link_update(o,...) pw_client_session_method(o,link_update,0,__VA_ARGS__)
289 
294 #ifdef __cplusplus
295 } /* extern "C" */
296 #endif
297 
298 #endif /* PIPEWIRE_EXT_SESSION_MANAGER_IMPL_INTERFACES_H */
spa/utils/defs.h
int(* update)(void *object, #define PW_CLIENT_ENDPOINT_UPDATE_PARAMS #define PW_CLIENT_ENDPOINT_UPDATE_INFO uint32_t change_mask, uint32_t n_params, const struct spa_pod **params, const struct pw_endpoint_info *info)
Update endpoint information.
Definition: impl-interfaces.h:161
int(* update)(void *object, #define PW_CLIENT_SESSION_UPDATE_PARAMS #define PW_CLIENT_SESSION_UPDATE_INFO uint32_t change_mask, uint32_t n_params, const struct spa_pod **params, const struct pw_session_info *info)
Update session information.
Definition: impl-interfaces.h:299
int(* link_update)(void *object, uint32_t link_id, #define PW_CLIENT_SESSION_LINK_UPDATE_PARAMS #define PW_CLIENT_SESSION_LINK_UPDATE_INFO #define PW_CLIENT_SESSION_LINK_UPDATE_DESTROYED uint32_t change_mask, uint32_t n_params, const struct spa_pod **params, const struct pw_endpoint_link_info *info)
Update link information.
Definition: impl-interfaces.h:310
int(* stream_update)(void *object, uint32_t stream_id, #define PW_CLIENT_ENDPOINT_STREAM_UPDATE_PARAMS #define PW_CLIENT_ENDPOINT_STREAM_UPDATE_INFO #define PW_CLIENT_ENDPOINT_STREAM_UPDATE_DESTROYED uint32_t change_mask, uint32_t n_params, const struct spa_pod **params, const struct pw_endpoint_stream_info *info)
Update stream information.
Definition: impl-interfaces.h:172
spa/utils/hook.h
pipewire/extensions/session-manager/introspect.h
Definition: impl-interfaces.h:67
int(* stream_set_param)(void *object, uint32_t stream_id, uint32_t id, uint32_t flags, const struct spa_pod *param)
Set a parameter on stream_id of endpoint.
Definition: impl-interfaces.h:134
int(* create_link)(void *object, const struct spa_dict *props)
Definition: impl-interfaces.h:138
int(* set_param)(void *object, uint32_t id, uint32_t flags, const struct spa_pod *param)
Set the configurable parameter in endpoint.
Definition: impl-interfaces.h:110
uint32_t version
version of this structure
Definition: impl-interfaces.h:70
int(* set_session_id)(void *object, uint32_t session_id)
Sets the session id of the endpoint.
Definition: impl-interfaces.h:87
Definition: impl-interfaces.h:150
int(* add_listener)(void *object, struct spa_hook *listener, const struct pw_client_endpoint_events *events, void *data)
Definition: impl-interfaces.h:155
uint32_t version
version of this structure
Definition: impl-interfaces.h:153
Definition: impl-interfaces.h:222
int(* link_set_param)(void *object, uint32_t link_id, uint32_t id, uint32_t flags, const struct spa_pod *param)
Set a parameter on link_id of session.
Definition: impl-interfaces.h:272
uint32_t version
version of this structure
Definition: impl-interfaces.h:225
int(* set_param)(void *object, uint32_t id, uint32_t flags, const struct spa_pod *param)
Set the configurable parameter in session.
Definition: impl-interfaces.h:248
int(* link_request_state)(void *object, uint32_t link_id, uint32_t state)
Definition: impl-interfaces.h:276
Definition: impl-interfaces.h:288
uint32_t version
version of this structure
Definition: impl-interfaces.h:291
int(* add_listener)(void *object, struct spa_hook *listener, const struct pw_client_session_events *events, void *data)
Definition: impl-interfaces.h:293
Definition: introspect.h:70
uint64_t change_mask
bitfield of changed fields since last call
Definition: introspect.h:91
uint32_t n_params
number of items in params
Definition: introspect.h:96
Definition: introspect.h:99
Definition: introspect.h:53
uint64_t change_mask
bitfield of changed fields since last call
Definition: introspect.h:64
uint32_t n_params
number of items in params
Definition: introspect.h:67
Definition: dict.h:59
A hook, contains the structure with functions and the data passed to the functions.
Definition: hook.h:342
Definition: pod.h:63