Loading...
Searching...
No Matches
client.h
Go to the documentation of this file.
/* PipeWire */
/* SPDX-FileCopyrightText: Copyright © 2018 Wim Taymans */
/* SPDX-License-Identifier: MIT */
#ifndef PIPEWIRE_CLIENT_H
#define PIPEWIRE_CLIENT_H
#include <spa/utils/defs.h>
#include <spa/param/param.h>
#include <pipewire/type.h>
#include <pipewire/proxy.h>
#include <pipewire/permission.h>
#ifdef __cplusplus
extern "C" {
#endif
#define PW_TYPE_INTERFACE_Client PW_TYPE_INFO_INTERFACE_BASE "Client"
#define PW_CLIENT_PERM_MASK PW_PERM_RWXM
#define PW_VERSION_CLIENT 3
struct pw_client;
#ifndef PW_API_CLIENT_IMPL
#define PW_API_CLIENT_IMPL static inline
#endif
/* default ID of the current client after connect */
#define PW_ID_CLIENT 1
struct pw_client_info {
uint32_t id;
#define PW_CLIENT_CHANGE_MASK_PROPS (1 << 0)
#define PW_CLIENT_CHANGE_MASK_ALL ((1 << 1)-1)
uint64_t change_mask;
struct spa_dict *props;
};
struct pw_client_info *
pw_client_info_update(struct pw_client_info *info,
const struct pw_client_info *update);
struct pw_client_info *
pw_client_info_merge(struct pw_client_info *info,
const struct pw_client_info *update, bool reset);
void pw_client_info_free(struct pw_client_info *info);
#define PW_CLIENT_EVENT_INFO 0
#define PW_CLIENT_EVENT_PERMISSIONS 1
#define PW_CLIENT_EVENT_NUM 2
struct pw_client_events {
#define PW_VERSION_CLIENT_EVENTS 0
uint32_t version;
void (*info) (void *data, const struct pw_client_info *info);
* \param index the index of the first permission entry
* \param n_permissions the number of permissions
* \param permissions the permissions
*/
void (*permissions) (void *data,
uint32_t index,
uint32_t n_permissions,
const struct pw_permission *permissions);
};
#define PW_CLIENT_METHOD_ADD_LISTENER 0
#define PW_CLIENT_METHOD_ERROR 1
#define PW_CLIENT_METHOD_UPDATE_PROPERTIES 2
#define PW_CLIENT_METHOD_GET_PERMISSIONS 3
#define PW_CLIENT_METHOD_UPDATE_PERMISSIONS 4
#define PW_CLIENT_METHOD_NUM 5
struct pw_client_methods {
#define PW_VERSION_CLIENT_METHODS 0
uint32_t version;
int (*add_listener) (void *object,
struct spa_hook *listener,
const struct pw_client_events *events,
void *data);
int (*error) (void *object, uint32_t id, int res, const char *message);
*
* This requires W and X permissions on the client.
*/
int (*update_properties) (void *object, const struct spa_dict *props);
int (*get_permissions) (void *object, uint32_t index, uint32_t num);
int (*update_permissions) (void *object, uint32_t n_permissions,
const struct pw_permission *permissions);
};
PW_API_CLIENT_IMPL int pw_client_add_listener(struct pw_client *object,
struct spa_hook *listener,
const struct pw_client_events *events,
void *data)
{
return spa_api_method_r(int, -ENOTSUP, pw_client, (struct spa_interface*)object, add_listener, 0,
listener, events, data);
}
PW_API_CLIENT_IMPL int pw_client_error(struct pw_client *object, uint32_t id, int res, const char *message)
{
return spa_api_method_r(int, -ENOTSUP, pw_client, (struct spa_interface*)object, error, 0,
id, res, message);
}
PW_API_CLIENT_IMPL int pw_client_update_properties(struct pw_client *object, const struct spa_dict *props)
{
return spa_api_method_r(int, -ENOTSUP, pw_client, (struct spa_interface*)object, update_properties, 0,
props);
}
* \sa pw_client_methods.get_permissions */
PW_API_CLIENT_IMPL int pw_client_get_permissions(struct pw_client *object, uint32_t index, uint32_t num)
{
return spa_api_method_r(int, -ENOTSUP, pw_client, (struct spa_interface*)object, get_permissions, 0,
index, num);
}
PW_API_CLIENT_IMPL int pw_client_update_permissions(struct pw_client *object, uint32_t n_permissions,
const struct pw_permission *permissions)
{
return spa_api_method_r(int, -ENOTSUP, pw_client, (struct spa_interface*)object, update_permissions, 0,
n_permissions, permissions);
}
*/
#ifdef __cplusplus
} /* extern "C" */
#endif
#endif /* PIPEWIRE_CLIENT_H */
defs.h
spa/utils/defs.h
pw_client_info_free
void pw_client_info_free(struct pw_client_info *info)
Free a pw_client_info.
Definition introspect.c:514
pw_client_add_listener
PW_API_CLIENT_IMPL int pw_client_add_listener(struct pw_client *object, struct spa_hook *listener, const struct pw_client_events *events, void *data)
Definition client.h:183
pw_client_info_update
struct pw_client_info * pw_client_info_update(struct pw_client_info *info, const struct pw_client_info *update)
Update an existing pw_client_info with update with reset.
Definition introspect.c:507
pw_client_info_merge
struct pw_client_info * pw_client_info_merge(struct pw_client_info *info, const struct pw_client_info *update, bool reset)
Merge an existing pw_client_info with update.
Definition introspect.c:481
pw_client_update_permissions
PW_API_CLIENT_IMPL int pw_client_update_permissions(struct pw_client *object, uint32_t n_permissions, const struct pw_permission *permissions)
Manage the permissions of the global objects for this client.
Definition client.h:214
pw_client_update_properties
PW_API_CLIENT_IMPL int pw_client_update_properties(struct pw_client *object, const struct spa_dict *props)
Update client properties.
Definition client.h:200
pw_client_get_permissions
PW_API_CLIENT_IMPL int pw_client_get_permissions(struct pw_client *object, uint32_t index, uint32_t num)
Get client permissions.
Definition client.h:207
pw_client_error
PW_API_CLIENT_IMPL int pw_client_error(struct pw_client *object, uint32_t id, int res, const char *message)
Send an error to a client.
Definition client.h:193
PW_API_CLIENT_IMPL
#define PW_API_CLIENT_IMPL
Definition client.h:44
id
uint32_t id
Definition core.h:432
message
uint32_t int int const char * message
Definition core.h:433
res
uint32_t int int res
Definition core.h:433
spa_api_method_r
#define spa_api_method_r(rtype, def, type, o, method, version,...)
Definition hook.h:291
param.h
spa/param/param.h
permission.h
pipewire/permission.h
proxy.h
pipewire/proxy.h
type.h
pipewire/type.h
pw_client_events
Client events.
Definition client.h:82
pw_client_events::version
uint32_t version
Definition client.h:85
pw_client_events::permissions
void(* permissions)(void *data, uint32_t index, uint32_t n_permissions, const struct pw_permission *permissions)
Notify a client permission.
Definition client.h:102
pw_client_info
The client information.
Definition client.h:52
pw_client_info::change_mask
uint64_t change_mask
bitfield of changed fields since last call
Definition client.h:58
pw_client_methods
Client methods.
Definition client.h:123
pw_client_methods::update_properties
int(* update_properties)(void *object, const struct spa_dict *props)
Update client properties.
Definition client.h:149
pw_client_methods::update_permissions
int(* update_permissions)(void *object, uint32_t n_permissions, const struct pw_permission *permissions)
Manage the permissions of the global objects for this client.
Definition client.h:177
pw_client_methods::get_permissions
int(* get_permissions)(void *object, uint32_t index, uint32_t num)
Get client permissions.
Definition client.h:161
pw_client_methods::add_listener
int(* add_listener)(void *object, struct spa_hook *listener, const struct pw_client_events *events, void *data)
Definition client.h:128
pw_client
pw_permission
Definition permission.h:69
pw_permission::permissions
uint32_t permissions
bitmask of above permissions
Definition permission.h:71
spa_dict
Definition dict.h:51
spa_hook
A hook, contains the structure with functions and the data passed to the functions.
Definition hook.h:427
spa_interface
Definition hook.h:148