Go to the documentation of this file.
20 #ifndef __PIPEWIRE_CLIENT_H__
21 #define __PIPEWIRE_CLIENT_H__
27 #include <spa/utils/hook.h>
47 #define PW_TYPE__Client PW_TYPE_OBJECT_BASE "Client"
48 #define PW_TYPE_CLIENT_BASE PW_TYPE__Client ":"
82 #define PW_VERSION_CLIENT_EVENTS 0
111 #define PW_CLIENT_PROP_PROTOCOL "pipewire.protocol"
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"
122 size_t user_data_size );
162 struct spa_hook *listener,
SPA_EXPORT int pw_global_register(struct pw_global *global, struct pw_client *owner, struct pw_global *parent)
register a global to the core registry
Definition: global.c:102
void(* busy_changed)(void *data, bool busy)
emited when the client becomes busy processing an asynchronous message.
Definition: client.h:107
static void * pw_map_lookup(struct pw_map *map, uint32_t id)
Find an item in the map.
Definition: map.h:152
uint32_t permissions
Definition: client.c:32
struct pw_resource * pw_client_get_core_resource(struct pw_client *client)
Get the client core resource.
Definition: client.c:247
const struct pw_properties * pw_client_get_properties(struct pw_client *client)
Get the client properties.
Definition: client.c:265
SPA_EXPORT void pw_global_destroy(struct pw_global *global)
Destroy a global.
Definition: global.c:241
static void pw_map_init(struct pw_map *map, size_t size, size_t extend)
Initialize a map.
Definition: map.h:70
int pw_core_for_each_global(struct pw_core *core, int(*callback)(void *data, struct pw_global *global), void *data)
Iterate the globals of the core.
Definition: core.c:613
SPA_EXPORT 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
SPA_EXPORT 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
PipeWire client object class.
void pw_core_add_listener(struct pw_core *core, struct spa_hook *listener, const struct pw_core_events *events, void *data)
Add a new event listener to a core.
Definition: core.c:543
struct spa_hook resource_listener
Definition: factory.c:27
Global events, use pw_global_add_listener.
Definition: global.h:59
uint32_t permissions
Definition: client.c:390
#define PW_CORE_PROXY_PERMISSIONS_EXISTING
Key to update specific permissions of all existing globals.
Definition: interfaces.h:99
#define PW_PERM_RWX
Definition: core.h:80
void(* resource_impl)(void *data, struct pw_resource *resource)
emited when an implementation is set on a resource.
Definition: client.h:99
void pw_global_add_listener(struct pw_global *global, struct spa_hook *listener, const struct pw_global_events *events, void *data)
Add an event listener on the global.
Definition: global.c:190
SPA_EXPORT int pw_client_update_permissions(struct pw_client *client, const struct spa_dict *dict)
Update the client permissions.
Definition: client.c:452
A global object visible to remote clients.
void * pw_client_get_user_data(struct pw_client *client)
Get the client user data.
Definition: client.c:271
void pw_client_set_busy(struct pw_client *client, bool busy)
Mark the client busy.
Definition: client.c:514
struct pw_core * pw_client_get_core(struct pw_client *client)
Get the core used to create this client.
Definition: client.c:241
#define PW_PERM_R
object can be seen and events can be received
Definition: core.h:76
struct spa_dict dict
Definition: properties.h:39
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
static int pw_map_for_each(struct pw_map *map, int(*func)(void *item_data, void *data), void *data)
Iterate all map items.
Definition: map.h:171
An array object.
Definition: array.h:36
SPA_EXPORT struct pw_global * pw_global_new(struct pw_core *core, uint32_t type, uint32_t version, struct pw_properties *properties, void *object)
Create a new global.
Definition: global.c:61
void(* resource_added)(void *data, struct pw_resource *resource)
emited when a new resource is added for client
Definition: client.h:95
struct pw_global * pw_client_get_global(struct pw_client *client)
Get the global associated with this client.
Definition: client.c:259
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
bool only_new
Definition: client.c:391
#define PW_VERSION_CLIENT
Definition: interfaces.h:664
SPA_EXPORT struct pw_resource * pw_client_get_core_resource(struct pw_client *client)
Get the client core resource.
Definition: client.c:247
#define PW_CORE_PROXY_PERMISSIONS_DEFAULT
Key to update default permissions of globals without specific permissions.
Definition: interfaces.h:84
struct pw_resource * pw_resource_new(struct pw_client *client, uint32_t id, uint32_t permissions, uint32_t type, uint32_t version, size_t user_data_size)
Make a new resource for client.
Definition: resource.c:34
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
uint32_t version
Definition: client.h:83
#define PW_VERSION_RESOURCE_EVENTS
Definition: resource.h:63
The client information.
Definition: introspect.h:125
void pw_resource_error(struct pw_resource *resource, int result, const char *error)
Generate an error for a resource.
Definition: resource.c:162
void * pw_resource_get_user_data(struct pw_resource *resource)
Get the user data for the resource, the size was given in pw_resource_new.
Definition: resource.c:113
static void pw_map_clear(struct pw_map *map)
Clear a map.
Definition: map.h:81
#define PW_VERSION_CORE_EVENTS
Definition: core.h:88
#define PW_CORE_PROXY_PERMISSIONS_GLOBAL
Key to update specific permissions of a global.
Definition: interfaces.h:91
int pw_client_update_permissions(struct pw_client *client, const struct spa_dict *dict)
Update the client permissions.
Definition: client.c:452
static void * pw_array_add(struct pw_array *arr, size_t size)
Add ref size bytes to arr.
Definition: array.h:98
#define pw_array_get_len(a, t)
Get the number of items of type t in array.
Definition: array.h:50
SPA_EXPORT int pw_properties_set(struct pw_properties *properties, const char *key, const char *value)
Set a property value.
Definition: properties.c:308
SPA_EXPORT struct pw_core * pw_client_get_core(struct pw_client *client)
Get the core used to create this client.
Definition: client.c:241
void pw_resource_destroy(struct pw_resource *resource)
Destroy a resource.
Definition: resource.c:169
#define PW_VERSION_GLOBAL_EVENTS
Definition: global.h:60
SPA_EXPORT const struct pw_properties * pw_client_get_properties(struct pw_client *client)
Get the client properties.
Definition: client.c:265
void(* destroy)(void *data)
emited when the client is destroyed
Definition: client.h:86
SPA_EXPORT struct pw_global * pw_client_get_global(struct pw_client *client)
Get the global associated with this client.
Definition: client.c:259
struct pw_client * client
Definition: client.c:389
SPA_EXPORT const char * pw_properties_get(const struct pw_properties *properties, const char *key)
Get a property.
Definition: properties.c:361
void(* free)(void *data)
emited right before the client is freed
Definition: client.h:89
#define PW_PERM_W
methods can be called that modify the object
Definition: core.h:77
#define pw_array_get_unchecked(a, idx, t)
Get the item with index idx and type t from array.
Definition: array.h:52
struct pw_control this
Definition: control.c:26
The events that a client can emit.
Definition: client.h:81
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_properties * pw_properties_new(const char *key,...)
Make a new properties object.
Definition: properties.c:89
#define pw_array_check_index(a, idx, t)
Check if an item with index idx and type t exist in array.
Definition: array.h:54
void pw_log_error(const char *format,...)
Log an error message.
struct pw_global * pw_core_find_global(struct pw_core *core, uint32_t id)
Find a core global by id.
Definition: core.c:631
SPA_EXPORT 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
void(* info_changed)(void *data, struct pw_client_info *info)
emited when the client info changed
Definition: client.h:92
#define pw_client_resource_info(r,...)
Definition: interfaces.h:691
SPA_EXPORT int pw_client_update_properties(struct pw_client *client, const struct spa_dict *dict)
Update client properties.
Definition: client.c:353
void(* resource_removed)(void *data, struct pw_resource *resource)
emited when a resource is removed
Definition: client.h:102
SPA_EXPORT void pw_client_destroy(struct pw_client *client)
Destroy a client object.
Definition: client.c:291
#define PW_CLIENT_CHANGE_MASK_PROPS
Definition: introspect.h:127
Resource events.
Definition: resource.h:62
SPA_EXPORT const struct pw_client_info * pw_client_get_info(struct pw_client *client)
Get the client information.
Definition: client.c:336
SPA_EXPORT void pw_client_set_busy(struct pw_client *client, bool busy)
Mark the client busy.
Definition: client.c:514
void pw_resource_add_listener(struct pw_resource *resource, struct spa_hook *listener, const struct pw_resource_events *events, void *data)
Add an event listener.
Definition: resource.c:119
uint32_t id
Definition: client.c:31
#define PW_PERM_X
methods can be called on the object.
Definition: core.h:78
uint32_t version
Definition: resource.h:64
void pw_log_warn(const char *format,...)
Log a warning message.
void pw_log_debug(const char *format,...)
Log a debug message.
SPA_EXPORT void * pw_client_get_user_data(struct pw_client *client)
Get the client user data.
Definition: client.c:271
A collection of key/value pairs.
Definition: properties.h:38
SPA_EXPORT void pw_properties_free(struct pw_properties *properties)
Free a properties object.
Definition: properties.c:245
const struct pw_client_info * pw_client_get_info(struct pw_client *client)
Get the client information.
Definition: client.c:336
static void pw_array_init(struct pw_array *arr, size_t extend)
Initialize the array with given extend.
Definition: array.h:62
core events emited by the core object added with pw_core_add_listener
Definition: core.h:87