node: add max_ports to node info

This commit is contained in:
Wim Taymans 2019-02-14 17:40:01 +01:00
parent 21957e9e8d
commit e9bedae5fa
30 changed files with 124 additions and 99 deletions

View file

@ -284,9 +284,9 @@ static int negotiate_link_buffers(struct impl *this, struct link *link)
spa_pod_fixate(param);
in_alloc = SPA_FLAG_CHECK(link->in_flags,
SPA_PORT_INFO_FLAG_CAN_ALLOC_BUFFERS);
SPA_PORT_FLAG_CAN_ALLOC_BUFFERS);
out_alloc = SPA_FLAG_CHECK(link->out_flags,
SPA_PORT_INFO_FLAG_CAN_ALLOC_BUFFERS);
SPA_PORT_FLAG_CAN_ALLOC_BUFFERS);
flags = 0;
if (out_alloc || in_alloc) {

View file

@ -1193,7 +1193,7 @@ 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;
port->info.flags = SPA_PORT_FLAG_CAN_USE_BUFFERS;
spa_list_init(&port->queue);
port = GET_IN_PORT(this, 0);
@ -1201,7 +1201,7 @@ 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;
port->info.flags = SPA_PORT_FLAG_CAN_USE_BUFFERS;
spa_list_init(&port->queue);
props_reset(&this->props);

View file

@ -951,8 +951,8 @@ impl_init(const struct spa_handle_factory *factory,
if (this->cpu)
this->cpu_flags = spa_cpu_get_flags(this->cpu);
init_port(this, SPA_DIRECTION_OUTPUT, 0, SPA_PORT_INFO_FLAG_CAN_USE_BUFFERS);
init_port(this, SPA_DIRECTION_INPUT, 0, SPA_PORT_INFO_FLAG_CAN_USE_BUFFERS);
init_port(this, SPA_DIRECTION_OUTPUT, 0, SPA_PORT_FLAG_CAN_USE_BUFFERS);
init_port(this, SPA_DIRECTION_INPUT, 0, SPA_PORT_FLAG_CAN_USE_BUFFERS);
props_reset(&this->props);

View file

@ -117,6 +117,8 @@ static void emit_node_info(struct impl *this)
{
if (this->callbacks && this->callbacks->info) {
struct spa_node_info info = SPA_NODE_INFO_INIT();
info.max_input_ports = MAX_PORTS;
info.max_output_ports = MAX_PORTS+1;
info.change_mask = 0;
this->callbacks->info(this->user_data, &info);
}
@ -142,7 +144,7 @@ static int init_port(struct impl *this, enum spa_direction direction, uint32_t p
port->info = SPA_PORT_INFO_INIT();
port->info.change_mask = SPA_PORT_CHANGE_MASK_FLAGS | SPA_PORT_CHANGE_MASK_PROPS;
port->info.flags = SPA_PORT_INFO_FLAG_CAN_USE_BUFFERS;
port->info.flags = SPA_PORT_FLAG_CAN_USE_BUFFERS;
port->info_props_items[n_items++] = SPA_DICT_ITEM_INIT("port.dsp", "32 bit float mono audio");
port->info_props_items[n_items++] = SPA_DICT_ITEM_INIT("port.channel", port->position);
if (direction == SPA_DIRECTION_OUTPUT)
@ -1043,7 +1045,7 @@ 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;
port->info.flags = SPA_PORT_FLAG_CAN_USE_BUFFERS;
spa_list_init(&port->queue);
return 0;

View file

@ -885,7 +885,7 @@ 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;
port->info.flags = SPA_PORT_FLAG_CAN_USE_BUFFERS;
spa_list_init(&port->queue);
port = GET_IN_PORT(this, 0);
@ -893,7 +893,7 @@ 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;
port->info.flags = SPA_PORT_FLAG_CAN_USE_BUFFERS;
spa_list_init(&port->queue);
props_reset(&this->props);

View file

@ -115,6 +115,8 @@ static void emit_node_info(struct impl *this)
{
if (this->callbacks && this->callbacks->info) {
struct spa_node_info info = SPA_NODE_INFO_INIT();
info.max_input_ports = 1;
info.max_output_ports = MAX_PORTS;
info.change_mask = 0;
this->callbacks->info(this->user_data, &info);
}
@ -139,7 +141,7 @@ static int init_port(struct impl *this, enum spa_direction direction,
port->info = SPA_PORT_INFO_INIT();
port->info.change_mask = SPA_PORT_CHANGE_MASK_FLAGS | SPA_PORT_CHANGE_MASK_PROPS;
port->info.flags = SPA_PORT_INFO_FLAG_CAN_USE_BUFFERS;
port->info.flags = SPA_PORT_FLAG_CAN_USE_BUFFERS;
port->info_props_items[0] = SPA_DICT_ITEM_INIT("port.dsp", "32 bit float mono audio");
port->info_props_items[1] = SPA_DICT_ITEM_INIT("port.channel", port->position);
port->info_props = SPA_DICT_INIT(port->info_props_items, 2);
@ -972,7 +974,7 @@ 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;
port->info.flags = SPA_PORT_FLAG_CAN_USE_BUFFERS;
return 0;
}