mirror of
https://gitlab.freedesktop.org/pipewire/pipewire.git
synced 2025-11-04 13:30:12 -05:00
node: Add id to set_io
Make it possible to configure multiple io areas on a port by giving an id to set_io. Add some types to enumerate the supported ids Make an area to exchange buffers and one to specify pull ranges. The idea is to make more area types for controlable properties. Implement enumeration of IO areas in volume.
This commit is contained in:
parent
4288a634f4
commit
8efea3e1ea
40 changed files with 583 additions and 208 deletions
|
|
@ -80,7 +80,7 @@ struct proxy_port {
|
|||
bool have_format;
|
||||
uint32_t n_params;
|
||||
struct spa_pod **params;
|
||||
struct spa_port_io *io;
|
||||
struct spa_io_buffers *io;
|
||||
|
||||
uint32_t n_buffers;
|
||||
struct proxy_buffer buffers[MAX_BUFFERS];
|
||||
|
|
@ -511,21 +511,30 @@ spa_proxy_node_port_set_param(struct spa_node *node,
|
|||
|
||||
static int
|
||||
spa_proxy_node_port_set_io(struct spa_node *node,
|
||||
enum spa_direction direction, uint32_t port_id, struct spa_port_io *io)
|
||||
enum spa_direction direction,
|
||||
uint32_t port_id,
|
||||
uint32_t id,
|
||||
void *io)
|
||||
{
|
||||
struct proxy *this;
|
||||
struct proxy_port *port;
|
||||
struct pw_type *t;
|
||||
|
||||
if (node == NULL)
|
||||
return -EINVAL;
|
||||
|
||||
this = SPA_CONTAINER_OF(node, struct proxy, node);
|
||||
t = this->impl->t;
|
||||
|
||||
if (!CHECK_PORT(this, direction, port_id))
|
||||
return -EINVAL;
|
||||
|
||||
port = GET_PORT(this, direction, port_id);
|
||||
port->io = io;
|
||||
|
||||
if (id == t->io.Buffers)
|
||||
port->io = io;
|
||||
else
|
||||
return -ENOENT;
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
|
@ -737,7 +746,7 @@ static int spa_proxy_node_process_input(struct spa_node *node)
|
|||
}
|
||||
else {
|
||||
spa_list_for_each(p, &n->ports[SPA_DIRECTION_INPUT], link) {
|
||||
struct spa_port_io *io = p->io;
|
||||
struct spa_io_buffers *io = p->io;
|
||||
|
||||
pw_log_trace("set io status to %d %d", io->status, io->buffer_id);
|
||||
impl->transport->inputs[p->port_id] = *io;
|
||||
|
|
@ -773,7 +782,7 @@ static int spa_proxy_node_process_output(struct spa_node *node)
|
|||
impl->out_pending = true;
|
||||
|
||||
spa_list_for_each(p, &n->ports[SPA_DIRECTION_OUTPUT], link) {
|
||||
struct spa_port_io *io = p->io;
|
||||
struct spa_io_buffers *io = p->io;
|
||||
|
||||
impl->transport->outputs[p->port_id] = *io;
|
||||
|
||||
|
|
|
|||
|
|
@ -22,6 +22,7 @@
|
|||
#include <sys/mman.h>
|
||||
|
||||
#include <spa/utils/ringbuffer.h>
|
||||
#include <spa/node/io.h>
|
||||
#include <pipewire/log.h>
|
||||
#include <extensions/client-node.h>
|
||||
|
||||
|
|
@ -47,8 +48,8 @@ static size_t area_get_size(struct pw_client_node_area *area)
|
|||
{
|
||||
size_t size;
|
||||
size = sizeof(struct pw_client_node_area);
|
||||
size += area->max_input_ports * sizeof(struct spa_port_io);
|
||||
size += area->max_output_ports * sizeof(struct spa_port_io);
|
||||
size += area->max_input_ports * sizeof(struct spa_io_buffers);
|
||||
size += area->max_output_ports * sizeof(struct spa_io_buffers);
|
||||
size += sizeof(struct spa_ringbuffer);
|
||||
size += INPUT_BUFFER_SIZE;
|
||||
size += sizeof(struct spa_ringbuffer);
|
||||
|
|
@ -61,13 +62,13 @@ static void transport_setup_area(void *p, struct pw_client_node_transport *trans
|
|||
struct pw_client_node_area *a;
|
||||
|
||||
trans->area = a = p;
|
||||
p = SPA_MEMBER(p, sizeof(struct pw_client_node_area), struct spa_port_io);
|
||||
p = SPA_MEMBER(p, sizeof(struct pw_client_node_area), struct spa_io_buffers);
|
||||
|
||||
trans->inputs = p;
|
||||
p = SPA_MEMBER(p, a->max_input_ports * sizeof(struct spa_port_io), void);
|
||||
p = SPA_MEMBER(p, a->max_input_ports * sizeof(struct spa_io_buffers), void);
|
||||
|
||||
trans->outputs = p;
|
||||
p = SPA_MEMBER(p, a->max_output_ports * sizeof(struct spa_port_io), void);
|
||||
p = SPA_MEMBER(p, a->max_output_ports * sizeof(struct spa_io_buffers), void);
|
||||
|
||||
trans->input_buffer = p;
|
||||
p = SPA_MEMBER(p, sizeof(struct spa_ringbuffer), void);
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue