mirror of
https://gitlab.freedesktop.org/pipewire/pipewire.git
synced 2025-11-07 13:30:09 -05:00
API cleanups
Fix docs Add some more versions to interfaces Make types for the various proxy object + inline methods that does type checking and create proxys etc. Set owner client of client-nodes in the properties Pass type to bind to in create-node Don't place global id in the info structs Improve registration of marshal functions Pass more types around as ids
This commit is contained in:
parent
465f12241e
commit
1acba78234
45 changed files with 963 additions and 764 deletions
|
|
@ -101,13 +101,13 @@ on_link_state_changed(struct pw_listener *listener,
|
|||
link->error);
|
||||
|
||||
spa_list_for_each(resource, &link->resource_list, link) {
|
||||
pw_core_notify_error(resource->client->core_resource,
|
||||
resource->id, SPA_RESULT_ERROR, link->error);
|
||||
pw_core_resource_error(resource->client->core_resource,
|
||||
resource->id, SPA_RESULT_ERROR, link->error);
|
||||
}
|
||||
if (info->node->owner) {
|
||||
pw_core_notify_error(info->node->owner->client->core_resource,
|
||||
info->node->owner->id,
|
||||
SPA_RESULT_ERROR, link->error);
|
||||
pw_core_resource_error(info->node->owner->client->core_resource,
|
||||
info->node->owner->id,
|
||||
SPA_RESULT_ERROR, link->error);
|
||||
}
|
||||
break;
|
||||
}
|
||||
|
|
@ -194,8 +194,8 @@ static void try_link_port(struct pw_node *node, struct pw_port *port, struct nod
|
|||
error:
|
||||
pw_log_error("module %p: can't link node '%s'", impl, error);
|
||||
if (info->node->owner && info->node->owner->client->core_resource) {
|
||||
pw_core_notify_error(info->node->owner->client->core_resource,
|
||||
info->node->owner->id, SPA_RESULT_ERROR, error);
|
||||
pw_core_resource_error(info->node->owner->client->core_resource,
|
||||
info->node->owner->id, SPA_RESULT_ERROR, error);
|
||||
}
|
||||
free(error);
|
||||
return;
|
||||
|
|
|
|||
|
|
@ -44,6 +44,14 @@ static struct pw_node *create_node(struct pw_node_factory *factory,
|
|||
{
|
||||
struct pw_client_node *node;
|
||||
|
||||
if (properties == NULL)
|
||||
properties = pw_properties_new(NULL, NULL);
|
||||
if (properties == NULL)
|
||||
goto no_mem;
|
||||
|
||||
pw_properties_setf(properties,
|
||||
"pipewire.owner.client", "%d", resource->client->global->id);
|
||||
|
||||
node = pw_client_node_new(resource, name, properties);
|
||||
if (node == NULL)
|
||||
goto no_mem;
|
||||
|
|
@ -52,8 +60,10 @@ static struct pw_node *create_node(struct pw_node_factory *factory,
|
|||
|
||||
no_mem:
|
||||
pw_log_error("can't create node");
|
||||
pw_core_notify_error(resource->client->core_resource,
|
||||
resource->client->core_resource->id, SPA_RESULT_NO_MEMORY, "no memory");
|
||||
pw_core_resource_error(resource->client->core_resource,
|
||||
resource->client->core_resource->id, SPA_RESULT_NO_MEMORY, "no memory");
|
||||
if (properties)
|
||||
pw_properties_free(properties);
|
||||
return NULL;
|
||||
}
|
||||
|
||||
|
|
@ -68,7 +78,7 @@ static struct impl *module_new(struct pw_core *core, struct pw_properties *prope
|
|||
|
||||
impl->this.core = core;
|
||||
impl->this.name = "client-node";
|
||||
impl->this.type = spa_type_map_get_id(core->type.map, PW_TYPE__ClientNode);
|
||||
|
||||
pw_signal_init(&impl->this.destroy_signal);
|
||||
impl->this.create_node = create_node;
|
||||
|
||||
|
|
@ -76,7 +86,8 @@ static struct impl *module_new(struct pw_core *core, struct pw_properties *prope
|
|||
|
||||
spa_list_insert(core->node_factory_list.prev, &impl->this.link);
|
||||
|
||||
pw_core_add_global(core, NULL, core->type.node_factory, 0, impl, NULL, &impl->this.global);
|
||||
pw_core_add_global(core, NULL, core->type.node_factory, 0,
|
||||
NULL, impl, &impl->this.global);
|
||||
|
||||
return impl;
|
||||
}
|
||||
|
|
|
|||
|
|
@ -114,8 +114,6 @@ struct proxy {
|
|||
struct impl {
|
||||
struct pw_client_node this;
|
||||
|
||||
uint32_t type_client_node;
|
||||
|
||||
struct pw_core *core;
|
||||
|
||||
struct proxy proxy;
|
||||
|
|
@ -194,10 +192,10 @@ static int spa_proxy_node_send_command(struct spa_node *node, struct spa_command
|
|||
core = this->impl->core;
|
||||
|
||||
if (SPA_COMMAND_TYPE(command) == core->type.command_node.ClockUpdate) {
|
||||
pw_client_node_notify_node_command(this->resource, this->seq++, command);
|
||||
pw_client_node_resource_node_command(this->resource, this->seq++, command);
|
||||
} else {
|
||||
/* send start */
|
||||
pw_client_node_notify_node_command(this->resource, this->seq, command);
|
||||
pw_client_node_resource_node_command(this->resource, this->seq, command);
|
||||
if (SPA_COMMAND_TYPE(command) == core->type.command_node.Start)
|
||||
send_need_input(this);
|
||||
|
||||
|
|
@ -470,8 +468,8 @@ spa_proxy_node_port_set_format(struct spa_node *node,
|
|||
if (this->resource == NULL)
|
||||
return SPA_RESULT_OK;
|
||||
|
||||
pw_client_node_notify_set_format(this->resource,
|
||||
this->seq, direction, port_id, flags, format);
|
||||
pw_client_node_resource_set_format(this->resource,
|
||||
this->seq, direction, port_id, flags, format);
|
||||
|
||||
return SPA_RESULT_RETURN_ASYNC(this->seq++);
|
||||
}
|
||||
|
|
@ -644,12 +642,12 @@ spa_proxy_node_port_use_buffers(struct spa_node *node,
|
|||
mb[i].offset = 0;
|
||||
mb[i].size = msh->size;
|
||||
|
||||
pw_client_node_notify_add_mem(this->resource,
|
||||
direction,
|
||||
port_id,
|
||||
mb[i].mem_id,
|
||||
impl->core->type.data.MemFd,
|
||||
msh->fd, msh->flags, msh->offset, msh->size);
|
||||
pw_client_node_resource_add_mem(this->resource,
|
||||
direction,
|
||||
port_id,
|
||||
mb[i].mem_id,
|
||||
impl->core->type.data.MemFd,
|
||||
msh->fd, msh->flags, msh->offset, msh->size);
|
||||
|
||||
for (j = 0; j < buffers[i]->n_metas; j++) {
|
||||
memcpy(&b->buffer.metas[j], &buffers[i]->metas[j], sizeof(struct spa_meta));
|
||||
|
|
@ -662,13 +660,13 @@ spa_proxy_node_port_use_buffers(struct spa_node *node,
|
|||
|
||||
if (d->type == impl->core->type.data.DmaBuf ||
|
||||
d->type == impl->core->type.data.MemFd) {
|
||||
pw_client_node_notify_add_mem(this->resource,
|
||||
direction,
|
||||
port_id,
|
||||
n_mem,
|
||||
d->type,
|
||||
d->fd,
|
||||
d->flags, d->mapoffset, d->maxsize);
|
||||
pw_client_node_resource_add_mem(this->resource,
|
||||
direction,
|
||||
port_id,
|
||||
n_mem,
|
||||
d->type,
|
||||
d->fd,
|
||||
d->flags, d->mapoffset, d->maxsize);
|
||||
b->buffer.datas[j].type = impl->core->type.data.Id;
|
||||
b->buffer.datas[j].data = SPA_UINT32_TO_PTR(n_mem);
|
||||
n_mem++;
|
||||
|
|
@ -683,8 +681,8 @@ spa_proxy_node_port_use_buffers(struct spa_node *node,
|
|||
}
|
||||
}
|
||||
|
||||
pw_client_node_notify_use_buffers(this->resource,
|
||||
this->seq, direction, port_id, n_buffers, mb);
|
||||
pw_client_node_resource_use_buffers(this->resource,
|
||||
this->seq, direction, port_id, n_buffers, mb);
|
||||
|
||||
return SPA_RESULT_RETURN_ASYNC(this->seq++);
|
||||
}
|
||||
|
|
@ -948,6 +946,7 @@ static void client_node_destroy(void *object)
|
|||
}
|
||||
|
||||
static struct pw_client_node_methods client_node_methods = {
|
||||
PW_VERSION_CLIENT_NODE_METHODS,
|
||||
&client_node_done,
|
||||
&client_node_update,
|
||||
&client_node_port_update,
|
||||
|
|
@ -1053,8 +1052,8 @@ static void on_initialized(struct pw_listener *listener, struct pw_node *node)
|
|||
pw_client_node_get_fds(this, &readfd, &writefd);
|
||||
pw_transport_get_info(impl->transport, &info);
|
||||
|
||||
pw_client_node_notify_transport(this->resource, node->global->id,
|
||||
readfd, writefd, info.memfd, info.offset, info.size);
|
||||
pw_client_node_resource_transport(this->resource, node->global->id,
|
||||
readfd, writefd, info.memfd, info.offset, info.size);
|
||||
}
|
||||
|
||||
static void
|
||||
|
|
@ -1150,8 +1149,6 @@ struct pw_client_node *pw_client_node_new(struct pw_resource *resource,
|
|||
impl->fds[0] = impl->fds[1] = -1;
|
||||
pw_log_debug("client-node %p: new", impl);
|
||||
|
||||
impl->type_client_node = spa_type_map_get_id(core->type.map, PW_TYPE__ClientNode);
|
||||
|
||||
pw_signal_init(&this->destroy_signal);
|
||||
|
||||
proxy_init(&impl->proxy, NULL, core->support, core->n_support);
|
||||
|
|
@ -1168,11 +1165,9 @@ struct pw_client_node *pw_client_node_new(struct pw_resource *resource,
|
|||
if (this->node == NULL)
|
||||
goto error_no_node;
|
||||
|
||||
this->resource->destroy = (pw_destroy_t) client_node_resource_destroy;
|
||||
pw_resource_set_implementation(this->resource,
|
||||
this,
|
||||
PW_VERSION_CLIENT_NODE,
|
||||
&client_node_methods,
|
||||
(pw_destroy_t) client_node_resource_destroy);
|
||||
this, &client_node_methods);
|
||||
|
||||
impl->proxy.resource = this->resource;
|
||||
|
||||
|
|
|
|||
|
|
@ -158,7 +158,7 @@ static bool client_node_demarshal_set_props(void *object, void *data, size_t siz
|
|||
-SPA_POD_TYPE_OBJECT, &props, 0))
|
||||
return false;
|
||||
|
||||
((struct pw_client_node_events *) proxy->implementation)->set_props(proxy, seq, props);
|
||||
pw_proxy_notify(proxy, struct pw_client_node_events, set_props, seq, props);
|
||||
return true;
|
||||
}
|
||||
|
||||
|
|
@ -173,7 +173,7 @@ static bool client_node_demarshal_event_event(void *object, void *data, size_t s
|
|||
!spa_pod_iter_get(&it, SPA_POD_TYPE_OBJECT, &event, 0))
|
||||
return false;
|
||||
|
||||
((struct pw_client_node_events *) proxy->implementation)->event(proxy, event);
|
||||
pw_proxy_notify(proxy, struct pw_client_node_events, event, event);
|
||||
return true;
|
||||
}
|
||||
|
||||
|
|
@ -189,8 +189,7 @@ static bool client_node_demarshal_add_port(void *object, void *data, size_t size
|
|||
SPA_POD_TYPE_INT, &direction, SPA_POD_TYPE_INT, &port_id, 0))
|
||||
return false;
|
||||
|
||||
((struct pw_client_node_events *) proxy->implementation)->add_port(proxy, seq, direction,
|
||||
port_id);
|
||||
pw_proxy_notify(proxy, struct pw_client_node_events, add_port, seq, direction, port_id);
|
||||
return true;
|
||||
}
|
||||
|
||||
|
|
@ -206,8 +205,7 @@ static bool client_node_demarshal_remove_port(void *object, void *data, size_t s
|
|||
SPA_POD_TYPE_INT, &direction, SPA_POD_TYPE_INT, &port_id, 0))
|
||||
return false;
|
||||
|
||||
((struct pw_client_node_events *) proxy->implementation)->remove_port(proxy, seq, direction,
|
||||
port_id);
|
||||
pw_proxy_notify(proxy, struct pw_client_node_events, remove_port, seq, direction, port_id);
|
||||
return true;
|
||||
}
|
||||
|
||||
|
|
@ -228,9 +226,8 @@ static bool client_node_demarshal_set_format(void *object, void *data, size_t si
|
|||
-SPA_POD_TYPE_OBJECT, &format, 0))
|
||||
return false;
|
||||
|
||||
((struct pw_client_node_events *) proxy->implementation)->set_format(proxy, seq, direction,
|
||||
port_id, flags,
|
||||
format);
|
||||
pw_proxy_notify(proxy, struct pw_client_node_events, set_format, seq, direction, port_id,
|
||||
flags, format);
|
||||
return true;
|
||||
}
|
||||
|
||||
|
|
@ -250,8 +247,7 @@ static bool client_node_demarshal_set_param(void *object, void *data, size_t siz
|
|||
-SPA_POD_TYPE_OBJECT, ¶m, 0))
|
||||
return false;
|
||||
|
||||
((struct pw_client_node_events *) proxy->implementation)->set_param(proxy, seq, direction,
|
||||
port_id, param);
|
||||
pw_proxy_notify(proxy, struct pw_client_node_events, set_param, seq, direction, port_id, param);
|
||||
return true;
|
||||
}
|
||||
|
||||
|
|
@ -276,12 +272,11 @@ static bool client_node_demarshal_add_mem(void *object, void *data, size_t size)
|
|||
|
||||
memfd = pw_protocol_native_get_proxy_fd(proxy, memfd_idx);
|
||||
|
||||
((struct pw_client_node_events *) proxy->implementation)->add_mem(proxy,
|
||||
direction,
|
||||
port_id,
|
||||
mem_id,
|
||||
type,
|
||||
memfd, flags, offset, sz);
|
||||
pw_proxy_notify(proxy, struct pw_client_node_events, add_mem, direction,
|
||||
port_id,
|
||||
mem_id,
|
||||
type,
|
||||
memfd, flags, offset, sz);
|
||||
return true;
|
||||
}
|
||||
|
||||
|
|
@ -340,11 +335,10 @@ static bool client_node_demarshal_use_buffers(void *object, void *data, size_t s
|
|||
d->data = SPA_UINT32_TO_PTR(data_id);
|
||||
}
|
||||
}
|
||||
((struct pw_client_node_events *) proxy->implementation)->use_buffers(proxy,
|
||||
seq,
|
||||
direction,
|
||||
port_id,
|
||||
n_buffers, buffers);
|
||||
pw_proxy_notify(proxy, struct pw_client_node_events, use_buffers, seq,
|
||||
direction,
|
||||
port_id,
|
||||
n_buffers, buffers);
|
||||
return true;
|
||||
}
|
||||
|
||||
|
|
@ -360,7 +354,7 @@ static bool client_node_demarshal_node_command(void *object, void *data, size_t
|
|||
!spa_pod_iter_get(&it, SPA_POD_TYPE_INT, &seq, SPA_POD_TYPE_OBJECT, &command, 0))
|
||||
return false;
|
||||
|
||||
((struct pw_client_node_events *) proxy->implementation)->node_command(proxy, seq, command);
|
||||
pw_proxy_notify(proxy, struct pw_client_node_events, node_command, seq, command);
|
||||
return true;
|
||||
}
|
||||
|
||||
|
|
@ -379,10 +373,9 @@ static bool client_node_demarshal_port_command(void *object, void *data, size_t
|
|||
SPA_POD_TYPE_OBJECT, &command, 0))
|
||||
return false;
|
||||
|
||||
((struct pw_client_node_events *) proxy->implementation)->port_command(proxy,
|
||||
direction,
|
||||
port_id,
|
||||
command);
|
||||
pw_proxy_notify(proxy, struct pw_client_node_events, port_command, direction,
|
||||
port_id,
|
||||
command);
|
||||
return true;
|
||||
}
|
||||
|
||||
|
|
@ -409,9 +402,9 @@ static bool client_node_demarshal_transport(void *object, void *data, size_t siz
|
|||
if (readfd == -1 || writefd == -1 || memfd_idx == -1)
|
||||
return false;
|
||||
|
||||
((struct pw_client_node_events *) proxy->implementation)->transport(proxy, node_id,
|
||||
readfd, writefd,
|
||||
memfd, offset, sz);
|
||||
pw_proxy_notify(proxy, struct pw_client_node_events, transport, node_id,
|
||||
readfd, writefd,
|
||||
memfd, offset, sz);
|
||||
return true;
|
||||
}
|
||||
|
||||
|
|
@ -666,7 +659,7 @@ static bool client_node_demarshal_done(void *object, void *data, size_t size)
|
|||
SPA_POD_TYPE_INT, &res, 0))
|
||||
return false;
|
||||
|
||||
((struct pw_client_node_methods *) resource->implementation)->done(resource, seq, res);
|
||||
pw_resource_do(resource, struct pw_client_node_methods, done, seq, res);
|
||||
return true;
|
||||
}
|
||||
|
||||
|
|
@ -685,10 +678,10 @@ static bool client_node_demarshal_update(void *object, void *data, size_t size)
|
|||
SPA_POD_TYPE_INT, &max_output_ports, -SPA_POD_TYPE_OBJECT, &props, 0))
|
||||
return false;
|
||||
|
||||
((struct pw_client_node_methods *) resource->implementation)->update(resource, change_mask,
|
||||
max_input_ports,
|
||||
max_output_ports,
|
||||
props);
|
||||
pw_resource_do(resource, struct pw_client_node_methods, update, change_mask,
|
||||
max_input_ports,
|
||||
max_output_ports,
|
||||
props);
|
||||
return true;
|
||||
}
|
||||
|
||||
|
|
@ -738,15 +731,14 @@ static bool client_node_demarshal_port_update(void *object, void *data, size_t s
|
|||
return false;
|
||||
}
|
||||
|
||||
((struct pw_client_node_methods *) resource->implementation)->port_update(resource,
|
||||
direction,
|
||||
port_id,
|
||||
change_mask,
|
||||
n_possible_formats,
|
||||
possible_formats,
|
||||
format,
|
||||
n_params,
|
||||
params, infop);
|
||||
pw_resource_do(resource, struct pw_client_node_methods, port_update, direction,
|
||||
port_id,
|
||||
change_mask,
|
||||
n_possible_formats,
|
||||
possible_formats,
|
||||
format,
|
||||
n_params,
|
||||
params, infop);
|
||||
return true;
|
||||
}
|
||||
|
||||
|
|
@ -761,7 +753,7 @@ static bool client_node_demarshal_event_method(void *object, void *data, size_t
|
|||
!spa_pod_iter_get(&it, SPA_POD_TYPE_OBJECT, &event, 0))
|
||||
return false;
|
||||
|
||||
((struct pw_client_node_methods *) resource->implementation)->event(resource, event);
|
||||
pw_resource_do(resource, struct pw_client_node_methods, event, event);
|
||||
return true;
|
||||
}
|
||||
|
||||
|
|
@ -773,11 +765,12 @@ static bool client_node_demarshal_destroy(void *object, void *data, size_t size)
|
|||
if (!spa_pod_iter_struct(&it, data, size))
|
||||
return false;
|
||||
|
||||
((struct pw_client_node_methods *) resource->implementation)->destroy(resource);
|
||||
pw_resource_do_na(resource, struct pw_client_node_methods, destroy);
|
||||
return true;
|
||||
}
|
||||
|
||||
static const struct pw_client_node_methods pw_protocol_native_client_client_node_methods = {
|
||||
static const struct pw_client_node_methods pw_protocol_native_client_node_method_marshal = {
|
||||
PW_VERSION_CLIENT_NODE_METHODS,
|
||||
&client_node_marshal_done,
|
||||
&client_node_marshal_update,
|
||||
&client_node_marshal_port_update,
|
||||
|
|
@ -785,28 +778,7 @@ static const struct pw_client_node_methods pw_protocol_native_client_client_node
|
|||
&client_node_marshal_destroy
|
||||
};
|
||||
|
||||
static const demarshal_func_t pw_protocol_native_client_client_node_demarshal[] = {
|
||||
&client_node_demarshal_transport,
|
||||
&client_node_demarshal_set_props,
|
||||
&client_node_demarshal_event_event,
|
||||
&client_node_demarshal_add_port,
|
||||
&client_node_demarshal_remove_port,
|
||||
&client_node_demarshal_set_format,
|
||||
&client_node_demarshal_set_param,
|
||||
&client_node_demarshal_add_mem,
|
||||
&client_node_demarshal_use_buffers,
|
||||
&client_node_demarshal_node_command,
|
||||
&client_node_demarshal_port_command,
|
||||
};
|
||||
|
||||
static const struct pw_interface pw_protocol_native_client_client_node_interface = {
|
||||
PW_TYPE__ClientNode,
|
||||
PW_VERSION_CLIENT_NODE,
|
||||
PW_CLIENT_NODE_METHOD_NUM, &pw_protocol_native_client_client_node_methods,
|
||||
PW_CLIENT_NODE_EVENT_NUM, pw_protocol_native_client_client_node_demarshal,
|
||||
};
|
||||
|
||||
static const demarshal_func_t pw_protocol_native_server_client_node_demarshal[] = {
|
||||
static const demarshal_func_t pw_protocol_native_client_node_method_demarshal[] = {
|
||||
&client_node_demarshal_done,
|
||||
&client_node_demarshal_update,
|
||||
&client_node_demarshal_port_update,
|
||||
|
|
@ -814,7 +786,8 @@ static const demarshal_func_t pw_protocol_native_server_client_node_demarshal[]
|
|||
&client_node_demarshal_destroy,
|
||||
};
|
||||
|
||||
static const struct pw_client_node_events pw_protocol_native_server_client_node_events = {
|
||||
static const struct pw_client_node_events pw_protocol_native_client_node_event_marshal = {
|
||||
PW_VERSION_CLIENT_NODE_EVENTS,
|
||||
&client_node_marshal_transport,
|
||||
&client_node_marshal_set_props,
|
||||
&client_node_marshal_event_event,
|
||||
|
|
@ -828,11 +801,29 @@ static const struct pw_client_node_events pw_protocol_native_server_client_node_
|
|||
&client_node_marshal_port_command,
|
||||
};
|
||||
|
||||
const struct pw_interface pw_protocol_native_server_client_node_interface = {
|
||||
PW_TYPE__ClientNode,
|
||||
static const demarshal_func_t pw_protocol_native_client_node_event_demarshal[] = {
|
||||
&client_node_demarshal_transport,
|
||||
&client_node_demarshal_set_props,
|
||||
&client_node_demarshal_event_event,
|
||||
&client_node_demarshal_add_port,
|
||||
&client_node_demarshal_remove_port,
|
||||
&client_node_demarshal_set_format,
|
||||
&client_node_demarshal_set_param,
|
||||
&client_node_demarshal_add_mem,
|
||||
&client_node_demarshal_use_buffers,
|
||||
&client_node_demarshal_node_command,
|
||||
&client_node_demarshal_port_command,
|
||||
};
|
||||
|
||||
const struct pw_protocol_marshal pw_protocol_native_client_node_marshal = {
|
||||
PW_TYPE_INTERFACE__ClientNode,
|
||||
PW_VERSION_CLIENT_NODE,
|
||||
PW_CLIENT_NODE_METHOD_NUM, &pw_protocol_native_server_client_node_demarshal,
|
||||
PW_CLIENT_NODE_EVENT_NUM, &pw_protocol_native_server_client_node_events,
|
||||
PW_CLIENT_NODE_METHOD_NUM,
|
||||
&pw_protocol_native_client_node_method_marshal,
|
||||
&pw_protocol_native_client_node_method_demarshal,
|
||||
PW_CLIENT_NODE_EVENT_NUM,
|
||||
&pw_protocol_native_client_node_event_marshal,
|
||||
pw_protocol_native_client_node_event_demarshal,
|
||||
};
|
||||
|
||||
struct pw_protocol *pw_protocol_native_ext_client_node_init(struct pw_core *core)
|
||||
|
|
@ -844,9 +835,7 @@ struct pw_protocol *pw_protocol_native_ext_client_node_init(struct pw_core *core
|
|||
if (protocol == NULL)
|
||||
return NULL;
|
||||
|
||||
pw_protocol_add_interfaces(protocol,
|
||||
&pw_protocol_native_client_client_node_interface,
|
||||
&pw_protocol_native_server_client_node_interface);
|
||||
pw_protocol_add_marshal(protocol, &pw_protocol_native_client_node_marshal);
|
||||
|
||||
return protocol;
|
||||
}
|
||||
|
|
|
|||
|
|
@ -69,8 +69,9 @@ struct async_pending {
|
|||
struct pw_resource *resource;
|
||||
char *factory_name;
|
||||
char *name;
|
||||
struct pw_properties *properties;
|
||||
uint32_t type;
|
||||
uint32_t version;
|
||||
struct pw_properties *properties;
|
||||
uint32_t new_id;
|
||||
};
|
||||
|
||||
|
|
@ -230,8 +231,9 @@ do_global_filter(struct pw_global *global, struct pw_client *client, void *data)
|
|||
if (link->input
|
||||
&& !check_global_owner(client->core, client, link->input->node->global))
|
||||
return false;
|
||||
} else if (!check_global_owner(client->core, client, global))
|
||||
return false;
|
||||
}
|
||||
else if (!check_global_owner(client->core, client, global))
|
||||
return false;
|
||||
|
||||
return true;
|
||||
}
|
||||
|
|
@ -268,12 +270,13 @@ portal_response(DBusConnection *connection, DBusMessage *msg, void *user_data)
|
|||
cinfo->old_methods->create_node (p->resource,
|
||||
p->factory_name,
|
||||
p->name,
|
||||
&p->properties->dict,
|
||||
p->type,
|
||||
p->version,
|
||||
&p->properties->dict,
|
||||
p->new_id);
|
||||
} else {
|
||||
pw_core_notify_error(cinfo->client->core_resource,
|
||||
p->resource->id, SPA_RESULT_NO_PERMISSION, "not allowed");
|
||||
pw_core_resource_error(cinfo->client->core_resource,
|
||||
p->resource->id, SPA_RESULT_NO_PERMISSION, "not allowed");
|
||||
|
||||
}
|
||||
free_pending(p);
|
||||
|
|
@ -288,8 +291,9 @@ portal_response(DBusConnection *connection, DBusMessage *msg, void *user_data)
|
|||
static void do_create_node(void *object,
|
||||
const char *factory_name,
|
||||
const char *name,
|
||||
const struct spa_dict *props,
|
||||
uint32_t type,
|
||||
uint32_t version,
|
||||
const struct spa_dict *props,
|
||||
uint32_t new_id)
|
||||
{
|
||||
struct pw_resource *resource = object;
|
||||
|
|
@ -306,7 +310,7 @@ static void do_create_node(void *object,
|
|||
struct async_pending *p;
|
||||
|
||||
if (!cinfo->is_sandboxed) {
|
||||
cinfo->old_methods->create_node (object, factory_name, name, props, version, new_id);
|
||||
cinfo->old_methods->create_node (object, factory_name, name, type, version, props, new_id);
|
||||
return;
|
||||
}
|
||||
if (strcmp(factory_name, "client-node") != 0) {
|
||||
|
|
@ -362,8 +366,9 @@ static void do_create_node(void *object,
|
|||
p->resource = resource;
|
||||
p->factory_name = strdup(factory_name);
|
||||
p->name = strdup(name);
|
||||
p->properties = props ? pw_properties_new_dict(props) : NULL;
|
||||
p->type = type;
|
||||
p->version = version;
|
||||
p->properties = props ? pw_properties_new_dict(props) : NULL;
|
||||
p->new_id = new_id;
|
||||
pw_client_set_busy(client, true);
|
||||
|
||||
|
|
@ -393,8 +398,8 @@ static void do_create_node(void *object,
|
|||
dbus_error_free(&error);
|
||||
goto not_allowed;
|
||||
not_allowed:
|
||||
pw_core_notify_error(client->core_resource,
|
||||
resource->id, SPA_RESULT_NO_PERMISSION, "not allowed");
|
||||
pw_core_resource_error(client->core_resource,
|
||||
resource->id, SPA_RESULT_NO_PERMISSION, "not allowed");
|
||||
return;
|
||||
}
|
||||
|
||||
|
|
@ -413,8 +418,8 @@ do_create_link(void *object,
|
|||
struct pw_client *client = resource->client;
|
||||
|
||||
if (cinfo->is_sandboxed) {
|
||||
pw_core_notify_error(client->core_resource,
|
||||
resource->id, SPA_RESULT_NO_PERMISSION, "not allowed");
|
||||
pw_core_resource_error(client->core_resource,
|
||||
resource->id, SPA_RESULT_NO_PERMISSION, "not allowed");
|
||||
return;
|
||||
}
|
||||
cinfo->old_methods->create_link (object,
|
||||
|
|
@ -432,9 +437,8 @@ static void on_resource_impl(struct pw_listener *listener,
|
|||
struct pw_resource *resource)
|
||||
{
|
||||
struct client_info *cinfo = SPA_CONTAINER_OF(listener, struct client_info, resource_impl);
|
||||
struct impl *impl = cinfo->impl;
|
||||
|
||||
if (resource->type == impl->core->type.core) {
|
||||
if (resource->type == client->core->type.core) {
|
||||
cinfo->old_methods = resource->implementation;
|
||||
cinfo->core_methods = *cinfo->old_methods;
|
||||
resource->implementation = &cinfo->core_methods;
|
||||
|
|
|
|||
|
|
@ -116,13 +116,13 @@ process_messages(struct pw_client *client)
|
|||
client->protocol, id);
|
||||
continue;
|
||||
}
|
||||
if (opcode >= resource->iface->n_methods) {
|
||||
if (opcode >= resource->marshal->n_methods) {
|
||||
pw_log_error("protocol-native %p: invalid method %u %u", client->protocol,
|
||||
id, opcode);
|
||||
pw_client_destroy(client);
|
||||
break;
|
||||
}
|
||||
demarshal = resource->iface->methods;
|
||||
demarshal = resource->marshal->method_demarshal;
|
||||
if (!demarshal[opcode] || !demarshal[opcode] (resource, message, size)) {
|
||||
pw_log_error("protocol-native %p: invalid message received %u %u",
|
||||
client->protocol, id, opcode);
|
||||
|
|
@ -449,13 +449,13 @@ on_remote_data(struct spa_loop_utils *utils,
|
|||
pw_log_error("protocol-native %p: could not find proxy %u", this, id);
|
||||
continue;
|
||||
}
|
||||
if (opcode >= proxy->iface->n_events) {
|
||||
if (opcode >= proxy->marshal->n_events) {
|
||||
pw_log_error("protocol-native %p: invalid method %u for %u", this, opcode,
|
||||
id);
|
||||
continue;
|
||||
}
|
||||
|
||||
demarshal = proxy->iface->events;
|
||||
demarshal = proxy->marshal->event_demarshal;
|
||||
if (demarshal[opcode]) {
|
||||
if (!demarshal[opcode] (proxy, message, size))
|
||||
pw_log_error
|
||||
|
|
|
|||
|
|
@ -375,7 +375,7 @@ pw_protocol_native_connection_begin_resource(struct pw_protocol_native_connectio
|
|||
types[i] = spa_type_map_get_type(core->type.map, b);
|
||||
|
||||
client->n_types += diff;
|
||||
pw_core_notify_update_types(client->core_resource, base, diff, types);
|
||||
pw_core_resource_update_types(client->core_resource, base, diff, types);
|
||||
}
|
||||
|
||||
impl->dest_id = resource->id;
|
||||
|
|
@ -404,7 +404,7 @@ pw_protocol_native_connection_begin_proxy(struct pw_protocol_native_connection *
|
|||
types[i] = spa_type_map_get_type(core->type.map, b);
|
||||
|
||||
remote->n_types += diff;
|
||||
pw_core_do_update_types(remote->core_proxy, base, diff, types);
|
||||
pw_core_proxy_update_types(remote->core_proxy, base, diff, types);
|
||||
}
|
||||
|
||||
impl->dest_id = proxy->id;
|
||||
|
|
|
|||
|
|
@ -89,9 +89,9 @@ static void core_marshal_get_registry(void *object, uint32_t version, uint32_t n
|
|||
|
||||
static void
|
||||
core_marshal_create_node(void *object,
|
||||
const char *factory_name,
|
||||
const char *name, const struct spa_dict *props,
|
||||
uint32_t version, uint32_t new_id)
|
||||
const char *factory_name, const char *name,
|
||||
uint32_t type, uint32_t version,
|
||||
const struct spa_dict *props, uint32_t new_id)
|
||||
{
|
||||
struct pw_proxy *proxy = object;
|
||||
struct spa_pod_builder *b;
|
||||
|
|
@ -105,7 +105,10 @@ core_marshal_create_node(void *object,
|
|||
spa_pod_builder_add(b,
|
||||
SPA_POD_TYPE_STRUCT, &f,
|
||||
SPA_POD_TYPE_STRING, factory_name,
|
||||
SPA_POD_TYPE_STRING, name, SPA_POD_TYPE_INT, n_items, 0);
|
||||
SPA_POD_TYPE_STRING, name,
|
||||
SPA_POD_TYPE_ID, type,
|
||||
SPA_POD_TYPE_INT, version,
|
||||
SPA_POD_TYPE_INT, n_items, 0);
|
||||
|
||||
for (i = 0; i < n_items; i++) {
|
||||
spa_pod_builder_add(b,
|
||||
|
|
@ -113,7 +116,6 @@ core_marshal_create_node(void *object,
|
|||
SPA_POD_TYPE_STRING, props->items[i].value, 0);
|
||||
}
|
||||
spa_pod_builder_add(b,
|
||||
SPA_POD_TYPE_INT, version,
|
||||
SPA_POD_TYPE_INT, new_id,
|
||||
-SPA_POD_TYPE_STRUCT, &f, 0);
|
||||
|
||||
|
|
@ -192,7 +194,6 @@ static bool core_demarshal_info(void *object, void *data, size_t size)
|
|||
|
||||
if (!spa_pod_iter_struct(&it, data, size) ||
|
||||
!spa_pod_iter_get(&it,
|
||||
SPA_POD_TYPE_INT, &info.id,
|
||||
SPA_POD_TYPE_LONG, &info.change_mask,
|
||||
SPA_POD_TYPE_STRING, &info.user_name,
|
||||
SPA_POD_TYPE_STRING, &info.host_name,
|
||||
|
|
@ -292,7 +293,6 @@ static void core_marshal_info(void *object, struct pw_core_info *info)
|
|||
|
||||
spa_pod_builder_add(b,
|
||||
SPA_POD_TYPE_STRUCT, &f,
|
||||
SPA_POD_TYPE_INT, info->id,
|
||||
SPA_POD_TYPE_LONG, info->change_mask,
|
||||
SPA_POD_TYPE_STRING, info->user_name,
|
||||
SPA_POD_TYPE_STRING, info->host_name,
|
||||
|
|
@ -437,14 +437,18 @@ static bool core_demarshal_create_node(void *object, void *data, size_t size)
|
|||
{
|
||||
struct pw_resource *resource = object;
|
||||
struct spa_pod_iter it;
|
||||
uint32_t version, new_id, i;
|
||||
uint32_t version, type, new_id, i;
|
||||
const char *factory_name, *name;
|
||||
struct spa_dict props;
|
||||
|
||||
if (!spa_pod_iter_struct(&it, data, size) ||
|
||||
!pw_pod_remap_data(SPA_POD_TYPE_STRUCT, data, size, &resource->client->types) ||
|
||||
!spa_pod_iter_get(&it,
|
||||
SPA_POD_TYPE_STRING, &factory_name,
|
||||
SPA_POD_TYPE_STRING, &name, SPA_POD_TYPE_INT, &props.n_items, 0))
|
||||
SPA_POD_TYPE_STRING, &name,
|
||||
SPA_POD_TYPE_ID, &type,
|
||||
SPA_POD_TYPE_INT, &version,
|
||||
SPA_POD_TYPE_INT, &props.n_items, 0))
|
||||
return false;
|
||||
|
||||
props.items = alloca(props.n_items * sizeof(struct spa_dict_item));
|
||||
|
|
@ -455,12 +459,12 @@ static bool core_demarshal_create_node(void *object, void *data, size_t size)
|
|||
return false;
|
||||
}
|
||||
if (!spa_pod_iter_get(&it,
|
||||
SPA_POD_TYPE_INT, &version,
|
||||
SPA_POD_TYPE_INT, &new_id, 0))
|
||||
return false;
|
||||
|
||||
pw_resource_do(resource, struct pw_core_methods, create_node, factory_name,
|
||||
name, &props, version, new_id);
|
||||
pw_resource_do(resource, struct pw_core_methods, create_node, factory_name, name,
|
||||
type, version,
|
||||
&props, new_id);
|
||||
return true;
|
||||
}
|
||||
|
||||
|
|
@ -558,16 +562,18 @@ static bool registry_demarshal_bind(void *object, void *data, size_t size)
|
|||
{
|
||||
struct pw_resource *resource = object;
|
||||
struct spa_pod_iter it;
|
||||
uint32_t id, version, new_id;
|
||||
uint32_t id, version, type, new_id;
|
||||
|
||||
if (!spa_pod_iter_struct(&it, data, size) ||
|
||||
!pw_pod_remap_data(SPA_POD_TYPE_STRUCT, data, size, &resource->client->types) ||
|
||||
!spa_pod_iter_get(&it,
|
||||
SPA_POD_TYPE_INT, &id,
|
||||
SPA_POD_TYPE_ID, &type,
|
||||
SPA_POD_TYPE_INT, &version,
|
||||
SPA_POD_TYPE_INT, &new_id, 0))
|
||||
return false;
|
||||
|
||||
pw_resource_do(resource, struct pw_registry_methods, bind, id, version, new_id);
|
||||
pw_resource_do(resource, struct pw_registry_methods, bind, id, type, version, new_id);
|
||||
return true;
|
||||
}
|
||||
|
||||
|
|
@ -584,7 +590,6 @@ static void module_marshal_info(void *object, struct pw_module_info *info)
|
|||
|
||||
spa_pod_builder_add(b,
|
||||
SPA_POD_TYPE_STRUCT, &f,
|
||||
SPA_POD_TYPE_INT, info->id,
|
||||
SPA_POD_TYPE_LONG, info->change_mask,
|
||||
SPA_POD_TYPE_STRING, info->name,
|
||||
SPA_POD_TYPE_STRING, info->filename,
|
||||
|
|
@ -610,7 +615,6 @@ static bool module_demarshal_info(void *object, void *data, size_t size)
|
|||
|
||||
if (!spa_pod_iter_struct(&it, data, size) ||
|
||||
!spa_pod_iter_get(&it,
|
||||
SPA_POD_TYPE_INT, &info.id,
|
||||
SPA_POD_TYPE_LONG, &info.change_mask,
|
||||
SPA_POD_TYPE_STRING, &info.name,
|
||||
SPA_POD_TYPE_STRING, &info.filename,
|
||||
|
|
@ -640,7 +644,6 @@ static void node_marshal_info(void *object, struct pw_node_info *info)
|
|||
|
||||
spa_pod_builder_add(b,
|
||||
SPA_POD_TYPE_STRUCT, &f,
|
||||
SPA_POD_TYPE_INT, info->id,
|
||||
SPA_POD_TYPE_LONG, info->change_mask,
|
||||
SPA_POD_TYPE_STRING, info->name,
|
||||
SPA_POD_TYPE_INT, info->max_input_ports,
|
||||
|
|
@ -685,7 +688,6 @@ static bool node_demarshal_info(void *object, void *data, size_t size)
|
|||
if (!spa_pod_iter_struct(&it, data, size) ||
|
||||
!pw_pod_remap_data(SPA_POD_TYPE_STRUCT, data, size, &proxy->remote->types) ||
|
||||
!spa_pod_iter_get(&it,
|
||||
SPA_POD_TYPE_INT, &info.id,
|
||||
SPA_POD_TYPE_LONG, &info.change_mask,
|
||||
SPA_POD_TYPE_STRING, &info.name,
|
||||
SPA_POD_TYPE_INT, &info.max_input_ports,
|
||||
|
|
@ -740,7 +742,6 @@ static void client_marshal_info(void *object, struct pw_client_info *info)
|
|||
|
||||
spa_pod_builder_add(b,
|
||||
SPA_POD_TYPE_STRUCT, &f,
|
||||
SPA_POD_TYPE_INT, info->id,
|
||||
SPA_POD_TYPE_LONG, info->change_mask, SPA_POD_TYPE_INT, n_items, 0);
|
||||
|
||||
for (i = 0; i < n_items; i++) {
|
||||
|
|
@ -763,7 +764,6 @@ static bool client_demarshal_info(void *object, void *data, size_t size)
|
|||
|
||||
if (!spa_pod_iter_struct(&it, data, size) ||
|
||||
!spa_pod_iter_get(&it,
|
||||
SPA_POD_TYPE_INT, &info.id,
|
||||
SPA_POD_TYPE_LONG, &info.change_mask,
|
||||
SPA_POD_TYPE_INT, &props.n_items, 0))
|
||||
return false;
|
||||
|
|
@ -789,7 +789,6 @@ static void link_marshal_info(void *object, struct pw_link_info *info)
|
|||
b = pw_protocol_native_begin_resource(resource, PW_LINK_EVENT_INFO);
|
||||
|
||||
spa_pod_builder_struct(b, &f,
|
||||
SPA_POD_TYPE_INT, info->id,
|
||||
SPA_POD_TYPE_LONG, info->change_mask,
|
||||
SPA_POD_TYPE_INT, info->output_node_id,
|
||||
SPA_POD_TYPE_INT, info->output_port_id,
|
||||
|
|
@ -809,7 +808,6 @@ static bool link_demarshal_info(void *object, void *data, size_t size)
|
|||
if (!spa_pod_iter_struct(&it, data, size) ||
|
||||
!pw_pod_remap_data(SPA_POD_TYPE_STRUCT, data, size, &proxy->remote->types) ||
|
||||
!spa_pod_iter_get(&it,
|
||||
SPA_POD_TYPE_INT, &info.id,
|
||||
SPA_POD_TYPE_LONG, &info.change_mask,
|
||||
SPA_POD_TYPE_INT, &info.output_node_id,
|
||||
SPA_POD_TYPE_INT, &info.output_port_id,
|
||||
|
|
@ -854,7 +852,8 @@ static bool registry_demarshal_global_remove(void *object, void *data, size_t si
|
|||
return true;
|
||||
}
|
||||
|
||||
static void registry_marshal_bind(void *object, uint32_t id, uint32_t version, uint32_t new_id)
|
||||
static void registry_marshal_bind(void *object, uint32_t id,
|
||||
uint32_t type, uint32_t version, uint32_t new_id)
|
||||
{
|
||||
struct pw_proxy *proxy = object;
|
||||
struct spa_pod_builder *b;
|
||||
|
|
@ -864,13 +863,15 @@ static void registry_marshal_bind(void *object, uint32_t id, uint32_t version, u
|
|||
|
||||
spa_pod_builder_struct(b, &f,
|
||||
SPA_POD_TYPE_INT, id,
|
||||
SPA_POD_TYPE_ID, type,
|
||||
SPA_POD_TYPE_INT, version,
|
||||
SPA_POD_TYPE_INT, new_id);
|
||||
|
||||
pw_protocol_native_end_proxy(proxy, b);
|
||||
}
|
||||
|
||||
static const struct pw_core_methods pw_protocol_native_client_core_methods = {
|
||||
static const struct pw_core_methods pw_protocol_native_core_method_marshal = {
|
||||
PW_VERSION_CORE_METHODS,
|
||||
&core_marshal_update_types_client,
|
||||
&core_marshal_sync,
|
||||
&core_marshal_get_registry,
|
||||
|
|
@ -879,82 +880,7 @@ static const struct pw_core_methods pw_protocol_native_client_core_methods = {
|
|||
&core_marshal_create_link
|
||||
};
|
||||
|
||||
static const demarshal_func_t pw_protocol_native_client_core_demarshal[PW_CORE_EVENT_NUM] = {
|
||||
&core_demarshal_update_types_client,
|
||||
&core_demarshal_done,
|
||||
&core_demarshal_error,
|
||||
&core_demarshal_remove_id,
|
||||
&core_demarshal_info
|
||||
};
|
||||
|
||||
static const struct pw_interface pw_protocol_native_client_core_interface = {
|
||||
PW_TYPE__Core,
|
||||
PW_VERSION_CORE,
|
||||
PW_CORE_METHOD_NUM, &pw_protocol_native_client_core_methods,
|
||||
PW_CORE_EVENT_NUM, pw_protocol_native_client_core_demarshal
|
||||
};
|
||||
|
||||
static const struct pw_registry_methods pw_protocol_native_client_registry_methods = {
|
||||
®istry_marshal_bind
|
||||
};
|
||||
|
||||
static const demarshal_func_t pw_protocol_native_client_registry_demarshal[] = {
|
||||
®istry_demarshal_global,
|
||||
®istry_demarshal_global_remove,
|
||||
};
|
||||
|
||||
static const struct pw_interface pw_protocol_native_client_registry_interface = {
|
||||
PW_TYPE__Registry,
|
||||
PW_VERSION_REGISTRY,
|
||||
PW_REGISTRY_METHOD_NUM, &pw_protocol_native_client_registry_methods,
|
||||
PW_REGISTRY_EVENT_NUM, pw_protocol_native_client_registry_demarshal,
|
||||
};
|
||||
|
||||
static const demarshal_func_t pw_protocol_native_client_module_demarshal[] = {
|
||||
&module_demarshal_info,
|
||||
};
|
||||
|
||||
static const struct pw_interface pw_protocol_native_client_module_interface = {
|
||||
PW_TYPE__Module,
|
||||
PW_VERSION_MODULE,
|
||||
0, NULL,
|
||||
PW_MODULE_EVENT_NUM, pw_protocol_native_client_module_demarshal,
|
||||
};
|
||||
|
||||
static const demarshal_func_t pw_protocol_native_client_node_demarshal[] = {
|
||||
&node_demarshal_info,
|
||||
};
|
||||
|
||||
static const struct pw_interface pw_protocol_native_client_node_interface = {
|
||||
PW_TYPE__Node,
|
||||
PW_VERSION_NODE,
|
||||
0, NULL,
|
||||
PW_NODE_EVENT_NUM, pw_protocol_native_client_node_demarshal,
|
||||
};
|
||||
|
||||
static const demarshal_func_t pw_protocol_native_client_client_demarshal[] = {
|
||||
&client_demarshal_info,
|
||||
};
|
||||
|
||||
static const struct pw_interface pw_protocol_native_client_client_interface = {
|
||||
PW_TYPE__Client,
|
||||
PW_VERSION_CLIENT,
|
||||
0, NULL,
|
||||
PW_CLIENT_EVENT_NUM, pw_protocol_native_client_client_demarshal,
|
||||
};
|
||||
|
||||
static const demarshal_func_t pw_protocol_native_client_link_demarshal[] = {
|
||||
&link_demarshal_info,
|
||||
};
|
||||
|
||||
static const struct pw_interface pw_protocol_native_client_link_interface = {
|
||||
PW_TYPE__Link,
|
||||
PW_VERSION_LINK,
|
||||
0, NULL,
|
||||
PW_LINK_EVENT_NUM, pw_protocol_native_client_link_demarshal,
|
||||
};
|
||||
|
||||
static const demarshal_func_t pw_protocol_native_server_core_demarshal[PW_CORE_METHOD_NUM] = {
|
||||
static const demarshal_func_t pw_protocol_native_core_method_demarshal[PW_CORE_METHOD_NUM] = {
|
||||
&core_demarshal_update_types_server,
|
||||
&core_demarshal_sync,
|
||||
&core_demarshal_get_registry,
|
||||
|
|
@ -963,7 +889,8 @@ static const demarshal_func_t pw_protocol_native_server_core_demarshal[PW_CORE_M
|
|||
&core_demarshal_create_link
|
||||
};
|
||||
|
||||
static const struct pw_core_events pw_protocol_native_server_core_events = {
|
||||
static const struct pw_core_events pw_protocol_native_core_event_marshal = {
|
||||
PW_VERSION_CORE_EVENTS,
|
||||
&core_marshal_update_types_server,
|
||||
&core_marshal_done,
|
||||
&core_marshal_error,
|
||||
|
|
@ -971,92 +898,134 @@ static const struct pw_core_events pw_protocol_native_server_core_events = {
|
|||
&core_marshal_info
|
||||
};
|
||||
|
||||
const struct pw_interface pw_protocol_native_server_core_interface = {
|
||||
PW_TYPE__Core,
|
||||
PW_VERSION_CORE,
|
||||
PW_CORE_METHOD_NUM, pw_protocol_native_server_core_demarshal,
|
||||
PW_CORE_EVENT_NUM, &pw_protocol_native_server_core_events,
|
||||
static const demarshal_func_t pw_protocol_native_core_event_demarshal[PW_CORE_EVENT_NUM] = {
|
||||
&core_demarshal_update_types_client,
|
||||
&core_demarshal_done,
|
||||
&core_demarshal_error,
|
||||
&core_demarshal_remove_id,
|
||||
&core_demarshal_info
|
||||
};
|
||||
|
||||
static const demarshal_func_t pw_protocol_native_server_registry_demarshal[] = {
|
||||
static const struct pw_protocol_marshal pw_protocol_native_core_marshal = {
|
||||
PW_TYPE_INTERFACE__Core,
|
||||
PW_VERSION_CORE,
|
||||
PW_CORE_METHOD_NUM,
|
||||
&pw_protocol_native_core_method_marshal,
|
||||
pw_protocol_native_core_method_demarshal,
|
||||
PW_CORE_EVENT_NUM,
|
||||
&pw_protocol_native_core_event_marshal,
|
||||
pw_protocol_native_core_event_demarshal
|
||||
};
|
||||
|
||||
static const struct pw_registry_methods pw_protocol_native_registry_method_marshal = {
|
||||
PW_VERSION_REGISTRY_METHODS,
|
||||
®istry_marshal_bind
|
||||
};
|
||||
|
||||
static const demarshal_func_t pw_protocol_native_registry_method_demarshal[] = {
|
||||
®istry_demarshal_bind,
|
||||
};
|
||||
|
||||
static const struct pw_registry_events pw_protocol_native_server_registry_events = {
|
||||
static const struct pw_registry_events pw_protocol_native_registry_event_marshal = {
|
||||
PW_VERSION_REGISTRY_EVENTS,
|
||||
®istry_marshal_global,
|
||||
®istry_marshal_global_remove,
|
||||
};
|
||||
|
||||
const struct pw_interface pw_protocol_native_server_registry_interface = {
|
||||
PW_TYPE__Registry,
|
||||
PW_VERSION_REGISTRY,
|
||||
PW_REGISTRY_METHOD_NUM, pw_protocol_native_server_registry_demarshal,
|
||||
PW_REGISTRY_EVENT_NUM, &pw_protocol_native_server_registry_events,
|
||||
static const demarshal_func_t pw_protocol_native_registry_event_demarshal[] = {
|
||||
®istry_demarshal_global,
|
||||
®istry_demarshal_global_remove,
|
||||
};
|
||||
|
||||
static const struct pw_module_events pw_protocol_native_server_module_events = {
|
||||
const struct pw_protocol_marshal pw_protocol_native_registry_marshal = {
|
||||
PW_TYPE_INTERFACE__Registry,
|
||||
PW_VERSION_REGISTRY,
|
||||
PW_REGISTRY_METHOD_NUM,
|
||||
&pw_protocol_native_registry_method_marshal,
|
||||
pw_protocol_native_registry_method_demarshal,
|
||||
PW_REGISTRY_EVENT_NUM,
|
||||
&pw_protocol_native_registry_event_marshal,
|
||||
pw_protocol_native_registry_event_demarshal,
|
||||
};
|
||||
|
||||
static const struct pw_module_events pw_protocol_native_module_event_marshal = {
|
||||
PW_VERSION_MODULE_EVENTS,
|
||||
&module_marshal_info,
|
||||
};
|
||||
|
||||
const struct pw_interface pw_protocol_native_server_module_interface = {
|
||||
PW_TYPE__Module,
|
||||
PW_VERSION_MODULE,
|
||||
0, NULL,
|
||||
PW_MODULE_EVENT_NUM, &pw_protocol_native_server_module_events,
|
||||
static const demarshal_func_t pw_protocol_native_module_event_demarshal[] = {
|
||||
&module_demarshal_info,
|
||||
};
|
||||
|
||||
static const struct pw_node_events pw_protocol_native_server_node_events = {
|
||||
const struct pw_protocol_marshal pw_protocol_native_module_marshal = {
|
||||
PW_TYPE_INTERFACE__Module,
|
||||
PW_VERSION_MODULE,
|
||||
0, NULL, NULL,
|
||||
PW_MODULE_EVENT_NUM,
|
||||
&pw_protocol_native_module_event_marshal,
|
||||
pw_protocol_native_module_event_demarshal,
|
||||
};
|
||||
|
||||
static const struct pw_node_events pw_protocol_native_node_event_marshal = {
|
||||
PW_VERSION_NODE_EVENTS,
|
||||
&node_marshal_info,
|
||||
};
|
||||
|
||||
const struct pw_interface pw_protocol_native_server_node_interface = {
|
||||
PW_TYPE__Node,
|
||||
PW_VERSION_NODE,
|
||||
0, NULL,
|
||||
PW_NODE_EVENT_NUM, &pw_protocol_native_server_node_events,
|
||||
static const demarshal_func_t pw_protocol_native_node_event_demarshal[] = {
|
||||
&node_demarshal_info,
|
||||
};
|
||||
|
||||
static const struct pw_client_events pw_protocol_native_server_client_events = {
|
||||
static const struct pw_protocol_marshal pw_protocol_native_node_marshal = {
|
||||
PW_TYPE_INTERFACE__Node,
|
||||
PW_VERSION_NODE,
|
||||
0, NULL, NULL,
|
||||
PW_NODE_EVENT_NUM,
|
||||
&pw_protocol_native_node_event_marshal,
|
||||
pw_protocol_native_node_event_demarshal,
|
||||
};
|
||||
|
||||
static const struct pw_client_events pw_protocol_native_client_event_marshal = {
|
||||
PW_VERSION_CLIENT_EVENTS,
|
||||
&client_marshal_info,
|
||||
};
|
||||
|
||||
const struct pw_interface pw_protocol_native_server_client_interface = {
|
||||
PW_TYPE__Client,
|
||||
PW_VERSION_CLIENT,
|
||||
0, NULL,
|
||||
PW_CLIENT_EVENT_NUM, &pw_protocol_native_server_client_events,
|
||||
static const demarshal_func_t pw_protocol_native_client_event_demarshal[] = {
|
||||
&client_demarshal_info,
|
||||
};
|
||||
|
||||
static const struct pw_link_events pw_protocol_native_server_link_events = {
|
||||
static const struct pw_protocol_marshal pw_protocol_native_client_marshal = {
|
||||
PW_TYPE_INTERFACE__Client,
|
||||
PW_VERSION_CLIENT,
|
||||
0, NULL, NULL,
|
||||
PW_CLIENT_EVENT_NUM,
|
||||
&pw_protocol_native_client_event_marshal,
|
||||
pw_protocol_native_client_event_demarshal,
|
||||
};
|
||||
|
||||
static const struct pw_link_events pw_protocol_native_link_event_marshal = {
|
||||
PW_VERSION_LINK_EVENTS,
|
||||
&link_marshal_info,
|
||||
};
|
||||
|
||||
const struct pw_interface pw_protocol_native_server_link_interface = {
|
||||
PW_TYPE__Link,
|
||||
static const demarshal_func_t pw_protocol_native_link_event_demarshal[] = {
|
||||
&link_demarshal_info,
|
||||
};
|
||||
|
||||
static const struct pw_protocol_marshal pw_protocol_native_link_marshal = {
|
||||
PW_TYPE_INTERFACE__Link,
|
||||
PW_VERSION_LINK,
|
||||
0, NULL,
|
||||
PW_LINK_EVENT_NUM, &pw_protocol_native_server_link_events,
|
||||
0, NULL, NULL,
|
||||
PW_LINK_EVENT_NUM,
|
||||
&pw_protocol_native_link_event_marshal,
|
||||
pw_protocol_native_link_event_demarshal,
|
||||
};
|
||||
|
||||
void pw_protocol_native_init(struct pw_protocol *protocol)
|
||||
{
|
||||
pw_protocol_add_interfaces(protocol,
|
||||
&pw_protocol_native_client_core_interface,
|
||||
&pw_protocol_native_server_core_interface);
|
||||
pw_protocol_add_interfaces(protocol,
|
||||
&pw_protocol_native_client_registry_interface,
|
||||
&pw_protocol_native_server_registry_interface);
|
||||
pw_protocol_add_interfaces(protocol,
|
||||
&pw_protocol_native_client_module_interface,
|
||||
&pw_protocol_native_server_module_interface);
|
||||
pw_protocol_add_interfaces(protocol,
|
||||
&pw_protocol_native_client_node_interface,
|
||||
&pw_protocol_native_server_node_interface);
|
||||
pw_protocol_add_interfaces(protocol,
|
||||
&pw_protocol_native_client_client_interface,
|
||||
&pw_protocol_native_server_client_interface);
|
||||
pw_protocol_add_interfaces(protocol,
|
||||
&pw_protocol_native_client_link_interface,
|
||||
&pw_protocol_native_server_link_interface);
|
||||
|
||||
pw_protocol_add_marshal(protocol, &pw_protocol_native_core_marshal);
|
||||
pw_protocol_add_marshal(protocol, &pw_protocol_native_registry_marshal);
|
||||
pw_protocol_add_marshal(protocol, &pw_protocol_native_module_marshal);
|
||||
pw_protocol_add_marshal(protocol, &pw_protocol_native_node_marshal);
|
||||
pw_protocol_add_marshal(protocol, &pw_protocol_native_client_marshal);
|
||||
pw_protocol_add_marshal(protocol, &pw_protocol_native_link_marshal);
|
||||
}
|
||||
|
|
|
|||
|
|
@ -66,7 +66,7 @@ static struct pw_node *create_node(struct pw_node_factory *factory,
|
|||
no_properties:
|
||||
pw_log_error("missing properties");
|
||||
if (resource) {
|
||||
pw_core_notify_error(resource->client->core_resource,
|
||||
pw_core_resource_error(resource->client->core_resource,
|
||||
resource->client->core_resource->id,
|
||||
SPA_RESULT_INVALID_ARGUMENTS, "missing properties");
|
||||
}
|
||||
|
|
@ -74,7 +74,7 @@ static struct pw_node *create_node(struct pw_node_factory *factory,
|
|||
no_mem:
|
||||
pw_log_error("can't create node");
|
||||
if (resource) {
|
||||
pw_core_notify_error(resource->client->core_resource,
|
||||
pw_core_resource_error(resource->client->core_resource,
|
||||
resource->client->core_resource->id,
|
||||
SPA_RESULT_NO_MEMORY, "no memory");
|
||||
}
|
||||
|
|
@ -97,7 +97,8 @@ static struct impl *module_new(struct pw_core *core, struct pw_properties *prope
|
|||
|
||||
spa_list_insert(core->node_factory_list.prev, &impl->this.link);
|
||||
|
||||
pw_core_add_global(core, NULL, core->type.node_factory, 0, impl, NULL, &impl->this.global);
|
||||
pw_core_add_global(core, NULL, core->type.node_factory, 0,
|
||||
NULL, impl, &impl->this.global);
|
||||
|
||||
return impl;
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue