PipeWire 0.1.9

client.h
Go to the documentation of this file.
1 /* PipeWire
2 * Copyright (C) 2015 Wim Taymans <wim.taymans@gmail.com>
3 *
4 * This library is free software; you can redistribute it and/or
5 * modify it under the terms of the GNU Library General Public
6 * License as published by the Free Software Foundation; either
7 * version 2 of the License, or (at your option) any later version.
8 *
9 * This library is distributed in the hope that it will be useful,
10 * but WITHOUT ANY WARRANTY; without even the implied warranty of
11 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
12 * Library General Public License for more details.
13 *
14 * You should have received a copy of the GNU Library General Public
15 * License along with this library; if not, write to the
16 * Free Software Foundation, Inc., 51 Franklin St, Fifth Floor,
17 * Boston, MA 02110-1301, USA.
18 */
19
20 #ifndef __PIPEWIRE_CLIENT_H__
21 #define __PIPEWIRE_CLIENT_H__
22
23 #ifdef __cplusplus
24 extern "C" {
25 #endif
26
27 #ifndef __USE_GNU
28 #define __USE_GNU
29 #endif
30
31 #include <sys/socket.h>
32
33 #include <spa/utils/hook.h>
34
45 struct pw_client;
46
47 #include <pipewire/core.h>
48 #include <pipewire/global.h>
49 #include <pipewire/introspect.h>
50 #include <pipewire/properties.h>
51 #include <pipewire/resource.h>
52
53 #define PW_TYPE__Client PW_TYPE_OBJECT_BASE "Client"
54 #define PW_TYPE_CLIENT_BASE PW_TYPE__Client ":"
55
87 struct pw_client_events {
88 #define PW_VERSION_CLIENT_EVENTS 0
89 uint32_t version;
90
92 void (*destroy) (void *data);
93
95 void (*free) (void *data);
96
98 void (*info_changed) (void *data, struct pw_client_info *info);
99
101 void (*resource_added) (void *data, struct pw_resource *resource);
102
105 void (*resource_impl) (void *data, struct pw_resource *resource);
106
108 void (*resource_removed) (void *data, struct pw_resource *resource);
109
113 void (*busy_changed) (void *data, bool busy);
114 };
115
117 #define PW_CLIENT_PROP_PROTOCOL "pipewire.protocol"
118
119 #define PW_CLIENT_PROP_UCRED_PID "pipewire.ucred.pid"
120 #define PW_CLIENT_PROP_UCRED_UID "pipewire.ucred.uid"
121 #define PW_CLIENT_PROP_UCRED_GID "pipewire.ucred.gid"
124 struct pw_client *
125 pw_client_new(struct pw_core *core,
126 struct ucred *ucred,
127 struct pw_properties *properties,
128 size_t user_data_size );
129
131 void pw_client_destroy(struct pw_client *client);
132
134 int pw_client_register(struct pw_client *client,
135 struct pw_client *owner,
136 struct pw_global *parent,
137 struct pw_properties *properties);
138
140 void *pw_client_get_user_data(struct pw_client *client);
141
143 const struct pw_client_info *pw_client_get_info(struct pw_client *client);
144
146 int pw_client_update_properties(struct pw_client *client, const struct spa_dict *dict);
147
149 int pw_client_update_permissions(struct pw_client *client, const struct spa_dict *dict);
150
152 const struct pw_properties *pw_client_get_properties(struct pw_client *client);
153
155 struct pw_core *pw_client_get_core(struct pw_client *client);
156
158 struct pw_resource *pw_client_get_core_resource(struct pw_client *client);
159
161 struct pw_resource *pw_client_find_resource(struct pw_client *client, uint32_t id);
162
164 struct pw_global *pw_client_get_global(struct pw_client *client);
165
167 const struct ucred *pw_client_get_ucred(struct pw_client *client);
168
170 void pw_client_add_listener(struct pw_client *client,
171 struct spa_hook *listener,
172 const struct pw_client_events *events,
173 void *data);
174
175
178 void pw_client_set_busy(struct pw_client *client, bool busy);
179
180 #ifdef __cplusplus
181 }
182 #endif
183
184 #endif /* __PIPEWIRE_CLIENT_H__ */
pw_client_get_info
const struct pw_client_info * pw_client_get_info(struct pw_client *client)
Get the client information.
Definition: client.c:338
pw_client_events::resource_impl
void(* resource_impl)(void *data, struct pw_resource *resource)
emited when an implementation is set on a resource.
Definition: client.h:105
pw_properties
A collection of key/value pairs.
Definition: properties.h:38
pw_client::pw_client_destroy
void pw_client_destroy(struct pw_client *client)
Destroy a client object.
Definition: client.c:294
pw_client_get_core_resource
struct pw_resource * pw_client_get_core_resource(struct pw_client *client)
Get the client core resource.
Definition: client.c:249
pw_client_events::free
void(* free)(void *data)
emited right before the client is freed
Definition: client.h:95
introspect.h
pw_client_events::resource_removed
void(* resource_removed)(void *data, struct pw_resource *resource)
emited when a resource is removed
Definition: client.h:108
pw_client_get_ucred
const struct ucred * pw_client_get_ucred(struct pw_client *client)
Get the ucred from a client or NULL when not specified/valid.
Definition: client.c:269
pw_client_set_busy
void pw_client_set_busy(struct pw_client *client, bool busy)
Mark the client busy.
Definition: client.c:502
pw_client_add_listener
void pw_client_add_listener(struct pw_client *client, struct spa_hook *listener, const struct pw_client_events *events, void *data)
listen to events from this client
Definition: client.c:330
core.h
pw_client_events::busy_changed
void(* busy_changed)(void *data, bool busy)
emited when the client becomes busy processing an asynchronous message.
Definition: client.h:113
pw_core
the core PipeWire object
pw_client_get_properties
const struct pw_properties * pw_client_get_properties(struct pw_client *client)
Get the client properties.
Definition: client.c:264
global.h
pw_client_events::info_changed
void(* info_changed)(void *data, struct pw_client_info *info)
emited when the client info changed
Definition: client.h:98
pw_client::pw_client_new
struct pw_client * pw_client_new(struct pw_core *core, struct ucred *ucred, struct pw_properties *properties, size_t user_data_size)
Make a new client object.
Definition: client.c:151
pw_client_get_global
struct pw_global * pw_client_get_global(struct pw_client *client)
Get the global associated with this client.
Definition: client.c:259
pw_client_get_user_data
void * pw_client_get_user_data(struct pw_client *client)
Get the client user data.
Definition: client.c:277
pw_client_get_core
struct pw_core * pw_client_get_core(struct pw_client *client)
Get the core used to create this client.
Definition: client.c:244
pw_client_info
The client information.
Definition: introspect.h:125
resource.h
pw_client
PipeWire client object class.
pw_resource
Client owned objects.
properties.h
pw_client_events::destroy
void(* destroy)(void *data)
emited when the client is destroyed
Definition: client.h:92
pw_client_events::version
uint32_t version
Definition: client.h:89
pw_global
A global object visible to remote clients.
pw_client_register
int pw_client_register(struct pw_client *client, struct pw_client *owner, struct pw_global *parent, struct pw_properties *properties)
Finish configuration and register a client.
Definition: client.c:218
pw_client_events::resource_added
void(* resource_added)(void *data, struct pw_resource *resource)
emited when a new resource is added for client
Definition: client.h:101
pw_client_find_resource
struct pw_resource * pw_client_find_resource(struct pw_client *client, uint32_t id)
Get a resource with the given id.
Definition: client.c:254
pw_client::pw_client_update_properties
int pw_client_update_properties(struct pw_client *client, const struct spa_dict *dict)
Update client properties.
Definition: client.c:354
pw_client_events
The events that a client can emit.
Definition: client.h:87
pw_client_update_permissions
int pw_client_update_permissions(struct pw_client *client, const struct spa_dict *dict)
Update the client permissions.
Definition: client.c:441