PipeWire 1.0.5
Loading...
Searching...
No Matches
client.h
Go to the documentation of this file.
1/* PipeWire */
2/* SPDX-FileCopyrightText: Copyright © 2018 Wim Taymans */
3/* SPDX-License-Identifier: MIT */
4
5#ifndef PIPEWIRE_CLIENT_H
6#define PIPEWIRE_CLIENT_H
7
8#ifdef __cplusplus
9extern "C" {
10#endif
11
12#include <spa/utils/defs.h>
13#include <spa/param/param.h>
14
15#include <pipewire/proxy.h>
16#include <pipewire/permission.h>
17
26#define PW_TYPE_INTERFACE_Client PW_TYPE_INFO_INTERFACE_BASE "Client"
27
28#define PW_CLIENT_PERM_MASK PW_PERM_RWXM
29
30#define PW_VERSION_CLIENT 3
31struct pw_client;
32
33/* default ID of the current client after connect */
34#define PW_ID_CLIENT 1
35
38 uint32_t id;
39#define PW_CLIENT_CHANGE_MASK_PROPS (1 << 0)
40#define PW_CLIENT_CHANGE_MASK_ALL ((1 << 1)-1)
41 uint64_t change_mask;
42 struct spa_dict *props;
43};
44
48 const struct pw_client_info *update);
50struct pw_client_info *
52 const struct pw_client_info *update, bool reset);
54void pw_client_info_free(struct pw_client_info *info);
55
56
57#define PW_CLIENT_EVENT_INFO 0
58#define PW_CLIENT_EVENT_PERMISSIONS 1
59#define PW_CLIENT_EVENT_NUM 2
60
62struct pw_client_events {
63#define PW_VERSION_CLIENT_EVENTS 0
64 uint32_t version;
70 void (*info) (void *data, const struct pw_client_info *info);
81 void (*permissions) (void *data,
82 uint32_t index,
83 uint32_t n_permissions,
84 const struct pw_permission *permissions);
85};
86
87
88#define PW_CLIENT_METHOD_ADD_LISTENER 0
89#define PW_CLIENT_METHOD_ERROR 1
90#define PW_CLIENT_METHOD_UPDATE_PROPERTIES 2
91#define PW_CLIENT_METHOD_GET_PERMISSIONS 3
92#define PW_CLIENT_METHOD_UPDATE_PERMISSIONS 4
93#define PW_CLIENT_METHOD_NUM 5
94
97#define PW_VERSION_CLIENT_METHODS 0
98 uint32_t version;
99
100 int (*add_listener) (void *object,
101 struct spa_hook *listener,
102 const struct pw_client_events *events,
103 void *data);
113 int (*error) (void *object, uint32_t id, int res, const char *message);
121 int (*update_properties) (void *object, const struct spa_dict *props);
133 int (*get_permissions) (void *object, uint32_t index, uint32_t num);
149 int (*update_permissions) (void *object, uint32_t n_permissions,
150 const struct pw_permission *permissions);
151};
152
153#define pw_client_method(o,method,version,...) \
154({ \
155 int _res = -ENOTSUP; \
156 spa_interface_call_res((struct spa_interface*)o, \
157 struct pw_client_methods, _res, \
158 method, version, ##__VA_ARGS__); \
159 _res; \
160})
161
162#define pw_client_add_listener(c,...) pw_client_method(c,add_listener,0,__VA_ARGS__)
163#define pw_client_error(c,...) pw_client_method(c,error,0,__VA_ARGS__)
164#define pw_client_update_properties(c,...) pw_client_method(c,update_properties,0,__VA_ARGS__)
165#define pw_client_get_permissions(c,...) pw_client_method(c,get_permissions,0,__VA_ARGS__)
166#define pw_client_update_permissions(c,...) pw_client_method(c,update_permissions,0,__VA_ARGS__)
167
172#ifdef __cplusplus
173} /* extern "C" */
174#endif
176#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:513
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:506
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:480
spa/param/param.h
pipewire/permission.h
pipewire/proxy.h
Client events.
Definition client.h:76
uint32_t version
Definition client.h:79
void(* info)(void *data, const struct pw_client_info *info)
Notify client info.
Definition client.h:85
void(* permissions)(void *data, uint32_t index, uint32_t n_permissions, const struct pw_permission *permissions)
Notify a client permission.
Definition client.h:96
The client information.
Definition client.h:46
uint32_t id
id of the global
Definition client.h:47
uint64_t change_mask
bitfield of changed fields since last call
Definition client.h:52
Client methods.
Definition client.h:117
int(* update_properties)(void *object, const struct spa_dict *props)
Update client properties.
Definition client.h:143
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:171
int(* error)(void *object, uint32_t id, int res, const char *message)
Send an error to a client.
Definition client.h:135
int(* get_permissions)(void *object, uint32_t index, uint32_t num)
Get client permissions.
Definition client.h:155
uint32_t version
Definition client.h:120
int(* add_listener)(void *object, struct spa_hook *listener, const struct pw_client_events *events, void *data)
Definition client.h:122
Definition permission.h:69
Definition dict.h:39
A hook, contains the structure with functions and the data passed to the functions.
Definition hook.h:350