PipeWire  0.3.66
impl-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_IMPL_CLIENT_H
6 #define PIPEWIRE_IMPL_CLIENT_H
7 
8 #ifdef __cplusplus
9 extern "C" {
10 #endif
11 
12 #include <spa/utils/hook.h>
13 
61 struct pw_impl_client;
62 
63 #include <pipewire/context.h>
64 #include <pipewire/global.h>
66 #include <pipewire/resource.h>
67 #include <pipewire/permission.h>
68 
70 struct pw_impl_client_events {
71 #define PW_VERSION_IMPL_CLIENT_EVENTS 0
72  uint32_t version;
73 
75  void (*destroy) (void *data);
76 
78  void (*free) (void *data);
79 
81  void (*initialized) (void *data);
82 
84  void (*info_changed) (void *data, const struct pw_client_info *info);
85 
87  void (*resource_added) (void *data, struct pw_resource *resource);
88 
90  void (*resource_removed) (void *data, struct pw_resource *resource);
91 
95  void (*busy_changed) (void *data, bool busy);
96 };
97 
99 struct pw_impl_client *
101  struct pw_protocol *protocol,
102  struct pw_properties *properties,
103  size_t user_data_size );
104 
106 void pw_impl_client_destroy(struct pw_impl_client *client);
107 
109 int pw_impl_client_register(struct pw_impl_client *client,
110  struct pw_properties *properties);
111 
113 void *pw_impl_client_get_user_data(struct pw_impl_client *client);
114 
116 const struct pw_client_info *pw_impl_client_get_info(struct pw_impl_client *client);
117 
119 int pw_impl_client_update_properties(struct pw_impl_client *client, const struct spa_dict *dict);
120 
122 int pw_impl_client_update_permissions(struct pw_impl_client *client, uint32_t n_permissions,
123  const struct pw_permission *permissions);
124 
127  uint32_t global_id, uint32_t permissions);
128 
130 const struct pw_properties *pw_impl_client_get_properties(struct pw_impl_client *client);
131 
136 
139 
141 struct pw_resource *pw_impl_client_find_resource(struct pw_impl_client *client, uint32_t id);
142 
144 struct pw_global *pw_impl_client_get_global(struct pw_impl_client *client);
145 
147 void pw_impl_client_add_listener(struct pw_impl_client *client,
148  struct spa_hook *listener,
149  const struct pw_impl_client_events *events,
150  void *data);
151 
152 
155 void pw_impl_client_set_busy(struct pw_impl_client *client, bool busy);
156 
161 #ifdef __cplusplus
162 }
163 #endif
164 
165 #endif /* PIPEWIRE_IMPL_CLIENT_H */
pipewire/global.h
void pw_impl_client_destroy(struct pw_impl_client *client)
Destroy a previously created client.
Definition: impl-client.c:602
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:629
void pw_impl_client_set_busy(struct pw_impl_client *client, bool busy)
Mark the client busy.
Definition: impl-client.c:732
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:520
const struct pw_client_info * pw_impl_client_get_info(struct pw_impl_client *client)
Get the client information.
Definition: impl-client.c:638
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:742
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:380
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:662
struct pw_resource * pw_impl_client_get_core_resource(struct pw_impl_client *client)
Get the client core resource.
Definition: impl-client.c:532
void * pw_impl_client_get_user_data(struct pw_impl_client *client)
Get the client user data.
Definition: impl-client.c:556
const struct pw_properties * pw_impl_client_get_properties(struct pw_impl_client *client)
Get the client properties.
Definition: impl-client.c:550
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:526
int pw_impl_client_register(struct pw_impl_client *client, struct pw_properties *properties)
Finish configuration and register a client.
Definition: impl-client.c:468
int pw_impl_client_update_properties(struct pw_impl_client *client, const struct spa_dict *dict)
Update the client properties.
Definition: impl-client.c:654
struct pw_global * pw_impl_client_get_global(struct pw_impl_client *client)
Get the global associated with this client.
Definition: impl-client.c:544
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:538
spa/utils/hook.h
pipewire/permission.h
pipewire/properties.h
pipewire/resource.h
pipewire/context.h
The client information.
Definition: client.h:43
Definition: src/pipewire/context.h:47
The events that a client can emit.
Definition: impl-client.h:75
void(* busy_changed)(void *data, bool busy)
emitted when the client becomes busy processing an asynchronous message.
Definition: impl-client.h:101
uint32_t version
Definition: impl-client.h:78
void(* initialized)(void *data)
the client is initialized
Definition: impl-client.h:87
void(* resource_added)(void *data, struct pw_resource *resource)
emitted when a new resource is added for client
Definition: impl-client.h:93
void(* info_changed)(void *data, const struct pw_client_info *info)
emitted when the client info changed
Definition: impl-client.h:90
void(* destroy)(void *data)
emitted when the client is destroyed
Definition: impl-client.h:81
void(* free)(void *data)
emitted right before the client is freed
Definition: impl-client.h:84
void(* resource_removed)(void *data, struct pw_resource *resource)
emitted when a resource is removed
Definition: impl-client.h:96
Definition: permission.h:60
Definition: properties.h:33
Definition: impl.h:29
Definition: utils/dict.h:39
A hook, contains the structure with functions and the data passed to the functions.
Definition: hook.h:331