diff options
author | Wim Taymans <wtaymans@redhat.com> | 2019-07-25 13:19:39 +0200 |
---|---|---|
committer | Wim Taymans <wtaymans@redhat.com> | 2019-07-25 13:19:39 +0200 |
commit | 8590ac158bb4f295f41e2c1acd6950f838e5e1d2 (patch) | |
tree | 939f632910b6ae12659172b60b5267cb8d6c097d /src/modules/module-client-node | |
parent | b314547702953a82ec5cacbd7b716b654a8cd728 (diff) |
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.
Diffstat (limited to 'src/modules/module-client-node')
-rw-r--r-- | src/modules/module-client-node/client-node.c | 13 | ||||
-rw-r--r-- | src/modules/module-client-node/protocol-native.c | 6 | ||||
-rw-r--r-- | src/modules/module-client-node/remote-node.c | 5 |
3 files changed, 17 insertions, 7 deletions
diff --git a/src/modules/module-client-node/client-node.c b/src/modules/module-client-node/client-node.c index 2524fd5d..e017b44b 100644 --- a/src/modules/module-client-node/client-node.c +++ b/src/modules/module-client-node/client-node.c @@ -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 diff --git a/src/modules/module-client-node/protocol-native.c b/src/modules/module-client-node/protocol-native.c index 5d84bc50..b90264de 100644 --- a/src/modules/module-client-node/protocol-native.c +++ b/src/modules/module-client-node/protocol-native.c @@ -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++) { diff --git a/src/modules/module-client-node/remote-node.c b/src/modules/module-client-node/remote-node.c index 4e06bd3f..a06f3034 100644 --- a/src/modules/module-client-node/remote-node.c +++ b/src/modules/module-client-node/remote-node.c @@ -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; |