PipeWire 1.4.10

Loading...
Searching...
No Matches
impl-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_IMPL_INTERFACES_H
7#define PIPEWIRE_EXT_SESSION_MANAGER_IMPL_INTERFACES_H
8
9#include <spa/utils/defs.h>
10#include <spa/utils/hook.h>
11#include <errno.h>
12
13#include "introspect.h"
14
15#ifdef __cplusplus
16 extern "C" {
17#endif
18
23
24#define PW_TYPE_INTERFACE_ClientEndpoint PW_TYPE_INFO_INTERFACE_BASE "ClientEndpoint"
25
26#define PW_VERSION_CLIENT_ENDPOINT 0
27 struct pw_client_endpoint;
28
29#define PW_CLIENT_ENDPOINT_EVENT_SET_SESSION_ID 0
30#define PW_CLIENT_ENDPOINT_EVENT_SET_PARAM 1
31#define PW_CLIENT_ENDPOINT_EVENT_STREAM_SET_PARAM 2
32#define PW_CLIENT_ENDPOINT_EVENT_CREATE_LINK 3
33#define PW_CLIENT_ENDPOINT_EVENT_NUM 4
34
35 struct pw_client_endpoint_events {
36#define PW_VERSION_CLIENT_ENDPOINT_EVENTS 0
37 uint32_t version;
38
47 * \param endpoint a #pw_endpoint
48 * \param id the session id associated with this endpoint
49 *
50 * \return 0 on success
51 * -EINVAL when the session id has already been set
52 * -ENOTSUP when the endpoint is a session master
53 */
54 int (*set_session_id) (void *data, uint32_t session_id);
55
77 int (*set_param) (void *data,
78 uint32_t id, uint32_t flags,
79 const struct spa_pod *param);
80
101 int (*stream_set_param) (void *data, uint32_t stream_id,
102 uint32_t id, uint32_t flags,
103 const struct spa_pod *param);
104
105 int (*create_link) (void *data, const struct spa_dict *props);
106};
107
108#define PW_CLIENT_ENDPOINT_METHOD_ADD_LISTENER 0
109#define PW_CLIENT_ENDPOINT_METHOD_UPDATE 1
110#define PW_CLIENT_ENDPOINT_METHOD_STREAM_UPDATE 2
111#define PW_CLIENT_ENDPOINT_METHOD_NUM 3
112
113 struct pw_client_endpoint_methods {
114#define PW_VERSION_CLIENT_ENDPOINT_METHODS 0
115 uint32_t version;
116
117 int (*add_listener) (void *object,
118 struct spa_hook *listener,
119 const struct pw_client_endpoint_events *events,
120 void *data);
121
123 int (*update) (void *object,
124#define PW_CLIENT_ENDPOINT_UPDATE_PARAMS (1 << 0)
125#define PW_CLIENT_ENDPOINT_UPDATE_INFO (1 << 1)
126 uint32_t change_mask,
127 uint32_t n_params,
128 const struct spa_pod **params,
129 const struct pw_endpoint_info *info);
130
132 int (*stream_update) (void *object,
133 uint32_t stream_id,
134#define PW_CLIENT_ENDPOINT_STREAM_UPDATE_PARAMS (1 << 0)
135#define PW_CLIENT_ENDPOINT_STREAM_UPDATE_INFO (1 << 1)
136#define PW_CLIENT_ENDPOINT_STREAM_UPDATE_DESTROYED (1 << 2)
137 uint32_t change_mask,
138 uint32_t n_params,
139 const struct spa_pod **params,
140 const struct pw_endpoint_stream_info *info);
141};
142
143#define pw_client_endpoint_method(o,method,version,...) \
144({ \
145 int _res = -ENOTSUP; \
146 spa_interface_call_res((struct spa_interface*)o, \
147 struct pw_client_endpoint_methods, _res, \
148 method, version, ##__VA_ARGS__); \
149 _res; \
150})
151
152#define pw_client_endpoint_add_listener(o,...) pw_client_endpoint_method(o,add_listener,0,__VA_ARGS__)
153#define pw_client_endpoint_update(o,...) pw_client_endpoint_method(o,update,0,__VA_ARGS__)
154#define pw_client_endpoint_stream_update(o,...) pw_client_endpoint_method(o,stream_update,0,__VA_ARGS__)
155
156#define PW_TYPE_INTERFACE_ClientSession PW_TYPE_INFO_INTERFACE_BASE "ClientSession"
157
158#define PW_VERSION_CLIENT_SESSION 0
159 struct pw_client_session;
160
161#define PW_CLIENT_SESSION_EVENT_SET_PARAM 0
162#define PW_CLIENT_SESSION_EVENT_LINK_SET_PARAM 1
163#define PW_CLIENT_SESSION_EVENT_LINK_REQUEST_STATE 2
164#define PW_CLIENT_SESSION_EVENT_NUM 3
165
166 struct pw_client_session_events {
167#define PW_VERSION_CLIENT_SESSION_EVENTS 0
168 uint32_t version;
169
174
191 int (*set_param) (void *data,
192 uint32_t id, uint32_t flags,
193 const struct spa_pod *param);
194
202 * \param session a #struct pw_session
203 * \param link_id the link to configure
204 * \param id the parameter id to set
205 * \param flags optional flags
206 * \param param a #struct spa_pod with the parameter to set
207 * \return 0 on success
208 * 1 on success, the value of \a param might have been
209 * changed depending on \a flags and the final value can
210 * be found by doing link_enum_params.
211 * -EINVAL when \a session is NULL or invalid arguments are given
212 * -ESRCH when the type or size of a property is not correct.
213 * -ENOENT when the param id is not found
214 */
215 int (*link_set_param) (void *data, uint32_t link_id,
216 uint32_t id, uint32_t flags,
217 const struct spa_pod *param);
218
219 int (*link_request_state) (void *data, uint32_t link_id, uint32_t state);
220};
221
222#define PW_CLIENT_SESSION_METHOD_ADD_LISTENER 0
223#define PW_CLIENT_SESSION_METHOD_UPDATE 1
224#define PW_CLIENT_SESSION_METHOD_LINK_UPDATE 2
225#define PW_CLIENT_SESSION_METHOD_NUM 3
226
227 struct pw_client_session_methods {
228#define PW_VERSION_CLIENT_SESSION_METHODS 0
229 uint32_t version;
230
231 int (*add_listener) (void *object,
232 struct spa_hook *listener,
233 const struct pw_client_session_events *events,
234 void *data);
235
237 int (*update) (void *object,
238#define PW_CLIENT_SESSION_UPDATE_PARAMS (1 << 0)
239#define PW_CLIENT_SESSION_UPDATE_INFO (1 << 1)
240 uint32_t change_mask,
241 uint32_t n_params,
242 const struct spa_pod **params,
243 const struct pw_session_info *info);
244
246 int (*link_update) (void *object,
247 uint32_t link_id,
248#define PW_CLIENT_SESSION_LINK_UPDATE_PARAMS (1 << 0)
249#define PW_CLIENT_SESSION_LINK_UPDATE_INFO (1 << 1)
250#define PW_CLIENT_SESSION_LINK_UPDATE_DESTROYED (1 << 2)
251 uint32_t change_mask,
252 uint32_t n_params,
253 const struct spa_pod **params,
254 const struct pw_endpoint_link_info *info);
255};
256
257#define pw_client_session_method(o,method,version,...) \
258({ \
259 int _res = -ENOTSUP; \
260 spa_interface_call_res((struct spa_interface*)o, \
261 struct pw_client_session_methods, _res, \
262 method, version, ##__VA_ARGS__); \
263 _res; \
264})
265
266#define pw_client_session_add_listener(o,...) pw_client_session_method(o,add_listener,0,__VA_ARGS__)
267#define pw_client_session_update(o,...) pw_client_session_method(o,update,0,__VA_ARGS__)
268#define pw_client_session_link_update(o,...) pw_client_session_method(o,link_update,0,__VA_ARGS__)
269
273
274#ifdef __cplusplus
275} /* extern "C" */
276#endif
277
278#endif /* PIPEWIRE_EXT_SESSION_MANAGER_IMPL_INTERFACES_H */
defs.h
spa/utils/defs.h
id
uint32_t id
Definition core.h:432
pw_client_endpoint_methods::update
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:141
pw_client_session_methods::update
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:279
pw_client_session_methods::link_update
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:290
pw_client_endpoint_methods::stream_update
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:152
hook.h
spa/utils/hook.h
introspect.h
pipewire/extensions/session-manager/introspect.h
pw_client_endpoint_events
Definition impl-interfaces.h:47
pw_client_endpoint_events::create_link
int(* create_link)(void *data, const struct spa_dict *props)
Definition impl-interfaces.h:118
pw_client_endpoint_events::set_session_id
int(* set_session_id)(void *data, uint32_t session_id)
Sets the session id of the endpoint.
Definition impl-interfaces.h:67
pw_client_endpoint_events::stream_set_param
int(* stream_set_param)(void *data, 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:114
pw_client_endpoint_events::set_param
int(* set_param)(void *data, uint32_t id, uint32_t flags, const struct spa_pod *param)
Set the configurable parameter in endpoint.
Definition impl-interfaces.h:90
pw_client_endpoint_events::version
uint32_t version
version of this structure
Definition impl-interfaces.h:50
pw_client_endpoint_methods
Definition impl-interfaces.h:130
pw_client_endpoint_methods::add_listener
int(* add_listener)(void *object, struct spa_hook *listener, const struct pw_client_endpoint_events *events, void *data)
Definition impl-interfaces.h:135
pw_client_endpoint
pw_client_session_events
Definition impl-interfaces.h:202
pw_client_session_events::version
uint32_t version
version of this structure
Definition impl-interfaces.h:205
pw_client_session_events::set_param
int(* set_param)(void *data, uint32_t id, uint32_t flags, const struct spa_pod *param)
Set the configurable parameter in session.
Definition impl-interfaces.h:228
pw_client_session_events::link_request_state
int(* link_request_state)(void *data, uint32_t link_id, uint32_t state)
Definition impl-interfaces.h:256
pw_client_session_events::link_set_param
int(* link_set_param)(void *data, 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:252
pw_client_session_methods
Definition impl-interfaces.h:268
pw_client_session_methods::add_listener
int(* add_listener)(void *object, struct spa_hook *listener, const struct pw_client_session_events *events, void *data)
Definition impl-interfaces.h:273
pw_client_session
pw_endpoint_info
Definition introspect.h:50
pw_endpoint_link_info
Definition introspect.h:101
pw_endpoint_stream_info
Definition introspect.h:79
pw_session_info
Definition introspect.h:33
spa_dict
Definition dict.h:51
spa_hook
A hook, contains the structure with functions and the data passed to the functions.
Definition hook.h:427
spa_pod
Definition pod.h:43