Add control properties to audiotestsrc

Add control properties to audiotestsrc for frequency and volume
and add a test program.
Add size parameter to set_io for additional checks and to make it
easy to know how much control data we can write.
This commit is contained in:
Wim Taymans 2017-11-22 14:30:04 +01:00
parent 8efea3e1ea
commit a092b9312a
28 changed files with 774 additions and 64 deletions

View file

@ -217,12 +217,12 @@ static int impl_get_port_ids(struct spa_node *node,
static int impl_port_set_io(struct spa_node *node,
enum spa_direction direction, uint32_t port_id,
uint32_t id, void *io)
uint32_t id, void *data, size_t size)
{
struct data *d = SPA_CONTAINER_OF(node, struct data, impl_node);
if (id == d->t->io.Buffers)
d->io = io;
d->io = data;
else
return -ENOENT;

View file

@ -132,12 +132,12 @@ static int impl_get_port_ids(struct spa_node *node,
}
static int impl_port_set_io(struct spa_node *node, enum spa_direction direction, uint32_t port_id,
uint32_t id, void *io)
uint32_t id, void *data, size_t size)
{
struct data *d = SPA_CONTAINER_OF(node, struct data, impl_node);
if (id == d->t->io.Buffers)
d->io = io;
d->io = data;
else
return -ENOENT;

View file

@ -211,12 +211,12 @@ static int impl_get_port_ids(struct spa_node *node,
}
static int impl_port_set_io(struct spa_node *node, enum spa_direction direction, uint32_t port_id,
uint32_t id, void *io)
uint32_t id, void *data, size_t size)
{
struct data *d = SPA_CONTAINER_OF(node, struct data, impl_node);
if (id == d->t->io.Buffers)
d->io = io;
d->io = data;
else
return -ENOENT;

View file

@ -514,7 +514,7 @@ spa_proxy_node_port_set_io(struct spa_node *node,
enum spa_direction direction,
uint32_t port_id,
uint32_t id,
void *io)
void *data, size_t size)
{
struct proxy *this;
struct proxy_port *port;
@ -532,7 +532,7 @@ spa_proxy_node_port_set_io(struct spa_node *node,
port = GET_PORT(this, direction, port_id);
if (id == t->io.Buffers)
port->io = io;
port->io = data;
else
return -ENOENT;

View file

@ -374,14 +374,14 @@ static int node_process_output(struct spa_node *node)
static int port_set_io(struct spa_node *node,
enum spa_direction direction, uint32_t port_id,
uint32_t id, void *io)
uint32_t id, void *data, size_t size)
{
struct node_data *nd = SPA_CONTAINER_OF(node, struct node_data, node_impl);
struct port_data *pd = nd->port_data[direction][port_id];
struct type *t = &pd->node->type;
if (id == t->io.Buffers)
pd->io = io;
pd->io = data;
else
return -ENOENT;

View file

@ -289,7 +289,8 @@ bool pw_port_add(struct pw_port *port, struct pw_node *node)
spa_node_port_set_io(node->node,
port->direction, port_id,
node->core->type.io.Buffers, port->rt.port.io);
node->core->type.io.Buffers,
port->rt.port.io, sizeof(*port->rt.port.io));
port->rt.graph = node->rt.graph;
pw_loop_invoke(node->data_loop, do_add_port, SPA_ID_INVALID, NULL, 0, false, port);