PipeWire: client.h Source File

PipeWire 0.3.71

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_VERSION_CLIENT 3
29struct pw_client;
30
31/* default ID of the current client after connect */
32#define PW_ID_CLIENT 1
33
35 struct pw_client_info {
36 uint32_t id;
37#define PW_CLIENT_CHANGE_MASK_PROPS (1 << 0)
38#define PW_CLIENT_CHANGE_MASK_ALL ((1 << 1)-1)
39 uint64_t change_mask;
40 struct spa_dict *props;
41};
42
44 struct pw_client_info *
45 pw_client_info_update(struct pw_client_info *info,
46 const struct pw_client_info *update);
48 struct pw_client_info *
49 pw_client_info_merge(struct pw_client_info *info,
50 const struct pw_client_info *update, bool reset);
52void pw_client_info_free(struct pw_client_info *info);
53
54
55#define PW_CLIENT_EVENT_INFO 0
56#define PW_CLIENT_EVENT_PERMISSIONS 1
57#define PW_CLIENT_EVENT_NUM 2
58
60struct pw_client_events {
61#define PW_VERSION_CLIENT_EVENTS 0
62 uint32_t version;
68 void (*info) (void *data, const struct pw_client_info *info);
79 void (*permissions) (void *data,
80 uint32_t index,
81 uint32_t n_permissions,
82 const struct pw_permission *permissions);
83};
84
85
86#define PW_CLIENT_METHOD_ADD_LISTENER 0
87#define PW_CLIENT_METHOD_ERROR 1
88#define PW_CLIENT_METHOD_UPDATE_PROPERTIES 2
89#define PW_CLIENT_METHOD_GET_PERMISSIONS 3
90#define PW_CLIENT_METHOD_UPDATE_PERMISSIONS 4
91#define PW_CLIENT_METHOD_NUM 5
92
94struct pw_client_methods {
95#define PW_VERSION_CLIENT_METHODS 0
96 uint32_t version;
97
98 int (*add_listener) (void *object,
99 struct spa_hook *listener,
100 const struct pw_client_events *events,
101 void *data);
109 int (*error) (void *object, uint32_t id, int res, const char *message);
115 int (*update_properties) (void *object, const struct spa_dict *props);
116
125 int (*get_permissions) (void *object, uint32_t index, uint32_t num);
139 int (*update_permissions) (void *object, uint32_t n_permissions,
140 const struct pw_permission *permissions);
141};
142
143#define pw_client_method(o,method,version,...) \
144({ \
145 int _res = -ENOTSUP; \
146 spa_interface_call_res((struct spa_interface*)o, \
147 struct pw_client_methods, _res, \
148 method, version, ##__VA_ARGS__); \
149 _res; \
150})
151
152#define pw_client_add_listener(c,...) pw_client_method(c,add_listener,0,__VA_ARGS__)
153#define pw_client_error(c,...) pw_client_method(c,error,0,__VA_ARGS__)
154#define pw_client_update_properties(c,...) pw_client_method(c,update_properties,0,__VA_ARGS__)
155#define pw_client_get_permissions(c,...) pw_client_method(c,get_permissions,0,__VA_ARGS__)
156#define pw_client_update_permissions(c,...) pw_client_method(c,update_permissions,0,__VA_ARGS__)
157
162#ifdef __cplusplus
163} /* extern "C" */
164#endif
165
166#endif /* PIPEWIRE_CLIENT_H */
defs.h
spa/utils/defs.h
pw_client_info_free
void pw_client_info_free(struct pw_client_info *info)
Free a pw_client_info.
Definition introspect.c:509
pw_client_info_update
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:502
pw_client_info_merge
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:476
param.h
spa/param/param.h
permission.h
pipewire/permission.h
proxy.h
pipewire/proxy.h
pw_client_events
Client events.
Definition client.h:73
pw_client_events::version
uint32_t version
Definition client.h:76
pw_client_events::info
void(* info)(void *data, const struct pw_client_info *info)
Notify client info.
Definition client.h:82
pw_client_events::permissions
void(* permissions)(void *data, uint32_t index, uint32_t n_permissions, const struct pw_permission *permissions)
Notify a client permission.
Definition client.h:93
pw_client_info
The client information.
Definition client.h:43
pw_client_info::id
uint32_t id
id of the global
Definition client.h:44
pw_client_info::change_mask
uint64_t change_mask
bitfield of changed fields since last call
Definition client.h:49
pw_client_methods
Client methods.
Definition client.h:114
pw_client_methods::update_properties
int(* update_properties)(void *object, const struct spa_dict *props)
Update client properties.
Definition client.h:136
pw_client_methods::update_permissions
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:160
pw_client_methods::error
int(* error)(void *object, uint32_t id, int res, const char *message)
Send an error to a client.
Definition client.h:130
pw_client_methods::get_permissions
int(* get_permissions)(void *object, uint32_t index, uint32_t num)
Get client permissions.
Definition client.h:146
pw_client_methods::version
uint32_t version
Definition client.h:117
pw_client_methods::add_listener
int(* add_listener)(void *object, struct spa_hook *listener, const struct pw_client_events *events, void *data)
Definition client.h:119
pw_client
pw_permission
Definition permission.h:60
spa_dict
Definition utils/dict.h:39
spa_hook
A hook, contains the structure with functions and the data passed to the functions.
Definition hook.h:350