mirror of
https://gitlab.freedesktop.org/pipewire/pipewire.git
synced 2025-11-05 13:30:02 -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
|
|
@ -649,7 +649,7 @@ static int negotiate_buffers(struct impl *this)
|
|||
}
|
||||
else {
|
||||
if ((res = spa_node_port_use_buffers(this->convert,
|
||||
SPA_DIRECTION_REVERSE(this->direction), 0,
|
||||
SPA_DIRECTION_REVERSE(this->direction), 0, 0,
|
||||
this->buffers, this->n_buffers)) < 0)
|
||||
return res;
|
||||
}
|
||||
|
|
@ -663,7 +663,7 @@ static int negotiate_buffers(struct impl *this)
|
|||
}
|
||||
else {
|
||||
if ((res = spa_node_port_use_buffers(this->slave,
|
||||
this->direction, 0,
|
||||
this->direction, 0, 0,
|
||||
this->buffers, this->n_buffers)) < 0) {
|
||||
return res;
|
||||
}
|
||||
|
|
@ -730,6 +730,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)
|
||||
{
|
||||
|
|
@ -742,7 +743,7 @@ impl_node_port_use_buffers(void *object,
|
|||
port_id++;
|
||||
|
||||
if ((res = spa_node_port_use_buffers(this->target,
|
||||
direction, port_id, buffers, n_buffers)) < 0)
|
||||
direction, port_id, flags, buffers, n_buffers)) < 0)
|
||||
return res;
|
||||
|
||||
|
||||
|
|
|
|||
|
|
@ -344,7 +344,7 @@ static int negotiate_link_buffers(struct impl *this, struct link *link)
|
|||
}
|
||||
else {
|
||||
if ((res = spa_node_port_use_buffers(link->out_node,
|
||||
SPA_DIRECTION_OUTPUT, link->out_port,
|
||||
SPA_DIRECTION_OUTPUT, link->out_port, 0,
|
||||
link->buffers, link->n_buffers)) < 0)
|
||||
return res;
|
||||
}
|
||||
|
|
@ -357,7 +357,7 @@ static int negotiate_link_buffers(struct impl *this, struct link *link)
|
|||
}
|
||||
else {
|
||||
if ((res = spa_node_port_use_buffers(link->in_node,
|
||||
SPA_DIRECTION_INPUT, link->in_port,
|
||||
SPA_DIRECTION_INPUT, link->in_port, 0,
|
||||
link->buffers, link->n_buffers)) < 0)
|
||||
return res;
|
||||
}
|
||||
|
|
@ -799,6 +799,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)
|
||||
{
|
||||
|
|
@ -814,7 +815,7 @@ impl_node_port_use_buffers(void *object,
|
|||
target = this->fmt[direction];
|
||||
|
||||
if ((res = spa_node_port_use_buffers(target,
|
||||
direction, port_id, buffers, n_buffers)) < 0)
|
||||
direction, port_id, flags, buffers, n_buffers)) < 0)
|
||||
return res;
|
||||
|
||||
if (buffers && this->buffers_set[SPA_DIRECTION_REVERSE(direction)]) {
|
||||
|
|
|
|||
|
|
@ -688,10 +688,9 @@ impl_node_port_set_param(void *object,
|
|||
|
||||
static int
|
||||
impl_node_port_use_buffers(void *object,
|
||||
enum spa_direction direction,
|
||||
uint32_t port_id,
|
||||
struct spa_buffer **buffers,
|
||||
uint32_t n_buffers)
|
||||
enum spa_direction direction, uint32_t port_id,
|
||||
uint32_t flags,
|
||||
struct spa_buffer **buffers, uint32_t n_buffers)
|
||||
{
|
||||
struct impl *this = object;
|
||||
struct port *port;
|
||||
|
|
@ -1028,8 +1027,7 @@ impl_init(const struct spa_handle_factory *factory,
|
|||
port->info_all = SPA_PORT_CHANGE_MASK_FLAGS |
|
||||
SPA_PORT_CHANGE_MASK_PARAMS;
|
||||
port->info = SPA_PORT_INFO_INIT();
|
||||
port->info.flags = SPA_PORT_FLAG_CAN_USE_BUFFERS |
|
||||
SPA_PORT_FLAG_DYNAMIC_DATA;
|
||||
port->info.flags = SPA_PORT_FLAG_DYNAMIC_DATA;
|
||||
port->params[0] = SPA_PARAM_INFO(SPA_PARAM_EnumFormat, SPA_PARAM_INFO_READ);
|
||||
port->params[1] = SPA_PARAM_INFO(SPA_PARAM_Meta, SPA_PARAM_INFO_READ);
|
||||
port->params[2] = SPA_PARAM_INFO(SPA_PARAM_IO, SPA_PARAM_INFO_READ);
|
||||
|
|
@ -1045,8 +1043,7 @@ impl_init(const struct spa_handle_factory *factory,
|
|||
port->info_all = SPA_PORT_CHANGE_MASK_FLAGS |
|
||||
SPA_PORT_CHANGE_MASK_PARAMS;
|
||||
port->info = SPA_PORT_INFO_INIT();
|
||||
port->info.flags = SPA_PORT_FLAG_CAN_USE_BUFFERS |
|
||||
SPA_PORT_FLAG_NO_REF |
|
||||
port->info.flags = SPA_PORT_FLAG_NO_REF |
|
||||
SPA_PORT_FLAG_DYNAMIC_DATA;
|
||||
port->params[0] = SPA_PARAM_INFO(SPA_PARAM_EnumFormat, SPA_PARAM_INFO_READ);
|
||||
port->params[1] = SPA_PARAM_INFO(SPA_PARAM_Meta, SPA_PARAM_INFO_READ);
|
||||
|
|
|
|||
|
|
@ -639,6 +639,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)
|
||||
{
|
||||
|
|
@ -935,8 +936,7 @@ static int init_port(struct impl *this, enum spa_direction direction, uint32_t p
|
|||
spa_list_init(&port->queue);
|
||||
port->info_all = SPA_PORT_CHANGE_MASK_FLAGS;
|
||||
port->info = SPA_PORT_INFO_INIT();
|
||||
port->info.flags = SPA_PORT_FLAG_CAN_USE_BUFFERS |
|
||||
SPA_PORT_FLAG_NO_REF |
|
||||
port->info.flags = SPA_PORT_FLAG_NO_REF |
|
||||
SPA_PORT_FLAG_DYNAMIC_DATA;
|
||||
port->params[0] = SPA_PARAM_INFO(SPA_PARAM_EnumFormat, SPA_PARAM_INFO_READ);
|
||||
port->params[1] = SPA_PARAM_INFO(SPA_PARAM_Meta, SPA_PARAM_INFO_READ);
|
||||
|
|
|
|||
|
|
@ -166,8 +166,7 @@ static int init_port(struct impl *this, enum spa_direction direction, uint32_t p
|
|||
SPA_PORT_CHANGE_MASK_PROPS |
|
||||
SPA_PORT_CHANGE_MASK_PARAMS;
|
||||
port->info = SPA_PORT_INFO_INIT();
|
||||
port->info.flags = SPA_PORT_FLAG_CAN_USE_BUFFERS |
|
||||
SPA_PORT_FLAG_NO_REF |
|
||||
port->info.flags = SPA_PORT_FLAG_NO_REF |
|
||||
SPA_PORT_FLAG_DYNAMIC_DATA;
|
||||
port->params[0] = SPA_PARAM_INFO(SPA_PARAM_EnumFormat, SPA_PARAM_INFO_READ);
|
||||
port->params[1] = SPA_PARAM_INFO(SPA_PARAM_Meta, SPA_PARAM_INFO_READ);
|
||||
|
|
@ -736,6 +735,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)
|
||||
{
|
||||
|
|
@ -1101,8 +1101,7 @@ impl_init(const struct spa_handle_factory *factory,
|
|||
port->info_all = SPA_PORT_CHANGE_MASK_FLAGS |
|
||||
SPA_PORT_CHANGE_MASK_PARAMS;
|
||||
port->info = SPA_PORT_INFO_INIT();
|
||||
port->info.flags = SPA_PORT_FLAG_CAN_USE_BUFFERS |
|
||||
SPA_PORT_FLAG_DYNAMIC_DATA;
|
||||
port->info.flags = SPA_PORT_FLAG_DYNAMIC_DATA;
|
||||
port->params[0] = SPA_PARAM_INFO(SPA_PARAM_EnumFormat, SPA_PARAM_INFO_READ);
|
||||
port->params[1] = SPA_PARAM_INFO(SPA_PARAM_Meta, SPA_PARAM_INFO_READ);
|
||||
port->params[2] = SPA_PARAM_INFO(SPA_PARAM_IO, SPA_PARAM_INFO_READ);
|
||||
|
|
|
|||
|
|
@ -568,6 +568,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)
|
||||
{
|
||||
|
|
@ -953,7 +954,7 @@ impl_init(const struct spa_handle_factory *factory,
|
|||
port->info_all = SPA_PORT_CHANGE_MASK_FLAGS |
|
||||
SPA_PORT_CHANGE_MASK_PARAMS;
|
||||
port->info = SPA_PORT_INFO_INIT();
|
||||
port->info.flags = SPA_PORT_FLAG_CAN_USE_BUFFERS;
|
||||
port->info.flags = 0;
|
||||
port->params[0] = SPA_PARAM_INFO(SPA_PARAM_EnumFormat, SPA_PARAM_INFO_READ);
|
||||
port->params[1] = SPA_PARAM_INFO(SPA_PARAM_Meta, SPA_PARAM_INFO_READ);
|
||||
port->params[2] = SPA_PARAM_INFO(SPA_PARAM_IO, SPA_PARAM_INFO_READ);
|
||||
|
|
@ -969,8 +970,7 @@ impl_init(const struct spa_handle_factory *factory,
|
|||
port->info_all = SPA_PORT_CHANGE_MASK_FLAGS |
|
||||
SPA_PORT_CHANGE_MASK_PARAMS;
|
||||
port->info = SPA_PORT_INFO_INIT();
|
||||
port->info.flags = SPA_PORT_FLAG_CAN_USE_BUFFERS |
|
||||
SPA_PORT_FLAG_DYNAMIC_DATA;
|
||||
port->info.flags = SPA_PORT_FLAG_DYNAMIC_DATA;
|
||||
port->params[0] = SPA_PARAM_INFO(SPA_PARAM_EnumFormat, SPA_PARAM_INFO_READ);
|
||||
port->params[1] = SPA_PARAM_INFO(SPA_PARAM_Meta, SPA_PARAM_INFO_READ);
|
||||
port->params[2] = SPA_PARAM_INFO(SPA_PARAM_IO, SPA_PARAM_INFO_READ);
|
||||
|
|
|
|||
|
|
@ -158,8 +158,7 @@ static int init_port(struct impl *this, enum spa_direction direction,
|
|||
SPA_PORT_CHANGE_MASK_PARAMS;
|
||||
|
||||
port->info = SPA_PORT_INFO_INIT();
|
||||
port->info.flags = SPA_PORT_FLAG_CAN_USE_BUFFERS |
|
||||
SPA_PORT_FLAG_DYNAMIC_DATA;
|
||||
port->info.flags = SPA_PORT_FLAG_DYNAMIC_DATA;
|
||||
port->info_props_items[0] = SPA_DICT_ITEM_INIT(SPA_KEY_FORMAT_DSP, "32 bit float mono audio");
|
||||
port->info_props_items[1] = SPA_DICT_ITEM_INIT(SPA_KEY_AUDIO_CHANNEL, port->position);
|
||||
port->info_props = SPA_DICT_INIT(port->info_props_items, 2);
|
||||
|
|
@ -706,6 +705,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)
|
||||
{
|
||||
|
|
@ -1017,8 +1017,7 @@ impl_init(const struct spa_handle_factory *factory,
|
|||
port->direction = SPA_DIRECTION_INPUT;
|
||||
port->id = 0;
|
||||
port->info = SPA_PORT_INFO_INIT();
|
||||
port->info.flags = SPA_PORT_FLAG_CAN_USE_BUFFERS |
|
||||
SPA_PORT_FLAG_NO_REF |
|
||||
port->info.flags = SPA_PORT_FLAG_NO_REF |
|
||||
SPA_PORT_FLAG_DYNAMIC_DATA;
|
||||
port->params[0] = SPA_PARAM_INFO(SPA_PARAM_EnumFormat, SPA_PARAM_INFO_READ);
|
||||
port->params[1] = SPA_PARAM_INFO(SPA_PARAM_Meta, SPA_PARAM_INFO_READ);
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue