mirror of
https://gitlab.freedesktop.org/pipewire/pipewire.git
synced 2025-11-04 13:30:12 -05:00
node: add flags to port_use_buffer
Remove the CAN_USE_BUFFERS flag, it is redundant. We can know this because of the IO params and buffer params. Add flags to the port_use_buffer call. We also want this call to replace port_alloc_buffer. Together with a new result event we can ask the node to (a)synchronously fill up the buffer data for us. This is part of a plan to let remote nodes provide buffer data.
This commit is contained in:
parent
b314547702
commit
8590ac158b
33 changed files with 153 additions and 122 deletions
|
|
@ -187,11 +187,13 @@ struct impl {
|
|||
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,
|
||||
uint32_t port_id,
|
||||
uint32_t mix_id,
|
||||
uint32_t flags,
|
||||
struct spa_buffer **buffers,
|
||||
uint32_t n_buffers);
|
||||
|
||||
|
|
@ -268,7 +270,7 @@ static void mix_clear(struct node *this, struct mix *mix)
|
|||
if (!mix->valid)
|
||||
return;
|
||||
do_port_use_buffers(this->impl, port->direction, port->id,
|
||||
mix->id, NULL, 0);
|
||||
mix->id, 0, NULL, 0);
|
||||
mix->valid = false;
|
||||
}
|
||||
|
||||
|
|
@ -695,6 +697,7 @@ do_port_use_buffers(struct impl *impl,
|
|||
enum spa_direction direction,
|
||||
uint32_t port_id,
|
||||
uint32_t mix_id,
|
||||
uint32_t flags,
|
||||
struct spa_buffer **buffers,
|
||||
uint32_t n_buffers)
|
||||
{
|
||||
|
|
@ -811,7 +814,7 @@ do_port_use_buffers(struct impl *impl,
|
|||
}
|
||||
|
||||
return pw_client_node_resource_port_use_buffers(this->resource,
|
||||
direction, port_id, mix_id,
|
||||
direction, port_id, mix_id, flags,
|
||||
n_buffers, mb);
|
||||
}
|
||||
|
||||
|
|
@ -819,6 +822,7 @@ static int
|
|||
impl_node_port_use_buffers(void *object,
|
||||
enum spa_direction direction,
|
||||
uint32_t port_id,
|
||||
uint32_t flags,
|
||||
struct spa_buffer **buffers,
|
||||
uint32_t n_buffers)
|
||||
{
|
||||
|
|
@ -830,7 +834,7 @@ impl_node_port_use_buffers(void *object,
|
|||
impl = this->impl;
|
||||
|
||||
return do_port_use_buffers(impl, direction, port_id,
|
||||
SPA_ID_INVALID, buffers, n_buffers);
|
||||
SPA_ID_INVALID, flags, buffers, n_buffers);
|
||||
}
|
||||
|
||||
static int
|
||||
|
|
@ -1344,13 +1348,14 @@ static int
|
|||
impl_mix_port_use_buffers(void *object,
|
||||
enum spa_direction direction,
|
||||
uint32_t mix_id,
|
||||
uint32_t flags,
|
||||
struct spa_buffer **buffers,
|
||||
uint32_t n_buffers)
|
||||
{
|
||||
struct port *port = object;
|
||||
struct impl *impl = port->impl;
|
||||
|
||||
return do_port_use_buffers(impl, direction, port->id, mix_id, buffers, n_buffers);
|
||||
return do_port_use_buffers(impl, direction, port->id, mix_id, flags, buffers, n_buffers);
|
||||
}
|
||||
|
||||
static int
|
||||
|
|
|
|||
|
|
@ -413,7 +413,7 @@ static int client_node_demarshal_port_use_buffers(void *object, const struct pw_
|
|||
struct pw_proxy *proxy = object;
|
||||
struct spa_pod_parser prs;
|
||||
struct spa_pod_frame f;
|
||||
uint32_t direction, port_id, mix_id, n_buffers, data_id;
|
||||
uint32_t direction, port_id, mix_id, flags, n_buffers, data_id;
|
||||
struct pw_client_node_buffer *buffers;
|
||||
uint32_t i, j;
|
||||
|
||||
|
|
@ -423,6 +423,7 @@ static int client_node_demarshal_port_use_buffers(void *object, const struct pw_
|
|||
SPA_POD_Int(&direction),
|
||||
SPA_POD_Int(&port_id),
|
||||
SPA_POD_Int(&mix_id),
|
||||
SPA_POD_Int(&flags),
|
||||
SPA_POD_Int(&n_buffers), NULL) < 0)
|
||||
return -EINVAL;
|
||||
|
||||
|
|
@ -469,6 +470,7 @@ static int client_node_demarshal_port_use_buffers(void *object, const struct pw_
|
|||
direction,
|
||||
port_id,
|
||||
mix_id,
|
||||
flags,
|
||||
n_buffers, buffers);
|
||||
return 0;
|
||||
}
|
||||
|
|
@ -673,6 +675,7 @@ client_node_marshal_port_use_buffers(void *object,
|
|||
enum spa_direction direction,
|
||||
uint32_t port_id,
|
||||
uint32_t mix_id,
|
||||
uint32_t flags,
|
||||
uint32_t n_buffers, struct pw_client_node_buffer *buffers)
|
||||
{
|
||||
struct pw_resource *resource = object;
|
||||
|
|
@ -687,6 +690,7 @@ client_node_marshal_port_use_buffers(void *object,
|
|||
SPA_POD_Int(direction),
|
||||
SPA_POD_Int(port_id),
|
||||
SPA_POD_Int(mix_id),
|
||||
SPA_POD_Int(flags),
|
||||
SPA_POD_Int(n_buffers), NULL);
|
||||
|
||||
for (i = 0; i < n_buffers; i++) {
|
||||
|
|
|
|||
|
|
@ -496,7 +496,7 @@ static int clear_buffers(struct node_data *data, struct mix *mix)
|
|||
int res;
|
||||
|
||||
pw_log_debug("port %p: clear buffers mix:%d", port, mix->mix_id);
|
||||
if ((res = pw_port_use_buffers(port, mix->mix_id, NULL, 0)) < 0) {
|
||||
if ((res = pw_port_use_buffers(port, mix->mix_id, 0, NULL, 0)) < 0) {
|
||||
pw_log_error("port %p: error clear buffers %s", port, spa_strerror(res));
|
||||
return res;
|
||||
}
|
||||
|
|
@ -553,6 +553,7 @@ error_exit:
|
|||
static int
|
||||
client_node_port_use_buffers(void *object,
|
||||
enum spa_direction direction, uint32_t port_id, uint32_t mix_id,
|
||||
uint32_t flags,
|
||||
uint32_t n_buffers, struct pw_client_node_buffer *buffers)
|
||||
{
|
||||
struct pw_proxy *proxy = object;
|
||||
|
|
@ -666,7 +667,7 @@ client_node_port_use_buffers(void *object,
|
|||
bufs[i] = b;
|
||||
}
|
||||
|
||||
if ((res = pw_port_use_buffers(mix->port, mix->mix_id, bufs, n_buffers)) < 0)
|
||||
if ((res = pw_port_use_buffers(mix->port, mix->mix_id, flags, bufs, n_buffers)) < 0)
|
||||
goto error_exit_cleanup;
|
||||
|
||||
return res;
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue