node: remove port_send_command

We don't want to do this, we use a sequence to change things
at runtime.
This commit is contained in:
Wim Taymans 2019-02-13 12:43:15 +01:00
parent 04f1046113
commit 7a1bd163f7
27 changed files with 3 additions and 365 deletions

View file

@ -486,22 +486,6 @@ struct spa_node {
*/
int (*port_reuse_buffer) (struct spa_node *node, uint32_t port_id, uint32_t buffer_id);
/**
* Send a command to a port
*
* This function must be called from the data thread.
*
* \param node a spa_node
* \param direction a direction
* \param port_id a port id
* \param command a command to send
* \return 0 on success
* -EINVAL when node is NULL
*/
int (*port_send_command) (struct spa_node *node,
enum spa_direction direction,
uint32_t port_id,
const struct spa_command *command);
/**
* Process the node
*
@ -536,7 +520,6 @@ struct spa_node {
#define spa_node_port_alloc_buffers(n,...) (n)->port_alloc_buffers((n),__VA_ARGS__)
#define spa_node_port_set_io(n,...) (n)->port_set_io((n),__VA_ARGS__)
#define spa_node_port_reuse_buffer(n,...) (n)->port_reuse_buffer((n),__VA_ARGS__)
#define spa_node_port_send_command(n,...) (n)->port_send_command((n),__VA_ARGS__)
#define spa_node_process(n) (n)->process((n))
#ifdef __cplusplus

View file

@ -638,14 +638,6 @@ static int impl_node_port_reuse_buffer(struct spa_node *node, uint32_t port_id,
return -ENOTSUP;
}
static int
impl_node_port_send_command(struct spa_node *node,
enum spa_direction direction, uint32_t port_id, const struct spa_command *command)
{
spa_return_val_if_fail(node != NULL, -EINVAL);
return -ENOTSUP;
}
static int impl_node_process(struct spa_node *node)
{
struct state *this;
@ -701,7 +693,6 @@ static const struct spa_node impl_node = {
impl_node_port_alloc_buffers,
impl_node_port_set_io,
impl_node_port_reuse_buffer,
impl_node_port_send_command,
impl_node_process,
};

View file

@ -649,14 +649,6 @@ static int impl_node_port_reuse_buffer(struct spa_node *node, uint32_t port_id,
return 0;
}
static int
impl_node_port_send_command(struct spa_node *node,
enum spa_direction direction, uint32_t port_id, const struct spa_command *command)
{
spa_return_val_if_fail(node != NULL, -EINVAL);
return -ENOTSUP;
}
static int impl_node_process(struct spa_node *node)
{
struct state *this;
@ -709,7 +701,6 @@ static const struct spa_node impl_node = {
impl_node_port_alloc_buffers,
impl_node_port_set_io,
impl_node_port_reuse_buffer,
impl_node_port_send_command,
impl_node_process,
};

View file

@ -832,21 +832,6 @@ static int impl_node_port_reuse_buffer(struct spa_node *node, uint32_t port_id,
return spa_node_port_reuse_buffer(this->fmt[SPA_DIRECTION_OUTPUT], port_id, buffer_id);
}
static int
impl_node_port_send_command(struct spa_node *node,
enum spa_direction direction,
uint32_t port_id,
const struct spa_command *command)
{
struct impl *this;
spa_return_val_if_fail(node != NULL, -EINVAL);
this = SPA_CONTAINER_OF(node, struct impl, node);
return spa_node_port_send_command(this->fmt[direction], direction, port_id, command);
}
static int impl_node_process(struct spa_node *node)
{
struct impl *this;
@ -906,7 +891,6 @@ static const struct spa_node impl_node = {
impl_node_port_alloc_buffers,
impl_node_port_set_io,
impl_node_port_reuse_buffer,
impl_node_port_send_command,
impl_node_process,
};

View file

@ -1061,15 +1061,6 @@ static int impl_node_port_reuse_buffer(struct spa_node *node, uint32_t port_id,
return 0;
}
static int
impl_node_port_send_command(struct spa_node *node,
enum spa_direction direction,
uint32_t port_id,
const struct spa_command *command)
{
return -ENOTSUP;
}
static int process_control(struct impl *this, struct port *port, struct spa_pod_sequence *sequence)
{
struct spa_pod_control *c;
@ -1181,7 +1172,6 @@ static const struct spa_node impl_node = {
impl_node_port_alloc_buffers,
impl_node_port_set_io,
impl_node_port_reuse_buffer,
impl_node_port_send_command,
impl_node_process,
};

View file

@ -808,15 +808,6 @@ static int impl_node_port_reuse_buffer(struct spa_node *node, uint32_t port_id,
return 0;
}
static int
impl_node_port_send_command(struct spa_node *node,
enum spa_direction direction,
uint32_t port_id,
const struct spa_command *command)
{
return -ENOTSUP;
}
static int impl_node_process(struct spa_node *node)
{
struct impl *this;
@ -924,7 +915,6 @@ static const struct spa_node impl_node = {
impl_node_port_alloc_buffers,
impl_node_port_set_io,
impl_node_port_reuse_buffer,
impl_node_port_send_command,
impl_node_process,
};

View file

@ -862,15 +862,6 @@ static int impl_node_port_reuse_buffer(struct spa_node *node, uint32_t port_id,
return 0;
}
static int
impl_node_port_send_command(struct spa_node *node,
enum spa_direction direction,
uint32_t port_id,
const struct spa_command *command)
{
return -ENOTSUP;
}
static inline int get_in_buffer(struct impl *this, struct port *port, struct buffer **buf)
{
struct spa_io_buffers *io;
@ -1023,7 +1014,6 @@ static const struct spa_node impl_node = {
impl_node_port_alloc_buffers,
impl_node_port_set_io,
impl_node_port_reuse_buffer,
impl_node_port_send_command,
impl_node_process,
};

View file

@ -722,15 +722,6 @@ static int impl_node_port_reuse_buffer(struct spa_node *node, uint32_t port_id,
return 0;
}
static int
impl_node_port_send_command(struct spa_node *node,
enum spa_direction direction,
uint32_t port_id,
const struct spa_command *command)
{
return -ENOTSUP;
}
static int process_control(struct impl *this, struct port *port, struct spa_pod_sequence *sequence)
{
struct spa_pod_control *c;
@ -861,7 +852,6 @@ static const struct spa_node impl_node = {
impl_node_port_alloc_buffers,
impl_node_port_set_io,
impl_node_port_reuse_buffer,
impl_node_port_send_command,
impl_node_process,
};

View file

@ -827,15 +827,6 @@ static int impl_node_port_reuse_buffer(struct spa_node *node, uint32_t port_id,
return 0;
}
static int
impl_node_port_send_command(struct spa_node *node,
enum spa_direction direction,
uint32_t port_id,
const struct spa_command *command)
{
return -ENOTSUP;
}
static int impl_node_process(struct spa_node *node)
{
struct impl *this;
@ -956,7 +947,6 @@ static const struct spa_node impl_node = {
impl_node_port_alloc_buffers,
impl_node_port_set_io,
impl_node_port_reuse_buffer,
impl_node_port_send_command,
impl_node_process,
};

View file

@ -711,15 +711,6 @@ static int impl_node_port_reuse_buffer(struct spa_node *node, uint32_t port_id,
return -ENOTSUP;
}
static int
impl_node_port_send_command(struct spa_node *node,
enum spa_direction direction,
uint32_t port_id,
const struct spa_command *command)
{
return -ENOTSUP;
}
static inline void
add_port_data(struct impl *this, void *out, size_t outsize, struct port *port, int layer)
{
@ -927,7 +918,6 @@ static const struct spa_node impl_node = {
impl_node_port_alloc_buffers,
impl_node_port_set_io,
impl_node_port_reuse_buffer,
impl_node_port_send_command,
impl_node_process,
};

View file

@ -913,15 +913,6 @@ static int impl_node_port_reuse_buffer(struct spa_node *node, uint32_t port_id,
return 0;
}
static int
impl_node_port_send_command(struct spa_node *node,
enum spa_direction direction,
uint32_t port_id,
const struct spa_command *command)
{
return -ENOTSUP;
}
static int process_control(struct impl *this, struct spa_pod_sequence *sequence)
{
struct spa_pod_control *c;
@ -990,7 +981,6 @@ static const struct spa_node impl_node = {
impl_node_port_alloc_buffers,
impl_node_port_set_io,
impl_node_port_reuse_buffer,
impl_node_port_send_command,
impl_node_process,
};

View file

@ -1248,13 +1248,6 @@ static int impl_node_port_reuse_buffer(struct spa_node *node, uint32_t port_id,
return -ENOTSUP;
}
static int
impl_node_port_send_command(struct spa_node *node,
enum spa_direction direction, uint32_t port_id, const struct spa_command *command)
{
return -ENOTSUP;
}
static int impl_node_process(struct spa_node *node)
{
struct impl *this;
@ -1312,7 +1305,6 @@ static const struct spa_node impl_node = {
impl_node_port_alloc_buffers,
impl_node_port_set_io,
impl_node_port_reuse_buffer,
impl_node_port_send_command,
impl_node_process,
};

View file

@ -463,16 +463,6 @@ spa_ffmpeg_dec_node_port_reuse_buffer(struct spa_node *node, uint32_t port_id, u
return -ENOTSUP;
}
static int
spa_ffmpeg_dec_node_port_send_command(struct spa_node *node,
enum spa_direction direction,
uint32_t port_id,
const struct spa_command *command)
{
return -ENOTSUP;
}
static const struct spa_node ffmpeg_dec_node = {
SPA_VERSION_NODE,
spa_ffmpeg_dec_node_enum_params,
@ -491,7 +481,6 @@ static const struct spa_node ffmpeg_dec_node = {
spa_ffmpeg_dec_node_port_alloc_buffers,
spa_ffmpeg_dec_node_port_set_io,
spa_ffmpeg_dec_node_port_reuse_buffer,
spa_ffmpeg_dec_node_port_send_command,
spa_ffmpeg_dec_node_process,
};

View file

@ -417,14 +417,6 @@ spa_ffmpeg_enc_node_port_reuse_buffer(struct spa_node *node, uint32_t port_id, u
return -ENOTSUP;
}
static int
spa_ffmpeg_enc_node_port_send_command(struct spa_node *node,
enum spa_direction direction,
uint32_t port_id, const struct spa_command *command)
{
return -ENOTSUP;
}
static int spa_ffmpeg_enc_node_process(struct spa_node *node)
{
struct impl *this;
@ -468,7 +460,6 @@ static const struct spa_node ffmpeg_enc_node = {
spa_ffmpeg_enc_node_port_alloc_buffers,
spa_ffmpeg_enc_node_port_set_io,
spa_ffmpeg_enc_node_port_reuse_buffer,
spa_ffmpeg_enc_node_port_send_command,
spa_ffmpeg_enc_node_process,
};

View file

@ -665,15 +665,6 @@ static int impl_node_port_reuse_buffer(struct spa_node *node, uint32_t port_id,
return -ENOTSUP;
}
static int
impl_node_port_send_command(struct spa_node *node,
enum spa_direction direction,
uint32_t port_id,
const struct spa_command *command)
{
return -ENOTSUP;
}
static int impl_node_process(struct spa_node *node)
{
struct impl *this;
@ -727,7 +718,6 @@ static const struct spa_node impl_node = {
impl_node_port_alloc_buffers,
impl_node_port_set_io,
impl_node_port_reuse_buffer,
impl_node_port_send_command,
impl_node_process,
};

View file

@ -709,15 +709,6 @@ static int impl_node_port_reuse_buffer(struct spa_node *node, uint32_t port_id,
return 0;
}
static int
impl_node_port_send_command(struct spa_node *node,
enum spa_direction direction,
uint32_t port_id,
const struct spa_command *command)
{
return -ENOTSUP;
}
static int impl_node_process(struct spa_node *node)
{
struct impl *this;
@ -762,7 +753,6 @@ static const struct spa_node impl_node = {
impl_node_port_alloc_buffers,
impl_node_port_set_io,
impl_node_port_reuse_buffer,
impl_node_port_send_command,
impl_node_process,
};

View file

@ -810,14 +810,6 @@ static int impl_node_port_reuse_buffer(struct spa_node *node,
return res;
}
static int impl_node_port_send_command(struct spa_node *node,
enum spa_direction direction,
uint32_t port_id,
const struct spa_command *command)
{
return -ENOTSUP;
}
static uint32_t prop_to_control_id(uint32_t prop)
{
switch (prop) {
@ -947,7 +939,6 @@ static const struct spa_node impl_node = {
impl_node_port_alloc_buffers,
impl_node_port_set_io,
impl_node_port_reuse_buffer,
impl_node_port_send_command,
impl_node_process,
};

View file

@ -813,15 +813,6 @@ static int impl_node_port_reuse_buffer(struct spa_node *node, uint32_t port_id,
return 0;
}
static int
impl_node_port_send_command(struct spa_node *node,
enum spa_direction direction,
uint32_t port_id,
const struct spa_command *command)
{
return -ENOTSUP;
}
static int impl_node_process(struct spa_node *node)
{
struct impl *this;
@ -865,7 +856,6 @@ static const struct spa_node impl_node = {
impl_node_port_alloc_buffers,
impl_node_port_set_io,
impl_node_port_reuse_buffer,
impl_node_port_send_command,
impl_node_process,
};

View file

@ -667,15 +667,6 @@ static int impl_node_port_reuse_buffer(struct spa_node *node, uint32_t port_id,
return 0;
}
static int
impl_node_port_send_command(struct spa_node *node,
enum spa_direction direction,
uint32_t port_id,
const struct spa_command *command)
{
return -ENOTSUP;
}
static struct buffer *find_free_buffer(struct impl *this, struct port *port)
{
struct buffer *b;
@ -810,7 +801,6 @@ static const struct spa_node impl_node = {
impl_node_port_alloc_buffers,
impl_node_port_set_io,
impl_node_port_reuse_buffer,
impl_node_port_send_command,
impl_node_process,
};

View file

@ -176,10 +176,9 @@ pw_client_node_proxy_event(struct pw_client_node_proxy *p, struct spa_event *eve
#define PW_CLIENT_NODE_PROXY_EVENT_REMOVE_PORT 7
#define PW_CLIENT_NODE_PROXY_EVENT_PORT_SET_PARAM 8
#define PW_CLIENT_NODE_PROXY_EVENT_PORT_USE_BUFFERS 9
#define PW_CLIENT_NODE_PROXY_EVENT_PORT_COMMAND 10
#define PW_CLIENT_NODE_PROXY_EVENT_PORT_SET_IO 11
#define PW_CLIENT_NODE_PROXY_EVENT_SET_ACTIVATION 12
#define PW_CLIENT_NODE_PROXY_EVENT_NUM 13
#define PW_CLIENT_NODE_PROXY_EVENT_PORT_SET_IO 10
#define PW_CLIENT_NODE_PROXY_EVENT_SET_ACTIVATION 11
#define PW_CLIENT_NODE_PROXY_EVENT_NUM 12
/** \ref pw_client_node events */
struct pw_client_node_proxy_events {
@ -319,18 +318,6 @@ struct pw_client_node_proxy_events {
uint32_t mix_id,
uint32_t n_buffers,
struct pw_client_node_buffer *buffers);
/**
* Notify of a new port command
*
* \param direction a port direction
* \param port_id the port id
* \param command the command
*/
void (*port_command) (void *object,
enum spa_direction direction,
uint32_t port_id,
const struct spa_command *command);
/**
* Configure the io area with \a id of \a port_id.
*
@ -390,8 +377,6 @@ pw_client_node_proxy_add_listener(struct pw_client_node_proxy *p,
pw_resource_notify(r,struct pw_client_node_proxy_events,port_set_param,__VA_ARGS__)
#define pw_client_node_resource_port_use_buffers(r,...) \
pw_resource_notify(r,struct pw_client_node_proxy_events,port_use_buffers,__VA_ARGS__)
#define pw_client_node_resource_port_command(r,...) \
pw_resource_notify(r,struct pw_client_node_proxy_events,port_command,__VA_ARGS__)
#define pw_client_node_resource_port_set_io(r,...) \
pw_resource_notify(r,struct pw_client_node_proxy_events,port_set_io,__VA_ARGS__)
#define pw_client_node_resource_set_activation(r,...) \

View file

@ -705,16 +705,6 @@ static int impl_node_port_reuse_buffer(struct spa_node *node, uint32_t port_id,
return queue_buffer(this, port, &port->buffers[buffer_id]);
}
static int
impl_node_port_send_command(struct spa_node *node,
enum spa_direction direction,
uint32_t port_id,
const struct spa_command *command)
{
return -ENOTSUP;
}
#if defined (__SSE__)
#include <xmmintrin.h>
static void mix_2(float *dst, float *src1, float *src2, int n_samples)
@ -892,7 +882,6 @@ static const struct spa_node impl_node = {
impl_node_port_alloc_buffers,
impl_node_port_set_io,
impl_node_port_reuse_buffer,
impl_node_port_send_command,
impl_node_process,
};

View file

@ -981,30 +981,6 @@ impl_node_port_reuse_buffer(struct spa_node *node, uint32_t port_id, uint32_t bu
return -ENOTSUP;
}
static int
impl_node_port_send_command(struct spa_node *node,
enum spa_direction direction,
uint32_t port_id, const struct spa_command *command)
{
struct node *this;
spa_return_val_if_fail(node != NULL, -EINVAL);
spa_return_val_if_fail(command != NULL, -EINVAL);
this = SPA_CONTAINER_OF(node, struct node, node);
if (this->resource == NULL)
return 0;
spa_log_trace(this->log, "send command %s",
spa_debug_type_find_name(spa_type_node_command_id, SPA_NODE_COMMAND_ID(command)));
pw_client_node_resource_port_command(this->resource,
direction, port_id,
command);
return 0;
}
static int impl_node_process(struct spa_node *node)
{
struct node *this = SPA_CONTAINER_OF(node, struct node, node);
@ -1187,7 +1163,6 @@ static const struct spa_node impl_node = {
.port_alloc_buffers = impl_node_port_alloc_buffers,
.port_set_io = impl_node_port_set_io,
.port_reuse_buffer = impl_node_port_reuse_buffer,
.port_send_command = impl_node_port_send_command,
.process = impl_node_process,
};
@ -1503,15 +1478,6 @@ impl_mix_port_reuse_buffer(struct spa_node *node, uint32_t port_id, uint32_t buf
return impl_node_port_reuse_buffer(&p->node->node, p->id, buffer_id);
}
static int
impl_mix_port_send_command(struct spa_node *node,
enum spa_direction direction,
uint32_t port_id, const struct spa_command *command)
{
struct port *p = SPA_CONTAINER_OF(node, struct port, mix_node);
return impl_node_port_send_command(&p->node->node, direction, p->id, command);
}
static int impl_mix_process(struct spa_node *data)
{
return SPA_STATUS_HAVE_BUFFER;
@ -1528,7 +1494,6 @@ static const struct spa_node impl_port_mix = {
.port_alloc_buffers = impl_mix_port_alloc_buffers,
.port_set_io = impl_mix_port_set_io,
.port_reuse_buffer = impl_mix_port_reuse_buffer,
.port_send_command = impl_mix_port_send_command,
.process = impl_mix_process,
};

View file

@ -827,30 +827,6 @@ impl_node_port_reuse_buffer(struct spa_node *node, uint32_t port_id, uint32_t bu
return spa_node_port_reuse_buffer(impl->adapter, port_id, buffer_id);
}
static int
impl_node_port_send_command(struct spa_node *node,
enum spa_direction direction,
uint32_t port_id, const struct spa_command *command)
{
struct node *this;
struct impl *impl;
int res;
spa_return_val_if_fail(node != NULL, -EINVAL);
spa_return_val_if_fail(command != NULL, -EINVAL);
this = SPA_CONTAINER_OF(node, struct node, node);
impl = this->impl;
if (direction != impl->direction)
return -EINVAL;
if ((res = spa_node_port_send_command(impl->adapter, direction, port_id, command)) < 0)
return res;
return res;
}
static int impl_node_process(struct spa_node *node)
{
struct node *this = SPA_CONTAINER_OF(node, struct node, node);
@ -916,7 +892,6 @@ static const struct spa_node impl_node = {
impl_node_port_alloc_buffers,
impl_node_port_set_io,
impl_node_port_reuse_buffer,
impl_node_port_send_command,
impl_node_process,
};

View file

@ -384,26 +384,6 @@ static int client_node_demarshal_port_use_buffers(void *object, void *data, size
return 0;
}
static int client_node_demarshal_port_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 direction, port_id;
spa_pod_parser_init(&prs, data, size);
if (spa_pod_parser_get_struct(&prs,
SPA_POD_Int(&direction),
SPA_POD_Int(&port_id),
SPA_POD_PodObject(&command)) < 0)
return -EINVAL;
pw_proxy_notify(proxy, struct pw_client_node_proxy_events, port_command, 0, direction,
port_id,
command);
return 0;
}
static int client_node_demarshal_port_set_io(void *object, void *data, size_t size)
{
struct pw_proxy *proxy = object;
@ -672,25 +652,6 @@ client_node_marshal_port_use_buffers(void *object,
pw_protocol_native_end_resource(resource, b);
}
static void
client_node_marshal_port_command(void *object,
uint32_t direction,
uint32_t port_id,
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_PORT_COMMAND);
spa_pod_builder_add_struct(b,
SPA_POD_Int(direction),
SPA_POD_Int(port_id),
SPA_POD_Pod(command));
pw_protocol_native_end_resource(resource, b);
}
static void
client_node_marshal_port_set_io(void *object,
uint32_t seq,
@ -948,7 +909,6 @@ static const struct pw_client_node_proxy_events pw_protocol_native_client_node_e
&client_node_marshal_remove_port,
&client_node_marshal_port_set_param,
&client_node_marshal_port_use_buffers,
&client_node_marshal_port_command,
&client_node_marshal_port_set_io,
&client_node_marshal_set_activation,
};
@ -964,7 +924,6 @@ static const struct pw_protocol_native_demarshal pw_protocol_native_client_node_
{ &client_node_demarshal_remove_port, 0 },
{ &client_node_demarshal_port_set_param, 0 },
{ &client_node_demarshal_port_use_buffers, 0 },
{ &client_node_demarshal_port_command, 0 },
{ &client_node_demarshal_port_set_io, 0 },
{ &client_node_demarshal_set_activation, 0 }
};

View file

@ -792,23 +792,6 @@ client_node_port_use_buffers(void *object,
}
static void
client_node_port_command(void *object,
uint32_t direction,
uint32_t port_id,
const struct spa_command *command)
{
struct pw_proxy *proxy = object;
struct node_data *data = proxy->user_data;
struct pw_port *port;
port = pw_node_find_port(data->node, direction, port_id);
if (port == NULL)
return;
pw_port_send_command(port, true, command);
}
static void
client_node_port_set_io(void *object,
uint32_t seq,
@ -942,7 +925,6 @@ static const struct pw_client_node_proxy_events client_node_events = {
.remove_port = client_node_remove_port,
.port_set_param = client_node_port_set_param,
.port_use_buffers = client_node_port_use_buffers,
.port_command = client_node_port_command,
.port_set_io = client_node_port_set_io,
.set_activation = client_node_set_activation,
};

View file

@ -762,22 +762,6 @@ void pw_port_destroy(struct pw_port *port)
free(port);
}
static int
do_port_command(struct spa_loop *loop,
bool async, uint32_t seq, const void *data, size_t size, void *user_data)
{
struct pw_port *port = user_data;
struct pw_node *node = port->node;
return spa_node_port_send_command(node->node, port->direction, port->port_id, data);
}
SPA_EXPORT
int pw_port_send_command(struct pw_port *port, bool block, const struct spa_command *command)
{
return pw_loop_invoke(port->node->data_loop, do_port_command, 0,
command, SPA_POD_SIZE(command), block, port);
}
int pw_port_for_each_param(struct pw_port *port,
uint32_t param_id,
uint32_t index, uint32_t max,

View file

@ -765,9 +765,6 @@ int pw_port_alloc_buffers(struct pw_port *port, uint32_t mix_id,
struct spa_pod **params, uint32_t n_params,
struct spa_buffer **buffers, uint32_t *n_buffers);
/** Send a command to a port */
int pw_port_send_command(struct pw_port *port, bool block, const struct spa_command *command);
/** Change the state of the node */
int pw_node_set_state(struct pw_node *node, enum pw_node_state state);