mirror of
https://gitlab.freedesktop.org/pipewire/pipewire.git
synced 2025-11-04 13:30:12 -05:00
Unify props, params and formats
Make enum_params and set_param to configure properties, format and other parameters. This allows us to remove some duplicate code and make the properties and parameters much more extensible. Use the object id to mark the id of the parameter. Remove the spa_format and spa_props. We can now make the client-node easier by merging the various format methods into the params. Make the stream API more powerful now that we can pass params around.
This commit is contained in:
parent
b6ee67905d
commit
f3bca48398
87 changed files with 3773 additions and 3580 deletions
|
|
@ -29,7 +29,6 @@
|
|||
#include <sys/eventfd.h>
|
||||
|
||||
#include "spa/node.h"
|
||||
#include "spa/format-builder.h"
|
||||
#include "spa/lib/format.h"
|
||||
|
||||
#include "pipewire/pipewire.h"
|
||||
|
|
@ -73,11 +72,10 @@ struct proxy_buffer {
|
|||
struct proxy_port {
|
||||
bool valid;
|
||||
struct spa_port_info info;
|
||||
struct spa_format *format;
|
||||
uint32_t n_formats;
|
||||
struct spa_format **formats;
|
||||
|
||||
bool have_format;
|
||||
uint32_t n_params;
|
||||
struct spa_param **params;
|
||||
struct spa_pod_object **params;
|
||||
struct spa_port_io *io;
|
||||
|
||||
uint32_t n_buffers;
|
||||
|
|
@ -108,6 +106,9 @@ struct proxy {
|
|||
struct proxy_port in_ports[MAX_INPUTS];
|
||||
struct proxy_port out_ports[MAX_OUTPUTS];
|
||||
|
||||
uint32_t n_params;
|
||||
struct spa_pod_object **params;
|
||||
|
||||
uint8_t format_buffer[1024];
|
||||
uint32_t seq;
|
||||
};
|
||||
|
|
@ -145,14 +146,51 @@ static int clear_buffers(struct proxy *this, struct proxy_port *port)
|
|||
return SPA_RESULT_OK;
|
||||
}
|
||||
|
||||
static int spa_proxy_node_get_props(struct spa_node *node, struct spa_props **props)
|
||||
static int spa_proxy_node_enum_params(struct spa_node *node,
|
||||
uint32_t id, uint32_t *index,
|
||||
const struct spa_pod_object *filter,
|
||||
struct spa_pod_builder *builder)
|
||||
{
|
||||
return SPA_RESULT_NOT_IMPLEMENTED;
|
||||
struct proxy *this;
|
||||
|
||||
spa_return_val_if_fail(node != NULL, SPA_RESULT_INVALID_ARGUMENTS);
|
||||
spa_return_val_if_fail(index != NULL, SPA_RESULT_INVALID_ARGUMENTS);
|
||||
spa_return_val_if_fail(builder != NULL, SPA_RESULT_INVALID_ARGUMENTS);
|
||||
|
||||
this = SPA_CONTAINER_OF(node, struct proxy, node);
|
||||
|
||||
while (true) {
|
||||
struct spa_pod_object *param;
|
||||
|
||||
if (*index >= this->n_params)
|
||||
return SPA_RESULT_ENUM_END;
|
||||
|
||||
param = this->params[(*index)++];
|
||||
|
||||
if (param->body.id == id) {
|
||||
spa_pod_builder_primitive(builder, ¶m->pod);
|
||||
break;
|
||||
}
|
||||
}
|
||||
return SPA_RESULT_OK;
|
||||
}
|
||||
|
||||
static int spa_proxy_node_set_props(struct spa_node *node, const struct spa_props *props)
|
||||
static int spa_proxy_node_set_param(struct spa_node *node, uint32_t id, uint32_t flags,
|
||||
const struct spa_pod_object *param)
|
||||
{
|
||||
return SPA_RESULT_NOT_IMPLEMENTED;
|
||||
struct proxy *this;
|
||||
|
||||
if (node == NULL)
|
||||
return SPA_RESULT_INVALID_ARGUMENTS;
|
||||
|
||||
this = SPA_CONTAINER_OF(node, struct proxy, node);
|
||||
|
||||
if (this->resource == NULL)
|
||||
return SPA_RESULT_OK;
|
||||
|
||||
pw_client_node_resource_set_param(this->resource, this->seq, id, flags, param);
|
||||
|
||||
return SPA_RESULT_RETURN_ASYNC(this->seq++);
|
||||
}
|
||||
|
||||
static inline void do_flush(struct proxy *this)
|
||||
|
|
@ -180,10 +218,10 @@ static int spa_proxy_node_send_command(struct spa_node *node, const struct spa_c
|
|||
t = this->impl->t;
|
||||
|
||||
if (SPA_COMMAND_TYPE(command) == t->command_node.ClockUpdate) {
|
||||
pw_client_node_resource_node_command(this->resource, this->seq++, command);
|
||||
pw_client_node_resource_command(this->resource, this->seq++, command);
|
||||
} else {
|
||||
/* send start */
|
||||
pw_client_node_resource_node_command(this->resource, this->seq, command);
|
||||
pw_client_node_resource_command(this->resource, this->seq, command);
|
||||
res = SPA_RESULT_RETURN_ASYNC(this->seq++);
|
||||
}
|
||||
return res;
|
||||
|
|
@ -267,15 +305,12 @@ do_update_port(struct proxy *this,
|
|||
enum spa_direction direction,
|
||||
uint32_t port_id,
|
||||
uint32_t change_mask,
|
||||
uint32_t n_possible_formats,
|
||||
const struct spa_format **possible_formats,
|
||||
const struct spa_format *format,
|
||||
uint32_t n_params,
|
||||
const struct spa_param **params,
|
||||
const struct spa_pod_object **params,
|
||||
const struct spa_port_info *info)
|
||||
{
|
||||
struct proxy_port *port;
|
||||
uint32_t i;
|
||||
struct pw_type *t = this->impl->t;
|
||||
|
||||
if (direction == SPA_DIRECTION_INPUT) {
|
||||
port = &this->in_ports[port_id];
|
||||
|
|
@ -283,31 +318,23 @@ do_update_port(struct proxy *this,
|
|||
port = &this->out_ports[port_id];
|
||||
}
|
||||
|
||||
if (change_mask & PW_CLIENT_NODE_PORT_UPDATE_POSSIBLE_FORMATS) {
|
||||
spa_log_info(this->log, "proxy %p: %d formats", this, n_possible_formats);
|
||||
for (i = 0; i < port->n_formats; i++)
|
||||
free(port->formats[i]);
|
||||
port->n_formats = n_possible_formats;
|
||||
port->formats =
|
||||
realloc(port->formats, port->n_formats * sizeof(struct spa_format *));
|
||||
for (i = 0; i < port->n_formats; i++)
|
||||
port->formats[i] = spa_format_copy(possible_formats[i]);
|
||||
}
|
||||
if (change_mask & PW_CLIENT_NODE_PORT_UPDATE_FORMAT) {
|
||||
spa_log_info(this->log, "proxy %p: update format %p", this, format);
|
||||
if (port->format)
|
||||
free(port->format);
|
||||
port->format = spa_format_copy(format);
|
||||
}
|
||||
|
||||
if (change_mask & PW_CLIENT_NODE_PORT_UPDATE_PARAMS) {
|
||||
int i;
|
||||
|
||||
port->have_format = false;
|
||||
|
||||
spa_log_info(this->log, "proxy %p: update %d params", this, n_params);
|
||||
for (i = 0; i < port->n_params; i++)
|
||||
free(port->params[i]);
|
||||
port->n_params = n_params;
|
||||
port->params = realloc(port->params, port->n_params * sizeof(struct spa_param *));
|
||||
for (i = 0; i < port->n_params; i++)
|
||||
port->params[i] = spa_param_copy(params[i]);
|
||||
port->params = realloc(port->params, port->n_params * sizeof(struct spa_pod_object *));
|
||||
|
||||
for (i = 0; i < port->n_params; i++) {
|
||||
port->params[i] = spa_pod_object_copy(params[i]);
|
||||
if (port->params[i]->body.id == t->param.idFormat)
|
||||
port->have_format = true;
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
if (change_mask & PW_CLIENT_NODE_PORT_UPDATE_INFO && info)
|
||||
|
|
@ -315,7 +342,7 @@ do_update_port(struct proxy *this,
|
|||
|
||||
if (!port->valid) {
|
||||
spa_log_info(this->log, "proxy %p: adding port %d", this, port_id);
|
||||
port->format = NULL;
|
||||
port->have_format = false;
|
||||
port->valid = true;
|
||||
|
||||
if (direction == SPA_DIRECTION_INPUT)
|
||||
|
|
@ -332,10 +359,8 @@ clear_port(struct proxy *this,
|
|||
do_update_port(this,
|
||||
direction,
|
||||
port_id,
|
||||
PW_CLIENT_NODE_PORT_UPDATE_POSSIBLE_FORMATS |
|
||||
PW_CLIENT_NODE_PORT_UPDATE_FORMAT |
|
||||
PW_CLIENT_NODE_PORT_UPDATE_PARAMS |
|
||||
PW_CLIENT_NODE_PORT_UPDATE_INFO, 0, NULL, NULL, 0, NULL, NULL);
|
||||
PW_CLIENT_NODE_PORT_UPDATE_INFO, 0, NULL, NULL);
|
||||
clear_buffers(this, port);
|
||||
}
|
||||
|
||||
|
|
@ -394,101 +419,6 @@ spa_proxy_node_remove_port(struct spa_node *node, enum spa_direction direction,
|
|||
return SPA_RESULT_OK;
|
||||
}
|
||||
|
||||
static int
|
||||
spa_proxy_node_port_enum_formats(struct spa_node *node,
|
||||
enum spa_direction direction,
|
||||
uint32_t port_id,
|
||||
struct spa_format **format,
|
||||
const struct spa_format *filter,
|
||||
uint32_t index)
|
||||
{
|
||||
struct proxy *this;
|
||||
struct proxy_port *port;
|
||||
struct spa_format *fmt;
|
||||
struct spa_pod_builder b = { NULL, };
|
||||
int res;
|
||||
uint32_t count, match = 0;
|
||||
|
||||
if (node == NULL || format == NULL)
|
||||
return SPA_RESULT_INVALID_ARGUMENTS;
|
||||
|
||||
this = SPA_CONTAINER_OF(node, struct proxy, node);
|
||||
|
||||
if (!CHECK_PORT(this, direction, port_id))
|
||||
return SPA_RESULT_INVALID_PORT;
|
||||
|
||||
port =
|
||||
direction == SPA_DIRECTION_INPUT ? &this->in_ports[port_id] : &this->out_ports[port_id];
|
||||
|
||||
count = match = filter ? 0 : index;
|
||||
|
||||
next:
|
||||
if (count >= port->n_formats)
|
||||
return SPA_RESULT_ENUM_END;
|
||||
|
||||
fmt = port->formats[count++];
|
||||
|
||||
spa_pod_builder_init(&b, this->format_buffer, sizeof(this->format_buffer));
|
||||
|
||||
if ((res = spa_format_filter(fmt, filter, &b)) != SPA_RESULT_OK || match++ != index)
|
||||
goto next;
|
||||
|
||||
*format = SPA_POD_BUILDER_DEREF(&b, 0, struct spa_format);
|
||||
|
||||
return SPA_RESULT_OK;
|
||||
}
|
||||
|
||||
static int
|
||||
spa_proxy_node_port_set_format(struct spa_node *node,
|
||||
enum spa_direction direction,
|
||||
uint32_t port_id, uint32_t flags, const struct spa_format *format)
|
||||
{
|
||||
struct proxy *this;
|
||||
|
||||
if (node == NULL)
|
||||
return SPA_RESULT_INVALID_ARGUMENTS;
|
||||
|
||||
this = SPA_CONTAINER_OF(node, struct proxy, node);
|
||||
|
||||
if (!CHECK_PORT(this, direction, port_id))
|
||||
return SPA_RESULT_INVALID_PORT;
|
||||
|
||||
if (this->resource == NULL)
|
||||
return SPA_RESULT_OK;
|
||||
|
||||
pw_client_node_resource_set_format(this->resource,
|
||||
this->seq, direction, port_id, flags, format);
|
||||
|
||||
return SPA_RESULT_RETURN_ASYNC(this->seq++);
|
||||
}
|
||||
|
||||
static int
|
||||
spa_proxy_node_port_get_format(struct spa_node *node,
|
||||
enum spa_direction direction,
|
||||
uint32_t port_id, const struct spa_format **format)
|
||||
{
|
||||
struct proxy *this;
|
||||
struct proxy_port *port;
|
||||
|
||||
if (node == NULL || format == NULL)
|
||||
return SPA_RESULT_INVALID_ARGUMENTS;
|
||||
|
||||
this = SPA_CONTAINER_OF(node, struct proxy, node);
|
||||
|
||||
if (!CHECK_PORT(this, direction, port_id))
|
||||
return SPA_RESULT_INVALID_PORT;
|
||||
|
||||
port =
|
||||
direction == SPA_DIRECTION_INPUT ? &this->in_ports[port_id] : &this->out_ports[port_id];
|
||||
|
||||
if (!port->format)
|
||||
return SPA_RESULT_NO_FORMAT;
|
||||
|
||||
*format = port->format;
|
||||
|
||||
return SPA_RESULT_OK;
|
||||
}
|
||||
|
||||
static int
|
||||
spa_proxy_node_port_get_info(struct spa_node *node,
|
||||
enum spa_direction direction,
|
||||
|
|
@ -515,14 +445,17 @@ spa_proxy_node_port_get_info(struct spa_node *node,
|
|||
|
||||
static int
|
||||
spa_proxy_node_port_enum_params(struct spa_node *node,
|
||||
enum spa_direction direction,
|
||||
uint32_t port_id, uint32_t index, struct spa_param **param)
|
||||
enum spa_direction direction, uint32_t port_id,
|
||||
uint32_t id, uint32_t *index,
|
||||
const struct spa_pod_object *filter,
|
||||
struct spa_pod_builder *builder)
|
||||
{
|
||||
struct proxy *this;
|
||||
struct proxy_port *port;
|
||||
|
||||
spa_return_val_if_fail(node != NULL, SPA_RESULT_INVALID_ARGUMENTS);
|
||||
spa_return_val_if_fail(param != NULL, SPA_RESULT_INVALID_ARGUMENTS);
|
||||
spa_return_val_if_fail(index != NULL, SPA_RESULT_INVALID_ARGUMENTS);
|
||||
spa_return_val_if_fail(builder != NULL, SPA_RESULT_INVALID_ARGUMENTS);
|
||||
|
||||
this = SPA_CONTAINER_OF(node, struct proxy, node);
|
||||
|
||||
|
|
@ -531,20 +464,48 @@ spa_proxy_node_port_enum_params(struct spa_node *node,
|
|||
port =
|
||||
direction == SPA_DIRECTION_INPUT ? &this->in_ports[port_id] : &this->out_ports[port_id];
|
||||
|
||||
if (index >= port->n_params)
|
||||
return SPA_RESULT_ENUM_END;
|
||||
while (true) {
|
||||
struct spa_pod_object *param;
|
||||
|
||||
*param = port->params[index];
|
||||
if (*index >= port->n_params)
|
||||
return SPA_RESULT_ENUM_END;
|
||||
|
||||
param = port->params[(*index)++];
|
||||
|
||||
if (param->body.id == id) {
|
||||
spa_pod_builder_primitive(builder, ¶m->pod);
|
||||
break;
|
||||
}
|
||||
}
|
||||
return SPA_RESULT_OK;
|
||||
}
|
||||
|
||||
static int
|
||||
spa_proxy_node_port_set_param(struct spa_node *node,
|
||||
enum spa_direction direction,
|
||||
uint32_t port_id, const struct spa_param *param)
|
||||
enum spa_direction direction, uint32_t port_id,
|
||||
uint32_t id, uint32_t flags,
|
||||
const struct spa_pod_object *param)
|
||||
{
|
||||
return SPA_RESULT_NOT_IMPLEMENTED;
|
||||
struct proxy *this;
|
||||
|
||||
if (node == NULL)
|
||||
return SPA_RESULT_INVALID_ARGUMENTS;
|
||||
|
||||
this = SPA_CONTAINER_OF(node, struct proxy, node);
|
||||
|
||||
if (!CHECK_PORT(this, direction, port_id))
|
||||
return SPA_RESULT_INVALID_PORT;
|
||||
|
||||
if (this->resource == NULL)
|
||||
return SPA_RESULT_OK;
|
||||
|
||||
pw_client_node_resource_port_set_param(this->resource,
|
||||
this->seq,
|
||||
direction, port_id,
|
||||
id, flags,
|
||||
param);
|
||||
|
||||
return SPA_RESULT_RETURN_ASYNC(this->seq++);
|
||||
}
|
||||
|
||||
static int
|
||||
|
|
@ -597,7 +558,7 @@ spa_proxy_node_port_use_buffers(struct spa_node *node,
|
|||
port =
|
||||
direction == SPA_DIRECTION_INPUT ? &this->in_ports[port_id] : &this->out_ports[port_id];
|
||||
|
||||
if (!port->format)
|
||||
if (!port->have_format)
|
||||
return SPA_RESULT_NO_FORMAT;
|
||||
|
||||
clear_buffers(this, port);
|
||||
|
|
@ -633,12 +594,12 @@ spa_proxy_node_port_use_buffers(struct spa_node *node,
|
|||
mb[i].offset = 0;
|
||||
mb[i].size = msh->size;
|
||||
|
||||
pw_client_node_resource_add_mem(this->resource,
|
||||
direction,
|
||||
port_id,
|
||||
mb[i].mem_id,
|
||||
t->data.MemFd,
|
||||
msh->fd, msh->flags, msh->offset, msh->size);
|
||||
pw_client_node_resource_port_add_mem(this->resource,
|
||||
direction,
|
||||
port_id,
|
||||
mb[i].mem_id,
|
||||
t->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));
|
||||
|
|
@ -651,13 +612,13 @@ spa_proxy_node_port_use_buffers(struct spa_node *node,
|
|||
|
||||
if (d->type == t->data.DmaBuf ||
|
||||
d->type == t->data.MemFd) {
|
||||
pw_client_node_resource_add_mem(this->resource,
|
||||
direction,
|
||||
port_id,
|
||||
n_mem,
|
||||
d->type,
|
||||
d->fd,
|
||||
d->flags, d->mapoffset, d->maxsize);
|
||||
pw_client_node_resource_port_add_mem(this->resource,
|
||||
direction,
|
||||
port_id,
|
||||
n_mem,
|
||||
d->type,
|
||||
d->fd,
|
||||
d->flags, d->mapoffset, d->maxsize);
|
||||
b->buffer.datas[j].type = t->data.Id;
|
||||
b->buffer.datas[j].data = SPA_UINT32_TO_PTR(n_mem);
|
||||
n_mem++;
|
||||
|
|
@ -672,8 +633,10 @@ spa_proxy_node_port_use_buffers(struct spa_node *node,
|
|||
}
|
||||
}
|
||||
|
||||
pw_client_node_resource_use_buffers(this->resource,
|
||||
this->seq, direction, port_id, n_buffers, mb);
|
||||
pw_client_node_resource_port_use_buffers(this->resource,
|
||||
this->seq,
|
||||
direction, port_id,
|
||||
n_buffers, mb);
|
||||
|
||||
return SPA_RESULT_RETURN_ASYNC(this->seq++);
|
||||
}
|
||||
|
|
@ -682,7 +645,7 @@ static int
|
|||
spa_proxy_node_port_alloc_buffers(struct spa_node *node,
|
||||
enum spa_direction direction,
|
||||
uint32_t port_id,
|
||||
struct spa_param **params,
|
||||
struct spa_pod_object **params,
|
||||
uint32_t n_params,
|
||||
struct spa_buffer **buffers,
|
||||
uint32_t *n_buffers)
|
||||
|
|
@ -701,7 +664,7 @@ spa_proxy_node_port_alloc_buffers(struct spa_node *node,
|
|||
port =
|
||||
direction == SPA_DIRECTION_INPUT ? &this->in_ports[port_id] : &this->out_ports[port_id];
|
||||
|
||||
if (!port->format)
|
||||
if (!port->have_format)
|
||||
return SPA_RESULT_NO_FORMAT;
|
||||
|
||||
return SPA_RESULT_NOT_IMPLEMENTED;
|
||||
|
|
@ -874,7 +837,9 @@ static void
|
|||
client_node_update(void *data,
|
||||
uint32_t change_mask,
|
||||
uint32_t max_input_ports,
|
||||
uint32_t max_output_ports, const struct spa_props *props)
|
||||
uint32_t max_output_ports,
|
||||
uint32_t n_params,
|
||||
const struct spa_pod_object **params)
|
||||
{
|
||||
struct impl *impl = data;
|
||||
struct proxy *this = &impl->proxy;
|
||||
|
|
@ -883,7 +848,18 @@ client_node_update(void *data,
|
|||
this->max_inputs = max_input_ports;
|
||||
if (change_mask & PW_CLIENT_NODE_UPDATE_MAX_OUTPUTS)
|
||||
this->max_outputs = max_output_ports;
|
||||
if (change_mask & PW_CLIENT_NODE_UPDATE_PARAMS) {
|
||||
int i;
|
||||
spa_log_info(this->log, "proxy %p: update %d params", this, n_params);
|
||||
|
||||
for (i = 0; i < this->n_params; i++)
|
||||
free(this->params[i]);
|
||||
this->n_params = n_params;
|
||||
this->params = realloc(this->params, this->n_params * sizeof(struct spa_pod_object *));
|
||||
|
||||
for (i = 0; i < this->n_params; i++)
|
||||
this->params[i] = spa_pod_object_copy(params[i]);
|
||||
}
|
||||
spa_log_info(this->log, "proxy %p: got node update max_in %u, max_out %u", this,
|
||||
this->max_inputs, this->max_outputs);
|
||||
}
|
||||
|
|
@ -893,11 +869,9 @@ client_node_port_update(void *data,
|
|||
enum spa_direction direction,
|
||||
uint32_t port_id,
|
||||
uint32_t change_mask,
|
||||
uint32_t n_possible_formats,
|
||||
const struct spa_format **possible_formats,
|
||||
const struct spa_format *format,
|
||||
uint32_t n_params,
|
||||
const struct spa_param **params, const struct spa_port_info *info)
|
||||
const struct spa_pod_object **params,
|
||||
const struct spa_port_info *info)
|
||||
{
|
||||
struct impl *impl = data;
|
||||
struct proxy *this = &impl->proxy;
|
||||
|
|
@ -916,8 +890,7 @@ client_node_port_update(void *data,
|
|||
direction,
|
||||
port_id,
|
||||
change_mask,
|
||||
n_possible_formats,
|
||||
possible_formats, format, n_params, params, info);
|
||||
n_params, params, info);
|
||||
}
|
||||
}
|
||||
|
||||
|
|
@ -979,17 +952,14 @@ static void proxy_on_data_fd_events(struct spa_source *source)
|
|||
static const struct spa_node proxy_node = {
|
||||
SPA_VERSION_NODE,
|
||||
NULL,
|
||||
spa_proxy_node_get_props,
|
||||
spa_proxy_node_set_props,
|
||||
spa_proxy_node_enum_params,
|
||||
spa_proxy_node_set_param,
|
||||
spa_proxy_node_send_command,
|
||||
spa_proxy_node_set_callbacks,
|
||||
spa_proxy_node_get_n_ports,
|
||||
spa_proxy_node_get_port_ids,
|
||||
spa_proxy_node_add_port,
|
||||
spa_proxy_node_remove_port,
|
||||
spa_proxy_node_port_enum_formats,
|
||||
spa_proxy_node_port_set_format,
|
||||
spa_proxy_node_port_get_format,
|
||||
spa_proxy_node_port_get_info,
|
||||
spa_proxy_node_port_enum_params,
|
||||
spa_proxy_node_port_set_param,
|
||||
|
|
|
|||
|
|
@ -51,18 +51,27 @@ static void
|
|||
client_node_marshal_update(void *object,
|
||||
uint32_t change_mask,
|
||||
uint32_t max_input_ports,
|
||||
uint32_t max_output_ports, const struct spa_props *props)
|
||||
uint32_t max_output_ports,
|
||||
uint32_t n_params,
|
||||
const struct spa_pod_object **params)
|
||||
{
|
||||
struct pw_proxy *proxy = object;
|
||||
struct spa_pod_builder *b;
|
||||
int i;
|
||||
|
||||
b = pw_protocol_native_begin_proxy(proxy, PW_CLIENT_NODE_PROXY_METHOD_UPDATE);
|
||||
|
||||
spa_pod_builder_struct(b,
|
||||
"i", change_mask,
|
||||
"i", max_input_ports,
|
||||
"i", max_output_ports,
|
||||
"P", props);
|
||||
spa_pod_builder_add(b,
|
||||
"[",
|
||||
"i", change_mask,
|
||||
"i", max_input_ports,
|
||||
"i", max_output_ports,
|
||||
"i", n_params, NULL);
|
||||
|
||||
for (i = 0; i < n_params; i++)
|
||||
spa_pod_builder_add(b, "P", params[i], NULL);
|
||||
|
||||
spa_pod_builder_add(b, "]", NULL);
|
||||
|
||||
pw_protocol_native_end_proxy(proxy, b);
|
||||
}
|
||||
|
|
@ -72,11 +81,9 @@ client_node_marshal_port_update(void *object,
|
|||
enum spa_direction direction,
|
||||
uint32_t port_id,
|
||||
uint32_t change_mask,
|
||||
uint32_t n_possible_formats,
|
||||
const struct spa_format **possible_formats,
|
||||
const struct spa_format *format,
|
||||
uint32_t n_params,
|
||||
const struct spa_param **params, const struct spa_port_info *info)
|
||||
const struct spa_pod_object **params,
|
||||
const struct spa_port_info *info)
|
||||
{
|
||||
struct pw_proxy *proxy = object;
|
||||
struct spa_pod_builder *b;
|
||||
|
|
@ -89,13 +96,6 @@ client_node_marshal_port_update(void *object,
|
|||
"i", direction,
|
||||
"i", port_id,
|
||||
"i", change_mask,
|
||||
"i", n_possible_formats, NULL);
|
||||
|
||||
for (i = 0; i < n_possible_formats; i++)
|
||||
spa_pod_builder_add(b, "P", possible_formats[i], NULL);
|
||||
|
||||
spa_pod_builder_add(b,
|
||||
"P", format,
|
||||
"i", n_params, NULL);
|
||||
|
||||
for (i = 0; i < n_params; i++)
|
||||
|
|
@ -149,21 +149,57 @@ static void client_node_marshal_destroy(void *object)
|
|||
pw_protocol_native_end_proxy(proxy, b);
|
||||
}
|
||||
|
||||
static bool client_node_demarshal_set_props(void *object, void *data, size_t size)
|
||||
static bool client_node_demarshal_transport(void *object, void *data, size_t size)
|
||||
{
|
||||
struct pw_proxy *proxy = object;
|
||||
struct spa_pod_parser prs;
|
||||
uint32_t seq;
|
||||
const struct spa_props *props = NULL;
|
||||
uint32_t node_id, ridx, widx, memfd_idx;
|
||||
int readfd, writefd;
|
||||
struct pw_client_node_transport_info info;
|
||||
struct pw_client_node_transport *transport;
|
||||
|
||||
spa_pod_parser_init(&prs, data, size, 0);
|
||||
if (spa_pod_parser_get(&prs,
|
||||
"["
|
||||
"i", &node_id,
|
||||
"i", &ridx,
|
||||
"i", &widx,
|
||||
"i", &memfd_idx,
|
||||
"i", &info.offset,
|
||||
"i", &info.size, NULL) < 0)
|
||||
return false;
|
||||
|
||||
readfd = pw_protocol_native_get_proxy_fd(proxy, ridx);
|
||||
writefd = pw_protocol_native_get_proxy_fd(proxy, widx);
|
||||
info.memfd = pw_protocol_native_get_proxy_fd(proxy, memfd_idx);
|
||||
|
||||
if (readfd == -1 || writefd == -1 || info.memfd == -1)
|
||||
return false;
|
||||
|
||||
transport = pw_client_node_transport_new_from_info(&info);
|
||||
|
||||
pw_proxy_notify(proxy, struct pw_client_node_proxy_events, transport, node_id,
|
||||
readfd, writefd, transport);
|
||||
return true;
|
||||
}
|
||||
|
||||
static bool client_node_demarshal_set_param(void *object, void *data, size_t size)
|
||||
{
|
||||
struct pw_proxy *proxy = object;
|
||||
struct spa_pod_parser prs;
|
||||
uint32_t seq, id, flags;
|
||||
const struct spa_pod_object *param = NULL;
|
||||
|
||||
spa_pod_parser_init(&prs, data, size, 0);
|
||||
if (spa_pod_parser_get(&prs,
|
||||
"["
|
||||
"i", &seq,
|
||||
"O", &props, NULL) < 0)
|
||||
"I", &id,
|
||||
"i", &flags,
|
||||
"O", ¶m, NULL) < 0)
|
||||
return false;
|
||||
|
||||
pw_proxy_notify(proxy, struct pw_client_node_proxy_events, set_props, seq, props);
|
||||
pw_proxy_notify(proxy, struct pw_client_node_proxy_events, set_param, seq, id, flags, param);
|
||||
return true;
|
||||
}
|
||||
|
||||
|
|
@ -181,6 +217,24 @@ static bool client_node_demarshal_event_event(void *object, void *data, size_t s
|
|||
return true;
|
||||
}
|
||||
|
||||
static bool client_node_demarshal_command(void *object, void *data, size_t size)
|
||||
{
|
||||
struct pw_proxy *proxy = object;
|
||||
struct spa_pod_parser prs;
|
||||
const struct spa_command *command;
|
||||
uint32_t seq;
|
||||
|
||||
spa_pod_parser_init(&prs, data, size, 0);
|
||||
if (spa_pod_parser_get(&prs,
|
||||
"["
|
||||
"i", &seq,
|
||||
"O", &command, NULL) < 0)
|
||||
return false;
|
||||
|
||||
pw_proxy_notify(proxy, struct pw_client_node_proxy_events, command, seq, command);
|
||||
return true;
|
||||
}
|
||||
|
||||
static bool client_node_demarshal_add_port(void *object, void *data, size_t size)
|
||||
{
|
||||
struct pw_proxy *proxy = object;
|
||||
|
|
@ -217,12 +271,12 @@ static bool client_node_demarshal_remove_port(void *object, void *data, size_t s
|
|||
return true;
|
||||
}
|
||||
|
||||
static bool client_node_demarshal_set_format(void *object, void *data, size_t size)
|
||||
static bool client_node_demarshal_port_set_param(void *object, void *data, size_t size)
|
||||
{
|
||||
struct pw_proxy *proxy = object;
|
||||
struct spa_pod_parser prs;
|
||||
uint32_t seq, direction, port_id, flags;
|
||||
const struct spa_format *format = NULL;
|
||||
uint32_t seq, direction, port_id, id, flags;
|
||||
const struct spa_pod_object *param = NULL;
|
||||
|
||||
spa_pod_parser_init(&prs, data, size, 0);
|
||||
if (spa_pod_parser_get(&prs,
|
||||
|
|
@ -230,36 +284,17 @@ static bool client_node_demarshal_set_format(void *object, void *data, size_t si
|
|||
"i", &seq,
|
||||
"i", &direction,
|
||||
"i", &port_id,
|
||||
"I", &id,
|
||||
"i", &flags,
|
||||
"O", &format, NULL) < 0)
|
||||
return false;
|
||||
|
||||
pw_proxy_notify(proxy, struct pw_client_node_proxy_events, set_format, seq, direction, port_id,
|
||||
flags, format);
|
||||
return true;
|
||||
}
|
||||
|
||||
static bool client_node_demarshal_set_param(void *object, void *data, size_t size)
|
||||
{
|
||||
struct pw_proxy *proxy = object;
|
||||
struct spa_pod_parser prs;
|
||||
uint32_t seq, direction, port_id;
|
||||
const struct spa_param *param = NULL;
|
||||
|
||||
spa_pod_parser_init(&prs, data, size, 0);
|
||||
if (spa_pod_parser_get(&prs,
|
||||
"["
|
||||
"i", &seq,
|
||||
"i", &direction,
|
||||
"i", &port_id,
|
||||
"O", ¶m, NULL) < 0)
|
||||
return false;
|
||||
|
||||
pw_proxy_notify(proxy, struct pw_client_node_proxy_events, set_param, seq, direction, port_id, param);
|
||||
pw_proxy_notify(proxy, struct pw_client_node_proxy_events, port_set_param,
|
||||
seq, direction, port_id, id, flags, param);
|
||||
return true;
|
||||
}
|
||||
|
||||
static bool client_node_demarshal_add_mem(void *object, void *data, size_t size)
|
||||
static bool client_node_demarshal_port_add_mem(void *object, void *data, size_t size)
|
||||
{
|
||||
struct pw_proxy *proxy = object;
|
||||
struct spa_pod_parser prs;
|
||||
|
|
@ -281,7 +316,7 @@ static bool client_node_demarshal_add_mem(void *object, void *data, size_t size)
|
|||
|
||||
memfd = pw_protocol_native_get_proxy_fd(proxy, memfd_idx);
|
||||
|
||||
pw_proxy_notify(proxy, struct pw_client_node_proxy_events, add_mem, direction,
|
||||
pw_proxy_notify(proxy, struct pw_client_node_proxy_events, port_add_mem, direction,
|
||||
port_id,
|
||||
mem_id,
|
||||
type,
|
||||
|
|
@ -289,7 +324,7 @@ static bool client_node_demarshal_add_mem(void *object, void *data, size_t size)
|
|||
return true;
|
||||
}
|
||||
|
||||
static bool client_node_demarshal_use_buffers(void *object, void *data, size_t size)
|
||||
static bool client_node_demarshal_port_use_buffers(void *object, void *data, size_t size)
|
||||
{
|
||||
struct pw_proxy *proxy = object;
|
||||
struct spa_pod_parser prs;
|
||||
|
|
@ -345,31 +380,13 @@ static bool client_node_demarshal_use_buffers(void *object, void *data, size_t s
|
|||
d->data = SPA_UINT32_TO_PTR(data_id);
|
||||
}
|
||||
}
|
||||
pw_proxy_notify(proxy, struct pw_client_node_proxy_events, use_buffers, seq,
|
||||
pw_proxy_notify(proxy, struct pw_client_node_proxy_events, port_use_buffers, seq,
|
||||
direction,
|
||||
port_id,
|
||||
n_buffers, buffers);
|
||||
return true;
|
||||
}
|
||||
|
||||
static bool client_node_demarshal_node_command(void *object, void *data, size_t size)
|
||||
{
|
||||
struct pw_proxy *proxy = object;
|
||||
struct spa_pod_parser prs;
|
||||
const struct spa_command *command;
|
||||
uint32_t seq;
|
||||
|
||||
spa_pod_parser_init(&prs, data, size, 0);
|
||||
if (spa_pod_parser_get(&prs,
|
||||
"["
|
||||
"i", &seq,
|
||||
"O", &command, NULL) < 0)
|
||||
return false;
|
||||
|
||||
pw_proxy_notify(proxy, struct pw_client_node_proxy_events, node_command, seq, command);
|
||||
return true;
|
||||
}
|
||||
|
||||
static bool client_node_demarshal_port_command(void *object, void *data, size_t size)
|
||||
{
|
||||
struct pw_proxy *proxy = object;
|
||||
|
|
@ -391,51 +408,42 @@ static bool client_node_demarshal_port_command(void *object, void *data, size_t
|
|||
return true;
|
||||
}
|
||||
|
||||
static bool client_node_demarshal_transport(void *object, void *data, size_t size)
|
||||
static void client_node_marshal_transport(void *object, uint32_t node_id, int readfd, int writefd,
|
||||
struct pw_client_node_transport *transport)
|
||||
{
|
||||
struct pw_proxy *proxy = object;
|
||||
struct spa_pod_parser prs;
|
||||
uint32_t node_id, ridx, widx, memfd_idx;
|
||||
int readfd, writefd;
|
||||
struct pw_resource *resource = object;
|
||||
struct spa_pod_builder *b;
|
||||
struct pw_client_node_transport_info info;
|
||||
struct pw_client_node_transport *transport;
|
||||
|
||||
spa_pod_parser_init(&prs, data, size, 0);
|
||||
if (spa_pod_parser_get(&prs,
|
||||
"["
|
||||
"i", &node_id,
|
||||
"i", &ridx,
|
||||
"i", &widx,
|
||||
"i", &memfd_idx,
|
||||
"i", &info.offset,
|
||||
"i", &info.size, NULL) < 0)
|
||||
return false;
|
||||
pw_client_node_transport_get_info(transport, &info);
|
||||
|
||||
readfd = pw_protocol_native_get_proxy_fd(proxy, ridx);
|
||||
writefd = pw_protocol_native_get_proxy_fd(proxy, widx);
|
||||
info.memfd = pw_protocol_native_get_proxy_fd(proxy, memfd_idx);
|
||||
b = pw_protocol_native_begin_resource(resource, PW_CLIENT_NODE_PROXY_EVENT_TRANSPORT);
|
||||
|
||||
if (readfd == -1 || writefd == -1 || info.memfd == -1)
|
||||
return false;
|
||||
spa_pod_builder_struct(b,
|
||||
"i", node_id,
|
||||
"i", pw_protocol_native_add_resource_fd(resource, readfd),
|
||||
"i", pw_protocol_native_add_resource_fd(resource, writefd),
|
||||
"i", pw_protocol_native_add_resource_fd(resource, info.memfd),
|
||||
"i", info.offset,
|
||||
"i", info.size);
|
||||
|
||||
transport = pw_client_node_transport_new_from_info(&info);
|
||||
|
||||
pw_proxy_notify(proxy, struct pw_client_node_proxy_events, transport, node_id,
|
||||
readfd, writefd, transport);
|
||||
return true;
|
||||
pw_protocol_native_end_resource(resource, b);
|
||||
}
|
||||
|
||||
static void
|
||||
client_node_marshal_set_props(void *object, uint32_t seq, const struct spa_props *props)
|
||||
client_node_marshal_set_param(void *object, uint32_t seq, uint32_t id, uint32_t flags,
|
||||
const struct spa_pod_object *param)
|
||||
{
|
||||
struct pw_resource *resource = object;
|
||||
struct spa_pod_builder *b;
|
||||
|
||||
b = pw_protocol_native_begin_resource(resource, PW_CLIENT_NODE_PROXY_EVENT_SET_PROPS);
|
||||
b = pw_protocol_native_begin_resource(resource, PW_CLIENT_NODE_PROXY_EVENT_SET_PARAM);
|
||||
|
||||
spa_pod_builder_struct(b,
|
||||
"i", seq,
|
||||
"P", props);
|
||||
"I", id,
|
||||
"i", flags,
|
||||
"P", param);
|
||||
|
||||
pw_protocol_native_end_resource(resource, b);
|
||||
}
|
||||
|
|
@ -452,6 +460,19 @@ static void client_node_marshal_event_event(void *object, const struct spa_event
|
|||
pw_protocol_native_end_resource(resource, b);
|
||||
}
|
||||
|
||||
static void
|
||||
client_node_marshal_command(void *object, uint32_t seq, const struct spa_command *command)
|
||||
{
|
||||
struct pw_resource *resource = object;
|
||||
struct spa_pod_builder *b;
|
||||
|
||||
b = pw_protocol_native_begin_resource(resource, PW_CLIENT_NODE_PROXY_EVENT_COMMAND);
|
||||
|
||||
spa_pod_builder_struct(b, "i", seq, "P", command);
|
||||
|
||||
pw_protocol_native_end_resource(resource, b);
|
||||
}
|
||||
|
||||
static void
|
||||
client_node_marshal_add_port(void *object,
|
||||
uint32_t seq, enum spa_direction direction, uint32_t port_id)
|
||||
|
|
@ -487,61 +508,42 @@ client_node_marshal_remove_port(void *object,
|
|||
}
|
||||
|
||||
static void
|
||||
client_node_marshal_set_format(void *object,
|
||||
uint32_t seq,
|
||||
enum spa_direction direction,
|
||||
uint32_t port_id,
|
||||
uint32_t flags,
|
||||
const struct spa_format *format)
|
||||
client_node_marshal_port_set_param(void *object,
|
||||
uint32_t seq,
|
||||
enum spa_direction direction,
|
||||
uint32_t port_id,
|
||||
uint32_t id,
|
||||
uint32_t flags,
|
||||
const struct spa_pod_object *param)
|
||||
{
|
||||
struct pw_resource *resource = object;
|
||||
struct spa_pod_builder *b;
|
||||
|
||||
b = pw_protocol_native_begin_resource(resource, PW_CLIENT_NODE_PROXY_EVENT_SET_FORMAT);
|
||||
b = pw_protocol_native_begin_resource(resource, PW_CLIENT_NODE_PROXY_EVENT_PORT_SET_PARAM);
|
||||
|
||||
spa_pod_builder_struct(b,
|
||||
"i", seq,
|
||||
"i", direction,
|
||||
"i", port_id,
|
||||
"I", id,
|
||||
"i", flags,
|
||||
"P", format);
|
||||
|
||||
pw_protocol_native_end_resource(resource, b);
|
||||
}
|
||||
|
||||
static void
|
||||
client_node_marshal_set_param(void *object,
|
||||
uint32_t seq,
|
||||
enum spa_direction direction,
|
||||
uint32_t port_id,
|
||||
const struct spa_param *param)
|
||||
{
|
||||
struct pw_resource *resource = object;
|
||||
struct spa_pod_builder *b;
|
||||
|
||||
b = pw_protocol_native_begin_resource(resource, PW_CLIENT_NODE_PROXY_EVENT_SET_PARAM);
|
||||
|
||||
spa_pod_builder_struct(b,
|
||||
"i", seq,
|
||||
"i", direction,
|
||||
"i", port_id,
|
||||
"P", param);
|
||||
|
||||
pw_protocol_native_end_resource(resource, b);
|
||||
}
|
||||
|
||||
static void
|
||||
client_node_marshal_add_mem(void *object,
|
||||
enum spa_direction direction,
|
||||
uint32_t port_id,
|
||||
uint32_t mem_id,
|
||||
uint32_t type,
|
||||
int memfd, uint32_t flags, uint32_t offset, uint32_t size)
|
||||
client_node_marshal_port_add_mem(void *object,
|
||||
enum spa_direction direction,
|
||||
uint32_t port_id,
|
||||
uint32_t mem_id,
|
||||
uint32_t type,
|
||||
int memfd, uint32_t flags, uint32_t offset, uint32_t size)
|
||||
{
|
||||
struct pw_resource *resource = object;
|
||||
struct spa_pod_builder *b;
|
||||
|
||||
b = pw_protocol_native_begin_resource(resource, PW_CLIENT_NODE_PROXY_EVENT_ADD_MEM);
|
||||
b = pw_protocol_native_begin_resource(resource, PW_CLIENT_NODE_PROXY_EVENT_PORT_ADD_MEM);
|
||||
|
||||
spa_pod_builder_struct(b,
|
||||
"i", direction,
|
||||
|
|
@ -557,17 +559,17 @@ client_node_marshal_add_mem(void *object,
|
|||
}
|
||||
|
||||
static void
|
||||
client_node_marshal_use_buffers(void *object,
|
||||
uint32_t seq,
|
||||
enum spa_direction direction,
|
||||
uint32_t port_id,
|
||||
uint32_t n_buffers, struct pw_client_node_buffer *buffers)
|
||||
client_node_marshal_port_use_buffers(void *object,
|
||||
uint32_t seq,
|
||||
enum spa_direction direction,
|
||||
uint32_t port_id,
|
||||
uint32_t n_buffers, struct pw_client_node_buffer *buffers)
|
||||
{
|
||||
struct pw_resource *resource = object;
|
||||
struct spa_pod_builder *b;
|
||||
uint32_t i, j;
|
||||
|
||||
b = pw_protocol_native_begin_resource(resource, PW_CLIENT_NODE_PROXY_EVENT_USE_BUFFERS);
|
||||
b = pw_protocol_native_begin_resource(resource, PW_CLIENT_NODE_PROXY_EVENT_PORT_USE_BUFFERS);
|
||||
|
||||
spa_pod_builder_add(b,
|
||||
"[",
|
||||
|
|
@ -608,19 +610,6 @@ client_node_marshal_use_buffers(void *object,
|
|||
pw_protocol_native_end_resource(resource, b);
|
||||
}
|
||||
|
||||
static void
|
||||
client_node_marshal_node_command(void *object, uint32_t seq, const struct spa_command *command)
|
||||
{
|
||||
struct pw_resource *resource = object;
|
||||
struct spa_pod_builder *b;
|
||||
|
||||
b = pw_protocol_native_begin_resource(resource, PW_CLIENT_NODE_PROXY_EVENT_NODE_COMMAND);
|
||||
|
||||
spa_pod_builder_struct(b, "i", seq, "P", command);
|
||||
|
||||
pw_protocol_native_end_resource(resource, b);
|
||||
}
|
||||
|
||||
static void
|
||||
client_node_marshal_port_command(void *object,
|
||||
uint32_t direction,
|
||||
|
|
@ -640,28 +629,6 @@ client_node_marshal_port_command(void *object,
|
|||
pw_protocol_native_end_resource(resource, b);
|
||||
}
|
||||
|
||||
static void client_node_marshal_transport(void *object, uint32_t node_id, int readfd, int writefd,
|
||||
struct pw_client_node_transport *transport)
|
||||
{
|
||||
struct pw_resource *resource = object;
|
||||
struct spa_pod_builder *b;
|
||||
struct pw_client_node_transport_info info;
|
||||
|
||||
pw_client_node_transport_get_info(transport, &info);
|
||||
|
||||
b = pw_protocol_native_begin_resource(resource, PW_CLIENT_NODE_PROXY_EVENT_TRANSPORT);
|
||||
|
||||
spa_pod_builder_struct(b,
|
||||
"i", node_id,
|
||||
"i", pw_protocol_native_add_resource_fd(resource, readfd),
|
||||
"i", pw_protocol_native_add_resource_fd(resource, writefd),
|
||||
"i", pw_protocol_native_add_resource_fd(resource, info.memfd),
|
||||
"i", info.offset,
|
||||
"i", info.size);
|
||||
|
||||
pw_protocol_native_end_resource(resource, b);
|
||||
}
|
||||
|
||||
|
||||
static bool client_node_demarshal_done(void *object, void *data, size_t size)
|
||||
{
|
||||
|
|
@ -684,8 +651,9 @@ static bool client_node_demarshal_update(void *object, void *data, size_t size)
|
|||
{
|
||||
struct pw_resource *resource = object;
|
||||
struct spa_pod_parser prs;
|
||||
uint32_t change_mask, max_input_ports, max_output_ports;
|
||||
const struct spa_props *props;
|
||||
uint32_t change_mask, max_input_ports, max_output_ports, n_params;
|
||||
const struct spa_pod_object **params;
|
||||
int i;
|
||||
|
||||
spa_pod_parser_init(&prs, data, size, 0);
|
||||
if (spa_pod_parser_get(&prs,
|
||||
|
|
@ -693,13 +661,19 @@ static bool client_node_demarshal_update(void *object, void *data, size_t size)
|
|||
"i", &change_mask,
|
||||
"i", &max_input_ports,
|
||||
"i", &max_output_ports,
|
||||
"O", &props, NULL) < 0)
|
||||
"i", &n_params, NULL) < 0)
|
||||
return false;
|
||||
|
||||
params = alloca(n_params * sizeof(struct spa_pod_object *));
|
||||
for (i = 0; i < n_params; i++)
|
||||
if (spa_pod_parser_get(&prs, "O", ¶ms[i], NULL) < 0)
|
||||
return false;
|
||||
|
||||
pw_resource_do(resource, struct pw_client_node_proxy_methods, update, change_mask,
|
||||
max_input_ports,
|
||||
max_output_ports,
|
||||
props);
|
||||
n_params,
|
||||
params);
|
||||
return true;
|
||||
}
|
||||
|
||||
|
|
@ -707,9 +681,8 @@ static bool client_node_demarshal_port_update(void *object, void *data, size_t s
|
|||
{
|
||||
struct pw_resource *resource = object;
|
||||
struct spa_pod_parser prs;
|
||||
uint32_t i, direction, port_id, change_mask, n_possible_formats, n_params;
|
||||
const struct spa_param **params = NULL;
|
||||
const struct spa_format **possible_formats = NULL, *format = NULL;
|
||||
uint32_t i, direction, port_id, change_mask, n_params;
|
||||
const struct spa_pod_object **params = NULL;
|
||||
struct spa_port_info info, *infop = NULL;
|
||||
struct spa_pod *ipod;
|
||||
|
||||
|
|
@ -719,18 +692,10 @@ static bool client_node_demarshal_port_update(void *object, void *data, size_t s
|
|||
"i", &direction,
|
||||
"i", &port_id,
|
||||
"i", &change_mask,
|
||||
"i", &n_possible_formats, NULL) < 0)
|
||||
"i", &n_params, NULL) < 0)
|
||||
return false;
|
||||
|
||||
possible_formats = alloca(n_possible_formats * sizeof(struct spa_format *));
|
||||
for (i = 0; i < n_possible_formats; i++)
|
||||
if (spa_pod_parser_get(&prs, "O", &possible_formats[i], NULL) < 0)
|
||||
return false;
|
||||
|
||||
if (spa_pod_parser_get(&prs, "O", &format, "i", &n_params, NULL) < 0)
|
||||
return false;
|
||||
|
||||
params = alloca(n_params * sizeof(struct spa_param *));
|
||||
params = alloca(n_params * sizeof(struct spa_pod_object *));
|
||||
for (i = 0; i < n_params; i++)
|
||||
if (spa_pod_parser_get(&prs, "O", ¶ms[i], NULL) < 0)
|
||||
return false;
|
||||
|
|
@ -753,9 +718,6 @@ static bool client_node_demarshal_port_update(void *object, void *data, size_t s
|
|||
pw_resource_do(resource, struct pw_client_node_proxy_methods, port_update, direction,
|
||||
port_id,
|
||||
change_mask,
|
||||
n_possible_formats,
|
||||
possible_formats,
|
||||
format,
|
||||
n_params,
|
||||
params, infop);
|
||||
return true;
|
||||
|
|
@ -828,29 +790,27 @@ static const struct pw_protocol_native_demarshal pw_protocol_native_client_node_
|
|||
static const struct pw_client_node_proxy_events pw_protocol_native_client_node_event_marshal = {
|
||||
PW_VERSION_CLIENT_NODE_PROXY_EVENTS,
|
||||
&client_node_marshal_transport,
|
||||
&client_node_marshal_set_props,
|
||||
&client_node_marshal_set_param,
|
||||
&client_node_marshal_event_event,
|
||||
&client_node_marshal_command,
|
||||
&client_node_marshal_add_port,
|
||||
&client_node_marshal_remove_port,
|
||||
&client_node_marshal_set_format,
|
||||
&client_node_marshal_set_param,
|
||||
&client_node_marshal_add_mem,
|
||||
&client_node_marshal_use_buffers,
|
||||
&client_node_marshal_node_command,
|
||||
&client_node_marshal_port_set_param,
|
||||
&client_node_marshal_port_add_mem,
|
||||
&client_node_marshal_port_use_buffers,
|
||||
&client_node_marshal_port_command,
|
||||
};
|
||||
|
||||
static const struct pw_protocol_native_demarshal pw_protocol_native_client_node_event_demarshal[] = {
|
||||
{ &client_node_demarshal_transport, 0 },
|
||||
{ &client_node_demarshal_set_props, PW_PROTOCOL_NATIVE_REMAP },
|
||||
{ &client_node_demarshal_set_param, PW_PROTOCOL_NATIVE_REMAP },
|
||||
{ &client_node_demarshal_event_event, PW_PROTOCOL_NATIVE_REMAP },
|
||||
{ &client_node_demarshal_command, PW_PROTOCOL_NATIVE_REMAP },
|
||||
{ &client_node_demarshal_add_port, 0 },
|
||||
{ &client_node_demarshal_remove_port, 0 },
|
||||
{ &client_node_demarshal_set_format, PW_PROTOCOL_NATIVE_REMAP },
|
||||
{ &client_node_demarshal_set_param, PW_PROTOCOL_NATIVE_REMAP },
|
||||
{ &client_node_demarshal_add_mem, PW_PROTOCOL_NATIVE_REMAP },
|
||||
{ &client_node_demarshal_use_buffers, PW_PROTOCOL_NATIVE_REMAP },
|
||||
{ &client_node_demarshal_node_command, PW_PROTOCOL_NATIVE_REMAP },
|
||||
{ &client_node_demarshal_port_set_param, PW_PROTOCOL_NATIVE_REMAP },
|
||||
{ &client_node_demarshal_port_add_mem, PW_PROTOCOL_NATIVE_REMAP },
|
||||
{ &client_node_demarshal_port_use_buffers, PW_PROTOCOL_NATIVE_REMAP },
|
||||
{ &client_node_demarshal_port_command, PW_PROTOCOL_NATIVE_REMAP },
|
||||
};
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue