mirror of
https://gitlab.freedesktop.org/pipewire/pipewire.git
synced 2025-11-07 13:30:09 -05:00
node: add max_ports to node info
This commit is contained in:
parent
21957e9e8d
commit
e9bedae5fa
30 changed files with 124 additions and 99 deletions
|
|
@ -146,7 +146,7 @@ static int impl_set_callbacks(struct spa_node *node,
|
|||
|
||||
info = SPA_PORT_INFO_INIT();
|
||||
info.change_mask = SPA_PORT_CHANGE_MASK_FLAGS;
|
||||
info.flags = SPA_PORT_INFO_FLAG_CAN_USE_BUFFERS;
|
||||
info.flags = SPA_PORT_FLAG_CAN_USE_BUFFERS;
|
||||
|
||||
d->callbacks->port_info(d->callbacks_data, SPA_DIRECTION_INPUT, 0, &info);
|
||||
}
|
||||
|
|
|
|||
|
|
@ -113,7 +113,7 @@ static int impl_set_callbacks(struct spa_node *node,
|
|||
|
||||
info = SPA_PORT_INFO_INIT();
|
||||
info.change_mask = SPA_PORT_CHANGE_MASK_FLAGS | SPA_PORT_CHANGE_MASK_PROPS;
|
||||
info.flags = SPA_PORT_INFO_FLAG_CAN_USE_BUFFERS;
|
||||
info.flags = SPA_PORT_FLAG_CAN_USE_BUFFERS;
|
||||
port_items[0] = SPA_DICT_ITEM_INIT("port.dsp", "32 bit float mono audio");
|
||||
info.props = &SPA_DICT_INIT_ARRAY(port_items);
|
||||
|
||||
|
|
|
|||
|
|
@ -101,7 +101,7 @@ static int impl_set_callbacks(struct spa_node *node,
|
|||
|
||||
info = SPA_PORT_INFO_INIT();
|
||||
info.change_mask = SPA_PORT_CHANGE_MASK_FLAGS;
|
||||
info.flags = SPA_PORT_INFO_FLAG_CAN_USE_BUFFERS;
|
||||
info.flags = SPA_PORT_FLAG_CAN_USE_BUFFERS;
|
||||
|
||||
d->callbacks->port_info(d->callbacks_data, SPA_DIRECTION_INPUT, 0, &info);
|
||||
}
|
||||
|
|
|
|||
|
|
@ -216,10 +216,10 @@ static int impl_node_add_port(struct spa_node *node, enum spa_direction directio
|
|||
spa_list_init(&port->queue);
|
||||
port->info = SPA_PORT_INFO_INIT();
|
||||
port->info.change_mask = SPA_PORT_CHANGE_MASK_FLAGS;
|
||||
port->info.flags = SPA_PORT_INFO_FLAG_CAN_USE_BUFFERS |
|
||||
SPA_PORT_INFO_FLAG_REMOVABLE |
|
||||
SPA_PORT_INFO_FLAG_OPTIONAL |
|
||||
SPA_PORT_INFO_FLAG_IN_PLACE;
|
||||
port->info.flags = SPA_PORT_FLAG_CAN_USE_BUFFERS |
|
||||
SPA_PORT_FLAG_REMOVABLE |
|
||||
SPA_PORT_FLAG_OPTIONAL |
|
||||
SPA_PORT_FLAG_IN_PLACE;
|
||||
|
||||
this->port_count++;
|
||||
if (this->last_port <= port_id)
|
||||
|
|
@ -891,8 +891,8 @@ impl_init(const struct spa_handle_factory *factory,
|
|||
port->id = 0;
|
||||
port->info = SPA_PORT_INFO_INIT();
|
||||
port->info.change_mask = SPA_PORT_CHANGE_MASK_FLAGS;
|
||||
port->info.flags = SPA_PORT_INFO_FLAG_CAN_USE_BUFFERS |
|
||||
SPA_PORT_INFO_FLAG_NO_REF;
|
||||
port->info.flags = SPA_PORT_FLAG_CAN_USE_BUFFERS |
|
||||
SPA_PORT_FLAG_NO_REF;
|
||||
spa_list_init(&port->queue);
|
||||
|
||||
return 0;
|
||||
|
|
|
|||
|
|
@ -538,8 +538,8 @@ static int negotiate_buffers(struct impl *impl)
|
|||
in_flags = impl->client_port->spa_flags;
|
||||
out_flags = impl->adapter_mix_flags;
|
||||
|
||||
in_alloc = SPA_FLAG_CHECK(in_flags, SPA_PORT_INFO_FLAG_CAN_ALLOC_BUFFERS);
|
||||
out_alloc = SPA_FLAG_CHECK(out_flags, SPA_PORT_INFO_FLAG_CAN_ALLOC_BUFFERS);
|
||||
in_alloc = SPA_FLAG_CHECK(in_flags, SPA_PORT_FLAG_CAN_ALLOC_BUFFERS);
|
||||
out_alloc = SPA_FLAG_CHECK(out_flags, SPA_PORT_FLAG_CAN_ALLOC_BUFFERS);
|
||||
|
||||
flags = 0;
|
||||
if (out_alloc || in_alloc) {
|
||||
|
|
|
|||
|
|
@ -443,7 +443,7 @@ static void add_port_update(struct pw_proxy *proxy, struct pw_port *port, uint32
|
|||
pi.flags = port->spa_flags;
|
||||
pi.rate = 0;
|
||||
pi.props = &port->properties->dict;
|
||||
pi.flags &= ~SPA_PORT_INFO_FLAG_CAN_ALLOC_BUFFERS;
|
||||
pi.flags &= ~SPA_PORT_FLAG_CAN_ALLOC_BUFFERS;
|
||||
}
|
||||
|
||||
pw_client_node_proxy_port_update(data->node_proxy,
|
||||
|
|
|
|||
|
|
@ -564,23 +564,23 @@ static int do_allocation(struct pw_link *this, uint32_t in_state, uint32_t out_s
|
|||
in_flags = input->spa_flags;
|
||||
out_flags = output->spa_flags;
|
||||
|
||||
if (out_flags & SPA_PORT_INFO_FLAG_LIVE) {
|
||||
if (out_flags & SPA_PORT_FLAG_LIVE) {
|
||||
pw_log_debug("setting link as live");
|
||||
output->node->live = true;
|
||||
input->node->live = true;
|
||||
}
|
||||
|
||||
if (output->allocation.n_buffers) {
|
||||
out_flags = SPA_PORT_INFO_FLAG_CAN_USE_BUFFERS;
|
||||
in_flags = SPA_PORT_INFO_FLAG_CAN_USE_BUFFERS;
|
||||
out_flags = SPA_PORT_FLAG_CAN_USE_BUFFERS;
|
||||
in_flags = SPA_PORT_FLAG_CAN_USE_BUFFERS;
|
||||
|
||||
move_allocation(&output->allocation, &allocation);
|
||||
|
||||
pw_log_debug("link %p: reusing %d output buffers %p", this,
|
||||
allocation.n_buffers, allocation.buffers);
|
||||
} else if (input->allocation.n_buffers && input->mix == NULL) {
|
||||
out_flags = SPA_PORT_INFO_FLAG_CAN_USE_BUFFERS;
|
||||
in_flags = SPA_PORT_INFO_FLAG_CAN_USE_BUFFERS;
|
||||
out_flags = SPA_PORT_FLAG_CAN_USE_BUFFERS;
|
||||
in_flags = SPA_PORT_FLAG_CAN_USE_BUFFERS;
|
||||
|
||||
move_allocation(&input->allocation, &allocation);
|
||||
|
||||
|
|
@ -643,8 +643,8 @@ static int do_allocation(struct pw_link *this, uint32_t in_state, uint32_t out_s
|
|||
|
||||
/* when one of the ports can allocate buffer memory, set the minsize to
|
||||
* 0 to make sure we don't allocate memory in the shared memory */
|
||||
if ((in_flags & SPA_PORT_INFO_FLAG_CAN_ALLOC_BUFFERS) ||
|
||||
(out_flags & SPA_PORT_INFO_FLAG_CAN_ALLOC_BUFFERS)) {
|
||||
if ((in_flags & SPA_PORT_FLAG_CAN_ALLOC_BUFFERS) ||
|
||||
(out_flags & SPA_PORT_FLAG_CAN_ALLOC_BUFFERS)) {
|
||||
minsize = 0;
|
||||
}
|
||||
|
||||
|
|
@ -667,7 +667,7 @@ static int do_allocation(struct pw_link *this, uint32_t in_state, uint32_t out_s
|
|||
pw_log_debug("link %p: allocating %d buffers %p %zd %zd", this,
|
||||
allocation.n_buffers, allocation.buffers, minsize, stride);
|
||||
|
||||
if (out_flags & SPA_PORT_INFO_FLAG_CAN_ALLOC_BUFFERS) {
|
||||
if (out_flags & SPA_PORT_FLAG_CAN_ALLOC_BUFFERS) {
|
||||
if ((res = pw_port_alloc_buffers(output,
|
||||
this->rt.out_mix.port.port_id,
|
||||
params, n_params,
|
||||
|
|
@ -680,12 +680,12 @@ static int do_allocation(struct pw_link *this, uint32_t in_state, uint32_t out_s
|
|||
pw_work_queue_add(impl->work, output->node, res, complete_paused,
|
||||
&this->rt.out_mix);
|
||||
|
||||
out_flags &= ~SPA_PORT_INFO_FLAG_CAN_USE_BUFFERS;
|
||||
out_flags &= ~SPA_PORT_FLAG_CAN_USE_BUFFERS;
|
||||
move_allocation(&allocation, &output->allocation);
|
||||
|
||||
pw_log_debug("link %p: allocated %d buffers %p from output port", this,
|
||||
allocation.n_buffers, allocation.buffers);
|
||||
} else if (in_flags & SPA_PORT_INFO_FLAG_CAN_ALLOC_BUFFERS) {
|
||||
} else if (in_flags & SPA_PORT_FLAG_CAN_ALLOC_BUFFERS) {
|
||||
if ((res = pw_port_alloc_buffers(input,
|
||||
this->rt.in_mix.port.port_id,
|
||||
params, n_params,
|
||||
|
|
@ -698,13 +698,13 @@ static int do_allocation(struct pw_link *this, uint32_t in_state, uint32_t out_s
|
|||
pw_work_queue_add(impl->work, input->node, res, complete_paused,
|
||||
&this->rt.in_mix);
|
||||
|
||||
in_flags &= ~SPA_PORT_INFO_FLAG_CAN_USE_BUFFERS;
|
||||
in_flags &= ~SPA_PORT_FLAG_CAN_USE_BUFFERS;
|
||||
pw_log_debug("link %p: allocated %d buffers %p from input port", this,
|
||||
allocation.n_buffers, allocation.buffers);
|
||||
}
|
||||
}
|
||||
|
||||
if (out_flags & SPA_PORT_INFO_FLAG_CAN_USE_BUFFERS) {
|
||||
if (out_flags & SPA_PORT_FLAG_CAN_USE_BUFFERS) {
|
||||
pw_log_debug("link %p: using %d buffers %p on output port", this,
|
||||
allocation.n_buffers, allocation.buffers);
|
||||
if ((res = pw_port_use_buffers(output,
|
||||
|
|
@ -722,7 +722,7 @@ static int do_allocation(struct pw_link *this, uint32_t in_state, uint32_t out_s
|
|||
move_allocation(&allocation, &output->allocation);
|
||||
|
||||
}
|
||||
if (in_flags & SPA_PORT_INFO_FLAG_CAN_USE_BUFFERS) {
|
||||
if (in_flags & SPA_PORT_FLAG_CAN_USE_BUFFERS) {
|
||||
pw_log_debug("link %p: using %d buffers %p on input port", this,
|
||||
allocation.n_buffers, allocation.buffers);
|
||||
if ((res = pw_port_use_buffers(input,
|
||||
|
|
|
|||
|
|
@ -780,6 +780,8 @@ int pw_node_update_properties(struct pw_node *node, const struct spa_dict *dict)
|
|||
static void node_info(void *data, const struct spa_node_info *info)
|
||||
{
|
||||
struct pw_node *node = data;
|
||||
node->info.max_input_ports = info->max_input_ports;
|
||||
node->info.max_output_ports = info->max_output_ports;
|
||||
if (info->change_mask & SPA_NODE_CHANGE_MASK_PROPS)
|
||||
pw_node_update_properties(node, info->props);
|
||||
}
|
||||
|
|
|
|||
|
|
@ -264,9 +264,9 @@ struct pw_port *pw_port_new(enum pw_direction direction,
|
|||
if (properties == NULL)
|
||||
goto no_mem;
|
||||
|
||||
if (SPA_FLAG_CHECK(spa_flags, SPA_PORT_INFO_FLAG_PHYSICAL))
|
||||
if (SPA_FLAG_CHECK(spa_flags, SPA_PORT_FLAG_PHYSICAL))
|
||||
pw_properties_set(properties, "port.physical", "1");
|
||||
if (SPA_FLAG_CHECK(spa_flags, SPA_PORT_INFO_FLAG_TERMINAL))
|
||||
if (SPA_FLAG_CHECK(spa_flags, SPA_PORT_FLAG_TERMINAL))
|
||||
pw_properties_set(properties, "port.terminal", "1");
|
||||
|
||||
this->direction = direction;
|
||||
|
|
|
|||
|
|
@ -319,7 +319,7 @@ static void emit_port_info(struct stream *d)
|
|||
struct spa_port_info info;
|
||||
info = SPA_PORT_INFO_INIT();
|
||||
info.change_mask = SPA_PORT_CHANGE_MASK_FLAGS;
|
||||
info.flags = SPA_PORT_INFO_FLAG_CAN_USE_BUFFERS;
|
||||
info.flags = SPA_PORT_FLAG_CAN_USE_BUFFERS;
|
||||
d->callbacks->port_info(d->callbacks_data, d->direction, 0, &info);
|
||||
}
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue