PipeWire  0.3.29
impl-client.h
Go to the documentation of this file.
1 /* PipeWire
2  *
3  * Copyright © 2018 Wim Taymans
4  *
5  * Permission is hereby granted, free of charge, to any person obtaining a
6  * copy of this software and associated documentation files (the "Software"),
7  * to deal in the Software without restriction, including without limitation
8  * the rights to use, copy, modify, merge, publish, distribute, sublicense,
9  * and/or sell copies of the Software, and to permit persons to whom the
10  * Software is furnished to do so, subject to the following conditions:
11  *
12  * The above copyright notice and this permission notice (including the next
13  * paragraph) shall be included in all copies or substantial portions of the
14  * Software.
15  *
16  * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
17  * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
18  * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
19  * THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
20  * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
21  * FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
22  * DEALINGS IN THE SOFTWARE.
23  */
24 
25 #ifndef PIPEWIRE_IMPL_CLIENT_H
26 #define PIPEWIRE_IMPL_CLIENT_H
27 
28 #ifdef __cplusplus
29 extern "C" {
30 #endif
31 
32 #include <spa/utils/hook.h>
33 
79 struct pw_impl_client;
80 
81 #include <pipewire/context.h>
82 #include <pipewire/global.h>
83 #include <pipewire/properties.h>
84 #include <pipewire/resource.h>
85 #include <pipewire/permission.h>
86 
89 #define PW_VERSION_IMPL_CLIENT_EVENTS 0
90  uint32_t version;
91 
93  void (*destroy) (void *data);
94 
96  void (*free) (void *data);
97 
99  void (*initialized) (void *data);
100 
102  void (*info_changed) (void *data, const struct pw_client_info *info);
103 
105  void (*resource_added) (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_impl_client *
118 pw_context_create_client(struct pw_impl_core *core,
119  struct pw_protocol *protocol,
120  struct pw_properties *properties,
121  size_t user_data_size );
122 
124 void pw_impl_client_destroy(struct pw_impl_client *client);
125 
127 int pw_impl_client_register(struct pw_impl_client *client,
128  struct pw_properties *properties);
129 
131 void *pw_impl_client_get_user_data(struct pw_impl_client *client);
132 
134 const struct pw_client_info *pw_impl_client_get_info(struct pw_impl_client *client);
135 
137 int pw_impl_client_update_properties(struct pw_impl_client *client, const struct spa_dict *dict);
138 
140 int pw_impl_client_update_permissions(struct pw_impl_client *client, uint32_t n_permissions,
141  const struct pw_permission *permissions);
142 
144 int pw_impl_client_check_permissions(struct pw_impl_client *client,
145  uint32_t global_id, uint32_t permissions);
146 
148 const struct pw_properties *pw_impl_client_get_properties(struct pw_impl_client *client);
149 
151 struct pw_context *pw_impl_client_get_context(struct pw_impl_client *client);
153 struct pw_protocol *pw_impl_client_get_protocol(struct pw_impl_client *client);
154 
156 struct pw_resource *pw_impl_client_get_core_resource(struct pw_impl_client *client);
157 
159 struct pw_resource *pw_impl_client_find_resource(struct pw_impl_client *client, uint32_t id);
160 
162 struct pw_global *pw_impl_client_get_global(struct pw_impl_client *client);
163 
165 void pw_impl_client_add_listener(struct pw_impl_client *client,
166  struct spa_hook *listener,
167  const struct pw_impl_client_events *events,
168  void *data);
169 
170 
173 void pw_impl_client_set_busy(struct pw_impl_client *client, bool busy);
174 
179 #ifdef __cplusplus
180 }
181 #endif
182 
183 #endif /* PIPEWIRE_IMPL_CLIENT_H */
void pw_impl_client_destroy(struct pw_impl_client *client)
Destroy a previously created client.
Definition: impl-client.c:572
void pw_impl_client_add_listener(struct pw_impl_client *client, struct spa_hook *listener, const struct pw_impl_client_events *events, void *data)
listen to events from this client
Definition: impl-client.c:608
void pw_impl_client_set_busy(struct pw_impl_client *client, bool busy)
Mark the client busy.
Definition: impl-client.c:711
struct pw_context * pw_impl_client_get_context(struct pw_impl_client *client)
Get the context used to create this client.
Definition: impl-client.c:517
const struct pw_client_info * pw_impl_client_get_info(struct pw_impl_client *client)
Get the client information.
Definition: impl-client.c:617
int pw_impl_client_check_permissions(struct pw_impl_client *client, uint32_t global_id, uint32_t permissions)
check if a client has permissions for global_id, Since 0.3.9
Definition: impl-client.c:721
struct pw_impl_client * pw_context_create_client(struct pw_impl_core *core, struct pw_protocol *protocol, struct pw_properties *properties, size_t user_data_size)
Create a new client.
Definition: impl-client.c:382
int pw_impl_client_update_permissions(struct pw_impl_client *client, uint32_t n_permissions, const struct pw_permission *permissions)
Update the client permissions.
Definition: impl-client.c:641
struct pw_resource * pw_impl_client_get_core_resource(struct pw_impl_client *client)
Get the client core resource.
Definition: impl-client.c:529
void * pw_impl_client_get_user_data(struct pw_impl_client *client)
Get the client user data.
Definition: impl-client.c:553
const struct pw_properties * pw_impl_client_get_properties(struct pw_impl_client *client)
Get the client properties.
Definition: impl-client.c:547
struct pw_protocol * pw_impl_client_get_protocol(struct pw_impl_client *client)
Get the protocol used to create this client.
Definition: impl-client.c:523
int pw_impl_client_register(struct pw_impl_client *client, struct pw_properties *properties)
Finish configuration and register a client.
Definition: impl-client.c:469
int pw_impl_client_update_properties(struct pw_impl_client *client, const struct spa_dict *dict)
Update the client properties.
Definition: impl-client.c:633
struct pw_global * pw_impl_client_get_global(struct pw_impl_client *client)
Get the global associated with this client.
Definition: impl-client.c:541
struct pw_resource * pw_impl_client_find_resource(struct pw_impl_client *client, uint32_t id)
Get a resource with the given id.
Definition: impl-client.c:535
Definition: filter.c:75
The client information.
Definition: client.h:55
The events that a client can emit.
Definition: impl-client.h:88
void(* busy_changed)(void *data, bool busy)
emitted when the client becomes busy processing an asynchronous message.
Definition: impl-client.h:113
uint32_t version
Definition: impl-client.h:90
void(* initialized)(void *data)
the client is initialized
Definition: impl-client.h:99
void(* resource_added)(void *data, struct pw_resource *resource)
emitted when a new resource is added for client
Definition: impl-client.h:105
void(* info_changed)(void *data, const struct pw_client_info *info)
emitted when the client info changed
Definition: impl-client.h:102
void(* destroy)(void *data)
emitted when the client is destroyed
Definition: impl-client.h:93
void(* free)(void *data)
emitted right before the client is freed
Definition: impl-client.h:96
void(* resource_removed)(void *data, struct pw_resource *resource)
emitted when a resource is removed
Definition: impl-client.h:108
Definition: permission.h:64
Definition: properties.h:49
Definition: utils/dict.h:48
A hook, contains the structure with functions and the data passed to the functions.
Definition: hook.h:76