PipeWire 0.3.65
client.h
Go to the documentation of this file.
1/* PipeWire
2 *
3 * Copyright © 2018 Wim Taymans
4 *
5 * Permission is hereby granted, free of charge, to any person obtaining a
6 * copy of this software and associated documentation files (the "Software"),
7 * to deal in the Software without restriction, including without limitation
8 * the rights to use, copy, modify, merge, publish, distribute, sublicense,
9 * and/or sell copies of the Software, and to permit persons to whom the
10 * Software is furnished to do so, subject to the following conditions:
11 *
12 * The above copyright notice and this permission notice (including the next
13 * paragraph) shall be included in all copies or substantial portions of the
14 * Software.
15 *
16 * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
17 * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
18 * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
19 * THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
20 * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
21 * FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
22 * DEALINGS IN THE SOFTWARE.
23 */
24
25#ifndef PIPEWIRE_CLIENT_H
26#define PIPEWIRE_CLIENT_H
27
28#ifdef __cplusplus
29extern "C" {
30#endif
31
32#include <spa/utils/defs.h>
33#include <spa/param/param.h>
34
35#include <pipewire/proxy.h>
36#include <pipewire/permission.h>
37
46#define PW_TYPE_INTERFACE_Client PW_TYPE_INFO_INTERFACE_BASE "Client"
47
48#define PW_VERSION_CLIENT 3
49struct pw_client;
50
51/* default ID of the current client after connect */
52#define PW_ID_CLIENT 1
53
56 uint32_t id;
57#define PW_CLIENT_CHANGE_MASK_PROPS (1 << 0)
58#define PW_CLIENT_CHANGE_MASK_ALL ((1 << 1)-1)
59 uint64_t change_mask;
60 struct spa_dict *props;
61};
62
66 const struct pw_client_info *update);
70 const struct pw_client_info *update, bool reset);
72void pw_client_info_free(struct pw_client_info *info);
73
74
75#define PW_CLIENT_EVENT_INFO 0
76#define PW_CLIENT_EVENT_PERMISSIONS 1
77#define PW_CLIENT_EVENT_NUM 2
78
80struct pw_client_events {
81#define PW_VERSION_CLIENT_EVENTS 0
82 uint32_t version;
88 void (*info) (void *data, const struct pw_client_info *info);
99 void (*permissions) (void *data,
100 uint32_t index,
101 uint32_t n_permissions,
103};
104
105
106#define PW_CLIENT_METHOD_ADD_LISTENER 0
107#define PW_CLIENT_METHOD_ERROR 1
108#define PW_CLIENT_METHOD_UPDATE_PROPERTIES 2
109#define PW_CLIENT_METHOD_GET_PERMISSIONS 3
110#define PW_CLIENT_METHOD_UPDATE_PERMISSIONS 4
111#define PW_CLIENT_METHOD_NUM 5
112
114struct pw_client_methods {
115#define PW_VERSION_CLIENT_METHODS 0
116 uint32_t version;
117
118 int (*add_listener) (void *object,
119 struct spa_hook *listener,
120 const struct pw_client_events *events,
121 void *data);
129 int (*error) (void *object, uint32_t id, int res, const char *message);
135 int (*update_properties) (void *object, const struct spa_dict *props);
145 int (*get_permissions) (void *object, uint32_t index, uint32_t num);
159 int (*update_permissions) (void *object, uint32_t n_permissions,
160 const struct pw_permission *permissions);
161};
162
163#define pw_client_method(o,method,version,...) \
164({ \
165 int _res = -ENOTSUP; \
166 spa_interface_call_res((struct spa_interface*)o, \
167 struct pw_client_methods, _res, \
168 method, version, ##__VA_ARGS__); \
169 _res; \
170})
171
172#define pw_client_add_listener(c,...) pw_client_method(c,add_listener,0,__VA_ARGS__)
173#define pw_client_error(c,...) pw_client_method(c,error,0,__VA_ARGS__)
174#define pw_client_update_properties(c,...) pw_client_method(c,update_properties,0,__VA_ARGS__)
175#define pw_client_get_permissions(c,...) pw_client_method(c,get_permissions,0,__VA_ARGS__)
176#define pw_client_update_permissions(c,...) pw_client_method(c,update_permissions,0,__VA_ARGS__)
177
182#ifdef __cplusplus
183} /* extern "C" */
184#endif
185
186#endif /* PIPEWIRE_CLIENT_H */
spa/utils/defs.h
void pw_client_info_free(struct pw_client_info *info)
Free a pw_client_info.
Definition: introspect.c:529
struct pw_client_info * pw_client_info_update(struct pw_client_info *info, const struct pw_client_info *update)
Update an existing pw_client_info with update with reset.
Definition: introspect.c:522
struct pw_client_info * pw_client_info_merge(struct pw_client_info *info, const struct pw_client_info *update, bool reset)
Merge an existing pw_client_info with update.
Definition: introspect.c:496
spa/param/param.h
pipewire/permission.h
pipewire/proxy.h
Client events.
Definition: client.h:93
uint32_t version
Definition: client.h:96
void(* info)(void *data, const struct pw_client_info *info)
Notify client info.
Definition: client.h:102
void(* permissions)(void *data, uint32_t index, uint32_t n_permissions, const struct pw_permission *permissions)
Notify a client permission.
Definition: client.h:113
The client information.
Definition: client.h:63
uint32_t id
id of the global
Definition: client.h:64
uint64_t change_mask
bitfield of changed fields since last call
Definition: client.h:69
Client methods.
Definition: client.h:134
int(* update_properties)(void *object, const struct spa_dict *props)
Update client properties.
Definition: client.h:156
int(* update_permissions)(void *object, uint32_t n_permissions, const struct pw_permission *permissions)
Manage the permissions of the global objects for this client.
Definition: client.h:180
int(* error)(void *object, uint32_t id, int res, const char *message)
Send an error to a client.
Definition: client.h:150
int(* get_permissions)(void *object, uint32_t index, uint32_t num)
Get client permissions.
Definition: client.h:166
uint32_t version
Definition: client.h:137
int(* add_listener)(void *object, struct spa_hook *listener, const struct pw_client_events *events, void *data)
Definition: client.h:139
Definition: permission.h:80
uint32_t permissions
bitmask of above permissions
Definition: permission.h:82
Definition: utils/dict.h:59
A hook, contains the structure with functions and the data passed to the functions.
Definition: hook.h:351