client.h
Go to the documentation of this file.
/* PipeWire
*
* Copyright © 2018 Wim Taymans
*
* Permission is hereby granted, free of charge, to any person obtaining a
* copy of this software and associated documentation files (the "Software"),
* to deal in the Software without restriction, including without limitation
* the rights to use, copy, modify, merge, publish, distribute, sublicense,
* and/or sell copies of the Software, and to permit persons to whom the
* Software is furnished to do so, subject to the following conditions:
*
* The above copyright notice and this permission notice (including the next
* paragraph) shall be included in all copies or substantial portions of the
* Software.
*
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
* THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
* FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
* DEALINGS IN THE SOFTWARE.
*/
#ifndef PIPEWIRE_CLIENT_H
#define PIPEWIRE_CLIENT_H
#ifdef __cplusplus
extern "C" {
#endif
#include <spa/utils/defs.h>
#include <spa/param/param.h>
#include <pipewire/proxy.h>
#include <pipewire/permission.h>
#define PW_TYPE_INTERFACE_Client PW_TYPE_INFO_INTERFACE_BASE "Client"
#define PW_VERSION_CLIENT 3
struct pw_client;
/* 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 *object, const struct pw_client_info *info);
void (*permissions) (void *object,
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);
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);
};
#define pw_client_method(o,method,version,...) \
({ \
int _res = -ENOTSUP; \
spa_interface_call_res((struct spa_interface*)o, \
struct pw_client_methods, _res, \
method, version, ##__VA_ARGS__); \
_res; \
})
#define pw_client_add_listener(c,...) pw_client_method(c,add_listener,0,__VA_ARGS__)
#define pw_client_error(c,...) pw_client_method(c,error,0,__VA_ARGS__)
#define pw_client_update_properties(c,...) pw_client_method(c,update_properties,0,__VA_ARGS__)
#define pw_client_get_permissions(c,...) pw_client_method(c,get_permissions,0,__VA_ARGS__)
#define pw_client_update_permissions(c,...) pw_client_method(c,update_permissions,0,__VA_ARGS__)
#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:505
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:472
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:498
param.h
spa/param/param.h
permission.h
pipewire/permission.h
proxy.h
pipewire/proxy.h
pw_client_events
Client events.
Definition: client.h:93
pw_client_events::version
uint32_t version
Definition: client.h:96
pw_client_events::info
void(* info)(void *object, const struct pw_client_info *info)
Notify client info.
Definition: client.h:102
pw_client_events::permissions
void(* permissions)(void *object, uint32_t index, uint32_t n_permissions, const struct pw_permission *permissions)
Notify a client permission.
Definition: client.h:113
pw_client_info
The client information.
Definition: client.h:63
pw_client_info::id
uint32_t id
id of the global
Definition: client.h:64
pw_client_info::change_mask
uint64_t change_mask
bitfield of changed fields since last call
Definition: client.h:69
pw_client_methods
Client methods.
Definition: client.h:134
pw_client_methods::update_properties
int(* update_properties)(void *object, const struct spa_dict *props)
Update client properties.
Definition: client.h:156
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:180
pw_client_methods::error
int(* error)(void *object, uint32_t id, int res, const char *message)
Send an error to a client.
Definition: client.h:150
pw_client_methods::get_permissions
int(* get_permissions)(void *object, uint32_t index, uint32_t num)
Get client permissions.
Definition: client.h:166
pw_client_methods::version
uint32_t version
Definition: client.h:137
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:139
pw_client
pw_permission
Definition: permission.h:80
pw_permission::permissions
uint32_t permissions
bitmask of above permissions
Definition: permission.h:82
spa_dict
Definition: dict.h:59
spa_hook
A hook, contains the structure with functions and the data passed to the functions.
Definition: hook.h:342