PipeWire  0.1.4
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/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 
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 struct pw_client *
118 pw_client_new(struct pw_core *core,
119  struct pw_global *parent,
120  struct ucred *ucred,
121  struct pw_properties *properties,
122  size_t user_data_size );
123 
125 void pw_client_destroy(struct pw_client *client);
126 
128 void *pw_client_get_user_data(struct pw_client *client);
129 
131 const struct pw_client_info *pw_client_get_info(struct pw_client *client);
132 
134 void pw_client_update_properties(struct pw_client *client, const struct spa_dict *dict);
135 
137 const struct pw_properties *pw_client_get_properties(struct pw_client *client);
138 
140 struct pw_core *pw_client_get_core(struct pw_client *client);
141 
144 
146 struct pw_resource *pw_client_get_resource(struct pw_client *client, uint32_t id);
147 
149 struct pw_global *pw_client_get_global(struct pw_client *client);
150 
152 const struct ucred *pw_client_get_ucred(struct pw_client *client);
153 
155 void pw_client_add_listener(struct pw_client *client,
156  struct spa_hook *listener,
157  const struct pw_client_events *events,
158  void *data);
159 
160 
163 void pw_client_set_busy(struct pw_client *client, bool busy);
164 
165 #ifdef __cplusplus
166 }
167 #endif
168 
169 #endif /* __PIPEWIRE_CLIENT_H__ */
const struct pw_client_info * pw_client_get_info(struct pw_client *client)
Get the client information.
Definition: client.c:217
void(* resource_impl)(void *data, struct pw_resource *resource)
emited when an implementation is set on a resource.
Definition: client.h:105
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:137
void pw_client_destroy(struct pw_client *client)
Destroy a previously created client.
void(* free)(void *data)
emited right before the client is freed
Definition: client.h:95
void(* resource_removed)(void *data, struct pw_resource *resource)
emited when a resource is removed
Definition: client.h:108
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:157
void pw_client_set_busy(struct pw_client *client, bool busy)
Mark the client busy.
Definition: client.c:259
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:209
void(* busy_changed)(void *data, bool busy)
emited when the client becomes busy processing an asynchronous message.
Definition: client.h:113
const struct pw_properties * pw_client_get_properties(struct pw_client *client)
Get the client properties.
Definition: client.c:152
A global object visible to all clients.
Definition: private.h:87
Client owned objects.
Definition: private.h:284
void(* info_changed)(void *data, struct pw_client_info *info)
emited when the client info changed
Definition: client.h:98
struct pw_global * pw_client_get_global(struct pw_client *client)
Get the global associated with this client.
Definition: client.c:147
struct pw_client * client
owner client
Definition: private.h:288
void * pw_client_get_user_data(struct pw_client *client)
Get the client user data.
Definition: client.c:165
struct pw_core * pw_client_get_core(struct pw_client *client)
Get the core used to create this client.
Definition: client.c:132
struct ucred ucred
ucred information
Definition: private.h:67
PipeWire client object class.
Definition: private.h:58
struct pw_resource * pw_client_get_resource(struct pw_client *client, uint32_t id)
Get a resource with the given id.
Definition: client.c:142
The client information.
Definition: introspect.h:119
void(* destroy)(void *data)
emited when the client is destroyed
Definition: client.h:92
uint32_t version
Definition: client.h:89
void(* resource_added)(void *data, struct pw_resource *resource)
emited when a new resource is added for client
Definition: client.h:101
struct pw_core * core
core object
Definition: private.h:59
The events that a client can emit.
Definition: client.h:87
struct pw_properties * properties
Client properties.
Definition: private.h:63
struct pw_client * pw_client_new(struct pw_core *core, struct pw_global *parent, struct ucred *ucred, struct pw_properties *properties, size_t user_data_size)
Create a new client.
void pw_client_update_properties(struct pw_client *client, const struct spa_dict *dict)
Update the client properties.
the core PipeWire object
Definition: private.h:103