mirror of
https://gitlab.freedesktop.org/pipewire/pipewire.git
synced 2025-11-07 13:30:09 -05:00
interface: add an interface struct
The interface struct has the type,version and methods of the interface. Make spa interfaces extend from spa_interface and make a separate structure for the methods. Pass a generic void* as the first argument of methods, like we don in PipeWire. Bundle the methods + implementation in a versioned inteface and use that to invoke methods. This way we can do version checks on the methods. Make resource and proxy interfaces that we can can call. We can then make the core interfaces independent on proxy/resource and hide them in the lower layers. Add add_listener method to methods of core interfaces, just like SPA.
This commit is contained in:
parent
eb6481efb3
commit
ff946e3d4b
85 changed files with 3051 additions and 3000 deletions
|
|
@ -136,7 +136,8 @@ static void *create_object(void *_data,
|
|||
pw_node_register(dsp, client, pw_module_get_global(d->module), NULL);
|
||||
pw_node_add_listener(dsp, &nd->dsp_listener, &node_events, nd);
|
||||
|
||||
res = pw_global_bind(pw_node_get_global(dsp), client, PW_PERM_RWX, PW_VERSION_NODE, new_id);
|
||||
res = pw_global_bind(pw_node_get_global(dsp), client,
|
||||
PW_PERM_RWX, PW_VERSION_NODE_PROXY, new_id);
|
||||
if (res < 0)
|
||||
goto no_bind;
|
||||
|
||||
|
|
@ -208,7 +209,7 @@ static int module_init(struct pw_module *module, struct pw_properties *propertie
|
|||
factory = pw_factory_new(core,
|
||||
"audio-dsp",
|
||||
PW_TYPE_INTERFACE_Node,
|
||||
PW_VERSION_NODE,
|
||||
PW_VERSION_NODE_PROXY,
|
||||
NULL,
|
||||
sizeof(*data));
|
||||
if (factory == NULL)
|
||||
|
|
|
|||
|
|
@ -124,33 +124,31 @@ struct impl {
|
|||
#define GET_OUT_PORT(this,p) (&this->out_ports[p])
|
||||
#define GET_PORT(this,d,p) (d == SPA_DIRECTION_INPUT ? GET_IN_PORT(this,p) : GET_OUT_PORT(this,p))
|
||||
|
||||
static int impl_node_enum_params(struct spa_node *node, int seq,
|
||||
static int impl_node_enum_params(void *object, int seq,
|
||||
uint32_t id, uint32_t start, uint32_t num,
|
||||
const struct spa_pod *filter)
|
||||
{
|
||||
return -ENOTSUP;
|
||||
}
|
||||
|
||||
static int impl_node_set_param(struct spa_node *node, uint32_t id, uint32_t flags,
|
||||
static int impl_node_set_param(void *object, uint32_t id, uint32_t flags,
|
||||
const struct spa_pod *param)
|
||||
{
|
||||
return -ENOTSUP;
|
||||
}
|
||||
|
||||
static int impl_node_set_io(struct spa_node *node, uint32_t id, void *data, size_t size)
|
||||
static int impl_node_set_io(void *object, uint32_t id, void *data, size_t size)
|
||||
{
|
||||
return -ENOTSUP;
|
||||
}
|
||||
|
||||
static int impl_node_send_command(struct spa_node *node, const struct spa_command *command)
|
||||
static int impl_node_send_command(void *object, const struct spa_command *command)
|
||||
{
|
||||
struct impl *this;
|
||||
struct impl *this = object;
|
||||
|
||||
spa_return_val_if_fail(node != NULL, -EINVAL);
|
||||
spa_return_val_if_fail(this != NULL, -EINVAL);
|
||||
spa_return_val_if_fail(command != NULL, -EINVAL);
|
||||
|
||||
this = SPA_CONTAINER_OF(node, struct impl, node);
|
||||
|
||||
switch (SPA_NODE_COMMAND_ID(command)) {
|
||||
case SPA_NODE_COMMAND_Start:
|
||||
this->started = true;
|
||||
|
|
@ -185,18 +183,17 @@ static void emit_port_info(struct impl *this, struct port *port, bool full)
|
|||
}
|
||||
}
|
||||
|
||||
static int impl_node_add_listener(struct spa_node *node,
|
||||
static int impl_node_add_listener(void *object,
|
||||
struct spa_hook *listener,
|
||||
const struct spa_node_events *events,
|
||||
void *data)
|
||||
{
|
||||
struct impl *this;
|
||||
struct impl *this = object;
|
||||
struct spa_hook_list save;
|
||||
uint32_t i;
|
||||
|
||||
spa_return_val_if_fail(node != NULL, -EINVAL);
|
||||
spa_return_val_if_fail(this != NULL, -EINVAL);
|
||||
|
||||
this = SPA_CONTAINER_OF(node, struct impl, node);
|
||||
spa_hook_list_isolate(&this->hooks, &save, listener, events, data);
|
||||
|
||||
emit_node_info(this, true);
|
||||
|
|
@ -212,23 +209,20 @@ static int impl_node_add_listener(struct spa_node *node,
|
|||
}
|
||||
|
||||
static int
|
||||
impl_node_set_callbacks(struct spa_node *node,
|
||||
impl_node_set_callbacks(void *object,
|
||||
const struct spa_node_callbacks *callbacks,
|
||||
void *user_data)
|
||||
{
|
||||
return 0;
|
||||
}
|
||||
|
||||
static int impl_node_add_port(struct spa_node *node, enum spa_direction direction, uint32_t port_id,
|
||||
static int impl_node_add_port(void *object, enum spa_direction direction, uint32_t port_id,
|
||||
const struct spa_dict *props)
|
||||
{
|
||||
struct impl *this;
|
||||
struct impl *this = object;
|
||||
struct port *port;
|
||||
|
||||
spa_return_val_if_fail(node != NULL, -EINVAL);
|
||||
|
||||
this = SPA_CONTAINER_OF(node, struct impl, node);
|
||||
|
||||
spa_return_val_if_fail(this != NULL, -EINVAL);
|
||||
spa_return_val_if_fail(CHECK_FREE_IN_PORT(this, direction, port_id), -EINVAL);
|
||||
|
||||
port = GET_IN_PORT (this, port_id);
|
||||
|
|
@ -266,15 +260,12 @@ static int impl_node_add_port(struct spa_node *node, enum spa_direction directio
|
|||
}
|
||||
|
||||
static int
|
||||
impl_node_remove_port(struct spa_node *node, enum spa_direction direction, uint32_t port_id)
|
||||
impl_node_remove_port(void *object, enum spa_direction direction, uint32_t port_id)
|
||||
{
|
||||
struct impl *this;
|
||||
struct impl *this = object;
|
||||
struct port *port;
|
||||
|
||||
spa_return_val_if_fail(node != NULL, -EINVAL);
|
||||
|
||||
this = SPA_CONTAINER_OF(node, struct impl, node);
|
||||
|
||||
spa_return_val_if_fail(this != NULL, -EINVAL);
|
||||
spa_return_val_if_fail(CHECK_IN_PORT(this, direction, port_id), -EINVAL);
|
||||
|
||||
port = GET_IN_PORT (this, port_id);
|
||||
|
|
@ -303,13 +294,13 @@ impl_node_remove_port(struct spa_node *node, enum spa_direction direction, uint3
|
|||
return 0;
|
||||
}
|
||||
|
||||
static int port_enum_formats(struct spa_node *node,
|
||||
static int port_enum_formats(void *object,
|
||||
enum spa_direction direction, uint32_t port_id,
|
||||
uint32_t index,
|
||||
struct spa_pod **param,
|
||||
struct spa_pod_builder *builder)
|
||||
{
|
||||
struct impl *this = SPA_CONTAINER_OF(node, struct impl, node);
|
||||
struct impl *this = object;
|
||||
|
||||
switch (index) {
|
||||
case 0:
|
||||
|
|
@ -333,12 +324,12 @@ static int port_enum_formats(struct spa_node *node,
|
|||
}
|
||||
|
||||
static int
|
||||
impl_node_port_enum_params(struct spa_node *node, int seq,
|
||||
impl_node_port_enum_params(void *object, int seq,
|
||||
enum spa_direction direction, uint32_t port_id,
|
||||
uint32_t id, uint32_t start, uint32_t num,
|
||||
const struct spa_pod *filter)
|
||||
{
|
||||
struct impl *this;
|
||||
struct impl *this = object;
|
||||
struct port *port;
|
||||
struct spa_pod *param;
|
||||
struct spa_pod_builder b = { 0 };
|
||||
|
|
@ -347,11 +338,8 @@ impl_node_port_enum_params(struct spa_node *node, int seq,
|
|||
uint32_t count = 0;
|
||||
int res;
|
||||
|
||||
spa_return_val_if_fail(node != NULL, -EINVAL);
|
||||
spa_return_val_if_fail(this != NULL, -EINVAL);
|
||||
spa_return_val_if_fail(num != 0, -EINVAL);
|
||||
|
||||
this = SPA_CONTAINER_OF(node, struct impl, node);
|
||||
|
||||
spa_return_val_if_fail(CHECK_PORT(this, direction, port_id), -EINVAL);
|
||||
|
||||
port = GET_PORT(this, direction, port_id);
|
||||
|
|
@ -365,7 +353,7 @@ impl_node_port_enum_params(struct spa_node *node, int seq,
|
|||
|
||||
switch (id) {
|
||||
case SPA_PARAM_EnumFormat:
|
||||
if ((res = port_enum_formats(node, direction, port_id, result.index, ¶m, &b)) <= 0)
|
||||
if ((res = port_enum_formats(this, direction, port_id, result.index, ¶m, &b)) <= 0)
|
||||
return res;
|
||||
break;
|
||||
|
||||
|
|
@ -471,13 +459,13 @@ static struct buffer *dequeue_buffer(struct impl *this, struct port *port)
|
|||
return b;
|
||||
}
|
||||
|
||||
static int port_set_format(struct spa_node *node,
|
||||
static int port_set_format(void *object,
|
||||
enum spa_direction direction,
|
||||
uint32_t port_id,
|
||||
uint32_t flags,
|
||||
const struct spa_pod *format)
|
||||
{
|
||||
struct impl *this = SPA_CONTAINER_OF(node, struct impl, node);
|
||||
struct impl *this = object;
|
||||
struct port *port;
|
||||
int res;
|
||||
|
||||
|
|
@ -538,41 +526,35 @@ static int port_set_format(struct spa_node *node,
|
|||
|
||||
|
||||
static int
|
||||
impl_node_port_set_param(struct spa_node *node,
|
||||
impl_node_port_set_param(void *object,
|
||||
enum spa_direction direction, uint32_t port_id,
|
||||
uint32_t id, uint32_t flags,
|
||||
const struct spa_pod *param)
|
||||
{
|
||||
struct impl *this;
|
||||
|
||||
spa_return_val_if_fail(node != NULL, -EINVAL);
|
||||
|
||||
this = SPA_CONTAINER_OF(node, struct impl, node);
|
||||
struct impl *this = object;
|
||||
|
||||
spa_return_val_if_fail(this != NULL, -EINVAL);
|
||||
spa_return_val_if_fail(CHECK_PORT(this, direction, port_id), -EINVAL);
|
||||
|
||||
if (id == SPA_PARAM_Format) {
|
||||
return port_set_format(node, direction, port_id, flags, param);
|
||||
return port_set_format(this, direction, port_id, flags, param);
|
||||
}
|
||||
else
|
||||
return -ENOENT;
|
||||
}
|
||||
|
||||
static int
|
||||
impl_node_port_use_buffers(struct spa_node *node,
|
||||
impl_node_port_use_buffers(void *object,
|
||||
enum spa_direction direction,
|
||||
uint32_t port_id,
|
||||
struct spa_buffer **buffers,
|
||||
uint32_t n_buffers)
|
||||
{
|
||||
struct impl *this;
|
||||
struct impl *this = object;
|
||||
struct port *port;
|
||||
uint32_t i;
|
||||
|
||||
spa_return_val_if_fail(node != NULL, -EINVAL);
|
||||
|
||||
this = SPA_CONTAINER_OF(node, struct impl, node);
|
||||
|
||||
spa_return_val_if_fail(this != NULL, -EINVAL);
|
||||
spa_return_val_if_fail(CHECK_PORT(this, direction, port_id), -EINVAL);
|
||||
|
||||
port = GET_PORT(this, direction, port_id);
|
||||
|
|
@ -612,7 +594,7 @@ impl_node_port_use_buffers(struct spa_node *node,
|
|||
}
|
||||
|
||||
static int
|
||||
impl_node_port_alloc_buffers(struct spa_node *node,
|
||||
impl_node_port_alloc_buffers(void *object,
|
||||
enum spa_direction direction,
|
||||
uint32_t port_id,
|
||||
struct spa_pod **params,
|
||||
|
|
@ -624,17 +606,14 @@ impl_node_port_alloc_buffers(struct spa_node *node,
|
|||
}
|
||||
|
||||
static int
|
||||
impl_node_port_set_io(struct spa_node *node,
|
||||
impl_node_port_set_io(void *object,
|
||||
enum spa_direction direction, uint32_t port_id,
|
||||
uint32_t id, void *data, size_t size)
|
||||
{
|
||||
struct impl *this;
|
||||
struct impl *this = object;
|
||||
struct port *port;
|
||||
|
||||
spa_return_val_if_fail(node != NULL, -EINVAL);
|
||||
|
||||
this = SPA_CONTAINER_OF(node, struct impl, node);
|
||||
|
||||
spa_return_val_if_fail(this != NULL, -EINVAL);
|
||||
spa_return_val_if_fail(CHECK_PORT(this, direction, port_id), -EINVAL);
|
||||
|
||||
port = GET_PORT(this, direction, port_id);
|
||||
|
|
@ -649,15 +628,12 @@ impl_node_port_set_io(struct spa_node *node,
|
|||
return 0;
|
||||
}
|
||||
|
||||
static int impl_node_port_reuse_buffer(struct spa_node *node, uint32_t port_id, uint32_t buffer_id)
|
||||
static int impl_node_port_reuse_buffer(void *object, uint32_t port_id, uint32_t buffer_id)
|
||||
{
|
||||
struct impl *this;
|
||||
struct impl *this = object;
|
||||
struct port *port;
|
||||
|
||||
spa_return_val_if_fail(node != NULL, -EINVAL);
|
||||
|
||||
this = SPA_CONTAINER_OF(node, struct impl, node);
|
||||
|
||||
spa_return_val_if_fail(this != NULL, -EINVAL);
|
||||
spa_return_val_if_fail(CHECK_PORT(this, SPA_DIRECTION_OUTPUT, port_id), -EINVAL);
|
||||
port = GET_OUT_PORT(this, 0);
|
||||
|
||||
|
|
@ -721,18 +697,16 @@ static void mix_2(float * dst, const float * SPA_RESTRICT src1,
|
|||
#endif
|
||||
|
||||
|
||||
static int impl_node_process(struct spa_node *node)
|
||||
static int impl_node_process(void *object)
|
||||
{
|
||||
struct impl *this;
|
||||
struct impl *this = object;
|
||||
struct port *outport;
|
||||
struct spa_io_buffers *outio;
|
||||
uint32_t n_samples, n_buffers, i, maxsize;
|
||||
struct buffer **buffers;
|
||||
struct buffer *outb;
|
||||
|
||||
spa_return_val_if_fail(node != NULL, -EINVAL);
|
||||
|
||||
this = SPA_CONTAINER_OF(node, struct impl, node);
|
||||
spa_return_val_if_fail(this != NULL, -EINVAL);
|
||||
|
||||
outport = GET_OUT_PORT(this, 0);
|
||||
outio = outport->io;
|
||||
|
|
@ -825,8 +799,8 @@ static int impl_node_process(struct spa_node *node)
|
|||
return SPA_STATUS_HAVE_BUFFER | SPA_STATUS_NEED_BUFFER;
|
||||
}
|
||||
|
||||
static const struct spa_node impl_node = {
|
||||
SPA_VERSION_NODE,
|
||||
static const struct spa_node_methods impl_node = {
|
||||
SPA_VERSION_NODE_METHODS,
|
||||
.add_listener = impl_node_add_listener,
|
||||
.set_callbacks = impl_node_set_callbacks,
|
||||
.enum_params = impl_node_enum_params,
|
||||
|
|
@ -899,7 +873,10 @@ impl_init(const struct spa_handle_factory *factory,
|
|||
|
||||
spa_hook_list_init(&this->hooks);
|
||||
|
||||
this->node = impl_node;
|
||||
this->node.iface = SPA_INTERFACE_INIT(
|
||||
SPA_TYPE_INTERFACE_Node,
|
||||
SPA_VERSION_NODE,
|
||||
&impl_node, this);
|
||||
this->info = SPA_NODE_INFO_INIT();
|
||||
this->info.max_input_ports = MAX_PORTS;
|
||||
this->info.max_output_ports = 1;
|
||||
|
|
|
|||
|
|
@ -173,6 +173,33 @@ struct impl {
|
|||
int other_fds[2];
|
||||
};
|
||||
|
||||
#define pw_client_node_resource(r,m,v,...) \
|
||||
pw_resource_notify_res(r,struct pw_client_node_proxy_events,m,v,__VA_ARGS__)
|
||||
|
||||
#define pw_client_node_resource_add_mem(r,...) \
|
||||
pw_client_node_resource(r,add_mem,0,__VA_ARGS__)
|
||||
#define pw_client_node_resource_transport(r,...) \
|
||||
pw_client_node_resource(r,transport,0,__VA_ARGS__)
|
||||
#define pw_client_node_resource_set_param(r,...) \
|
||||
pw_client_node_resource(r,set_param,0,__VA_ARGS__)
|
||||
#define pw_client_node_resource_set_io(r,...) \
|
||||
pw_client_node_resource(r,set_io,0,__VA_ARGS__)
|
||||
#define pw_client_node_resource_event(r,...) \
|
||||
pw_client_node_resource(r,event,0,__VA_ARGS__)
|
||||
#define pw_client_node_resource_command(r,...) \
|
||||
pw_client_node_resource(r,command,0,__VA_ARGS__)
|
||||
#define pw_client_node_resource_add_port(r,...) \
|
||||
pw_client_node_resource(r,add_port,0,__VA_ARGS__)
|
||||
#define pw_client_node_resource_remove_port(r,...) \
|
||||
pw_client_node_resource(r,remove_port,0,__VA_ARGS__)
|
||||
#define pw_client_node_resource_port_set_param(r,...) \
|
||||
pw_client_node_resource(r,port_set_param,0,__VA_ARGS__)
|
||||
#define pw_client_node_resource_port_use_buffers(r,...) \
|
||||
pw_client_node_resource(r,port_use_buffers,0,__VA_ARGS__)
|
||||
#define pw_client_node_resource_port_set_io(r,...) \
|
||||
pw_client_node_resource(r,port_set_io,0,__VA_ARGS__)
|
||||
#define pw_client_node_resource_set_activation(r,...) \
|
||||
pw_client_node_resource(r,set_activation,0,__VA_ARGS__)
|
||||
static int
|
||||
do_port_use_buffers(struct impl *impl,
|
||||
enum spa_direction direction,
|
||||
|
|
@ -356,21 +383,19 @@ static void mix_clear(struct node *this, struct mix *mix)
|
|||
mix->valid = false;
|
||||
}
|
||||
|
||||
static int impl_node_enum_params(struct spa_node *node, int seq,
|
||||
static int impl_node_enum_params(void *object, int seq,
|
||||
uint32_t id, uint32_t start, uint32_t num,
|
||||
const struct spa_pod *filter)
|
||||
{
|
||||
struct node *this;
|
||||
struct node *this = object;
|
||||
uint8_t buffer[1024];
|
||||
struct spa_pod_builder b = { 0 };
|
||||
struct spa_result_node_params result;
|
||||
uint32_t count = 0;
|
||||
|
||||
spa_return_val_if_fail(node != NULL, -EINVAL);
|
||||
spa_return_val_if_fail(this != NULL, -EINVAL);
|
||||
spa_return_val_if_fail(num != 0, -EINVAL);
|
||||
|
||||
this = SPA_CONTAINER_OF(node, struct node, node);
|
||||
|
||||
result.id = id;
|
||||
result.next = start;
|
||||
|
||||
|
|
@ -399,14 +424,12 @@ static int impl_node_enum_params(struct spa_node *node, int seq,
|
|||
return 0;
|
||||
}
|
||||
|
||||
static int impl_node_set_param(struct spa_node *node, uint32_t id, uint32_t flags,
|
||||
static int impl_node_set_param(void *object, uint32_t id, uint32_t flags,
|
||||
const struct spa_pod *param)
|
||||
{
|
||||
struct node *this;
|
||||
struct node *this = object;
|
||||
|
||||
spa_return_val_if_fail(node != NULL, -EINVAL);
|
||||
|
||||
this = SPA_CONTAINER_OF(node, struct node, node);
|
||||
spa_return_val_if_fail(this != NULL, -EINVAL);
|
||||
|
||||
if (this->resource == NULL)
|
||||
return -EIO;
|
||||
|
|
@ -414,17 +437,16 @@ static int impl_node_set_param(struct spa_node *node, uint32_t id, uint32_t flag
|
|||
return pw_client_node_resource_set_param(this->resource, id, flags, param);
|
||||
}
|
||||
|
||||
static int impl_node_set_io(struct spa_node *node, uint32_t id, void *data, size_t size)
|
||||
static int impl_node_set_io(void *object, uint32_t id, void *data, size_t size)
|
||||
{
|
||||
struct node *this;
|
||||
struct node *this = object;
|
||||
struct impl *impl;
|
||||
struct pw_memblock *mem;
|
||||
struct mem *m;
|
||||
uint32_t memid, mem_offset, mem_size;
|
||||
|
||||
spa_return_val_if_fail(node != NULL, -EINVAL);
|
||||
spa_return_val_if_fail(this != NULL, -EINVAL);
|
||||
|
||||
this = SPA_CONTAINER_OF(node, struct node, node);
|
||||
impl = this->impl;
|
||||
|
||||
if (impl->this.flags & 1)
|
||||
|
|
@ -461,19 +483,17 @@ static int impl_node_set_io(struct spa_node *node, uint32_t id, void *data, size
|
|||
return 0;
|
||||
}
|
||||
|
||||
static int impl_node_send_command(struct spa_node *node, const struct spa_command *command)
|
||||
static int impl_node_send_command(void *object, const struct spa_command *command)
|
||||
{
|
||||
struct node *this;
|
||||
struct node *this = object;
|
||||
|
||||
spa_return_val_if_fail(node != NULL, -EINVAL);
|
||||
spa_return_val_if_fail(this != NULL, -EINVAL);
|
||||
spa_return_val_if_fail(command != NULL, -EINVAL);
|
||||
|
||||
this = SPA_CONTAINER_OF(node, struct node, node);
|
||||
|
||||
if (this->resource == NULL)
|
||||
return -EIO;
|
||||
|
||||
pw_log_debug("client-node %p: send command %d", node, SPA_COMMAND_TYPE(command));
|
||||
pw_log_debug("client-node %p: send command %d", this, SPA_COMMAND_TYPE(command));
|
||||
return pw_client_node_resource_command(this->resource, command);
|
||||
}
|
||||
|
||||
|
|
@ -484,18 +504,17 @@ static void emit_port_info(struct node *this, struct port *port)
|
|||
port->direction, port->id, &port->info);
|
||||
}
|
||||
|
||||
static int impl_node_add_listener(struct spa_node *node,
|
||||
static int impl_node_add_listener(void *object,
|
||||
struct spa_hook *listener,
|
||||
const struct spa_node_events *events,
|
||||
void *data)
|
||||
{
|
||||
struct node *this;
|
||||
struct node *this = object;
|
||||
struct spa_hook_list save;
|
||||
uint32_t i;
|
||||
|
||||
spa_return_val_if_fail(node != NULL, -EINVAL);
|
||||
spa_return_val_if_fail(this != NULL, -EINVAL);
|
||||
|
||||
this = SPA_CONTAINER_OF(node, struct node, node);
|
||||
spa_hook_list_isolate(&this->hooks, &save, listener, events, data);
|
||||
|
||||
for (i = 0; i < MAX_INPUTS; i++) {
|
||||
|
|
@ -512,29 +531,30 @@ static int impl_node_add_listener(struct spa_node *node,
|
|||
}
|
||||
|
||||
static int
|
||||
impl_node_set_callbacks(struct spa_node *node,
|
||||
impl_node_set_callbacks(void *object,
|
||||
const struct spa_node_callbacks *callbacks,
|
||||
void *data)
|
||||
{
|
||||
struct node *this;
|
||||
struct node *this = object;
|
||||
|
||||
spa_return_val_if_fail(node != NULL, -EINVAL);
|
||||
spa_return_val_if_fail(this != NULL, -EINVAL);
|
||||
|
||||
this = SPA_CONTAINER_OF(node, struct node, node);
|
||||
this->callbacks = SPA_CALLBACKS_INIT(callbacks, data);
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
static int
|
||||
impl_node_sync(struct spa_node *node, int seq)
|
||||
impl_node_sync(void *object, int seq)
|
||||
{
|
||||
struct node *this;
|
||||
spa_return_val_if_fail(node != NULL, -EINVAL);
|
||||
this = SPA_CONTAINER_OF(node, struct node, node);
|
||||
pw_log_debug("client-node %p: sync", node);
|
||||
struct node *this = object;
|
||||
|
||||
spa_return_val_if_fail(this != NULL, -EINVAL);
|
||||
|
||||
pw_log_debug("client-node %p: sync", this);
|
||||
if (this->resource == NULL)
|
||||
return -EIO;
|
||||
|
||||
return pw_resource_ping(this->resource, seq);
|
||||
}
|
||||
|
||||
|
|
@ -622,50 +642,43 @@ clear_port(struct node *this, struct port *port)
|
|||
}
|
||||
|
||||
static int
|
||||
impl_node_add_port(struct spa_node *node, enum spa_direction direction, uint32_t port_id,
|
||||
impl_node_add_port(void *object, enum spa_direction direction, uint32_t port_id,
|
||||
const struct spa_dict *props)
|
||||
{
|
||||
struct node *this;
|
||||
|
||||
spa_return_val_if_fail(node != NULL, -EINVAL);
|
||||
this = SPA_CONTAINER_OF(node, struct node, node);
|
||||
struct node *this = object;
|
||||
|
||||
spa_return_val_if_fail(this != NULL, -EINVAL);
|
||||
spa_return_val_if_fail(CHECK_FREE_PORT(this, direction, port_id), -EINVAL);
|
||||
|
||||
return pw_client_node_resource_add_port(this->resource, direction, port_id, props);
|
||||
}
|
||||
|
||||
static int
|
||||
impl_node_remove_port(struct spa_node *node, enum spa_direction direction, uint32_t port_id)
|
||||
impl_node_remove_port(void *object, enum spa_direction direction, uint32_t port_id)
|
||||
{
|
||||
struct node *this;
|
||||
|
||||
spa_return_val_if_fail(node != NULL, -EINVAL);
|
||||
this = SPA_CONTAINER_OF(node, struct node, node);
|
||||
struct node *this = object;
|
||||
|
||||
spa_return_val_if_fail(this != NULL, -EINVAL);
|
||||
spa_return_val_if_fail(CHECK_PORT(this, direction, port_id), -EINVAL);
|
||||
|
||||
return pw_client_node_resource_remove_port(this->resource, direction, port_id);
|
||||
}
|
||||
|
||||
static int
|
||||
impl_node_port_enum_params(struct spa_node *node, int seq,
|
||||
impl_node_port_enum_params(void *object, int seq,
|
||||
enum spa_direction direction, uint32_t port_id,
|
||||
uint32_t id, uint32_t start, uint32_t num,
|
||||
const struct spa_pod *filter)
|
||||
{
|
||||
struct node *this;
|
||||
struct node *this = object;
|
||||
struct port *port;
|
||||
uint8_t buffer[1024];
|
||||
struct spa_pod_builder b = { 0 };
|
||||
struct spa_result_node_params result;
|
||||
uint32_t count = 0;
|
||||
|
||||
spa_return_val_if_fail(node != NULL, -EINVAL);
|
||||
spa_return_val_if_fail(this != NULL, -EINVAL);
|
||||
spa_return_val_if_fail(num != 0, -EINVAL);
|
||||
|
||||
this = SPA_CONTAINER_OF(node, struct node, node);
|
||||
|
||||
spa_return_val_if_fail(CHECK_PORT(this, direction, port_id), -EINVAL);
|
||||
|
||||
port = GET_PORT(this, direction, port_id);
|
||||
|
|
@ -702,17 +715,14 @@ impl_node_port_enum_params(struct spa_node *node, int seq,
|
|||
}
|
||||
|
||||
static int
|
||||
impl_node_port_set_param(struct spa_node *node,
|
||||
impl_node_port_set_param(void *object,
|
||||
enum spa_direction direction, uint32_t port_id,
|
||||
uint32_t id, uint32_t flags,
|
||||
const struct spa_pod *param)
|
||||
{
|
||||
struct node *this;
|
||||
|
||||
spa_return_val_if_fail(node != NULL, -EINVAL);
|
||||
|
||||
this = SPA_CONTAINER_OF(node, struct node, node);
|
||||
struct node *this = object;
|
||||
|
||||
spa_return_val_if_fail(this != NULL, -EINVAL);
|
||||
spa_return_val_if_fail(CHECK_PORT(this, direction, port_id), -EINVAL);
|
||||
|
||||
if (this->resource == NULL)
|
||||
|
|
@ -783,7 +793,7 @@ static int do_port_set_io(struct impl *impl,
|
|||
}
|
||||
|
||||
static int
|
||||
impl_node_port_set_io(struct spa_node *node,
|
||||
impl_node_port_set_io(void *object,
|
||||
enum spa_direction direction,
|
||||
uint32_t port_id,
|
||||
uint32_t id,
|
||||
|
|
@ -907,18 +917,17 @@ do_port_use_buffers(struct impl *impl,
|
|||
}
|
||||
|
||||
static int
|
||||
impl_node_port_use_buffers(struct spa_node *node,
|
||||
impl_node_port_use_buffers(void *object,
|
||||
enum spa_direction direction,
|
||||
uint32_t port_id,
|
||||
struct spa_buffer **buffers,
|
||||
uint32_t n_buffers)
|
||||
{
|
||||
struct node *this;
|
||||
struct node *this = object;
|
||||
struct impl *impl;
|
||||
|
||||
spa_return_val_if_fail(node != NULL, -EINVAL);
|
||||
spa_return_val_if_fail(this != NULL, -EINVAL);
|
||||
|
||||
this = SPA_CONTAINER_OF(node, struct node, node);
|
||||
impl = this->impl;
|
||||
|
||||
return do_port_use_buffers(impl, direction, port_id,
|
||||
|
|
@ -926,7 +935,7 @@ impl_node_port_use_buffers(struct spa_node *node,
|
|||
}
|
||||
|
||||
static int
|
||||
impl_node_port_alloc_buffers(struct spa_node *node,
|
||||
impl_node_port_alloc_buffers(void *object,
|
||||
enum spa_direction direction,
|
||||
uint32_t port_id,
|
||||
struct spa_pod **params,
|
||||
|
|
@ -934,14 +943,11 @@ impl_node_port_alloc_buffers(struct spa_node *node,
|
|||
struct spa_buffer **buffers,
|
||||
uint32_t *n_buffers)
|
||||
{
|
||||
struct node *this;
|
||||
struct node *this = object;
|
||||
struct port *port;
|
||||
|
||||
spa_return_val_if_fail(node != NULL, -EINVAL);
|
||||
spa_return_val_if_fail(this != NULL, -EINVAL);
|
||||
spa_return_val_if_fail(buffers != NULL, -EINVAL);
|
||||
|
||||
this = SPA_CONTAINER_OF(node, struct node, node);
|
||||
|
||||
spa_return_val_if_fail(CHECK_PORT(this, direction, port_id), -EINVAL);
|
||||
|
||||
port = GET_PORT(this, direction, port_id);
|
||||
|
|
@ -954,13 +960,11 @@ impl_node_port_alloc_buffers(struct spa_node *node,
|
|||
}
|
||||
|
||||
static int
|
||||
impl_node_port_reuse_buffer(struct spa_node *node, uint32_t port_id, uint32_t buffer_id)
|
||||
impl_node_port_reuse_buffer(void *object, uint32_t port_id, uint32_t buffer_id)
|
||||
{
|
||||
struct node *this;
|
||||
|
||||
spa_return_val_if_fail(node != NULL, -EINVAL);
|
||||
this = SPA_CONTAINER_OF(node, struct node, node);
|
||||
struct node *this = object;
|
||||
|
||||
spa_return_val_if_fail(this != NULL, -EINVAL);
|
||||
spa_return_val_if_fail(CHECK_OUT_PORT(this, SPA_DIRECTION_OUTPUT, port_id), -EINVAL);
|
||||
|
||||
spa_log_trace_fp(this->log, "reuse buffer %d", buffer_id);
|
||||
|
|
@ -968,9 +972,9 @@ impl_node_port_reuse_buffer(struct spa_node *node, uint32_t port_id, uint32_t bu
|
|||
return -ENOTSUP;
|
||||
}
|
||||
|
||||
static int impl_node_process(struct spa_node *node)
|
||||
static int impl_node_process(void *object)
|
||||
{
|
||||
struct node *this = SPA_CONTAINER_OF(node, struct node, node);
|
||||
struct node *this = object;
|
||||
struct impl *impl = this->impl;
|
||||
struct pw_node *n = impl->this.node;
|
||||
struct timespec ts;
|
||||
|
|
@ -988,18 +992,22 @@ static int impl_node_process(struct spa_node *node)
|
|||
return SPA_STATUS_OK;
|
||||
}
|
||||
|
||||
static int
|
||||
static struct pw_node_proxy *
|
||||
client_node_get_node(void *data,
|
||||
uint32_t version,
|
||||
uint32_t new_id)
|
||||
size_t user_data_size)
|
||||
{
|
||||
struct impl *impl = data;
|
||||
struct node *this = &impl->node;
|
||||
uint32_t new_id = user_data_size;
|
||||
|
||||
pw_log_debug("node %p: bind %u/%u", this, new_id, version);
|
||||
|
||||
impl->bind_node_version = version;
|
||||
impl->bind_node_id = new_id;
|
||||
pw_map_insert_at(&this->resource->client->objects, new_id, NULL);
|
||||
return 0;
|
||||
|
||||
return NULL;
|
||||
}
|
||||
|
||||
static int
|
||||
|
|
@ -1118,9 +1126,8 @@ static void node_on_data_fd_events(struct spa_source *source)
|
|||
}
|
||||
}
|
||||
|
||||
static const struct spa_node impl_node = {
|
||||
SPA_VERSION_NODE,
|
||||
NULL,
|
||||
static const struct spa_node_methods impl_node = {
|
||||
SPA_VERSION_NODE_METHODS,
|
||||
.add_listener = impl_node_add_listener,
|
||||
.set_callbacks = impl_node_set_callbacks,
|
||||
.sync = impl_node_sync,
|
||||
|
|
@ -1164,7 +1171,10 @@ node_init(struct node *this,
|
|||
return -EINVAL;
|
||||
}
|
||||
|
||||
this->node = impl_node;
|
||||
this->node.iface = SPA_INTERFACE_INIT(
|
||||
SPA_TYPE_INTERFACE_Node,
|
||||
SPA_VERSION_NODE,
|
||||
&impl_node, this);
|
||||
spa_hook_list_init(&this->hooks);
|
||||
spa_list_init(&this->pending_list);
|
||||
|
||||
|
|
@ -1380,59 +1390,59 @@ static const struct pw_port_implementation port_impl = {
|
|||
};
|
||||
|
||||
static int
|
||||
impl_mix_port_enum_params(struct spa_node *node, int seq,
|
||||
impl_mix_port_enum_params(void *object, int seq,
|
||||
enum spa_direction direction, uint32_t port_id,
|
||||
uint32_t id, uint32_t start, uint32_t num,
|
||||
const struct spa_pod *filter)
|
||||
{
|
||||
struct port *port = SPA_CONTAINER_OF(node, struct port, mix_node);
|
||||
struct port *port = object;
|
||||
return impl_node_port_enum_params(&port->node->node, seq, direction, port->id,
|
||||
id, start, num, filter);
|
||||
}
|
||||
|
||||
static int
|
||||
impl_mix_port_set_param(struct spa_node *node,
|
||||
impl_mix_port_set_param(void *object,
|
||||
enum spa_direction direction, uint32_t port_id,
|
||||
uint32_t id, uint32_t flags,
|
||||
const struct spa_pod *param)
|
||||
{
|
||||
struct port *port = SPA_CONTAINER_OF(node, struct port, mix_node);
|
||||
struct port *port = object;
|
||||
return impl_node_port_set_param(&port->node->node, direction, port->id,
|
||||
id, flags, param);
|
||||
}
|
||||
|
||||
static int
|
||||
impl_mix_add_port(struct spa_node *node, enum spa_direction direction, uint32_t mix_id,
|
||||
impl_mix_add_port(void *object, enum spa_direction direction, uint32_t mix_id,
|
||||
const struct spa_dict *props)
|
||||
{
|
||||
struct port *port = SPA_CONTAINER_OF(node, struct port, mix_node);
|
||||
pw_log_debug("client-node %p: add port %d:%d.%d", node, direction, port->id, mix_id);
|
||||
struct port *port = object;
|
||||
pw_log_debug("client-node %p: add port %d:%d.%d", object, direction, port->id, mix_id);
|
||||
return 0;
|
||||
}
|
||||
|
||||
static int
|
||||
impl_mix_remove_port(struct spa_node *node, enum spa_direction direction, uint32_t mix_id)
|
||||
impl_mix_remove_port(void *object, enum spa_direction direction, uint32_t mix_id)
|
||||
{
|
||||
struct port *port = SPA_CONTAINER_OF(node, struct port, mix_node);
|
||||
pw_log_debug("client-node %p: remove port %d:%d.%d", node, direction, port->id, mix_id);
|
||||
struct port *port = object;
|
||||
pw_log_debug("client-node %p: remove port %d:%d.%d", object, direction, port->id, mix_id);
|
||||
return 0;
|
||||
}
|
||||
|
||||
static int
|
||||
impl_mix_port_use_buffers(struct spa_node *node,
|
||||
impl_mix_port_use_buffers(void *object,
|
||||
enum spa_direction direction,
|
||||
uint32_t mix_id,
|
||||
struct spa_buffer **buffers,
|
||||
uint32_t n_buffers)
|
||||
{
|
||||
struct port *port = SPA_CONTAINER_OF(node, struct port, mix_node);
|
||||
struct port *port = object;
|
||||
struct impl *impl = port->impl;
|
||||
|
||||
return do_port_use_buffers(impl, direction, port->id, mix_id, buffers, n_buffers);
|
||||
}
|
||||
|
||||
static int
|
||||
impl_mix_port_alloc_buffers(struct spa_node *node,
|
||||
impl_mix_port_alloc_buffers(void *object,
|
||||
enum spa_direction direction,
|
||||
uint32_t port_id,
|
||||
struct spa_pod **params,
|
||||
|
|
@ -1443,11 +1453,11 @@ impl_mix_port_alloc_buffers(struct spa_node *node,
|
|||
return -ENOTSUP;
|
||||
}
|
||||
|
||||
static int impl_mix_port_set_io(struct spa_node *node,
|
||||
static int impl_mix_port_set_io(void *object,
|
||||
enum spa_direction direction, uint32_t mix_id,
|
||||
uint32_t id, void *data, size_t size)
|
||||
{
|
||||
struct port *p = SPA_CONTAINER_OF(node, struct port, mix_node);
|
||||
struct port *p = object;
|
||||
struct pw_port *port = p->port;
|
||||
struct impl *impl = port->owner_data;
|
||||
struct pw_port_mix *mix;
|
||||
|
|
@ -1469,20 +1479,19 @@ static int impl_mix_port_set_io(struct spa_node *node,
|
|||
}
|
||||
|
||||
static int
|
||||
impl_mix_port_reuse_buffer(struct spa_node *node, uint32_t port_id, uint32_t buffer_id)
|
||||
impl_mix_port_reuse_buffer(void *object, uint32_t port_id, uint32_t buffer_id)
|
||||
{
|
||||
struct port *p = SPA_CONTAINER_OF(node, struct port, mix_node);
|
||||
struct port *p = object;
|
||||
return impl_node_port_reuse_buffer(&p->node->node, p->id, buffer_id);
|
||||
}
|
||||
|
||||
static int impl_mix_process(struct spa_node *data)
|
||||
static int impl_mix_process(void *object)
|
||||
{
|
||||
return SPA_STATUS_HAVE_BUFFER;
|
||||
}
|
||||
|
||||
static const struct spa_node impl_port_mix = {
|
||||
SPA_VERSION_NODE,
|
||||
NULL,
|
||||
static const struct spa_node_methods impl_port_mix = {
|
||||
SPA_VERSION_NODE_METHODS,
|
||||
.port_enum_params = impl_mix_port_enum_params,
|
||||
.port_set_param = impl_mix_port_set_param,
|
||||
.add_port = impl_mix_add_port,
|
||||
|
|
@ -1508,7 +1517,10 @@ static void node_port_init(void *data, struct pw_port *port)
|
|||
p->direction = port->direction;
|
||||
p->id = port->port_id;
|
||||
p->impl = impl;
|
||||
p->mix_node = impl_port_mix;
|
||||
p->mix_node.iface = SPA_INTERFACE_INIT(
|
||||
SPA_TYPE_INTERFACE_Node,
|
||||
SPA_VERSION_NODE,
|
||||
&impl_port_mix, p);
|
||||
mix_init(&p->mix[MAX_MIX], p, SPA_ID_INVALID);
|
||||
|
||||
if (p->direction == SPA_DIRECTION_INPUT) {
|
||||
|
|
@ -1526,7 +1538,7 @@ static void node_port_added(void *data, struct pw_port *port)
|
|||
struct impl *impl = data;
|
||||
struct port *p = pw_port_get_user_data(port);
|
||||
|
||||
pw_port_set_mix(port, &p->mix_node,
|
||||
pw_port_set_mix(port, (struct spa_node *)&p->mix_node,
|
||||
PW_PORT_MIX_FLAG_MULTI |
|
||||
PW_PORT_MIX_FLAG_MIX_ONLY);
|
||||
|
||||
|
|
@ -1613,7 +1625,7 @@ static int process_node(void *data)
|
|||
{
|
||||
struct impl *impl = data;
|
||||
pw_log_trace_fp("client-node %p: process", impl);
|
||||
return spa_node_process(&impl->node.node);
|
||||
return spa_node_process((struct spa_node*)&impl->node.node);
|
||||
}
|
||||
|
||||
/** Create a new client node
|
||||
|
|
@ -1670,7 +1682,7 @@ struct pw_client_node *pw_client_node_new(struct pw_resource *resource,
|
|||
name,
|
||||
PW_SPA_NODE_FLAG_ASYNC |
|
||||
(do_register ? 0 : PW_SPA_NODE_FLAG_NO_REGISTER),
|
||||
&impl->node.node,
|
||||
(struct spa_node *)&impl->node.node,
|
||||
NULL,
|
||||
properties, 0);
|
||||
if (this->node == NULL)
|
||||
|
|
|
|||
|
|
@ -116,11 +116,11 @@ struct impl {
|
|||
|
||||
/** \endcond */
|
||||
|
||||
static int impl_node_enum_params(struct spa_node *node, int seq,
|
||||
static int impl_node_enum_params(void *object, int seq,
|
||||
uint32_t id, uint32_t start, uint32_t num,
|
||||
const struct spa_pod *filter)
|
||||
{
|
||||
struct node *this;
|
||||
struct node *this = object;
|
||||
struct impl *impl;
|
||||
struct spa_pod *param;
|
||||
struct spa_pod_builder b = { 0 };
|
||||
|
|
@ -129,10 +129,9 @@ static int impl_node_enum_params(struct spa_node *node, int seq,
|
|||
uint32_t count = 0;
|
||||
int res;
|
||||
|
||||
spa_return_val_if_fail(node != NULL, -EINVAL);
|
||||
spa_return_val_if_fail(this != NULL, -EINVAL);
|
||||
spa_return_val_if_fail(num != 0, -EINVAL);
|
||||
|
||||
this = SPA_CONTAINER_OF(node, struct node, node);
|
||||
impl = this->impl;
|
||||
|
||||
result.id = id;
|
||||
|
|
@ -224,14 +223,13 @@ static void emit_node_info(struct node *this, bool full)
|
|||
}
|
||||
}
|
||||
|
||||
static int impl_node_set_param(struct spa_node *node, uint32_t id, uint32_t flags,
|
||||
static int impl_node_set_param(void *object, uint32_t id, uint32_t flags,
|
||||
const struct spa_pod *param)
|
||||
{
|
||||
int res = 0;
|
||||
struct node *this;
|
||||
struct node *this = object;
|
||||
struct impl *impl;
|
||||
|
||||
this = SPA_CONTAINER_OF(node, struct node, node);
|
||||
impl = this->impl;
|
||||
|
||||
switch (id) {
|
||||
|
|
@ -263,15 +261,14 @@ static int impl_node_set_param(struct spa_node *node, uint32_t id, uint32_t flag
|
|||
return res;
|
||||
}
|
||||
|
||||
static int impl_node_set_io(struct spa_node *node, uint32_t id, void *data, size_t size)
|
||||
static int impl_node_set_io(void *object, uint32_t id, void *data, size_t size)
|
||||
{
|
||||
struct node *this;
|
||||
struct node *this = object;
|
||||
struct impl *impl;
|
||||
int res = 0;
|
||||
|
||||
spa_return_val_if_fail(node != NULL, -EINVAL);
|
||||
spa_return_val_if_fail(this != NULL, -EINVAL);
|
||||
|
||||
this = SPA_CONTAINER_OF(node, struct node, node);
|
||||
impl = this->impl;
|
||||
|
||||
if (impl->adapter)
|
||||
|
|
@ -283,15 +280,14 @@ static int impl_node_set_io(struct spa_node *node, uint32_t id, void *data, size
|
|||
return res;
|
||||
}
|
||||
|
||||
static int impl_node_send_command(struct spa_node *node, const struct spa_command *command)
|
||||
static int impl_node_send_command(void *object, const struct spa_command *command)
|
||||
{
|
||||
struct node *this;
|
||||
struct node *this = object;
|
||||
struct impl *impl;
|
||||
int res;
|
||||
|
||||
spa_return_val_if_fail(node != NULL, -EINVAL);
|
||||
spa_return_val_if_fail(this != NULL, -EINVAL);
|
||||
|
||||
this = SPA_CONTAINER_OF(node, struct node, node);
|
||||
impl = this->impl;
|
||||
|
||||
switch (SPA_NODE_COMMAND_ID(command)) {
|
||||
|
|
@ -343,19 +339,18 @@ static const struct spa_node_events adapter_node_events = {
|
|||
.result = adapter_result,
|
||||
};
|
||||
|
||||
static int impl_node_add_listener(struct spa_node *node,
|
||||
static int impl_node_add_listener(void *object,
|
||||
struct spa_hook *listener,
|
||||
const struct spa_node_events *events,
|
||||
void *data)
|
||||
{
|
||||
struct node *this;
|
||||
struct node *this = object;
|
||||
struct impl *impl;
|
||||
struct spa_hook l;
|
||||
struct spa_hook_list save;
|
||||
|
||||
spa_return_val_if_fail(node != NULL, -EINVAL);
|
||||
spa_return_val_if_fail(this != NULL, -EINVAL);
|
||||
|
||||
this = SPA_CONTAINER_OF(node, struct node, node);
|
||||
impl = this->impl;
|
||||
|
||||
pw_log_debug("%p: add listener %p", this, listener);
|
||||
|
|
@ -375,15 +370,14 @@ static int impl_node_add_listener(struct spa_node *node,
|
|||
}
|
||||
|
||||
static int
|
||||
impl_node_set_callbacks(struct spa_node *node,
|
||||
impl_node_set_callbacks(void *object,
|
||||
const struct spa_node_callbacks *callbacks,
|
||||
void *data)
|
||||
{
|
||||
struct node *this;
|
||||
struct node *this = object;
|
||||
|
||||
spa_return_val_if_fail(node != NULL, -EINVAL);
|
||||
spa_return_val_if_fail(this != NULL, -EINVAL);
|
||||
|
||||
this = SPA_CONTAINER_OF(node, struct node, node);
|
||||
|
||||
this->callbacks = SPA_CALLBACKS_INIT(callbacks, data);
|
||||
|
||||
|
|
@ -391,30 +385,28 @@ impl_node_set_callbacks(struct spa_node *node,
|
|||
}
|
||||
|
||||
static int
|
||||
impl_node_sync(struct spa_node *node, int seq)
|
||||
impl_node_sync(void *object, int seq)
|
||||
{
|
||||
struct node *this;
|
||||
struct node *this = object;
|
||||
struct impl *impl;
|
||||
|
||||
spa_return_val_if_fail(node != NULL, -EINVAL);
|
||||
spa_return_val_if_fail(this != NULL, -EINVAL);
|
||||
|
||||
this = SPA_CONTAINER_OF(node, struct node, node);
|
||||
impl = this->impl;
|
||||
|
||||
return spa_node_sync(impl->cnode, seq);
|
||||
}
|
||||
|
||||
static int
|
||||
impl_node_add_port(struct spa_node *node, enum spa_direction direction, uint32_t port_id,
|
||||
impl_node_add_port(void *object, enum spa_direction direction, uint32_t port_id,
|
||||
const struct spa_dict *props)
|
||||
{
|
||||
struct node *this;
|
||||
struct node *this = object;
|
||||
struct impl *impl;
|
||||
int res;
|
||||
|
||||
spa_return_val_if_fail(node != NULL, -EINVAL);
|
||||
spa_return_val_if_fail(this != NULL, -EINVAL);
|
||||
|
||||
this = SPA_CONTAINER_OF(node, struct node, node);
|
||||
impl = this->impl;
|
||||
|
||||
if (direction != impl->direction)
|
||||
|
|
@ -427,14 +419,13 @@ impl_node_add_port(struct spa_node *node, enum spa_direction direction, uint32_t
|
|||
}
|
||||
|
||||
static int
|
||||
impl_node_remove_port(struct spa_node *node, enum spa_direction direction, uint32_t port_id)
|
||||
impl_node_remove_port(void *object, enum spa_direction direction, uint32_t port_id)
|
||||
{
|
||||
struct node *this;
|
||||
struct node *this = object;
|
||||
struct impl *impl;
|
||||
|
||||
spa_return_val_if_fail(node != NULL, -EINVAL);
|
||||
spa_return_val_if_fail(this != NULL, -EINVAL);
|
||||
|
||||
this = SPA_CONTAINER_OF(node, struct node, node);
|
||||
impl = this->impl;
|
||||
|
||||
if (direction != this->impl->direction)
|
||||
|
|
@ -444,18 +435,17 @@ impl_node_remove_port(struct spa_node *node, enum spa_direction direction, uint3
|
|||
}
|
||||
|
||||
static int
|
||||
impl_node_port_enum_params(struct spa_node *node, int seq,
|
||||
impl_node_port_enum_params(void *object, int seq,
|
||||
enum spa_direction direction, uint32_t port_id,
|
||||
uint32_t id, uint32_t start, uint32_t num,
|
||||
const struct spa_pod *filter)
|
||||
{
|
||||
struct node *this;
|
||||
struct node *this = object;
|
||||
struct impl *impl;
|
||||
|
||||
spa_return_val_if_fail(node != NULL, -EINVAL);
|
||||
spa_return_val_if_fail(this != NULL, -EINVAL);
|
||||
spa_return_val_if_fail(num != 0, -EINVAL);
|
||||
|
||||
this = SPA_CONTAINER_OF(node, struct node, node);
|
||||
impl = this->impl;
|
||||
|
||||
if (direction != impl->direction)
|
||||
|
|
@ -698,18 +688,17 @@ static int negotiate_buffers(struct impl *impl)
|
|||
}
|
||||
|
||||
static int
|
||||
impl_node_port_set_param(struct spa_node *node,
|
||||
impl_node_port_set_param(void *object,
|
||||
enum spa_direction direction, uint32_t port_id,
|
||||
uint32_t id, uint32_t flags,
|
||||
const struct spa_pod *param)
|
||||
{
|
||||
struct node *this;
|
||||
struct node *this = object;
|
||||
struct impl *impl;
|
||||
int res;
|
||||
|
||||
spa_return_val_if_fail(node != NULL, -EINVAL);
|
||||
spa_return_val_if_fail(this != NULL, -EINVAL);
|
||||
|
||||
this = SPA_CONTAINER_OF(node, struct node, node);
|
||||
impl = this->impl;
|
||||
|
||||
if (direction != impl->direction)
|
||||
|
|
@ -737,19 +726,18 @@ impl_node_port_set_param(struct spa_node *node,
|
|||
}
|
||||
|
||||
static int
|
||||
impl_node_port_set_io(struct spa_node *node,
|
||||
impl_node_port_set_io(void *object,
|
||||
enum spa_direction direction,
|
||||
uint32_t port_id,
|
||||
uint32_t id,
|
||||
void *data, size_t size)
|
||||
{
|
||||
struct node *this;
|
||||
struct node *this = object;
|
||||
struct impl *impl;
|
||||
int res = 0;
|
||||
|
||||
spa_return_val_if_fail(node != NULL, -EINVAL);
|
||||
spa_return_val_if_fail(this != NULL, -EINVAL);
|
||||
|
||||
this = SPA_CONTAINER_OF(node, struct node, node);
|
||||
impl = this->impl;
|
||||
|
||||
spa_log_debug(this->log, "set io %d %d %d %d", port_id, id, direction, impl->direction);
|
||||
|
|
@ -769,19 +757,18 @@ impl_node_port_set_io(struct spa_node *node,
|
|||
}
|
||||
|
||||
static int
|
||||
impl_node_port_use_buffers(struct spa_node *node,
|
||||
impl_node_port_use_buffers(void *object,
|
||||
enum spa_direction direction,
|
||||
uint32_t port_id,
|
||||
struct spa_buffer **buffers,
|
||||
uint32_t n_buffers)
|
||||
{
|
||||
struct node *this;
|
||||
struct node *this = object;
|
||||
struct impl *impl;
|
||||
int res;
|
||||
|
||||
spa_return_val_if_fail(node != NULL, -EINVAL);
|
||||
spa_return_val_if_fail(this != NULL, -EINVAL);
|
||||
|
||||
this = SPA_CONTAINER_OF(node, struct node, node);
|
||||
impl = this->impl;
|
||||
|
||||
if (direction != impl->direction)
|
||||
|
|
@ -802,7 +789,7 @@ impl_node_port_use_buffers(struct spa_node *node,
|
|||
}
|
||||
|
||||
static int
|
||||
impl_node_port_alloc_buffers(struct spa_node *node,
|
||||
impl_node_port_alloc_buffers(void *object,
|
||||
enum spa_direction direction,
|
||||
uint32_t port_id,
|
||||
struct spa_pod **params,
|
||||
|
|
@ -810,12 +797,11 @@ impl_node_port_alloc_buffers(struct spa_node *node,
|
|||
struct spa_buffer **buffers,
|
||||
uint32_t *n_buffers)
|
||||
{
|
||||
struct node *this;
|
||||
struct node *this = object;
|
||||
struct impl *impl;
|
||||
|
||||
spa_return_val_if_fail(node != NULL, -EINVAL);
|
||||
spa_return_val_if_fail(this != NULL, -EINVAL);
|
||||
|
||||
this = SPA_CONTAINER_OF(node, struct node, node);
|
||||
impl = this->impl;
|
||||
|
||||
if (direction != impl->direction)
|
||||
|
|
@ -826,22 +812,21 @@ impl_node_port_alloc_buffers(struct spa_node *node,
|
|||
}
|
||||
|
||||
static int
|
||||
impl_node_port_reuse_buffer(struct spa_node *node, uint32_t port_id, uint32_t buffer_id)
|
||||
impl_node_port_reuse_buffer(void *object, uint32_t port_id, uint32_t buffer_id)
|
||||
{
|
||||
struct node *this;
|
||||
struct node *this = object;
|
||||
struct impl *impl;
|
||||
|
||||
spa_return_val_if_fail(node != NULL, -EINVAL);
|
||||
spa_return_val_if_fail(this != NULL, -EINVAL);
|
||||
|
||||
this = SPA_CONTAINER_OF(node, struct node, node);
|
||||
impl = this->impl;
|
||||
|
||||
return spa_node_port_reuse_buffer(impl->adapter, port_id, buffer_id);
|
||||
}
|
||||
|
||||
static int impl_node_process(struct spa_node *node)
|
||||
static int impl_node_process(void *object)
|
||||
{
|
||||
struct node *this = SPA_CONTAINER_OF(node, struct node, node);
|
||||
struct node *this = object;
|
||||
struct impl *impl = this->impl;
|
||||
struct spa_io_position *q = impl->this.node->driver_node->rt.position;
|
||||
int status, trigger;
|
||||
|
|
@ -890,8 +875,8 @@ static int impl_node_process(struct spa_node *node)
|
|||
return status;
|
||||
}
|
||||
|
||||
static const struct spa_node impl_node = {
|
||||
SPA_VERSION_NODE,
|
||||
static const struct spa_node_methods impl_node = {
|
||||
SPA_VERSION_NODE_METHODS,
|
||||
.add_listener = impl_node_add_listener,
|
||||
.set_callbacks = impl_node_set_callbacks,
|
||||
.sync = impl_node_sync,
|
||||
|
|
@ -922,7 +907,10 @@ node_init(struct node *this,
|
|||
if (support[i].type == SPA_TYPE_INTERFACE_Log)
|
||||
this->log = support[i].data;
|
||||
}
|
||||
this->node = impl_node;
|
||||
this->node.iface = SPA_INTERFACE_INIT(
|
||||
SPA_TYPE_INTERFACE_Node,
|
||||
SPA_VERSION_NODE,
|
||||
&impl_node, this);
|
||||
spa_hook_list_init(&this->hooks);
|
||||
|
||||
this->info_all = SPA_NODE_CHANGE_MASK_PARAMS;
|
||||
|
|
@ -1301,7 +1289,7 @@ struct pw_client_stream *pw_client_stream_new(struct pw_resource *resource,
|
|||
name,
|
||||
PW_SPA_NODE_FLAG_ASYNC |
|
||||
PW_SPA_NODE_FLAG_ACTIVATE,
|
||||
&impl->node.node,
|
||||
(struct spa_node *)&impl->node.node,
|
||||
NULL,
|
||||
properties, 0);
|
||||
if (this->node == NULL)
|
||||
|
|
|
|||
|
|
@ -47,11 +47,29 @@ static void push_dict(struct spa_pod_builder *b, const struct spa_dict *dict)
|
|||
spa_pod_builder_pop(b, &f);
|
||||
}
|
||||
|
||||
static int
|
||||
client_node_marshal_get_node(void *object, uint32_t version, uint32_t new_id)
|
||||
static int client_node_marshal_add_listener(void *object,
|
||||
struct spa_hook *listener,
|
||||
const struct pw_client_node_proxy_events *events,
|
||||
void *data)
|
||||
{
|
||||
struct pw_proxy *proxy = object;
|
||||
pw_proxy_add_proxy_listener(proxy, listener, events, data);
|
||||
return 0;
|
||||
}
|
||||
|
||||
static struct pw_node_proxy *
|
||||
client_node_marshal_get_node(void *object, uint32_t version, size_t user_data_size)
|
||||
{
|
||||
struct pw_proxy *proxy = object;
|
||||
struct spa_pod_builder *b;
|
||||
struct pw_proxy *res;
|
||||
uint32_t new_id;
|
||||
|
||||
res = pw_proxy_new(object, PW_TYPE_INTERFACE_Node, user_data_size);
|
||||
if (res == NULL)
|
||||
return NULL;
|
||||
|
||||
new_id = pw_proxy_get_id(res);
|
||||
|
||||
b = pw_protocol_native_begin_proxy(proxy, PW_CLIENT_NODE_PROXY_METHOD_GET_NODE, NULL);
|
||||
|
||||
|
|
@ -59,7 +77,9 @@ client_node_marshal_get_node(void *object, uint32_t version, uint32_t new_id)
|
|||
SPA_POD_Int(version),
|
||||
SPA_POD_Int(new_id));
|
||||
|
||||
return pw_protocol_native_end_proxy(proxy, b);
|
||||
pw_protocol_native_end_proxy(proxy, b);
|
||||
|
||||
return (struct pw_node_proxy *) res;
|
||||
}
|
||||
|
||||
static int
|
||||
|
|
@ -1000,50 +1020,56 @@ static int client_node_demarshal_event_method(void *object, const struct pw_prot
|
|||
|
||||
static const struct pw_client_node_proxy_methods pw_protocol_native_client_node_method_marshal = {
|
||||
PW_VERSION_CLIENT_NODE_PROXY_METHODS,
|
||||
&client_node_marshal_get_node,
|
||||
&client_node_marshal_update,
|
||||
&client_node_marshal_port_update,
|
||||
&client_node_marshal_set_active,
|
||||
&client_node_marshal_event_method
|
||||
.add_listener = &client_node_marshal_add_listener,
|
||||
.get_node = &client_node_marshal_get_node,
|
||||
.update = &client_node_marshal_update,
|
||||
.port_update = &client_node_marshal_port_update,
|
||||
.set_active = &client_node_marshal_set_active,
|
||||
.event = &client_node_marshal_event_method
|
||||
};
|
||||
|
||||
static const struct pw_protocol_native_demarshal pw_protocol_native_client_node_method_demarshal[] = {
|
||||
{ &client_node_demarshal_get_node, 0 },
|
||||
{ &client_node_demarshal_update, 0 },
|
||||
{ &client_node_demarshal_port_update, 0 },
|
||||
{ &client_node_demarshal_set_active, 0 },
|
||||
{ &client_node_demarshal_event_method, 0 }
|
||||
static const struct pw_protocol_native_demarshal
|
||||
pw_protocol_native_client_node_method_demarshal[PW_CLIENT_NODE_PROXY_METHOD_NUM] =
|
||||
{
|
||||
[PW_CLIENT_NODE_PROXY_METHOD_ADD_LISTENER] = { NULL, 0 },
|
||||
[PW_CLIENT_NODE_PROXY_METHOD_GET_NODE] = { &client_node_demarshal_get_node, 0 },
|
||||
[PW_CLIENT_NODE_PROXY_METHOD_UPDATE] = { &client_node_demarshal_update, 0 },
|
||||
[PW_CLIENT_NODE_PROXY_METHOD_PORT_UPDATE] = { &client_node_demarshal_port_update, 0 },
|
||||
[PW_CLIENT_NODE_PROXY_METHOD_SET_ACTIVE] = { &client_node_demarshal_set_active, 0 },
|
||||
[PW_CLIENT_NODE_PROXY_METHOD_EVENT] = { &client_node_demarshal_event_method, 0 }
|
||||
};
|
||||
|
||||
static const struct pw_client_node_proxy_events pw_protocol_native_client_node_event_marshal = {
|
||||
PW_VERSION_CLIENT_NODE_PROXY_EVENTS,
|
||||
&client_node_marshal_add_mem,
|
||||
&client_node_marshal_transport,
|
||||
&client_node_marshal_set_param,
|
||||
&client_node_marshal_set_io,
|
||||
&client_node_marshal_event_event,
|
||||
&client_node_marshal_command,
|
||||
&client_node_marshal_add_port,
|
||||
&client_node_marshal_remove_port,
|
||||
&client_node_marshal_port_set_param,
|
||||
&client_node_marshal_port_use_buffers,
|
||||
&client_node_marshal_port_set_io,
|
||||
&client_node_marshal_set_activation,
|
||||
.add_mem = &client_node_marshal_add_mem,
|
||||
.transport = &client_node_marshal_transport,
|
||||
.set_param = &client_node_marshal_set_param,
|
||||
.set_io = &client_node_marshal_set_io,
|
||||
.event = &client_node_marshal_event_event,
|
||||
.command = &client_node_marshal_command,
|
||||
.add_port = &client_node_marshal_add_port,
|
||||
.remove_port = &client_node_marshal_remove_port,
|
||||
.port_set_param = &client_node_marshal_port_set_param,
|
||||
.port_use_buffers = &client_node_marshal_port_use_buffers,
|
||||
.port_set_io = &client_node_marshal_port_set_io,
|
||||
.set_activation = &client_node_marshal_set_activation,
|
||||
};
|
||||
|
||||
static const struct pw_protocol_native_demarshal pw_protocol_native_client_node_event_demarshal[] = {
|
||||
{ &client_node_demarshal_add_mem, 0 },
|
||||
{ &client_node_demarshal_transport, 0 },
|
||||
{ &client_node_demarshal_set_param, 0 },
|
||||
{ &client_node_demarshal_set_io, 0 },
|
||||
{ &client_node_demarshal_event_event, 0 },
|
||||
{ &client_node_demarshal_command, 0 },
|
||||
{ &client_node_demarshal_add_port, 0 },
|
||||
{ &client_node_demarshal_remove_port, 0 },
|
||||
{ &client_node_demarshal_port_set_param, 0 },
|
||||
{ &client_node_demarshal_port_use_buffers, 0 },
|
||||
{ &client_node_demarshal_port_set_io, 0 },
|
||||
{ &client_node_demarshal_set_activation, 0 }
|
||||
static const struct pw_protocol_native_demarshal
|
||||
pw_protocol_native_client_node_event_demarshal[PW_CLIENT_NODE_PROXY_EVENT_NUM] =
|
||||
{
|
||||
[PW_CLIENT_NODE_PROXY_EVENT_ADD_MEM] = { &client_node_demarshal_add_mem, 0 },
|
||||
[PW_CLIENT_NODE_PROXY_EVENT_TRANSPORT] = { &client_node_demarshal_transport, 0 },
|
||||
[PW_CLIENT_NODE_PROXY_EVENT_SET_PARAM] = { &client_node_demarshal_set_param, 0 },
|
||||
[PW_CLIENT_NODE_PROXY_EVENT_SET_IO] = { &client_node_demarshal_set_io, 0 },
|
||||
[PW_CLIENT_NODE_PROXY_EVENT_EVENT] = { &client_node_demarshal_event_event, 0 },
|
||||
[PW_CLIENT_NODE_PROXY_EVENT_COMMAND] = { &client_node_demarshal_command, 0 },
|
||||
[PW_CLIENT_NODE_PROXY_EVENT_ADD_PORT] = { &client_node_demarshal_add_port, 0 },
|
||||
[PW_CLIENT_NODE_PROXY_EVENT_REMOVE_PORT] = { &client_node_demarshal_remove_port, 0 },
|
||||
[PW_CLIENT_NODE_PROXY_EVENT_PORT_SET_PARAM] = { &client_node_demarshal_port_set_param, 0 },
|
||||
[PW_CLIENT_NODE_PROXY_EVENT_PORT_USE_BUFFERS] = { &client_node_demarshal_port_use_buffers, 0 },
|
||||
[PW_CLIENT_NODE_PROXY_EVENT_PORT_SET_IO] = { &client_node_demarshal_port_set_io, 0 },
|
||||
[PW_CLIENT_NODE_PROXY_EVENT_SET_ACTIVATION] = { &client_node_demarshal_set_activation, 0 }
|
||||
};
|
||||
|
||||
static const struct pw_protocol_marshal pw_protocol_native_client_node_marshal = {
|
||||
|
|
|
|||
|
|
@ -1218,7 +1218,7 @@ static struct pw_proxy *node_export(struct pw_remote *remote, void *object, bool
|
|||
do_node_init(proxy);
|
||||
|
||||
data->proxy = (struct pw_proxy*) pw_client_node_proxy_get_node(data->node_proxy,
|
||||
PW_VERSION_NODE, 0);
|
||||
PW_VERSION_NODE_PROXY, 0);
|
||||
|
||||
return data->proxy;
|
||||
}
|
||||
|
|
|
|||
|
|
@ -229,7 +229,7 @@ static void *create_object(void *_data,
|
|||
ld->global = pw_link_get_global(link);
|
||||
pw_global_add_listener(ld->global, &ld->global_listener, &global_events, ld);
|
||||
|
||||
res = pw_global_bind(ld->global, client, PW_PERM_RWX, PW_VERSION_LINK, new_id);
|
||||
res = pw_global_bind(ld->global, client, PW_PERM_RWX, PW_VERSION_LINK_PROXY, new_id);
|
||||
if (res < 0)
|
||||
goto no_bind;
|
||||
|
||||
|
|
@ -312,7 +312,7 @@ static int module_init(struct pw_module *module, struct pw_properties *propertie
|
|||
factory = pw_factory_new(core,
|
||||
"link-factory",
|
||||
PW_TYPE_INTERFACE_Link,
|
||||
PW_VERSION_LINK,
|
||||
PW_VERSION_LINK_PROXY,
|
||||
NULL,
|
||||
sizeof(*data));
|
||||
if (factory == NULL)
|
||||
|
|
|
|||
|
|
@ -299,7 +299,7 @@ static struct pw_client *client_new(struct server *s, int fd)
|
|||
pw_client_add_listener(client, &this->client_listener, &client_events, this);
|
||||
|
||||
if (pw_global_bind(pw_core_get_global(core), client,
|
||||
PW_PERM_RWX, PW_VERSION_CORE, 0) < 0)
|
||||
PW_PERM_RWX, PW_VERSION_CORE_PROXY, 0) < 0)
|
||||
goto cleanup_client;
|
||||
|
||||
props = pw_properties_copy(pw_client_get_properties(client));
|
||||
|
|
@ -307,7 +307,7 @@ static struct pw_client *client_new(struct server *s, int fd)
|
|||
goto cleanup_client;
|
||||
|
||||
if (pw_global_bind(pw_client_get_global(client), client,
|
||||
PW_PERM_RWX, PW_VERSION_CLIENT, 1) < 0)
|
||||
PW_PERM_RWX, PW_VERSION_CLIENT_PROXY, 1) < 0)
|
||||
goto cleanup_client;
|
||||
|
||||
return client;
|
||||
|
|
|
|||
|
|
@ -32,6 +32,16 @@
|
|||
|
||||
#include "connection.h"
|
||||
|
||||
static int core_method_marshal_add_listener(void *object,
|
||||
struct spa_hook *listener,
|
||||
const struct pw_core_proxy_events *events,
|
||||
void *data)
|
||||
{
|
||||
struct pw_proxy *proxy = object;
|
||||
pw_proxy_add_proxy_listener(proxy, listener, events, data);
|
||||
return 0;
|
||||
}
|
||||
|
||||
static int core_method_marshal_hello(void *object, uint32_t version)
|
||||
{
|
||||
struct pw_proxy *proxy = object;
|
||||
|
|
@ -90,10 +100,19 @@ static int core_method_marshal_error(void *object, uint32_t id, int seq, int res
|
|||
return pw_protocol_native_end_proxy(proxy, b);
|
||||
}
|
||||
|
||||
static int core_method_marshal_get_registry(void *object, uint32_t version, uint32_t new_id)
|
||||
static struct pw_registry_proxy * core_method_marshal_get_registry(void *object,
|
||||
uint32_t version, size_t user_data_size)
|
||||
{
|
||||
struct pw_proxy *proxy = object;
|
||||
struct spa_pod_builder *b;
|
||||
struct pw_proxy *res;
|
||||
uint32_t new_id;
|
||||
|
||||
res = pw_proxy_new(object, PW_TYPE_INTERFACE_Registry, user_data_size);
|
||||
if (res == NULL)
|
||||
return NULL;
|
||||
|
||||
new_id = pw_proxy_get_id(res);
|
||||
|
||||
b = pw_protocol_native_begin_proxy(proxy, PW_CORE_PROXY_METHOD_GET_REGISTRY, NULL);
|
||||
|
||||
|
|
@ -101,7 +120,9 @@ static int core_method_marshal_get_registry(void *object, uint32_t version, uint
|
|||
SPA_POD_Int(version),
|
||||
SPA_POD_Int(new_id));
|
||||
|
||||
return pw_protocol_native_end_proxy(proxy, b);
|
||||
pw_protocol_native_end_proxy(proxy, b);
|
||||
|
||||
return (struct pw_registry_proxy *) res;
|
||||
}
|
||||
|
||||
static void push_dict(struct spa_pod_builder *b, const struct spa_dict *dict)
|
||||
|
|
@ -135,15 +156,23 @@ static void push_params(struct spa_pod_builder *b, uint32_t n_params,
|
|||
spa_pod_builder_pop(b, &f);
|
||||
}
|
||||
|
||||
static int
|
||||
static void *
|
||||
core_method_marshal_create_object(void *object,
|
||||
const char *factory_name,
|
||||
uint32_t type, uint32_t version,
|
||||
const struct spa_dict *props, uint32_t new_id)
|
||||
const struct spa_dict *props, size_t user_data_size)
|
||||
{
|
||||
struct pw_proxy *proxy = object;
|
||||
struct spa_pod_builder *b;
|
||||
struct spa_pod_frame f;
|
||||
struct pw_proxy *res;
|
||||
uint32_t new_id;
|
||||
|
||||
res = pw_proxy_new(object, type, user_data_size);
|
||||
if (res == NULL)
|
||||
return NULL;
|
||||
|
||||
new_id = pw_proxy_get_id(res);
|
||||
|
||||
b = pw_protocol_native_begin_proxy(proxy, PW_CORE_PROXY_METHOD_CREATE_OBJECT, NULL);
|
||||
|
||||
|
|
@ -157,14 +186,17 @@ core_method_marshal_create_object(void *object,
|
|||
spa_pod_builder_int(b, new_id);
|
||||
spa_pod_builder_pop(b, &f);
|
||||
|
||||
return pw_protocol_native_end_proxy(proxy, b);
|
||||
pw_protocol_native_end_proxy(proxy, b);
|
||||
|
||||
return (void *)res;
|
||||
}
|
||||
|
||||
static int
|
||||
core_method_marshal_destroy(void *object, uint32_t id)
|
||||
core_method_marshal_destroy(void *object, void *p)
|
||||
{
|
||||
struct pw_proxy *proxy = object;
|
||||
struct spa_pod_builder *b;
|
||||
uint32_t id = pw_proxy_get_id(p);
|
||||
|
||||
b = pw_protocol_native_begin_proxy(proxy, PW_CORE_PROXY_METHOD_DESTROY, NULL);
|
||||
|
||||
|
|
@ -480,6 +512,8 @@ 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_resource *r;
|
||||
struct spa_pod_parser prs;
|
||||
uint32_t id;
|
||||
|
||||
|
|
@ -488,7 +522,27 @@ static int core_method_demarshal_destroy(void *object, const struct pw_protocol_
|
|||
SPA_POD_Int(&id)) < 0)
|
||||
return -EINVAL;
|
||||
|
||||
return pw_resource_do(resource, struct pw_core_proxy_methods, destroy, 0, id);
|
||||
pw_log_debug("client %p: destroy resource %d", client, id);
|
||||
|
||||
if ((r = pw_client_find_resource(client, id)) == NULL)
|
||||
goto no_resource;
|
||||
|
||||
return pw_resource_do(resource, struct pw_core_proxy_methods, destroy, 0, r);
|
||||
|
||||
no_resource:
|
||||
pw_log_error("client %p: can't find resouce %d", client, id);
|
||||
pw_resource_error(resource, -EINVAL, "unknown resource %d", id);
|
||||
return -EINVAL;
|
||||
}
|
||||
|
||||
static int registry_method_marshal_add_listener(void *object,
|
||||
struct spa_hook *listener,
|
||||
const struct pw_registry_proxy_events *events,
|
||||
void *data)
|
||||
{
|
||||
struct pw_proxy *proxy = object;
|
||||
pw_proxy_add_proxy_listener(proxy, listener, events, data);
|
||||
return 0;
|
||||
}
|
||||
|
||||
static void registry_marshal_global(void *object, uint32_t id, uint32_t parent_id, uint32_t permissions,
|
||||
|
|
@ -557,6 +611,16 @@ static int registry_demarshal_destroy(void *object, const struct pw_protocol_nat
|
|||
return pw_resource_do(resource, struct pw_registry_proxy_methods, destroy, 0, id);
|
||||
}
|
||||
|
||||
static int module_method_marshal_add_listener(void *object,
|
||||
struct spa_hook *listener,
|
||||
const struct pw_module_proxy_events *events,
|
||||
void *data)
|
||||
{
|
||||
struct pw_proxy *proxy = object;
|
||||
pw_proxy_add_proxy_listener(proxy, listener, events, data);
|
||||
return 0;
|
||||
}
|
||||
|
||||
static void module_marshal_info(void *object, const struct pw_module_info *info)
|
||||
{
|
||||
struct pw_resource *resource = object;
|
||||
|
|
@ -614,6 +678,16 @@ static int module_demarshal_info(void *object, const struct pw_protocol_native_m
|
|||
return pw_proxy_notify(proxy, struct pw_module_proxy_events, info, 0, &info);
|
||||
}
|
||||
|
||||
static int device_method_marshal_add_listener(void *object,
|
||||
struct spa_hook *listener,
|
||||
const struct pw_device_proxy_events *events,
|
||||
void *data)
|
||||
{
|
||||
struct pw_proxy *proxy = object;
|
||||
pw_proxy_add_proxy_listener(proxy, listener, events, data);
|
||||
return 0;
|
||||
}
|
||||
|
||||
static void device_marshal_info(void *object, const struct pw_device_info *info)
|
||||
{
|
||||
struct pw_resource *resource = object;
|
||||
|
|
@ -795,6 +869,16 @@ static int device_demarshal_set_param(void *object, const struct pw_protocol_nat
|
|||
return pw_resource_do(resource, struct pw_device_proxy_methods, set_param, 0, id, flags, param);
|
||||
}
|
||||
|
||||
static int factory_method_marshal_add_listener(void *object,
|
||||
struct spa_hook *listener,
|
||||
const struct pw_factory_proxy_events *events,
|
||||
void *data)
|
||||
{
|
||||
struct pw_proxy *proxy = object;
|
||||
pw_proxy_add_proxy_listener(proxy, listener, events, data);
|
||||
return 0;
|
||||
}
|
||||
|
||||
static void factory_marshal_info(void *object, const struct pw_factory_info *info)
|
||||
{
|
||||
struct pw_resource *resource = object;
|
||||
|
|
@ -852,6 +936,16 @@ static int factory_demarshal_info(void *object, const struct pw_protocol_native_
|
|||
return pw_proxy_notify(proxy, struct pw_factory_proxy_events, info, 0, &info);
|
||||
}
|
||||
|
||||
static int node_method_marshal_add_listener(void *object,
|
||||
struct spa_hook *listener,
|
||||
const struct pw_node_proxy_events *events,
|
||||
void *data)
|
||||
{
|
||||
struct pw_proxy *proxy = object;
|
||||
pw_proxy_add_proxy_listener(proxy, listener, events, data);
|
||||
return 0;
|
||||
}
|
||||
|
||||
static void node_marshal_info(void *object, const struct pw_node_info *info)
|
||||
{
|
||||
struct pw_resource *resource = object;
|
||||
|
|
@ -1102,6 +1196,16 @@ static int node_demarshal_send_command(void *object, const struct pw_protocol_na
|
|||
return pw_resource_do(resource, struct pw_node_proxy_methods, send_command, 0, command);
|
||||
}
|
||||
|
||||
static int port_method_marshal_add_listener(void *object,
|
||||
struct spa_hook *listener,
|
||||
const struct pw_port_proxy_events *events,
|
||||
void *data)
|
||||
{
|
||||
struct pw_proxy *proxy = object;
|
||||
pw_proxy_add_proxy_listener(proxy, listener, events, data);
|
||||
return 0;
|
||||
}
|
||||
|
||||
static void port_marshal_info(void *object, const struct pw_port_info *info)
|
||||
{
|
||||
struct pw_resource *resource = object;
|
||||
|
|
@ -1282,6 +1386,16 @@ static int port_demarshal_enum_params(void *object, const struct pw_protocol_nat
|
|||
seq, id, index, num, filter);
|
||||
}
|
||||
|
||||
static int client_method_marshal_add_listener(void *object,
|
||||
struct spa_hook *listener,
|
||||
const struct pw_client_proxy_events *events,
|
||||
void *data)
|
||||
{
|
||||
struct pw_proxy *proxy = object;
|
||||
pw_proxy_add_proxy_listener(proxy, listener, events, data);
|
||||
return 0;
|
||||
}
|
||||
|
||||
static void client_marshal_info(void *object, const struct pw_client_info *info)
|
||||
{
|
||||
struct pw_resource *resource = object;
|
||||
|
|
@ -1540,6 +1654,16 @@ static int client_demarshal_update_permissions(void *object, const struct pw_pro
|
|||
n_permissions, permissions);
|
||||
}
|
||||
|
||||
static int link_method_marshal_add_listener(void *object,
|
||||
struct spa_hook *listener,
|
||||
const struct pw_link_proxy_events *events,
|
||||
void *data)
|
||||
{
|
||||
struct pw_proxy *proxy = object;
|
||||
pw_proxy_add_proxy_listener(proxy, listener, events, data);
|
||||
return 0;
|
||||
}
|
||||
|
||||
static void link_marshal_info(void *object, const struct pw_link_info *info)
|
||||
{
|
||||
struct pw_resource *resource = object;
|
||||
|
|
@ -1655,11 +1779,19 @@ static int registry_demarshal_global_remove(void *object, const struct pw_protoc
|
|||
return pw_proxy_notify(proxy, struct pw_registry_proxy_events, global_remove, 0, id);
|
||||
}
|
||||
|
||||
static int registry_marshal_bind(void *object, uint32_t id,
|
||||
uint32_t type, uint32_t version, uint32_t new_id)
|
||||
static void * registry_marshal_bind(void *object, uint32_t id,
|
||||
uint32_t type, uint32_t version, size_t user_data_size)
|
||||
{
|
||||
struct pw_proxy *proxy = object;
|
||||
struct spa_pod_builder *b;
|
||||
struct pw_proxy *res;
|
||||
uint32_t new_id;
|
||||
|
||||
res = pw_proxy_new(object, type, user_data_size);
|
||||
if (res == NULL)
|
||||
return NULL;
|
||||
|
||||
new_id = pw_proxy_get_id(res);
|
||||
|
||||
b = pw_protocol_native_begin_proxy(proxy, PW_REGISTRY_PROXY_METHOD_BIND, NULL);
|
||||
|
||||
|
|
@ -1669,7 +1801,9 @@ static int registry_marshal_bind(void *object, uint32_t id,
|
|||
SPA_POD_Int(version),
|
||||
SPA_POD_Int(new_id));
|
||||
|
||||
return pw_protocol_native_end_proxy(proxy, b);
|
||||
pw_protocol_native_end_proxy(proxy, b);
|
||||
|
||||
return (void *) res;
|
||||
}
|
||||
|
||||
static int registry_marshal_destroy(void *object, uint32_t id)
|
||||
|
|
@ -1685,45 +1819,49 @@ static int registry_marshal_destroy(void *object, uint32_t id)
|
|||
|
||||
static const struct pw_core_proxy_methods pw_protocol_native_core_method_marshal = {
|
||||
PW_VERSION_CORE_PROXY_METHODS,
|
||||
&core_method_marshal_hello,
|
||||
&core_method_marshal_sync,
|
||||
&core_method_marshal_pong,
|
||||
&core_method_marshal_error,
|
||||
&core_method_marshal_get_registry,
|
||||
&core_method_marshal_create_object,
|
||||
&core_method_marshal_destroy,
|
||||
.add_listener = &core_method_marshal_add_listener,
|
||||
.hello = &core_method_marshal_hello,
|
||||
.sync = &core_method_marshal_sync,
|
||||
.pong = &core_method_marshal_pong,
|
||||
.error = &core_method_marshal_error,
|
||||
.get_registry = &core_method_marshal_get_registry,
|
||||
.create_object = &core_method_marshal_create_object,
|
||||
.destroy = &core_method_marshal_destroy,
|
||||
};
|
||||
|
||||
static const struct pw_protocol_native_demarshal pw_protocol_native_core_method_demarshal[PW_CORE_PROXY_METHOD_NUM] = {
|
||||
{ &core_method_demarshal_hello, 0, },
|
||||
{ &core_method_demarshal_sync, 0, },
|
||||
{ &core_method_demarshal_pong, 0, },
|
||||
{ &core_method_demarshal_error, 0, },
|
||||
{ &core_method_demarshal_get_registry, 0, },
|
||||
{ &core_method_demarshal_create_object, 0, },
|
||||
{ &core_method_demarshal_destroy, 0, }
|
||||
[PW_CORE_PROXY_METHOD_ADD_LISTENER] = { NULL, 0, },
|
||||
[PW_CORE_PROXY_METHOD_HELLO] = { &core_method_demarshal_hello, 0, },
|
||||
[PW_CORE_PROXY_METHOD_SYNC] = { &core_method_demarshal_sync, 0, },
|
||||
[PW_CORE_PROXY_METHOD_PONG] = { &core_method_demarshal_pong, 0, },
|
||||
[PW_CORE_PROXY_METHOD_ERROR] = { &core_method_demarshal_error, 0, },
|
||||
[PW_CORE_PROXY_METHOD_GET_REGISTRY] = { &core_method_demarshal_get_registry, 0, },
|
||||
[PW_CORE_PROXY_METHOD_CREATE_OBJECT] = { &core_method_demarshal_create_object, 0, },
|
||||
[PW_CORE_PROXY_METHOD_DESTROY] = { &core_method_demarshal_destroy, 0, }
|
||||
};
|
||||
|
||||
static const struct pw_core_proxy_events pw_protocol_native_core_event_marshal = {
|
||||
PW_VERSION_CORE_PROXY_EVENTS,
|
||||
&core_event_marshal_info,
|
||||
&core_event_marshal_done,
|
||||
&core_event_marshal_ping,
|
||||
&core_event_marshal_error,
|
||||
&core_event_marshal_remove_id,
|
||||
.info = &core_event_marshal_info,
|
||||
.done = &core_event_marshal_done,
|
||||
.ping = &core_event_marshal_ping,
|
||||
.error = &core_event_marshal_error,
|
||||
.remove_id = &core_event_marshal_remove_id,
|
||||
};
|
||||
|
||||
static const struct pw_protocol_native_demarshal pw_protocol_native_core_event_demarshal[PW_CORE_PROXY_EVENT_NUM] = {
|
||||
{ &core_event_demarshal_info, 0, },
|
||||
{ &core_event_demarshal_done, 0, },
|
||||
{ &core_event_demarshal_ping, 0, },
|
||||
{ &core_event_demarshal_error, 0, },
|
||||
{ &core_event_demarshal_remove_id, 0, },
|
||||
static const struct pw_protocol_native_demarshal
|
||||
pw_protocol_native_core_event_demarshal[PW_CORE_PROXY_EVENT_NUM] =
|
||||
{
|
||||
[PW_CORE_PROXY_EVENT_INFO] = { &core_event_demarshal_info, 0, },
|
||||
[PW_CORE_PROXY_EVENT_DONE] = { &core_event_demarshal_done, 0, },
|
||||
[PW_CORE_PROXY_EVENT_PING] = { &core_event_demarshal_ping, 0, },
|
||||
[PW_CORE_PROXY_EVENT_ERROR] = { &core_event_demarshal_error, 0, },
|
||||
[PW_CORE_PROXY_EVENT_REMOVE_ID] = { &core_event_demarshal_remove_id, 0, },
|
||||
};
|
||||
|
||||
static const struct pw_protocol_marshal pw_protocol_native_core_marshal = {
|
||||
PW_TYPE_INTERFACE_Core,
|
||||
PW_VERSION_CORE,
|
||||
PW_VERSION_CORE_PROXY,
|
||||
PW_CORE_PROXY_METHOD_NUM,
|
||||
PW_CORE_PROXY_EVENT_NUM,
|
||||
&pw_protocol_native_core_method_marshal,
|
||||
|
|
@ -1734,29 +1872,35 @@ static const struct pw_protocol_marshal pw_protocol_native_core_marshal = {
|
|||
|
||||
static const struct pw_registry_proxy_methods pw_protocol_native_registry_method_marshal = {
|
||||
PW_VERSION_REGISTRY_PROXY_METHODS,
|
||||
®istry_marshal_bind,
|
||||
®istry_marshal_destroy,
|
||||
.add_listener = ®istry_method_marshal_add_listener,
|
||||
.bind = ®istry_marshal_bind,
|
||||
.destroy = ®istry_marshal_destroy,
|
||||
};
|
||||
|
||||
static const struct pw_protocol_native_demarshal pw_protocol_native_registry_method_demarshal[] = {
|
||||
{ ®istry_demarshal_bind, 0, },
|
||||
{ ®istry_demarshal_destroy, 0, },
|
||||
static const struct pw_protocol_native_demarshal
|
||||
pw_protocol_native_registry_method_demarshal[PW_REGISTRY_PROXY_METHOD_NUM] =
|
||||
{
|
||||
[PW_REGISTRY_PROXY_METHOD_ADD_LISTENER] = { NULL, 0, },
|
||||
[PW_REGISTRY_PROXY_METHOD_BIND] = { ®istry_demarshal_bind, 0, },
|
||||
[PW_REGISTRY_PROXY_METHOD_DESTROY] = { ®istry_demarshal_destroy, 0, },
|
||||
};
|
||||
|
||||
static const struct pw_registry_proxy_events pw_protocol_native_registry_event_marshal = {
|
||||
PW_VERSION_REGISTRY_PROXY_EVENTS,
|
||||
®istry_marshal_global,
|
||||
®istry_marshal_global_remove,
|
||||
.global = ®istry_marshal_global,
|
||||
.global_remove = ®istry_marshal_global_remove,
|
||||
};
|
||||
|
||||
static const struct pw_protocol_native_demarshal pw_protocol_native_registry_event_demarshal[] = {
|
||||
{ ®istry_demarshal_global, 0, },
|
||||
{ ®istry_demarshal_global_remove, 0, }
|
||||
static const struct pw_protocol_native_demarshal
|
||||
pw_protocol_native_registry_event_demarshal[PW_REGISTRY_PROXY_EVENT_NUM] =
|
||||
{
|
||||
[PW_REGISTRY_PROXY_EVENT_GLOBAL] = { ®istry_demarshal_global, 0, },
|
||||
[PW_REGISTRY_PROXY_EVENT_GLOBAL_REMOVE] = { ®istry_demarshal_global_remove, 0, }
|
||||
};
|
||||
|
||||
const struct pw_protocol_marshal pw_protocol_native_registry_marshal = {
|
||||
PW_TYPE_INTERFACE_Registry,
|
||||
PW_VERSION_REGISTRY,
|
||||
PW_VERSION_REGISTRY_PROXY,
|
||||
PW_REGISTRY_PROXY_METHOD_NUM,
|
||||
PW_REGISTRY_PROXY_EVENT_NUM,
|
||||
&pw_protocol_native_registry_method_marshal,
|
||||
|
|
@ -1767,67 +1911,100 @@ const struct pw_protocol_marshal pw_protocol_native_registry_marshal = {
|
|||
|
||||
static const struct pw_module_proxy_events pw_protocol_native_module_event_marshal = {
|
||||
PW_VERSION_MODULE_PROXY_EVENTS,
|
||||
&module_marshal_info,
|
||||
.info = &module_marshal_info,
|
||||
};
|
||||
|
||||
static const struct pw_protocol_native_demarshal pw_protocol_native_module_event_demarshal[] = {
|
||||
{ &module_demarshal_info, 0, },
|
||||
static const struct pw_protocol_native_demarshal
|
||||
pw_protocol_native_module_event_demarshal[PW_MODULE_PROXY_EVENT_NUM] =
|
||||
{
|
||||
[PW_MODULE_PROXY_EVENT_INFO] = { &module_demarshal_info, 0, },
|
||||
};
|
||||
|
||||
|
||||
static const struct pw_module_proxy_methods pw_protocol_native_module_method_marshal = {
|
||||
PW_VERSION_MODULE_PROXY_METHODS,
|
||||
.add_listener = &module_method_marshal_add_listener,
|
||||
};
|
||||
|
||||
static const struct pw_protocol_native_demarshal
|
||||
pw_protocol_native_module_method_demarshal[PW_MODULE_PROXY_METHOD_NUM] =
|
||||
{
|
||||
[PW_MODULE_PROXY_METHOD_ADD_LISTENER] = { NULL, 0, },
|
||||
};
|
||||
|
||||
const struct pw_protocol_marshal pw_protocol_native_module_marshal = {
|
||||
PW_TYPE_INTERFACE_Module,
|
||||
PW_VERSION_MODULE,
|
||||
0,
|
||||
PW_VERSION_MODULE_PROXY,
|
||||
PW_MODULE_PROXY_METHOD_NUM,
|
||||
PW_MODULE_PROXY_EVENT_NUM,
|
||||
NULL, NULL,
|
||||
&pw_protocol_native_module_method_marshal,
|
||||
pw_protocol_native_module_method_demarshal,
|
||||
&pw_protocol_native_module_event_marshal,
|
||||
pw_protocol_native_module_event_demarshal,
|
||||
};
|
||||
|
||||
static const struct pw_factory_proxy_events pw_protocol_native_factory_event_marshal = {
|
||||
PW_VERSION_FACTORY_PROXY_EVENTS,
|
||||
&factory_marshal_info,
|
||||
.info = &factory_marshal_info,
|
||||
};
|
||||
|
||||
static const struct pw_protocol_native_demarshal pw_protocol_native_factory_event_demarshal[] = {
|
||||
{ &factory_demarshal_info, 0, },
|
||||
static const struct pw_protocol_native_demarshal
|
||||
pw_protocol_native_factory_event_demarshal[PW_FACTORY_PROXY_EVENT_NUM] =
|
||||
{
|
||||
[PW_FACTORY_PROXY_EVENT_INFO] = { &factory_demarshal_info, 0, },
|
||||
};
|
||||
|
||||
static const struct pw_factory_proxy_methods pw_protocol_native_factory_method_marshal = {
|
||||
PW_VERSION_FACTORY_PROXY_METHODS,
|
||||
.add_listener = &factory_method_marshal_add_listener,
|
||||
};
|
||||
|
||||
static const struct pw_protocol_native_demarshal
|
||||
pw_protocol_native_factory_method_demarshal[PW_FACTORY_PROXY_METHOD_NUM] =
|
||||
{
|
||||
[PW_FACTORY_PROXY_METHOD_ADD_LISTENER] = { NULL, 0, },
|
||||
};
|
||||
|
||||
const struct pw_protocol_marshal pw_protocol_native_factory_marshal = {
|
||||
PW_TYPE_INTERFACE_Factory,
|
||||
PW_VERSION_FACTORY,
|
||||
0,
|
||||
PW_VERSION_FACTORY_PROXY,
|
||||
PW_FACTORY_PROXY_METHOD_NUM,
|
||||
PW_FACTORY_PROXY_EVENT_NUM,
|
||||
NULL, NULL,
|
||||
&pw_protocol_native_factory_method_marshal,
|
||||
pw_protocol_native_factory_method_demarshal,
|
||||
&pw_protocol_native_factory_event_marshal,
|
||||
pw_protocol_native_factory_event_demarshal,
|
||||
};
|
||||
|
||||
static const struct pw_device_proxy_methods pw_protocol_native_device_method_marshal = {
|
||||
PW_VERSION_DEVICE_PROXY_METHODS,
|
||||
&device_marshal_enum_params,
|
||||
&device_marshal_set_param,
|
||||
.add_listener = &device_method_marshal_add_listener,
|
||||
.enum_params = &device_marshal_enum_params,
|
||||
.set_param = &device_marshal_set_param,
|
||||
};
|
||||
|
||||
static const struct pw_protocol_native_demarshal pw_protocol_native_device_method_demarshal[] = {
|
||||
{ &device_demarshal_enum_params, 0, },
|
||||
{ &device_demarshal_set_param, PW_PERM_W, },
|
||||
static const struct pw_protocol_native_demarshal
|
||||
pw_protocol_native_device_method_demarshal[PW_DEVICE_PROXY_METHOD_NUM] = {
|
||||
[PW_DEVICE_PROXY_METHOD_ADD_LISTENER] = { NULL, 0, },
|
||||
[PW_DEVICE_PROXY_METHOD_ENUM_PARAMS] = { &device_demarshal_enum_params, 0, },
|
||||
[PW_DEVICE_PROXY_METHOD_SET_PARAM] = { &device_demarshal_set_param, PW_PERM_W, },
|
||||
};
|
||||
|
||||
static const struct pw_device_proxy_events pw_protocol_native_device_event_marshal = {
|
||||
PW_VERSION_DEVICE_PROXY_EVENTS,
|
||||
&device_marshal_info,
|
||||
&device_marshal_param,
|
||||
.info = &device_marshal_info,
|
||||
.param = &device_marshal_param,
|
||||
};
|
||||
|
||||
static const struct pw_protocol_native_demarshal pw_protocol_native_device_event_demarshal[] = {
|
||||
{ &device_demarshal_info, 0, },
|
||||
{ &device_demarshal_param, 0, }
|
||||
static const struct pw_protocol_native_demarshal
|
||||
pw_protocol_native_device_event_demarshal[PW_DEVICE_PROXY_EVENT_NUM] = {
|
||||
[PW_DEVICE_PROXY_EVENT_INFO] = { &device_demarshal_info, 0, },
|
||||
[PW_DEVICE_PROXY_EVENT_PARAM] = { &device_demarshal_param, 0, }
|
||||
};
|
||||
|
||||
static const struct pw_protocol_marshal pw_protocol_native_device_marshal = {
|
||||
PW_TYPE_INTERFACE_Device,
|
||||
PW_VERSION_DEVICE,
|
||||
PW_VERSION_DEVICE_PROXY,
|
||||
PW_DEVICE_PROXY_METHOD_NUM,
|
||||
PW_DEVICE_PROXY_EVENT_NUM,
|
||||
&pw_protocol_native_device_method_marshal,
|
||||
|
|
@ -1838,33 +2015,38 @@ static const struct pw_protocol_marshal pw_protocol_native_device_marshal = {
|
|||
|
||||
static const struct pw_node_proxy_methods pw_protocol_native_node_method_marshal = {
|
||||
PW_VERSION_NODE_PROXY_METHODS,
|
||||
&node_marshal_subscribe_params,
|
||||
&node_marshal_enum_params,
|
||||
&node_marshal_set_param,
|
||||
&node_marshal_send_command,
|
||||
.add_listener = &node_method_marshal_add_listener,
|
||||
.subscribe_params = &node_marshal_subscribe_params,
|
||||
.enum_params = &node_marshal_enum_params,
|
||||
.set_param = &node_marshal_set_param,
|
||||
.send_command = &node_marshal_send_command,
|
||||
};
|
||||
|
||||
static const struct pw_protocol_native_demarshal pw_protocol_native_node_method_demarshal[] = {
|
||||
{ &node_demarshal_subscribe_params, 0, },
|
||||
{ &node_demarshal_enum_params, 0, },
|
||||
{ &node_demarshal_set_param, PW_PERM_W, },
|
||||
{ &node_demarshal_send_command, PW_PERM_W, },
|
||||
static const struct pw_protocol_native_demarshal
|
||||
pw_protocol_native_node_method_demarshal[PW_NODE_PROXY_METHOD_NUM] =
|
||||
{
|
||||
[PW_NODE_PROXY_METHOD_ADD_LISTENER] = { NULL, 0, },
|
||||
[PW_NODE_PROXY_METHOD_SUBSCRIBE_PARAMS] = { &node_demarshal_subscribe_params, 0, },
|
||||
[PW_NODE_PROXY_METHOD_ENUM_PARAMS] = { &node_demarshal_enum_params, 0, },
|
||||
[PW_NODE_PROXY_METHOD_SET_PARAM] = { &node_demarshal_set_param, PW_PERM_W, },
|
||||
[PW_NODE_PROXY_METHOD_SEND_COMMAND] = { &node_demarshal_send_command, PW_PERM_W, },
|
||||
};
|
||||
|
||||
static const struct pw_node_proxy_events pw_protocol_native_node_event_marshal = {
|
||||
PW_VERSION_NODE_PROXY_EVENTS,
|
||||
&node_marshal_info,
|
||||
&node_marshal_param,
|
||||
.info = &node_marshal_info,
|
||||
.param = &node_marshal_param,
|
||||
};
|
||||
|
||||
static const struct pw_protocol_native_demarshal pw_protocol_native_node_event_demarshal[] = {
|
||||
{ &node_demarshal_info, 0, },
|
||||
{ &node_demarshal_param, 0, }
|
||||
static const struct pw_protocol_native_demarshal
|
||||
pw_protocol_native_node_event_demarshal[PW_NODE_PROXY_EVENT_NUM] = {
|
||||
[PW_NODE_PROXY_EVENT_INFO] = { &node_demarshal_info, 0, },
|
||||
[PW_NODE_PROXY_EVENT_PARAM] = { &node_demarshal_param, 0, }
|
||||
};
|
||||
|
||||
static const struct pw_protocol_marshal pw_protocol_native_node_marshal = {
|
||||
PW_TYPE_INTERFACE_Node,
|
||||
PW_VERSION_NODE,
|
||||
PW_VERSION_NODE_PROXY,
|
||||
PW_NODE_PROXY_METHOD_NUM,
|
||||
PW_NODE_PROXY_EVENT_NUM,
|
||||
&pw_protocol_native_node_method_marshal,
|
||||
|
|
@ -1876,29 +2058,35 @@ static const struct pw_protocol_marshal pw_protocol_native_node_marshal = {
|
|||
|
||||
static const struct pw_port_proxy_methods pw_protocol_native_port_method_marshal = {
|
||||
PW_VERSION_PORT_PROXY_METHODS,
|
||||
&port_marshal_subscribe_params,
|
||||
&port_marshal_enum_params,
|
||||
.add_listener = &port_method_marshal_add_listener,
|
||||
.subscribe_params = &port_marshal_subscribe_params,
|
||||
.enum_params = &port_marshal_enum_params,
|
||||
};
|
||||
|
||||
static const struct pw_protocol_native_demarshal pw_protocol_native_port_method_demarshal[] = {
|
||||
{ &port_demarshal_subscribe_params, 0, },
|
||||
{ &port_demarshal_enum_params, 0, },
|
||||
static const struct pw_protocol_native_demarshal
|
||||
pw_protocol_native_port_method_demarshal[PW_PORT_PROXY_METHOD_NUM] =
|
||||
{
|
||||
[PW_PORT_PROXY_METHOD_ADD_LISTENER] = { NULL, 0, },
|
||||
[PW_PORT_PROXY_METHOD_SUBSCRIBE_PARAMS] = { &port_demarshal_subscribe_params, 0, },
|
||||
[PW_PORT_PROXY_METHOD_ENUM_PARAMS] = { &port_demarshal_enum_params, 0, },
|
||||
};
|
||||
|
||||
static const struct pw_port_proxy_events pw_protocol_native_port_event_marshal = {
|
||||
PW_VERSION_PORT_PROXY_EVENTS,
|
||||
&port_marshal_info,
|
||||
&port_marshal_param,
|
||||
.info = &port_marshal_info,
|
||||
.param = &port_marshal_param,
|
||||
};
|
||||
|
||||
static const struct pw_protocol_native_demarshal pw_protocol_native_port_event_demarshal[] = {
|
||||
{ &port_demarshal_info, 0, },
|
||||
{ &port_demarshal_param, 0, }
|
||||
static const struct pw_protocol_native_demarshal
|
||||
pw_protocol_native_port_event_demarshal[PW_PORT_PROXY_EVENT_NUM] =
|
||||
{
|
||||
[PW_PORT_PROXY_EVENT_INFO] = { &port_demarshal_info, 0, },
|
||||
[PW_PORT_PROXY_EVENT_PARAM] = { &port_demarshal_param, 0, }
|
||||
};
|
||||
|
||||
static const struct pw_protocol_marshal pw_protocol_native_port_marshal = {
|
||||
PW_TYPE_INTERFACE_Port,
|
||||
PW_VERSION_PORT,
|
||||
PW_VERSION_PORT_PROXY,
|
||||
PW_PORT_PROXY_METHOD_NUM,
|
||||
PW_PORT_PROXY_EVENT_NUM,
|
||||
&pw_protocol_native_port_method_marshal,
|
||||
|
|
@ -1909,33 +2097,39 @@ static const struct pw_protocol_marshal pw_protocol_native_port_marshal = {
|
|||
|
||||
static const struct pw_client_proxy_methods pw_protocol_native_client_method_marshal = {
|
||||
PW_VERSION_CLIENT_PROXY_METHODS,
|
||||
&client_marshal_error,
|
||||
&client_marshal_update_properties,
|
||||
&client_marshal_get_permissions,
|
||||
&client_marshal_update_permissions,
|
||||
.add_listener = &client_method_marshal_add_listener,
|
||||
.error = &client_marshal_error,
|
||||
.update_properties = &client_marshal_update_properties,
|
||||
.get_permissions = &client_marshal_get_permissions,
|
||||
.update_permissions = &client_marshal_update_permissions,
|
||||
};
|
||||
|
||||
static const struct pw_protocol_native_demarshal pw_protocol_native_client_method_demarshal[] = {
|
||||
{ &client_demarshal_error, PW_PERM_W, },
|
||||
{ &client_demarshal_update_properties, PW_PERM_W, },
|
||||
{ &client_demarshal_get_permissions, 0, },
|
||||
{ &client_demarshal_update_permissions, PW_PERM_W, },
|
||||
static const struct pw_protocol_native_demarshal
|
||||
pw_protocol_native_client_method_demarshal[PW_CLIENT_PROXY_METHOD_NUM] =
|
||||
{
|
||||
[PW_CLIENT_PROXY_METHOD_ADD_LISTENER] = { NULL, 0, },
|
||||
[PW_CLIENT_PROXY_METHOD_ERROR] = { &client_demarshal_error, PW_PERM_W, },
|
||||
[PW_CLIENT_PROXY_METHOD_UPDATE_PROPERTIES] = { &client_demarshal_update_properties, PW_PERM_W, },
|
||||
[PW_CLIENT_PROXY_METHOD_GET_PERMISSIONS] = { &client_demarshal_get_permissions, 0, },
|
||||
[PW_CLIENT_PROXY_METHOD_UPDATE_PERMISSIONS] = { &client_demarshal_update_permissions, PW_PERM_W, },
|
||||
};
|
||||
|
||||
static const struct pw_client_proxy_events pw_protocol_native_client_event_marshal = {
|
||||
PW_VERSION_CLIENT_PROXY_EVENTS,
|
||||
&client_marshal_info,
|
||||
&client_marshal_permissions,
|
||||
.info = &client_marshal_info,
|
||||
.permissions = &client_marshal_permissions,
|
||||
};
|
||||
|
||||
static const struct pw_protocol_native_demarshal pw_protocol_native_client_event_demarshal[] = {
|
||||
{ &client_demarshal_info, 0, },
|
||||
{ &client_demarshal_permissions, 0, }
|
||||
static const struct pw_protocol_native_demarshal
|
||||
pw_protocol_native_client_event_demarshal[PW_CLIENT_PROXY_EVENT_NUM] =
|
||||
{
|
||||
[PW_CLIENT_PROXY_EVENT_INFO] = { &client_demarshal_info, 0, },
|
||||
[PW_CLIENT_PROXY_EVENT_PERMISSIONS] = { &client_demarshal_permissions, 0, }
|
||||
};
|
||||
|
||||
static const struct pw_protocol_marshal pw_protocol_native_client_marshal = {
|
||||
PW_TYPE_INTERFACE_Client,
|
||||
PW_VERSION_CLIENT,
|
||||
PW_VERSION_CLIENT_PROXY,
|
||||
PW_CLIENT_PROXY_METHOD_NUM,
|
||||
PW_CLIENT_PROXY_EVENT_NUM,
|
||||
&pw_protocol_native_client_method_marshal,
|
||||
|
|
@ -1944,21 +2138,36 @@ static const struct pw_protocol_marshal pw_protocol_native_client_marshal = {
|
|||
pw_protocol_native_client_event_demarshal,
|
||||
};
|
||||
|
||||
static const struct pw_link_proxy_events pw_protocol_native_link_event_marshal = {
|
||||
PW_VERSION_LINK_PROXY_EVENTS,
|
||||
&link_marshal_info,
|
||||
|
||||
static const struct pw_link_proxy_methods pw_protocol_native_link_method_marshal = {
|
||||
PW_VERSION_LINK_PROXY_METHODS,
|
||||
.add_listener = &link_method_marshal_add_listener,
|
||||
};
|
||||
|
||||
static const struct pw_protocol_native_demarshal pw_protocol_native_link_event_demarshal[] = {
|
||||
{ &link_demarshal_info, 0, }
|
||||
static const struct pw_protocol_native_demarshal
|
||||
pw_protocol_native_link_method_demarshal[PW_LINK_PROXY_METHOD_NUM] =
|
||||
{
|
||||
[PW_LINK_PROXY_METHOD_ADD_LISTENER] = { NULL, 0, },
|
||||
};
|
||||
|
||||
static const struct pw_link_proxy_events pw_protocol_native_link_event_marshal = {
|
||||
PW_VERSION_LINK_PROXY_EVENTS,
|
||||
.info = &link_marshal_info,
|
||||
};
|
||||
|
||||
static const struct pw_protocol_native_demarshal
|
||||
pw_protocol_native_link_event_demarshal[PW_LINK_PROXY_EVENT_NUM] =
|
||||
{
|
||||
[PW_LINK_PROXY_EVENT_INFO] = { &link_demarshal_info, 0, }
|
||||
};
|
||||
|
||||
static const struct pw_protocol_marshal pw_protocol_native_link_marshal = {
|
||||
PW_TYPE_INTERFACE_Link,
|
||||
PW_VERSION_LINK,
|
||||
0,
|
||||
PW_VERSION_LINK_PROXY,
|
||||
PW_LINK_PROXY_METHOD_NUM,
|
||||
PW_LINK_PROXY_EVENT_NUM,
|
||||
NULL, NULL,
|
||||
&pw_protocol_native_link_method_marshal,
|
||||
pw_protocol_native_link_method_demarshal,
|
||||
&pw_protocol_native_link_event_marshal,
|
||||
pw_protocol_native_link_event_demarshal,
|
||||
};
|
||||
|
|
|
|||
|
|
@ -180,7 +180,7 @@ static int module_init(struct pw_module *module, struct pw_properties *propertie
|
|||
factory = pw_factory_new(core,
|
||||
"spa-node-factory",
|
||||
PW_TYPE_INTERFACE_Node,
|
||||
PW_VERSION_NODE,
|
||||
PW_VERSION_NODE_PROXY,
|
||||
NULL,
|
||||
sizeof(*data));
|
||||
if (factory == NULL)
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue