pw_client -> pw_impl_client

This commit is contained in:
Wim Taymans 2019-12-11 11:21:43 +01:00
parent d70a47b7fe
commit 95688939bf
40 changed files with 236 additions and 236 deletions

View file

@ -50,7 +50,7 @@ struct impl {
struct spa_hook module_listener;
};
static int check_cmdline(struct pw_client *client, int pid, const char *str)
static int check_cmdline(struct pw_impl_client *client, int pid, const char *str)
{
char path[2048];
int fd;
@ -75,7 +75,7 @@ static int check_cmdline(struct pw_client *client, int pid, const char *str)
return 0;
}
static int check_flatpak(struct pw_client *client, int pid)
static int check_flatpak(struct pw_impl_client *client, int pid)
{
char root_path[2048];
int root_fd, info_fd, res;
@ -112,7 +112,7 @@ static int check_flatpak(struct pw_client *client, int pid)
}
static void
context_check_access(void *data, struct pw_client *client)
context_check_access(void *data, struct pw_impl_client *client)
{
struct impl *impl = data;
struct pw_permission permissions[1];
@ -122,7 +122,7 @@ context_check_access(void *data, struct pw_client *client)
int pid, res;
pid = -EINVAL;
if ((props = pw_client_get_properties(client)) != NULL) {
if ((props = pw_impl_client_get_properties(client)) != NULL) {
if ((str = pw_properties_get(props, PW_KEY_SEC_PID)) != NULL)
pid = atoi(str);
}
@ -175,18 +175,18 @@ context_check_access(void *data, struct pw_client *client)
granted:
pw_log_debug("module %p: client %p access granted", impl, client);
permissions[0] = PW_PERMISSION_INIT(-1, PW_PERM_RWX);
pw_client_update_permissions(client, 1, permissions);
pw_impl_client_update_permissions(client, 1, permissions);
return;
wait_permissions:
pw_log_debug("module %p: client %p wait for permissions", impl, client);
pw_client_update_properties(client, &SPA_DICT_INIT(items, 1));
pw_client_set_busy(client, true);
pw_impl_client_update_properties(client, &SPA_DICT_INIT(items, 1));
pw_impl_client_set_busy(client, true);
return;
blacklisted:
pw_resource_error(pw_client_get_core_resource(client), res, "blacklisted");
pw_client_update_properties(client, &SPA_DICT_INIT(items, 1));
pw_resource_error(pw_impl_client_get_core_resource(client), res, "blacklisted");
pw_impl_client_update_properties(client, &SPA_DICT_INIT(items, 1));
return;
}

View file

@ -101,7 +101,7 @@ static void node_free(void *data)
static void node_initialized(void *data)
{
struct node_data *nd = data;
struct pw_client *client;
struct pw_impl_client *client;
struct pw_resource *bound_resource;
struct pw_global *global;
int res;
@ -117,7 +117,7 @@ static void node_initialized(void *data)
if (res < 0)
goto error_bind;
if ((bound_resource = pw_client_find_resource(client, nd->new_id)) == NULL)
if ((bound_resource = pw_impl_client_find_resource(client, nd->new_id)) == NULL)
goto error_bind;
pw_resource_add_listener(bound_resource, &nd->resource_listener, &resource_events, nd);
@ -144,7 +144,7 @@ static void *create_object(void *_data,
uint32_t new_id)
{
struct factory_data *d = _data;
struct pw_client *client;
struct pw_impl_client *client;
struct pw_node *adapter, *slave;
const char *str, *factory_name;
int res;

View file

@ -69,7 +69,7 @@ static void *create_object(void *_data,
struct pw_factory *this = data->this;
void *result;
struct pw_resource *device_resource;
struct pw_client *client = pw_resource_get_client(resource);
struct pw_impl_client *client = pw_resource_get_client(resource);
int res;
device_resource = pw_resource_new(client, new_id, PW_PERM_RWX, type, version, 0);
@ -88,7 +88,7 @@ static void *create_object(void *_data,
pw_properties_setf(properties, PW_KEY_FACTORY_ID, "%d",
pw_global_get_id(pw_factory_get_global(this)));
pw_properties_setf(properties, PW_KEY_CLIENT_ID, "%d",
pw_global_get_id(pw_client_get_global(client)));
pw_global_get_id(pw_impl_client_get_global(client)));
result = pw_client_device_new(device_resource, properties);
if (result == NULL) {

View file

@ -118,8 +118,8 @@ struct pw_device *pw_client_device_new(struct pw_resource *resource,
{
struct impl *impl;
struct pw_device *device;
struct pw_client *client = pw_resource_get_client(resource);
struct pw_context *context = pw_client_get_context(client);
struct pw_impl_client *client = pw_resource_get_client(resource);
struct pw_context *context = pw_impl_client_get_context(client);
if (properties == NULL)
properties = pw_properties_new(NULL, NULL);

View file

@ -71,7 +71,7 @@ static void *create_object(void *_data,
{
void *result;
struct pw_resource *node_resource;
struct pw_client *client = pw_resource_get_client(resource);
struct pw_impl_client *client = pw_resource_get_client(resource);
int res;
node_resource = pw_resource_new(client, new_id, PW_PERM_RWX, type, version, 0);

View file

@ -119,7 +119,7 @@ struct node {
struct spa_callbacks callbacks;
struct pw_resource *resource;
struct pw_client *client;
struct pw_impl_client *client;
struct spa_source data_source;
int writefd;
@ -1200,7 +1200,7 @@ void pw_client_node_registered(struct pw_client_node *this, struct pw_global *gl
{
struct impl *impl = SPA_CONTAINER_OF(this, struct impl, this);
struct pw_node *node = this->node;
struct pw_client *client = impl->node.client;
struct pw_impl_client *client = impl->node.client;
uint32_t node_id = global->id;
struct pw_memblock *m;
@ -1618,8 +1618,8 @@ struct pw_client_node *pw_client_node_new(struct pw_resource *resource,
{
struct impl *impl;
struct pw_client_node *this;
struct pw_client *client = pw_resource_get_client(resource);
struct pw_context *context = pw_client_get_context(client);
struct pw_impl_client *client = pw_resource_get_client(resource);
struct pw_context *context = pw_impl_client_get_context(client);
const struct spa_support *support;
uint32_t n_support;
int res;

View file

@ -366,11 +366,11 @@ impl_node_sync(void *object, int seq)
return this->init_pending;
}
extern uint32_t pw_protocol_native0_type_from_v2(struct pw_client *client, uint32_t type);
extern uint32_t pw_protocol_native0_type_to_v2(struct pw_client *client, uint32_t type);
extern uint32_t pw_protocol_native0_type_from_v2(struct pw_impl_client *client, uint32_t type);
extern uint32_t pw_protocol_native0_type_to_v2(struct pw_impl_client *client, uint32_t type);
extern struct spa_pod *pw_protocol_native0_pod_from_v2(struct pw_client *client, const struct spa_pod *pod);
extern int pw_protocol_native0_pod_to_v2(struct pw_client *client, const struct spa_pod *pod,
extern struct spa_pod *pw_protocol_native0_pod_from_v2(struct pw_impl_client *client, const struct spa_pod *pod);
extern int pw_protocol_native0_pod_to_v2(struct pw_impl_client *client, const struct spa_pod *pod,
struct spa_pod_builder *b);
static void
@ -1255,8 +1255,8 @@ struct pw_client_node0 *pw_client_node0_new(struct pw_resource *resource,
{
struct impl *impl;
struct pw_client_node0 *this;
struct pw_client *client = pw_resource_get_client(resource);
struct pw_context *context = pw_client_get_context(client);
struct pw_impl_client *client = pw_resource_get_client(resource);
struct pw_context *context = pw_impl_client_get_context(client);
const struct spa_support *support;
uint32_t n_support;
const char *name;

View file

@ -35,10 +35,10 @@
#define PW_PROTOCOL_NATIVE_FLAG_REMAP (1<<0)
extern uint32_t pw_protocol_native0_find_type(struct pw_client *client, const char *type);
extern int pw_protocol_native0_pod_to_v2(struct pw_client *client, const struct spa_pod *pod,
extern uint32_t pw_protocol_native0_find_type(struct pw_impl_client *client, const char *type);
extern int pw_protocol_native0_pod_to_v2(struct pw_impl_client *client, const struct spa_pod *pod,
struct spa_pod_builder *b);
extern uint32_t pw_protocol_native0_type_to_v2(struct pw_client *client,
extern uint32_t pw_protocol_native0_type_to_v2(struct pw_impl_client *client,
const struct spa_type_info *info, uint32_t type);
static void
@ -130,7 +130,7 @@ static void
client_node_marshal_command(void *object, uint32_t seq, const struct spa_command *command)
{
struct pw_resource *resource = object;
struct pw_client *client = resource->client;
struct pw_impl_client *client = resource->client;
struct spa_pod_builder *b;
struct spa_pod_frame f;
@ -188,7 +188,7 @@ client_node_marshal_port_set_param(void *object,
const struct spa_pod *param)
{
struct pw_resource *resource = object;
struct pw_client *client = resource->client;
struct pw_impl_client *client = resource->client;
struct spa_pod_builder *b;
struct spa_pod_frame f;
const char *typename;
@ -227,7 +227,7 @@ client_node_marshal_port_use_buffers(void *object,
uint32_t n_buffers, struct pw_client_node0_buffer *buffers)
{
struct pw_resource *resource = object;
struct pw_client *client = resource->client;
struct pw_impl_client *client = resource->client;
struct spa_pod_builder *b;
struct spa_pod_frame f;
uint32_t i, j;
@ -280,7 +280,7 @@ client_node_marshal_port_command(void *object,
const struct spa_command *command)
{
struct pw_resource *resource = object;
struct pw_client *client = resource->client;
struct pw_impl_client *client = resource->client;
struct spa_pod_builder *b;
struct spa_pod_frame f;

View file

@ -112,7 +112,7 @@ static void link_destroy(void *data)
static void link_initialized(void *data)
{
struct link_data *ld = data;
struct pw_client *client = pw_resource_get_client(ld->factory_resource);
struct pw_impl_client *client = pw_resource_get_client(ld->factory_resource);
int res;
ld->global = pw_link_get_global(ld->link);
@ -123,7 +123,7 @@ static void link_initialized(void *data)
goto error_bind;
if (!ld->linger) {
ld->resource = pw_client_find_resource(client, ld->new_id);
ld->resource = pw_impl_client_find_resource(client, ld->new_id);
if (ld->resource == NULL) {
res = -ENOENT;
goto error_bind;
@ -178,7 +178,7 @@ static void *create_object(void *_data,
uint32_t new_id)
{
struct factory_data *d = _data;
struct pw_client *client = NULL;
struct pw_impl_client *client = NULL;
struct pw_node *output_node, *input_node;
struct pw_port *outport, *inport;
struct pw_context *context;
@ -192,7 +192,7 @@ static void *create_object(void *_data,
bool linger;
client = pw_resource_get_client(resource);
context = pw_client_get_context(client);
context = pw_impl_client_get_context(client);
if (properties == NULL)
goto error_properties;

View file

@ -69,7 +69,7 @@ static void *create_object(void *_data,
{
void *result;
struct pw_resource *metadata_resource;
struct pw_client *client = pw_resource_get_client(resource);
struct pw_impl_client *client = pw_resource_get_client(resource);
int res;
metadata_resource = pw_resource_new(client, new_id, PW_PERM_RWX, type, version, 0);
@ -79,7 +79,7 @@ static void *create_object(void *_data,
}
pw_log_debug(".");
result = pw_metadata_new(pw_client_get_context(client), metadata_resource, properties);
result = pw_metadata_new(pw_impl_client_get_context(client), metadata_resource, properties);
if (result == NULL) {
res = -errno;
goto error_node;

View file

@ -109,7 +109,7 @@ static const struct pw_resource_events resource_events = {
};
static int
global_bind(void *_data, struct pw_client *client, uint32_t permissions,
global_bind(void *_data, struct pw_impl_client *client, uint32_t permissions,
uint32_t version, uint32_t id)
{
struct impl *impl = _data;

View file

@ -107,8 +107,8 @@ struct pw_device *pw_client_device_new(struct pw_resource *resource,
{
struct impl *impl;
struct pw_device *device;
struct pw_client *client = pw_resource_get_client(resource);
struct pw_context *context = pw_client_get_context(client);
struct pw_impl_client *client = pw_resource_get_client(resource);
struct pw_context *context = pw_impl_client_get_context(client);
if (properties == NULL)
properties = pw_properties_new(NULL, NULL);

View file

@ -105,7 +105,7 @@ struct server {
};
struct client_data {
struct pw_client *client;
struct pw_impl_client *client;
struct spa_hook client_listener;
struct spa_source *source;
@ -122,7 +122,7 @@ static void
process_messages(struct client_data *data)
{
struct pw_protocol_native_connection *conn = data->connection;
struct pw_client *client = data->client;
struct pw_impl_client *client = data->client;
struct pw_context *context = client->context;
const struct pw_protocol_native_message *msg;
struct pw_resource *resource;
@ -162,7 +162,7 @@ process_messages(struct client_data *data)
spa_debug_pod(0, NULL, (struct spa_pod *)msg->data);
}
resource = pw_client_find_resource(client, msg->id);
resource = pw_impl_client_find_resource(client, msg->id);
if (resource == NULL) {
pw_log_error(NAME" %p: unknown resource %u op:%u",
client->protocol, msg->id, msg->opcode);
@ -204,7 +204,7 @@ invalid_method:
client->protocol, msg->id, msg->opcode);
pw_resource_errorf(resource, -EINVAL, "invalid method id:%u op:%u",
msg->id, msg->opcode);
pw_client_destroy(client);
pw_impl_client_destroy(client);
goto done;
invalid_message:
pw_log_error(NAME" %p: invalid message received id:%u op:%u (%s)",
@ -212,11 +212,11 @@ invalid_message:
pw_resource_errorf(resource, res, "invalid message received id:%u op:%u (%s)",
msg->id, msg->opcode, spa_strerror(res));
spa_debug_pod(0, NULL, (struct spa_pod *)msg->data);
pw_client_destroy(client);
pw_impl_client_destroy(client);
goto done;
error:
pw_log_error(NAME" %p: client error (%s)", client->protocol, spa_strerror(res));
pw_client_destroy(client);
pw_impl_client_destroy(client);
goto done;
}
@ -224,7 +224,7 @@ static void
client_busy_changed(void *data, bool busy)
{
struct client_data *c = data;
struct pw_client *client = c->client;
struct pw_impl_client *client = c->client;
uint32_t mask = c->source->mask;
c->busy = busy;
@ -243,17 +243,17 @@ static void
connection_data(void *data, int fd, uint32_t mask)
{
struct client_data *this = data;
struct pw_client *client = this->client;
struct pw_impl_client *client = this->client;
int res;
if (mask & SPA_IO_HUP) {
pw_log_info(NAME" %p: client %p disconnected", client->protocol, client);
pw_client_destroy(client);
pw_impl_client_destroy(client);
return;
}
if (mask & SPA_IO_ERR) {
pw_log_error(NAME" %p: client %p error", client->protocol, client);
pw_client_destroy(client);
pw_impl_client_destroy(client);
return;
}
if (mask & SPA_IO_OUT) {
@ -266,7 +266,7 @@ connection_data(void *data, int fd, uint32_t mask)
} else if (res != EAGAIN) {
pw_log_error("client %p: could not flush: %s",
client, spa_strerror(res));
pw_client_destroy(client);
pw_impl_client_destroy(client);
return;
}
}
@ -277,7 +277,7 @@ connection_data(void *data, int fd, uint32_t mask)
static void client_free(void *data)
{
struct client_data *this = data;
struct pw_client *client = this->client;
struct pw_impl_client *client = this->client;
spa_list_remove(&client->protocol_link);
@ -289,8 +289,8 @@ static void client_free(void *data)
pw_map_clear(&this->compat_v2.types);
}
static const struct pw_client_events client_events = {
PW_VERSION_CLIENT_EVENTS,
static const struct pw_impl_client_events client_events = {
PW_VERSION_IMPL_CLIENT_EVENTS,
.free = client_free,
.busy_changed = client_busy_changed,
};
@ -298,7 +298,7 @@ static const struct pw_client_events client_events = {
static void on_start(void *data, uint32_t version)
{
struct client_data *this = data;
struct pw_client *client = this->client;
struct pw_impl_client *client = this->client;
struct pw_context *context = client->context;
pw_log_debug("version %d", version);
@ -321,7 +321,7 @@ static const struct pw_protocol_native_connection_events server_conn_events = {
static struct client_data *client_new(struct server *s, int fd)
{
struct client_data *this;
struct pw_client *client;
struct pw_impl_client *client;
struct pw_protocol *protocol = s->this.protocol;
socklen_t len;
struct ucred ucred;
@ -355,14 +355,14 @@ static struct client_data *client_new(struct server *s, int fd)
pw_properties_setf(props, PW_KEY_MODULE_ID, "%d", d->module->global->id);
client = pw_client_new(protocol->context,
client = pw_impl_client_new(protocol->context,
props,
sizeof(struct client_data));
if (client == NULL)
goto exit;
this = pw_client_get_user_data(client);
this = pw_impl_client_get_user_data(client);
client->protocol = protocol;
spa_list_append(&s->this.client_list, &client->protocol_link);
@ -388,9 +388,9 @@ static struct client_data *client_new(struct server *s, int fd)
&server_conn_events,
this);
pw_client_add_listener(client, &this->client_listener, &client_events, this);
pw_impl_client_add_listener(client, &this->client_listener, &client_events, this);
if ((res = pw_client_register(client, NULL)) < 0)
if ((res = pw_impl_client_register(client, NULL)) < 0)
goto cleanup_client;
if (!client->busy)
@ -400,7 +400,7 @@ static struct client_data *client_new(struct server *s, int fd)
return this;
cleanup_client:
pw_client_destroy(client);
pw_impl_client_destroy(client);
errno = -res;
exit:
return NULL;
@ -792,7 +792,7 @@ static int pw_protocol_native_connect_internal(struct pw_protocol_client *client
}
permissions[0].id = SPA_ID_INVALID;
permissions[0].permissions = PW_PERM_RWX;
pw_client_update_permissions(c->client, 1, permissions);
pw_impl_client_update_permissions(c->client, 1, permissions);
res = pw_protocol_client_connect_fd(client, sv[1], true);
done:
@ -868,13 +868,13 @@ error_free:
static void destroy_server(struct pw_protocol_server *server)
{
struct server *s = SPA_CONTAINER_OF(server, struct server, this);
struct pw_client *client, *tmp;
struct pw_impl_client *client, *tmp;
spa_list_remove(&server->link);
spa_hook_remove(&s->hook);
spa_list_for_each_safe(client, tmp, &server->client_list, protocol_link)
pw_client_destroy(client);
pw_impl_client_destroy(client);
if (s->source) {
spa_hook_remove(&s->hook);
@ -893,7 +893,7 @@ static void on_before_hook(void *_data)
{
struct server *server = _data;
struct pw_protocol_server *this = &server->this;
struct pw_client *client, *tmp;
struct pw_impl_client *client, *tmp;
struct client_data *data;
int res;
@ -909,7 +909,7 @@ static void on_before_hook(void *_data)
} else if (res < 0) {
pw_log_warn("client %p: could not flush: %s",
data->client, spa_strerror(res));
pw_client_destroy(client);
pw_impl_client_destroy(client);
}
}
@ -1052,7 +1052,7 @@ static int impl_ext_end_resource(struct pw_resource *resource,
struct spa_pod_builder *builder)
{
struct client_data *data = resource->client->user_data;
struct pw_client *client = resource->client;
struct pw_impl_client *client = resource->client;
return client->send_seq = pw_protocol_native_connection_end(data->connection, builder);
}
const static struct pw_protocol_native_ext protocol_ext_impl = {

View file

@ -630,7 +630,7 @@ static int core_method_demarshal_create_object(void *object, const struct pw_pro
static int core_method_demarshal_destroy(void *object, const struct pw_protocol_native_message *msg)
{
struct pw_resource *resource = object;
struct pw_client *client = pw_resource_get_client(resource);
struct pw_impl_client *client = pw_resource_get_client(resource);
struct pw_resource *r;
struct spa_pod_parser prs;
uint32_t id;
@ -642,7 +642,7 @@ static int core_method_demarshal_destroy(void *object, const struct pw_protocol_
pw_log_debug("client %p: destroy resource %u", client, id);
if ((r = pw_client_find_resource(client, id)) == NULL)
if ((r = pw_impl_client_find_resource(client, id)) == NULL)
goto no_resource;
return pw_resource_notify(resource, struct pw_core_methods, destroy, 0, r);

View file

@ -37,7 +37,7 @@
#define PW_PROTOCOL_NATIVE_FLAG_REMAP (1<<0)
SPA_EXPORT
uint32_t pw_protocol_native0_find_type(struct pw_client *client, const char *type)
uint32_t pw_protocol_native0_find_type(struct pw_impl_client *client, const char *type)
{
uint32_t i;
for (i = 0; i < SPA_N_ELEMENTS(type_map); i++) {
@ -169,7 +169,7 @@ static int core_demarshal_client_update(void *object, const struct pw_protocol_n
NULL) < 0)
return -EINVAL;
}
pw_client_update_properties(resource->client, &props);
pw_impl_client_update_properties(resource->client, &props);
return 0;
}
@ -195,7 +195,7 @@ static int core_demarshal_permissions(void *object, const struct pw_protocol_nat
return -EINVAL;
}
/* FIXME */
//return pw_resource_notify(resource, struct pw_client_proxy_methods, update_permissions, 0,
//return pw_resource_notify(resource, struct pw_impl_client_proxy_methods, update_permissions, 0,
// n_permissions, permissions);
return 0;
}
@ -243,7 +243,7 @@ static int core_demarshal_get_registry(void *object, const struct pw_protocol_na
}
SPA_EXPORT
uint32_t pw_protocol_native0_type_from_v2(struct pw_client *client, uint32_t type)
uint32_t pw_protocol_native0_type_from_v2(struct pw_impl_client *client, uint32_t type)
{
void *t;
uint32_t index;
@ -260,7 +260,7 @@ uint32_t pw_protocol_native0_type_from_v2(struct pw_client *client, uint32_t typ
}
SPA_EXPORT
uint32_t pw_protocol_native0_type_to_v2(struct pw_client *client,
uint32_t pw_protocol_native0_type_to_v2(struct pw_impl_client *client,
const struct spa_type_info *info, uint32_t type)
{
uint32_t i;
@ -310,7 +310,7 @@ struct spa_pod_prop_body0 {
(iter) <= SPA_MEMBER((body), (_size)-(body)->value.size, __typeof__(*iter)); \
(iter) = SPA_MEMBER((iter), (body)->value.size, __typeof__(*iter)))
static int remap_from_v2(uint32_t type, void *body, uint32_t size, struct pw_client *client,
static int remap_from_v2(uint32_t type, void *body, uint32_t size, struct pw_impl_client *client,
struct spa_pod_builder *builder)
{
int res;
@ -428,7 +428,7 @@ static int remap_from_v2(uint32_t type, void *body, uint32_t size, struct pw_cli
return 0;
}
static int remap_to_v2(struct pw_client *client, const struct spa_type_info *info,
static int remap_to_v2(struct pw_impl_client *client, const struct spa_type_info *info,
uint32_t type, void *body, uint32_t size,
struct spa_pod_builder *builder)
{
@ -548,7 +548,7 @@ static int remap_to_v2(struct pw_client *client, const struct spa_type_info *inf
SPA_EXPORT
struct spa_pod * pw_protocol_native0_pod_from_v2(struct pw_client *client, const struct spa_pod *pod)
struct spa_pod * pw_protocol_native0_pod_from_v2(struct pw_impl_client *client, const struct spa_pod *pod)
{
uint8_t buffer[4096];
struct spa_pod *copy;
@ -571,7 +571,7 @@ struct spa_pod * pw_protocol_native0_pod_from_v2(struct pw_client *client, const
}
SPA_EXPORT
int pw_protocol_native0_pod_to_v2(struct pw_client *client, const struct spa_pod *pod,
int pw_protocol_native0_pod_to_v2(struct pw_impl_client *client, const struct spa_pod *pod,
struct spa_pod_builder *b)
{
int res;
@ -594,7 +594,7 @@ int pw_protocol_native0_pod_to_v2(struct pw_client *client, const struct spa_pod
static int core_demarshal_create_object(void *object, const struct pw_protocol_native_message *msg)
{
struct pw_resource *resource = object;
struct pw_client *client = pw_resource_get_client(resource);
struct pw_impl_client *client = pw_resource_get_client(resource);
struct spa_pod_parser prs;
struct spa_pod_frame f;
uint32_t version, type, new_id, i;
@ -630,7 +630,7 @@ static int core_demarshal_create_object(void *object, const struct pw_protocol_n
static int core_demarshal_destroy(void *object, const struct pw_protocol_native_message *msg)
{
struct pw_resource *resource = object, *r;
struct pw_client *client = pw_resource_get_client(resource);
struct pw_impl_client *client = pw_resource_get_client(resource);
struct spa_pod_parser prs;
uint32_t id;
@ -641,7 +641,7 @@ static int core_demarshal_destroy(void *object, const struct pw_protocol_native_
pw_log_debug("client %p: destroy resource %u", client, id);
if ((r = pw_client_find_resource(client, id)) == NULL)
if ((r = pw_impl_client_find_resource(client, id)) == NULL)
goto no_resource;
return pw_resource_notify(resource, struct pw_core_methods, destroy, 0, r);
@ -655,7 +655,7 @@ no_resource:
static int core_demarshal_update_types_server(void *object, const struct pw_protocol_native_message *msg)
{
struct pw_resource *resource = object;
struct pw_client *client = pw_resource_get_client(resource);
struct pw_impl_client *client = pw_resource_get_client(resource);
struct protocol_compat_v2 *compat_v2 = client->compat_v2;
struct spa_pod_parser prs;
uint32_t first_id, n_types;
@ -689,7 +689,7 @@ static void registry_marshal_global(void *object, uint32_t id, uint32_t permissi
uint32_t type, uint32_t version, const struct spa_dict *props)
{
struct pw_resource *resource = object;
struct pw_client *client = resource->client;
struct pw_impl_client *client = resource->client;
struct spa_pod_builder *b;
struct spa_pod_frame f;
uint32_t i, n_items, parent_id;
@ -785,7 +785,7 @@ static void module_marshal_info(void *object, const struct pw_module_info *info)
static void factory_marshal_info(void *object, const struct pw_factory_info *info)
{
struct pw_resource *resource = object;
struct pw_client *client = resource->client;
struct pw_impl_client *client = resource->client;
struct spa_pod_builder *b;
struct spa_pod_frame f;
uint32_t i, n_items, type, version;
@ -866,7 +866,7 @@ static void node_marshal_param(void *object, int seq, uint32_t id, uint32_t inde
static int node_demarshal_enum_params(void *object, const struct pw_protocol_native_message *msg)
{
struct pw_resource *resource = object;
struct pw_client *client = resource->client;
struct pw_impl_client *client = resource->client;
struct spa_pod_parser prs;
uint32_t id, index, num;
struct spa_pod *filter;
@ -918,7 +918,7 @@ static void port_marshal_param(void *object, int seq, uint32_t id, uint32_t inde
const struct spa_pod *param)
{
struct pw_resource *resource = object;
struct pw_client *client = resource->client;
struct pw_impl_client *client = resource->client;
struct spa_pod_builder *b;
b = pw_protocol_native_begin_resource(resource, PW_PORT_PROXY_V0_EVENT_PARAM, NULL);
@ -933,7 +933,7 @@ static void port_marshal_param(void *object, int seq, uint32_t id, uint32_t inde
static int port_demarshal_enum_params(void *object, const struct pw_protocol_native_message *msg)
{
struct pw_resource *resource = object;
struct pw_client *client = resource->client;
struct pw_impl_client *client = resource->client;
struct spa_pod_parser prs;
uint32_t id, index, num;
struct spa_pod *filter;

View file

@ -168,8 +168,8 @@ static void *create_object(void *data,
struct factory_data *d = data;
struct pw_factory *factory = d->factory;
struct client_endpoint *this;
struct pw_client *owner = pw_resource_get_client(owner_resource);
struct pw_context *context = pw_client_get_context(owner);
struct pw_impl_client *owner = pw_resource_get_client(owner_resource);
struct pw_context *context = pw_impl_client_get_context(owner);
this = calloc(1, sizeof(struct client_endpoint));
if (this == NULL)

View file

@ -167,8 +167,8 @@ static void *create_object(void *data,
struct factory_data *d = data;
struct pw_factory *factory = d->factory;
struct client_session *this;
struct pw_client *owner = pw_resource_get_client(owner_resource);
struct pw_context *context = pw_client_get_context(owner);
struct pw_impl_client *owner = pw_resource_get_client(owner_resource);
struct pw_context *context = pw_impl_client_get_context(owner);
this = calloc(1, sizeof(struct client_session));
if (this == NULL)

View file

@ -255,7 +255,7 @@ static const struct pw_resource_events resource_events = {
.destroy = endpoint_link_unbind,
};
static int endpoint_link_bind(void *_data, struct pw_client *client,
static int endpoint_link_bind(void *_data, struct pw_impl_client *client,
uint32_t permissions, uint32_t version, uint32_t id)
{
struct endpoint_link *this = _data;

View file

@ -237,7 +237,7 @@ static const struct pw_resource_events resource_events = {
.destroy = endpoint_stream_unbind,
};
static int endpoint_stream_bind(void *_data, struct pw_client *client,
static int endpoint_stream_bind(void *_data, struct pw_impl_client *client,
uint32_t permissions, uint32_t version, uint32_t id)
{
struct endpoint_stream *this = _data;

View file

@ -259,7 +259,7 @@ static const struct pw_resource_events resource_events = {
.destroy = endpoint_unbind,
};
static int endpoint_bind(void *_data, struct pw_client *client,
static int endpoint_bind(void *_data, struct pw_impl_client *client,
uint32_t permissions, uint32_t version, uint32_t id)
{
struct endpoint *this = _data;

View file

@ -229,7 +229,7 @@ static const struct pw_resource_events resource_events = {
.destroy = session_unbind,
};
static int session_bind(void *_data, struct pw_client *client,
static int session_bind(void *_data, struct pw_impl_client *client,
uint32_t permissions, uint32_t version, uint32_t id)
{
struct session *this = _data;

View file

@ -87,7 +87,7 @@ static void *create_object(void *_data,
struct pw_device *device;
const char *factory_name;
struct device_data *nd;
struct pw_client *client;
struct pw_impl_client *client;
int res;
if (properties == NULL)
@ -104,7 +104,7 @@ static void *create_object(void *_data,
if (client) {
pw_properties_setf(properties, PW_KEY_CLIENT_ID, "%d",
pw_global_get_id(pw_client_get_global(client)));
pw_global_get_id(pw_impl_client_get_global(client)));
}
device = pw_spa_device_load(context,

View file

@ -106,7 +106,7 @@ static void *create_object(void *_data,
const char *factory_name;
struct node_data *nd;
int res;
struct pw_client *client;
struct pw_impl_client *client;
if (properties == NULL)
goto error_properties;
@ -122,7 +122,7 @@ static void *create_object(void *_data,
if (client) {
pw_properties_setf(properties, PW_KEY_CLIENT_ID, "%d",
pw_global_get_id(pw_client_get_global(client)));
pw_global_get_id(pw_impl_client_get_global(client)));
}
node = pw_spa_node_load(context,
@ -150,7 +150,7 @@ static void *create_object(void *_data,
if (res < 0)
goto error_bind;
if ((bound_resource = pw_client_find_resource(client, new_id)) == NULL)
if ((bound_resource = pw_impl_client_find_resource(client, new_id)) == NULL)
goto error_bind;
pw_resource_add_listener(bound_resource, &nd->resource_listener, &resource_events, nd);

View file

@ -63,7 +63,7 @@ static void * registry_bind(void *object, uint32_t id,
uint32_t type, uint32_t version, size_t user_data_size)
{
struct pw_resource *resource = object;
struct pw_client *client = resource->client;
struct pw_impl_client *client = resource->client;
struct pw_context *context = resource->context;
struct pw_global *global;
uint32_t permissions, new_id = user_data_size;
@ -107,7 +107,7 @@ error_exit_clean:
static int registry_destroy(void *object, uint32_t id)
{
struct pw_resource *resource = object;
struct pw_client *client = resource->client;
struct pw_impl_client *client = resource->client;
struct pw_context *context = resource->context;
struct pw_global *global;
uint32_t permissions;
@ -161,7 +161,7 @@ static const struct pw_resource_events resource_events = {
static int destroy_resource(void *object, void *data)
{
struct pw_resource *resource = object;
struct pw_client *client = resource->client;
struct pw_impl_client *client = resource->client;
if (resource &&
resource != client->core_resource) {
@ -173,7 +173,7 @@ static int destroy_resource(void *object, void *data)
static int core_hello(void *object, uint32_t version)
{
struct pw_resource *resource = object;
struct pw_client *client = resource->client;
struct pw_impl_client *client = resource->client;
struct pw_context *this = resource->context;
int res;
@ -202,12 +202,12 @@ static int core_sync(void *object, uint32_t id, int seq)
static int core_pong(void *object, uint32_t id, int seq)
{
struct pw_resource *resource = object;
struct pw_client *client = resource->client;
struct pw_impl_client *client = resource->client;
struct pw_resource *r;
pw_log_debug(NAME" %p: pong %d for resource %d", resource->context, seq, id);
if ((r = pw_client_find_resource(client, id)) == NULL)
if ((r = pw_impl_client_find_resource(client, id)) == NULL)
return -EINVAL;
pw_resource_emit_pong(r, seq);
@ -217,12 +217,12 @@ static int core_pong(void *object, uint32_t id, int seq)
static int core_error(void *object, uint32_t id, int seq, int res, const char *message)
{
struct pw_resource *resource = object;
struct pw_client *client = resource->client;
struct pw_impl_client *client = resource->client;
struct pw_resource *r;
pw_log_debug(NAME" %p: error %d for resource %d: %s", resource->context, res, id, message);
if ((r = pw_client_find_resource(client, id)) == NULL)
if ((r = pw_impl_client_find_resource(client, id)) == NULL)
return -EINVAL;
pw_resource_emit_error(r, seq, res, message);
@ -232,7 +232,7 @@ static int core_error(void *object, uint32_t id, int seq, int res, const char *m
static struct pw_registry * core_get_registry(void *object, uint32_t version, size_t user_data_size)
{
struct pw_resource *resource = object;
struct pw_client *client = resource->client;
struct pw_impl_client *client = resource->client;
struct pw_context *this = resource->context;
struct pw_global *global;
struct pw_resource *registry_resource;
@ -297,7 +297,7 @@ core_create_object(void *object,
size_t user_data_size)
{
struct pw_resource *resource = object;
struct pw_client *client = resource->client;
struct pw_impl_client *client = resource->client;
struct pw_factory *factory;
void *obj;
struct pw_properties *properties;
@ -361,7 +361,7 @@ error_exit:
static int core_destroy(void *object, void *proxy)
{
struct pw_resource *resource = object;
struct pw_client *client = resource->client;
struct pw_impl_client *client = resource->client;
struct pw_resource *r = proxy;
pw_log_debug(NAME" %p: destroy resource %p from client %p", resource->context, r, client);
pw_resource_destroy(r);
@ -394,7 +394,7 @@ static const struct pw_resource_events core_resource_events = {
static int
global_bind(void *_data,
struct pw_client *client,
struct pw_impl_client *client,
uint32_t permissions,
uint32_t version,
uint32_t id)

View file

@ -43,7 +43,7 @@ extern "C" {
struct pw_context;
struct pw_global;
struct pw_client;
struct pw_impl_client;
#include <pipewire/introspect.h>
#include <pipewire/interfaces.h>
@ -90,7 +90,7 @@ struct pw_context_events {
/** The context info changed, use \ref pw_context_get_info() to get the updated info */
void (*info_changed) (void *data, const struct pw_core_info *info);
/** a new client object is added */
void (*check_access) (void *data, struct pw_client *client);
void (*check_access) (void *data, struct pw_impl_client *client);
/** a new global object was added */
void (*global_added) (void *data, struct pw_global *global);
/** a global object was removed */

View file

@ -44,7 +44,7 @@ struct impl {
/** \endcond */
SPA_EXPORT
uint32_t pw_global_get_permissions(struct pw_global *global, struct pw_client *client)
uint32_t pw_global_get_permissions(struct pw_global *global, struct pw_impl_client *client)
{
if (client->permission_func == NULL)
return PW_PERM_RWX;
@ -244,7 +244,7 @@ void pw_global_add_listener(struct pw_global *global,
* \memberof pw_global
*/
SPA_EXPORT int
pw_global_bind(struct pw_global *global, struct pw_client *client, uint32_t permissions,
pw_global_bind(struct pw_global *global, struct pw_impl_client *client, uint32_t permissions,
uint32_t version, uint32_t id)
{
int res;
@ -281,7 +281,7 @@ error_exit:
}
SPA_EXPORT
int pw_global_update_permissions(struct pw_global *global, struct pw_client *client,
int pw_global_update_permissions(struct pw_global *global, struct pw_impl_client *client,
uint32_t old_permissions, uint32_t new_permissions)
{
struct pw_context *context = global->context;

View file

@ -56,7 +56,7 @@ struct pw_global;
#include <pipewire/impl.h>
typedef int (*pw_global_bind_func_t) (void *object,
struct pw_client *client, /**< client that binds */
struct pw_impl_client *client, /**< client that binds */
uint32_t permissions, /**< permissions for the bind */
uint32_t version, /**< client interface version */
uint32_t id /**< client proxy id */);
@ -72,7 +72,7 @@ struct pw_global_events {
void (*free) (void *data);
/** The permissions changed for a client */
void (*permissions_changed) (void *data,
struct pw_client *client,
struct pw_impl_client *client,
uint32_t old_permissions,
uint32_t new_permissions);
};
@ -96,7 +96,7 @@ void pw_global_add_listener(struct pw_global *global,
void *data);
/** Get the permissions of the global for a given client */
uint32_t pw_global_get_permissions(struct pw_global *global, struct pw_client *client);
uint32_t pw_global_get_permissions(struct pw_global *global, struct pw_impl_client *client);
/** Get the context object of this global */
struct pw_context *pw_global_get_context(struct pw_global *global);
@ -119,12 +119,12 @@ uint32_t pw_global_get_id(struct pw_global *global);
/** Let a client bind to a global */
int pw_global_bind(struct pw_global *global,
struct pw_client *client,
struct pw_impl_client *client,
uint32_t permissions,
uint32_t version,
uint32_t id);
int pw_global_update_permissions(struct pw_global *global, struct pw_client *client,
int pw_global_update_permissions(struct pw_global *global, struct pw_impl_client *client,
uint32_t old_permissions, uint32_t new_permissions);
/** Destroy a global */

View file

@ -36,7 +36,7 @@
/** \cond */
struct impl {
struct pw_client this;
struct pw_impl_client this;
struct spa_hook context_listener;
struct pw_array permissions;
struct spa_hook pool_listener;
@ -49,12 +49,12 @@ struct impl {
struct resource_data {
struct spa_hook resource_listener;
struct spa_hook object_listener;
struct pw_client *client;
struct pw_impl_client *client;
};
/** find a specific permission for a global or the default when there is none */
static struct pw_permission *
find_permission(struct pw_client *client, uint32_t id)
find_permission(struct pw_impl_client *client, uint32_t id)
{
struct impl *impl = SPA_CONTAINER_OF(client, struct impl, this);
struct pw_permission *p;
@ -76,7 +76,7 @@ do_default:
return pw_array_get_unchecked(&impl->permissions, 0, struct pw_permission);
}
static struct pw_permission *ensure_permissions(struct pw_client *client, uint32_t id)
static struct pw_permission *ensure_permissions(struct pw_impl_client *client, uint32_t id)
{
struct impl *impl = SPA_CONTAINER_OF(client, struct impl, this);
struct pw_permission *p;
@ -104,7 +104,7 @@ static struct pw_permission *ensure_permissions(struct pw_client *client, uint32
static uint32_t
client_permission_func(struct pw_global *global,
struct pw_client *client, void *data)
struct pw_impl_client *client, void *data)
{
struct pw_permission *p = find_permission(client, global->id);
return p->permissions;
@ -114,7 +114,7 @@ static int client_error(void *object, uint32_t id, int res, const char *error)
{
struct pw_resource *resource = object;
struct resource_data *data = pw_resource_get_user_data(resource);
struct pw_client *client = data->client;
struct pw_impl_client *client = data->client;
struct pw_global *global;
struct pw_resource *r, *t;
@ -134,15 +134,15 @@ static int client_update_properties(void *object, const struct spa_dict *props)
{
struct pw_resource *resource = object;
struct resource_data *data = pw_resource_get_user_data(resource);
struct pw_client *client = data->client;
return pw_client_update_properties(client, props);
struct pw_impl_client *client = data->client;
return pw_impl_client_update_properties(client, props);
}
static int client_get_permissions(void *object, uint32_t index, uint32_t num)
{
struct pw_resource *resource = object;
struct resource_data *data = pw_resource_get_user_data(resource);
struct pw_client *client = data->client;
struct pw_impl_client *client = data->client;
struct impl *impl = SPA_CONTAINER_OF(client, struct impl, this);
size_t len;
@ -162,8 +162,8 @@ static int client_update_permissions(void *object,
{
struct pw_resource *resource = object;
struct resource_data *data = pw_resource_get_user_data(resource);
struct pw_client *client = data->client;
return pw_client_update_permissions(client, n_permissions, permissions);
struct pw_impl_client *client = data->client;
return pw_impl_client_update_permissions(client, n_permissions, permissions);
}
static const struct pw_client_proxy_methods client_methods = {
@ -188,10 +188,10 @@ static const struct pw_resource_events resource_events = {
};
static int
global_bind(void *_data, struct pw_client *client, uint32_t permissions,
global_bind(void *_data, struct pw_impl_client *client, uint32_t permissions,
uint32_t version, uint32_t id)
{
struct pw_client *this = _data;
struct pw_impl_client *this = _data;
struct pw_global *global = this->global;
struct pw_resource *resource;
struct resource_data *data;
@ -231,7 +231,7 @@ error_resource:
static void pool_added(void *data, struct pw_memblock *block)
{
struct impl *impl = data;
struct pw_client *client = &impl->this;
struct pw_impl_client *client = &impl->this;
pw_log_debug(NAME" %p: added block %d", client, block->id);
if (client->core_resource) {
@ -244,7 +244,7 @@ static void pool_added(void *data, struct pw_memblock *block)
static void pool_removed(void *data, struct pw_memblock *block)
{
struct impl *impl = data;
struct pw_client *client = &impl->this;
struct pw_impl_client *client = &impl->this;
pw_log_debug(NAME" %p: removed block %d", client, block->id);
if (client->core_resource)
pw_core_resource_remove_mem(client->core_resource, block->id);
@ -260,7 +260,7 @@ static void
context_global_removed(void *data, struct pw_global *global)
{
struct impl *impl = data;
struct pw_client *client = &impl->this;
struct pw_impl_client *client = &impl->this;
struct pw_permission *p;
p = find_permission(client, global->id);
@ -281,14 +281,14 @@ static const struct pw_context_events context_events = {
* \param properties optional client properties, ownership is taken
* \return a newly allocated client object
*
* \memberof pw_client
* \memberof pw_impl_client
*/
SPA_EXPORT
struct pw_client *pw_client_new(struct pw_context *context,
struct pw_impl_client *pw_impl_client_new(struct pw_context *context,
struct pw_properties *properties,
size_t user_data_size)
{
struct pw_client *this;
struct pw_impl_client *this;
struct impl *impl;
struct pw_permission *p;
int res;
@ -359,10 +359,10 @@ error_cleanup:
static void global_destroy(void *object)
{
struct pw_client *client = object;
struct pw_impl_client *client = object;
spa_hook_remove(&client->global_listener);
client->global = NULL;
pw_client_destroy(client);
pw_impl_client_destroy(client);
}
static const struct pw_global_events global_events = {
@ -371,7 +371,7 @@ static const struct pw_global_events global_events = {
};
SPA_EXPORT
int pw_client_register(struct pw_client *client,
int pw_impl_client_register(struct pw_impl_client *client,
struct pw_properties *properties)
{
struct pw_context *context = client->context;
@ -413,7 +413,7 @@ int pw_client_register(struct pw_client *client,
pw_properties_setf(client->properties, PW_KEY_OBJECT_ID, "%d", client->info.id);
client->info.props = &client->properties->dict;
pw_client_emit_initialized(client);
pw_impl_client_emit_initialized(client);
pw_global_add_listener(client->global, &client->global_listener, &global_events, client);
pw_global_register(client->global);
@ -427,37 +427,37 @@ error_existed:
}
SPA_EXPORT
struct pw_context *pw_client_get_context(struct pw_client *client)
struct pw_context *pw_impl_client_get_context(struct pw_impl_client *client)
{
return client->context;
}
SPA_EXPORT
struct pw_resource *pw_client_get_core_resource(struct pw_client *client)
struct pw_resource *pw_impl_client_get_core_resource(struct pw_impl_client *client)
{
return client->core_resource;
}
SPA_EXPORT
struct pw_resource *pw_client_find_resource(struct pw_client *client, uint32_t id)
struct pw_resource *pw_impl_client_find_resource(struct pw_impl_client *client, uint32_t id)
{
return pw_map_lookup(&client->objects, id);
}
SPA_EXPORT
struct pw_global *pw_client_get_global(struct pw_client *client)
struct pw_global *pw_impl_client_get_global(struct pw_impl_client *client)
{
return client->global;
}
SPA_EXPORT
const struct pw_properties *pw_client_get_properties(struct pw_client *client)
const struct pw_properties *pw_impl_client_get_properties(struct pw_impl_client *client)
{
return client->properties;
}
SPA_EXPORT
void *pw_client_get_user_data(struct pw_client *client)
void *pw_impl_client_get_user_data(struct pw_impl_client *client)
{
return client->user_data;
}
@ -474,15 +474,15 @@ static int destroy_resource(void *object, void *data)
*
* \param client the client to destroy
*
* \memberof pw_client
* \memberof pw_impl_client
*/
SPA_EXPORT
void pw_client_destroy(struct pw_client *client)
void pw_impl_client_destroy(struct pw_impl_client *client)
{
struct impl *impl = SPA_CONTAINER_OF(client, struct impl, this);
pw_log_debug(NAME" %p: destroy", client);
pw_client_emit_destroy(client);
pw_impl_client_emit_destroy(client);
spa_hook_remove(&impl->context_listener);
@ -497,7 +497,7 @@ void pw_client_destroy(struct pw_client *client)
}
pw_log_debug(NAME" %p: free", impl);
pw_client_emit_free(client);
pw_impl_client_emit_free(client);
pw_map_clear(&client->objects);
pw_array_clear(&impl->permissions);
@ -509,16 +509,16 @@ void pw_client_destroy(struct pw_client *client)
}
SPA_EXPORT
void pw_client_add_listener(struct pw_client *client,
void pw_impl_client_add_listener(struct pw_impl_client *client,
struct spa_hook *listener,
const struct pw_client_events *events,
const struct pw_impl_client_events *events,
void *data)
{
spa_hook_list_append(&client->listener_list, listener, events, data);
}
SPA_EXPORT
const struct pw_client_info *pw_client_get_info(struct pw_client *client)
const struct pw_client_info *pw_impl_client_get_info(struct pw_impl_client *client)
{
return &client->info;
}
@ -532,10 +532,10 @@ const struct pw_client_info *pw_client_get_info(struct pw_client *client)
* properties are overwritten. Items can be removed by setting the value
* to NULL.
*
* \memberof pw_client
* \memberof pw_impl_client
*/
SPA_EXPORT
int pw_client_update_properties(struct pw_client *client, const struct spa_dict *dict)
int pw_impl_client_update_properties(struct pw_impl_client *client, const struct spa_dict *dict)
{
struct pw_resource *resource;
int changed;
@ -550,7 +550,7 @@ int pw_client_update_properties(struct pw_client *client, const struct spa_dict
client->info.change_mask |= PW_CLIENT_CHANGE_MASK_PROPS;
pw_client_emit_info_changed(client, &client->info);
pw_impl_client_emit_info_changed(client, &client->info);
if (client->global)
spa_list_for_each(resource, &client->global->resource_list, link)
@ -562,7 +562,7 @@ int pw_client_update_properties(struct pw_client *client, const struct spa_dict
}
SPA_EXPORT
int pw_client_update_permissions(struct pw_client *client,
int pw_impl_client_update_permissions(struct pw_impl_client *client,
uint32_t n_permissions, const struct pw_permission *permissions)
{
struct pw_context *context = client->context;
@ -623,17 +623,17 @@ int pw_client_update_permissions(struct pw_client *client,
}
}
if (n_permissions > 0)
pw_client_set_busy(client, false);
pw_impl_client_set_busy(client, false);
return 0;
}
SPA_EXPORT
void pw_client_set_busy(struct pw_client *client, bool busy)
void pw_impl_client_set_busy(struct pw_impl_client *client, bool busy)
{
if (client->busy != busy) {
pw_log_debug(NAME" %p: busy %d", client, busy);
client->busy = busy;
pw_client_emit_busy_changed(client, busy);
pw_impl_client_emit_busy_changed(client, busy);
}
}

View file

@ -31,7 +31,7 @@ extern "C" {
#include <spa/utils/hook.h>
/** \class pw_client
/** \class pw_impl_client
*
* \brief PipeWire client object class.
*
@ -41,7 +41,7 @@ extern "C" {
* Each client has its own list of resources it is bound to along with
* a mapping between the client types and server types.
*/
struct pw_client;
struct pw_impl_client;
#include <pipewire/context.h>
#include <pipewire/global.h>
@ -54,7 +54,7 @@ struct pw_client;
*
* \section sec_page_client_overview Overview
*
* The \ref pw_client object is created by a protocol implementation when
* The \ref pw_impl_client object is created by a protocol implementation when
* a new client connects.
*
* The client is used to keep track of all resources belonging to one
@ -81,8 +81,8 @@ struct pw_client;
*/
/** The events that a client can emit */
struct pw_client_events {
#define PW_VERSION_CLIENT_EVENTS 0
struct pw_impl_client_events {
#define PW_VERSION_IMPL_CLIENT_EVENTS 0
uint32_t version;
/** emited when the client is destroyed */
@ -110,56 +110,56 @@ struct pw_client_events {
};
/** Create a new client. This is mainly used by protocols. */
struct pw_client *
pw_client_new(struct pw_context *context, /**< the context object */
struct pw_impl_client *
pw_impl_client_new(struct pw_context *context, /**< the context object */
struct pw_properties *properties, /**< client properties */
size_t user_data_size /**< extra user data size */);
/** Destroy a previously created client */
void pw_client_destroy(struct pw_client *client);
void pw_impl_client_destroy(struct pw_impl_client *client);
/** Finish configuration and register a client */
int pw_client_register(struct pw_client *client, /**< the client to register */
int pw_impl_client_register(struct pw_impl_client *client, /**< the client to register */
struct pw_properties *properties/**< extra properties */);
/** Get the client user data */
void *pw_client_get_user_data(struct pw_client *client);
void *pw_impl_client_get_user_data(struct pw_impl_client *client);
/** Get the client information */
const struct pw_client_info *pw_client_get_info(struct pw_client *client);
const struct pw_client_info *pw_impl_client_get_info(struct pw_impl_client *client);
/** Update the client properties */
int pw_client_update_properties(struct pw_client *client, const struct spa_dict *dict);
int pw_impl_client_update_properties(struct pw_impl_client *client, const struct spa_dict *dict);
/** Update the client permissions */
int pw_client_update_permissions(struct pw_client *client, uint32_t n_permissions,
int pw_impl_client_update_permissions(struct pw_impl_client *client, uint32_t n_permissions,
const struct pw_permission *permissions);
/** Get the client properties */
const struct pw_properties *pw_client_get_properties(struct pw_client *client);
const struct pw_properties *pw_impl_client_get_properties(struct pw_impl_client *client);
/** Get the context used to create this client */
struct pw_context *pw_client_get_context(struct pw_client *client);
struct pw_context *pw_impl_client_get_context(struct pw_impl_client *client);
/** Get the client context resource */
struct pw_resource *pw_client_get_core_resource(struct pw_client *client);
struct pw_resource *pw_impl_client_get_core_resource(struct pw_impl_client *client);
/** Get a resource with the given id */
struct pw_resource *pw_client_find_resource(struct pw_client *client, uint32_t id);
struct pw_resource *pw_impl_client_find_resource(struct pw_impl_client *client, uint32_t id);
/** Get the global associated with this client */
struct pw_global *pw_client_get_global(struct pw_client *client);
struct pw_global *pw_impl_client_get_global(struct pw_impl_client *client);
/** listen to events from this client */
void pw_client_add_listener(struct pw_client *client,
void pw_impl_client_add_listener(struct pw_impl_client *client,
struct spa_hook *listener,
const struct pw_client_events *events,
const struct pw_impl_client_events *events,
void *data);
/** Mark the client busy. This can be used when an asynchronous operation is
* started and no further processing is allowed to happen for the client */
void pw_client_set_busy(struct pw_client *client, bool busy);
void pw_impl_client_set_busy(struct pw_impl_client *client, bool busy);
#ifdef __cplusplus
}

View file

@ -284,7 +284,7 @@ static void result_device_params_async(void *data, int seq, int res, uint32_t ty
if (seq == d->end) {
spa_hook_remove(&d->listener);
d->end = -1;
pw_client_set_busy(d->resource->client, false);
pw_impl_client_set_busy(d->resource->client, false);
}
if (seq == d->seq)
result_device_params(&d->data, seq, res, type, result);
@ -297,7 +297,7 @@ static int device_enum_params(void *object, int seq, uint32_t id, uint32_t start
struct resource_data *data = object;
struct pw_resource *resource = data->resource;
struct pw_device *device = data->device;
struct pw_client *client = resource->client;
struct pw_impl_client *client = resource->client;
int res;
static const struct spa_device_events device_events = {
SPA_VERSION_DEVICE_EVENTS,
@ -311,7 +311,7 @@ static int device_enum_params(void *object, int seq, uint32_t id, uint32_t start
pw_core_resource_error(client->core_resource,
resource->id, seq, res, spa_strerror(res));
} else if (SPA_RESULT_IS_ASYNC(res)) {
pw_client_set_busy(client, true);
pw_impl_client_set_busy(client, true);
data->data.data = data;
data->data.callback = reply_param;
if (data->end == -1)
@ -344,7 +344,7 @@ static const struct pw_device_proxy_methods device_methods = {
};
static int
global_bind(void *_data, struct pw_client *client, uint32_t permissions,
global_bind(void *_data, struct pw_impl_client *client, uint32_t permissions,
uint32_t version, uint32_t id)
{
struct pw_device *this = _data;

View file

@ -117,7 +117,7 @@ static const struct pw_resource_events resource_events = {
};
static int
global_bind(void *_data, struct pw_client *client, uint32_t permissions,
global_bind(void *_data, struct pw_impl_client *client, uint32_t permissions,
uint32_t version, uint32_t id)
{
struct pw_factory *this = _data;

View file

@ -801,7 +801,7 @@ static const struct pw_resource_events resource_events = {
};
static int
global_bind(void *_data, struct pw_client *client, uint32_t permissions,
global_bind(void *_data, struct pw_impl_client *client, uint32_t permissions,
uint32_t version, uint32_t id)
{
struct pw_link *this = _data;
@ -991,7 +991,7 @@ check_permission(struct pw_context *context,
}
static void permissions_changed(struct pw_link *this, struct pw_port *other,
struct pw_client *client, uint32_t old, uint32_t new)
struct pw_impl_client *client, uint32_t old, uint32_t new)
{
uint32_t perm;
@ -1008,7 +1008,7 @@ static void permissions_changed(struct pw_link *this, struct pw_port *other,
}
static void output_permissions_changed(void *data,
struct pw_client *client, uint32_t old, uint32_t new)
struct pw_impl_client *client, uint32_t old, uint32_t new)
{
struct pw_link *this = data;
permissions_changed(this, this->input, client, old, new);
@ -1020,7 +1020,7 @@ static const struct pw_global_events output_global_events = {
};
static void input_permissions_changed(void *data,
struct pw_client *client, uint32_t old, uint32_t new)
struct pw_impl_client *client, uint32_t old, uint32_t new)
{
struct pw_link *this = data;
permissions_changed(this, this->output, client, old, new);

View file

@ -117,7 +117,7 @@ static const struct pw_resource_events resource_events = {
};
static int
global_bind(void *_data, struct pw_client *client, uint32_t permissions,
global_bind(void *_data, struct pw_impl_client *client, uint32_t permissions,
uint32_t version, uint32_t id)
{
struct pw_module *this = _data;

View file

@ -379,7 +379,7 @@ static int node_enum_params(void *object, int seq, uint32_t id,
struct pw_resource *resource = object;
struct resource_data *data = pw_resource_get_user_data(resource);
struct pw_node *node = data->node;
struct pw_client *client = resource->client;
struct pw_impl_client *client = resource->client;
int res;
pw_log_debug(NAME" %p: resource %p enum params %d %s %u %u",
@ -425,7 +425,7 @@ static void result_node_sync(void *data, int seq, int res, uint32_t type, const
if (seq == d->end) {
spa_hook_remove(&d->listener);
d->end = -1;
pw_client_set_busy(d->resource->client, false);
pw_impl_client_set_busy(d->resource->client, false);
}
}
@ -435,7 +435,7 @@ static int node_set_param(void *object, uint32_t id, uint32_t flags,
struct pw_resource *resource = object;
struct resource_data *data = pw_resource_get_user_data(resource);
struct pw_node *node = data->node;
struct pw_client *client = resource->client;
struct pw_impl_client *client = resource->client;
int res;
static const struct spa_node_events node_events = {
SPA_VERSION_NODE_EVENTS,
@ -452,7 +452,7 @@ static int node_set_param(void *object, uint32_t id, uint32_t flags,
resource, resource->id, res, spa_strerror(res));
pw_resource_error(resource, res, spa_strerror(res));
} else if (SPA_RESULT_IS_ASYNC(res)) {
pw_client_set_busy(client, true);
pw_impl_client_set_busy(client, true);
if (data->end == -1)
spa_node_add_listener(node->node, &data->listener,
&node_events, data);
@ -488,7 +488,7 @@ static const struct pw_node_proxy_methods node_methods = {
};
static int
global_bind(void *_data, struct pw_client *client, uint32_t permissions,
global_bind(void *_data, struct pw_impl_client *client, uint32_t permissions,
uint32_t version, uint32_t id)
{
struct pw_node *this = _data;

View file

@ -720,7 +720,7 @@ static const struct pw_port_proxy_methods port_methods = {
};
static int
global_bind(void *_data, struct pw_client *client, uint32_t permissions,
global_bind(void *_data, struct pw_impl_client *client, uint32_t permissions,
uint32_t version, uint32_t id)
{
struct pw_port *this = _data;

View file

@ -77,25 +77,25 @@ struct pw_protocol {
/** the permission function. It returns the allowed access permissions for \a global
* for \a client */
typedef uint32_t (*pw_permission_func_t) (struct pw_global *global,
struct pw_client *client, void *data);
struct pw_impl_client *client, void *data);
#define pw_client_emit(o,m,v,...) spa_hook_list_call(&o->listener_list, struct pw_client_events, m, v, ##__VA_ARGS__)
#define pw_impl_client_emit(o,m,v,...) spa_hook_list_call(&o->listener_list, struct pw_impl_client_events, m, v, ##__VA_ARGS__)
#define pw_client_emit_destroy(o) pw_client_emit(o, destroy, 0)
#define pw_client_emit_free(o) pw_client_emit(o, free, 0)
#define pw_client_emit_initialized(o) pw_client_emit(o, initialized, 0)
#define pw_client_emit_info_changed(o,i) pw_client_emit(o, info_changed, 0, i)
#define pw_client_emit_resource_added(o,r) pw_client_emit(o, resource_added, 0, r)
#define pw_client_emit_resource_impl(o,r) pw_client_emit(o, resource_impl, 0, r)
#define pw_client_emit_resource_removed(o,r) pw_client_emit(o, resource_removed, 0, r)
#define pw_client_emit_busy_changed(o,b) pw_client_emit(o, busy_changed, 0, b)
#define pw_impl_client_emit_destroy(o) pw_impl_client_emit(o, destroy, 0)
#define pw_impl_client_emit_free(o) pw_impl_client_emit(o, free, 0)
#define pw_impl_client_emit_initialized(o) pw_impl_client_emit(o, initialized, 0)
#define pw_impl_client_emit_info_changed(o,i) pw_impl_client_emit(o, info_changed, 0, i)
#define pw_impl_client_emit_resource_added(o,r) pw_impl_client_emit(o, resource_added, 0, r)
#define pw_impl_client_emit_resource_impl(o,r) pw_impl_client_emit(o, resource_impl, 0, r)
#define pw_impl_client_emit_resource_removed(o,r) pw_impl_client_emit(o, resource_removed, 0, r)
#define pw_impl_client_emit_busy_changed(o,b) pw_impl_client_emit(o, busy_changed, 0, b)
struct protocol_compat_v2 {
/* v2 typemap */
struct pw_map types;
};
struct pw_client {
struct pw_impl_client {
struct pw_context *context; /**< context object */
struct spa_list link; /**< link in context object client list */
struct pw_global *global; /**< global object created for this client */
@ -238,7 +238,7 @@ struct pw_context {
uint32_t n_support; /**< number of support items */
struct pw_array factory_lib; /**< mapping of factory_name regexp to library */
struct pw_client *current_client; /**< client currently executing code in mainloop */
struct pw_impl_client *current_client; /**< client currently executing code in mainloop */
long sc_pagesize;
@ -679,7 +679,7 @@ struct pw_resource {
struct pw_context *context; /**< the context object */
struct spa_list link; /**< link in global resource_list */
struct pw_client *client; /**< owner client */
struct pw_impl_client *client; /**< owner client */
uint32_t id; /**< per client unique id, index in client objects */
uint32_t permissions; /**< resource permissions */

View file

@ -41,7 +41,7 @@ struct impl {
/** \endcond */
SPA_EXPORT
struct pw_resource *pw_resource_new(struct pw_client *client,
struct pw_resource *pw_resource_new(struct pw_impl_client *client,
uint32_t id,
uint32_t permissions,
uint32_t type,
@ -96,7 +96,7 @@ struct pw_resource *pw_resource_new(struct pw_client *client,
spa_debug_type_find_name(pw_type_info(), type), version,
client, this->marshal);
pw_client_emit_resource_added(client, this);
pw_impl_client_emit_resource_added(client, this);
return this;
@ -109,7 +109,7 @@ error_clean:
SPA_EXPORT
int pw_resource_install_marshal(struct pw_resource *this, bool implementor)
{
struct pw_client *client = this->client;
struct pw_impl_client *client = this->client;
const struct pw_protocol_marshal *marshal;
marshal = pw_protocol_get_marshal(client->protocol,
@ -127,7 +127,7 @@ int pw_resource_install_marshal(struct pw_resource *this, bool implementor)
}
SPA_EXPORT
struct pw_client *pw_resource_get_client(struct pw_resource *resource)
struct pw_impl_client *pw_resource_get_client(struct pw_resource *resource)
{
return resource->client;
}
@ -198,7 +198,7 @@ SPA_EXPORT
int pw_resource_ping(struct pw_resource *resource, int seq)
{
int res = -EIO;
struct pw_client *client = resource->client;
struct pw_impl_client *client = resource->client;
if (client->core_resource != NULL) {
pw_core_resource_ping(client->core_resource, resource->id, seq);
@ -211,7 +211,7 @@ int pw_resource_ping(struct pw_resource *resource, int seq)
SPA_EXPORT
int pw_resource_set_bound_id(struct pw_resource *resource, uint32_t global_id)
{
struct pw_client *client = resource->client;
struct pw_impl_client *client = resource->client;
resource->bound_id = global_id;
if (client->core_resource != NULL) {
@ -231,7 +231,7 @@ SPA_EXPORT
void pw_resource_errorf(struct pw_resource *resource, int res, const char *error, ...)
{
va_list ap;
struct pw_client *client = resource->client;
struct pw_impl_client *client = resource->client;
va_start(ap, error);
if (client->core_resource != NULL)
@ -243,7 +243,7 @@ void pw_resource_errorf(struct pw_resource *resource, int res, const char *error
SPA_EXPORT
void pw_resource_error(struct pw_resource *resource, int res, const char *error)
{
struct pw_client *client = resource->client;
struct pw_impl_client *client = resource->client;
if (client->core_resource != NULL)
pw_core_resource_error(client->core_resource,
resource->id, client->recv_seq, res, error);
@ -252,13 +252,13 @@ void pw_resource_error(struct pw_resource *resource, int res, const char *error)
SPA_EXPORT
void pw_resource_destroy(struct pw_resource *resource)
{
struct pw_client *client = resource->client;
struct pw_impl_client *client = resource->client;
pw_log_debug(NAME" %p: destroy %u", resource, resource->id);
pw_resource_emit_destroy(resource);
pw_map_insert_at(&client->objects, resource->id, NULL);
pw_client_emit_resource_removed(client, resource);
pw_impl_client_emit_resource_removed(client, resource);
if (client->core_resource && !resource->removed)
pw_core_resource_remove_id(client->core_resource, resource->id);

View file

@ -35,7 +35,7 @@ extern "C" {
*
* \section sec_page_resource Overview
*
* Resources represent objects owned by a \ref pw_client. They are
* Resources represent objects owned by a \ref pw_impl_client. They are
* the result of binding to a global resource or by calling API that
* creates client owned objects.
*
@ -77,7 +77,7 @@ struct pw_resource_events {
/** Make a new resource for client */
struct pw_resource *
pw_resource_new(struct pw_client *client, /**< the client owning the resource */
pw_resource_new(struct pw_impl_client *client, /**< the client owning the resource */
uint32_t id, /**< the remote per client id */
uint32_t permissions, /**< permissions on this resource */
uint32_t type, /**< interface of the resource */
@ -88,7 +88,7 @@ pw_resource_new(struct pw_client *client, /**< the client owning the resource */
void pw_resource_destroy(struct pw_resource *resource);
/** Get the client owning this resource */
struct pw_client *pw_resource_get_client(struct pw_resource *resource);
struct pw_impl_client *pw_resource_get_client(struct pw_resource *resource);
/** Get the unique id of this resource */
uint32_t pw_resource_get_id(struct pw_resource *resource);

View file

@ -33,7 +33,7 @@ do { \
static void test_abi(void)
{
struct pw_client_events ev;
struct pw_impl_client_events ev;
struct {
uint32_t version;
void (*destroy) (void *data);
@ -43,7 +43,7 @@ static void test_abi(void)
void (*resource_added) (void *data, struct pw_resource *resource);
void (*resource_removed) (void *data, struct pw_resource *resource);
void (*busy_changed) (void *data, bool busy);
} test = { PW_VERSION_CLIENT_EVENTS, NULL };
} test = { PW_VERSION_IMPL_CLIENT_EVENTS, NULL };
TEST_FUNC(ev, test, destroy);
TEST_FUNC(ev, test, free);
@ -53,7 +53,7 @@ static void test_abi(void)
TEST_FUNC(ev, test, resource_removed);
TEST_FUNC(ev, test, busy_changed);
spa_assert(PW_VERSION_CLIENT_EVENTS == 0);
spa_assert(PW_VERSION_IMPL_CLIENT_EVENTS == 0);
spa_assert(sizeof(ev) == sizeof(test));
}

View file

@ -39,7 +39,7 @@ static void test_abi(void)
void (*destroy) (void *data);
void (*free) (void *data);
void (*info_changed) (void *data, const struct pw_core_info *info);
void (*check_access) (void *data, struct pw_client *client);
void (*check_access) (void *data, struct pw_impl_client *client);
void (*global_added) (void *data, struct pw_global *global);
void (*global_removed) (void *data, struct pw_global *global);
} test = { PW_VERSION_CONTEXT_EVENTS, NULL };
@ -67,7 +67,7 @@ static void context_info_changed_error(void *data, const struct pw_core_info *in
{
spa_assert_not_reached();
}
static void context_check_access_error(void *data, struct pw_client *client)
static void context_check_access_error(void *data, struct pw_impl_client *client)
{
spa_assert_not_reached();
}