PipeWire  0.2.7
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 #include <spa/utils/hook.h>
28 
39 struct pw_client;
40 
41 #include <pipewire/core.h>
42 #include <pipewire/global.h>
43 #include <pipewire/introspect.h>
44 #include <pipewire/properties.h>
45 #include <pipewire/resource.h>
46 
47 #define PW_TYPE__Client PW_TYPE_OBJECT_BASE "Client"
48 #define PW_TYPE_CLIENT_BASE PW_TYPE__Client ":"
49 
82 #define PW_VERSION_CLIENT_EVENTS 0
83  uint32_t version;
84 
86  void (*destroy) (void *data);
87 
89  void (*free) (void *data);
90 
92  void (*info_changed) (void *data, struct pw_client_info *info);
93 
95  void (*resource_added) (void *data, struct pw_resource *resource);
96 
99  void (*resource_impl) (void *data, struct pw_resource *resource);
100 
102  void (*resource_removed) (void *data, struct pw_resource *resource);
103 
107  void (*busy_changed) (void *data, bool busy);
108 };
109 
111 #define PW_CLIENT_PROP_PROTOCOL "pipewire.protocol"
112 
113 #define PW_CLIENT_PROP_UCRED_PID "pipewire.ucred.pid"
114 #define PW_CLIENT_PROP_UCRED_UID "pipewire.ucred.uid"
115 #define PW_CLIENT_PROP_UCRED_GID "pipewire.ucred.gid"
116 #define PW_CLIENT_PROP_SEC_LABEL "pipewire.sec.label"
119 struct pw_client *
120 pw_client_new(struct pw_core *core,
121  struct pw_properties *properties,
122  size_t user_data_size );
123 
125 void pw_client_destroy(struct pw_client *client);
126 
128 int pw_client_register(struct pw_client *client,
129  struct pw_client *owner,
130  struct pw_global *parent,
131  struct pw_properties *properties);
132 
134 void *pw_client_get_user_data(struct pw_client *client);
135 
137 const struct pw_client_info *pw_client_get_info(struct pw_client *client);
138 
140 int pw_client_update_properties(struct pw_client *client, const struct spa_dict *dict);
141 
143 int pw_client_update_permissions(struct pw_client *client, const struct spa_dict *dict);
144 
146 const struct pw_properties *pw_client_get_properties(struct pw_client *client);
147 
149 struct pw_core *pw_client_get_core(struct pw_client *client);
150 
152 struct pw_resource *pw_client_get_core_resource(struct pw_client *client);
153 
155 struct pw_resource *pw_client_find_resource(struct pw_client *client, uint32_t id);
156 
158 struct pw_global *pw_client_get_global(struct pw_client *client);
159 
161 void pw_client_add_listener(struct pw_client *client,
162  struct spa_hook *listener,
163  const struct pw_client_events *events,
164  void *data);
165 
166 
169 void pw_client_set_busy(struct pw_client *client, bool busy);
170 
171 #ifdef __cplusplus
172 }
173 #endif
174 
175 #endif /* __PIPEWIRE_CLIENT_H__ */
const struct pw_client_info * pw_client_get_info(struct pw_client *client)
Get the client information.
Definition: client.c:336
A collection of key/value pairs.
Definition: properties.h:38
struct pw_resource * pw_client_get_core_resource(struct pw_client *client)
Get the client core resource.
Definition: client.c:247
void pw_client_set_busy(struct pw_client *client, bool busy)
Mark the client busy.
Definition: client.c:514
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:327
the core PipeWire object
const struct pw_properties * pw_client_get_properties(struct pw_client *client)
Get the client properties.
Definition: client.c:265
SPA_EXPORT int pw_client_update_properties(struct pw_client *client, const struct spa_dict *dict)
Update client properties.
Definition: client.c:353
void(* info_changed)(void *data, struct pw_client_info *info)
emited when the client info changed
Definition: client.h:92
struct pw_global * pw_client_get_global(struct pw_client *client)
Get the global associated with this client.
Definition: client.c:259
void * pw_client_get_user_data(struct pw_client *client)
Get the client user data.
Definition: client.c:271
struct pw_core * pw_client_get_core(struct pw_client *client)
Get the core used to create this client.
Definition: client.c:241
void(* resource_removed)(void *data, struct pw_resource *resource)
emited when a resource is removed
Definition: client.h:102
The client information.
Definition: introspect.h:125
SPA_EXPORT void pw_client_destroy(struct pw_client *client)
Destroy a client object.
Definition: client.c:291
PipeWire client object class.
Client owned objects.
void(* resource_added)(void *data, struct pw_resource *resource)
emited when a new resource is added for client
Definition: client.h:95
uint32_t version
Definition: client.h:83
A global object visible to remote clients.
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:211
struct pw_resource * pw_client_find_resource(struct pw_client *client, uint32_t id)
Get a resource with the given id.
Definition: client.c:253
SPA_EXPORT struct pw_client * pw_client_new(struct pw_core *core, struct pw_properties *properties, size_t user_data_size)
Make a new client object.
Definition: client.c:152
The events that a client can emit.
Definition: client.h:81
void(* resource_impl)(void *data, struct pw_resource *resource)
emited when an implementation is set on a resource.
Definition: client.h:99
void(* free)(void *data)
emited right before the client is freed
Definition: client.h:89
void(* busy_changed)(void *data, bool busy)
emited when the client becomes busy processing an asynchronous message.
Definition: client.h:107
int pw_client_update_permissions(struct pw_client *client, const struct spa_dict *dict)
Update the client permissions.
Definition: client.c:452
void(* destroy)(void *data)
emited when the client is destroyed
Definition: client.h:86