mirror of
https://gitlab.freedesktop.org/pipewire/pipewire.git
synced 2025-10-29 05:40:27 -04: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
|
|
@ -1 +1 @@
|
|||
Subproject commit eef8bc593c69a5d53e91e7f03a25debff332887d
|
||||
Subproject commit 1108c5d83d2f105f6976a6edd79efa348b688d23
|
||||
|
|
@ -47,8 +47,15 @@ struct spa_node;
|
|||
* Contains the basic node information.
|
||||
*/
|
||||
struct spa_node_info {
|
||||
#define SPA_NODE_CHANGE_MASK_PROPS (1<<0)
|
||||
uint32_t max_input_ports;
|
||||
uint32_t max_output_ports;
|
||||
#define SPA_NODE_CHANGE_MASK_FLAGS (1u<<0)
|
||||
#define SPA_NODE_CHANGE_MASK_PROPS (1u<<1)
|
||||
uint64_t change_mask;
|
||||
#define SPA_NODE_FLAG_DYNAMIC_INPUT_PORTS (1u<<0) /**< input ports can be added/removed */
|
||||
#define SPA_NODE_FLAG_DYNAMIC_OUTPUT_PORTS (1u<<1) /**< output ports can be added/removed */
|
||||
#define SPA_NODE_FLAG_RT (1u<<2) /**< node can do real-time processing */
|
||||
uint32_t flags;
|
||||
struct spa_dict *props;
|
||||
};
|
||||
|
||||
|
|
@ -60,25 +67,25 @@ struct spa_node_info {
|
|||
* Contains the basic port information.
|
||||
*/
|
||||
struct spa_port_info {
|
||||
#define SPA_PORT_CHANGE_MASK_FLAGS (1<<0)
|
||||
#define SPA_PORT_CHANGE_MASK_RATE (1<<1)
|
||||
#define SPA_PORT_CHANGE_MASK_PROPS (1<<2)
|
||||
#define SPA_PORT_CHANGE_MASK_FLAGS (1u<<0)
|
||||
#define SPA_PORT_CHANGE_MASK_RATE (1u<<1)
|
||||
#define SPA_PORT_CHANGE_MASK_PROPS (1u<<2)
|
||||
uint64_t change_mask;
|
||||
|
||||
#define SPA_PORT_INFO_FLAG_REMOVABLE (1<<0) /**< port can be removed */
|
||||
#define SPA_PORT_INFO_FLAG_OPTIONAL (1<<1) /**< processing on port is optional */
|
||||
#define SPA_PORT_INFO_FLAG_CAN_ALLOC_BUFFERS (1<<2) /**< the port can allocate buffer data */
|
||||
#define SPA_PORT_INFO_FLAG_CAN_USE_BUFFERS (1<<3) /**< the port can use a provided buffer */
|
||||
#define SPA_PORT_INFO_FLAG_IN_PLACE (1<<4) /**< the port can process data in-place and
|
||||
#define SPA_PORT_FLAG_REMOVABLE (1u<<0) /**< port can be removed */
|
||||
#define SPA_PORT_FLAG_OPTIONAL (1u<<1) /**< processing on port is optional */
|
||||
#define SPA_PORT_FLAG_CAN_ALLOC_BUFFERS (1u<<2) /**< the port can allocate buffer data */
|
||||
#define SPA_PORT_FLAG_CAN_USE_BUFFERS (1u<<3) /**< the port can use a provided buffer */
|
||||
#define SPA_PORT_FLAG_IN_PLACE (1u<<4) /**< the port can process data in-place and
|
||||
* will need a writable input buffer */
|
||||
#define SPA_PORT_INFO_FLAG_NO_REF (1<<5) /**< the port does not keep a ref on the buffer */
|
||||
#define SPA_PORT_INFO_FLAG_LIVE (1<<6) /**< output buffers from this port are
|
||||
#define SPA_PORT_FLAG_NO_REF (1u<<5) /**< the port does not keep a ref on the buffer */
|
||||
#define SPA_PORT_FLAG_LIVE (1u<<6) /**< output buffers from this port are
|
||||
* timestamped against a live clock. */
|
||||
#define SPA_PORT_INFO_FLAG_PHYSICAL (1<<7) /**< connects to some device */
|
||||
#define SPA_PORT_INFO_FLAG_TERMINAL (1<<8) /**< data was not created from this port
|
||||
#define SPA_PORT_FLAG_PHYSICAL (1u<<7) /**< connects to some device */
|
||||
#define SPA_PORT_FLAG_TERMINAL (1u<<8) /**< data was not created from this port
|
||||
* or will not be made available on another
|
||||
* port */
|
||||
#define SPA_PORT_INFO_FLAG_DYNAMIC_DATA (1<<9) /**< data pointer on buffers can be changed */
|
||||
#define SPA_PORT_FLAG_DYNAMIC_DATA (1u<<9) /**< data pointer on buffers can be changed */
|
||||
uint32_t flags; /**< port flags */
|
||||
uint32_t rate; /**< rate of sequence numbers on port */
|
||||
const struct spa_dict *props; /**< extra port properties */
|
||||
|
|
|
|||
|
|
@ -248,6 +248,7 @@ static void emit_node_info(struct state *this)
|
|||
struct spa_node_info info;
|
||||
|
||||
info = SPA_NODE_INFO_INIT();
|
||||
info.max_input_ports = 1;
|
||||
info.change_mask = SPA_NODE_CHANGE_MASK_PROPS;
|
||||
info.props = &SPA_DICT_INIT_ARRAY(node_info_items);
|
||||
|
||||
|
|
@ -718,10 +719,10 @@ impl_init(const struct spa_handle_factory *factory,
|
|||
|
||||
this->info = SPA_PORT_INFO_INIT();
|
||||
this->info.change_mask |= SPA_PORT_CHANGE_MASK_FLAGS;
|
||||
this->info.flags = SPA_PORT_INFO_FLAG_CAN_USE_BUFFERS |
|
||||
SPA_PORT_INFO_FLAG_LIVE |
|
||||
SPA_PORT_INFO_FLAG_PHYSICAL |
|
||||
SPA_PORT_INFO_FLAG_TERMINAL;
|
||||
this->info.flags = SPA_PORT_FLAG_CAN_USE_BUFFERS |
|
||||
SPA_PORT_FLAG_LIVE |
|
||||
SPA_PORT_FLAG_PHYSICAL |
|
||||
SPA_PORT_FLAG_TERMINAL;
|
||||
|
||||
spa_list_init(&this->ready);
|
||||
|
||||
|
|
|
|||
|
|
@ -249,6 +249,7 @@ static void emit_node_info(struct state *this)
|
|||
struct spa_node_info info;
|
||||
|
||||
info = SPA_NODE_INFO_INIT();
|
||||
info.max_output_ports = 1;
|
||||
info.change_mask = SPA_NODE_CHANGE_MASK_PROPS;
|
||||
info.props = &SPA_DICT_INIT_ARRAY(node_info_items);
|
||||
|
||||
|
|
@ -731,10 +732,10 @@ impl_init(const struct spa_handle_factory *factory,
|
|||
|
||||
this->info = SPA_PORT_INFO_INIT();
|
||||
this->info.change_mask = SPA_PORT_CHANGE_MASK_FLAGS;
|
||||
this->info.flags = SPA_PORT_INFO_FLAG_CAN_USE_BUFFERS |
|
||||
SPA_PORT_INFO_FLAG_LIVE |
|
||||
SPA_PORT_INFO_FLAG_PHYSICAL |
|
||||
SPA_PORT_INFO_FLAG_TERMINAL;
|
||||
this->info.flags = SPA_PORT_FLAG_CAN_USE_BUFFERS |
|
||||
SPA_PORT_FLAG_LIVE |
|
||||
SPA_PORT_FLAG_PHYSICAL |
|
||||
SPA_PORT_FLAG_TERMINAL;
|
||||
|
||||
spa_list_init(&this->free);
|
||||
spa_list_init(&this->ready);
|
||||
|
|
|
|||
|
|
@ -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) {
|
||||
|
|
|
|||
|
|
@ -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);
|
||||
|
|
|
|||
|
|
@ -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);
|
||||
|
||||
|
|
|
|||
|
|
@ -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;
|
||||
|
|
|
|||
|
|
@ -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);
|
||||
|
|
|
|||
|
|
@ -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;
|
||||
}
|
||||
|
|
|
|||
|
|
@ -223,10 +223,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)
|
||||
|
|
@ -926,8 +926,8 @@ impl_init(const struct spa_handle_factory *factory,
|
|||
port->valid = true;
|
||||
port->direction = SPA_DIRECTION_OUTPUT;
|
||||
port->id = 0;
|
||||
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);
|
||||
|
||||
spa_audiomixer_get_ops(&this->ops);
|
||||
|
|
|
|||
|
|
@ -261,9 +261,9 @@ static int impl_node_set_param(struct spa_node *node, uint32_t id, uint32_t flag
|
|||
SPA_PROP_volume, SPA_POD_OPT_Float(&p->volume));
|
||||
|
||||
if (p->live)
|
||||
this->info.flags |= SPA_PORT_INFO_FLAG_LIVE;
|
||||
this->info.flags |= SPA_PORT_FLAG_LIVE;
|
||||
else
|
||||
this->info.flags &= ~SPA_PORT_INFO_FLAG_LIVE;
|
||||
this->info.flags &= ~SPA_PORT_FLAG_LIVE;
|
||||
}
|
||||
else
|
||||
return -ENOENT;
|
||||
|
|
@ -454,6 +454,7 @@ static void emit_node_info(struct impl *this)
|
|||
struct spa_node_info info;
|
||||
|
||||
info = SPA_NODE_INFO_INIT();
|
||||
info.max_output_ports = 1;
|
||||
info.change_mask = SPA_NODE_CHANGE_MASK_PROPS;
|
||||
info.props = &SPA_DICT_INIT_ARRAY(node_info_items);
|
||||
|
||||
|
|
@ -1021,9 +1022,9 @@ impl_init(const struct spa_handle_factory *factory,
|
|||
|
||||
this->info = SPA_PORT_INFO_INIT();
|
||||
this->info.change_mask = SPA_PORT_CHANGE_MASK_FLAGS;
|
||||
this->info.flags = SPA_PORT_INFO_FLAG_CAN_USE_BUFFERS | SPA_PORT_INFO_FLAG_NO_REF;
|
||||
this->info.flags = SPA_PORT_FLAG_CAN_USE_BUFFERS | SPA_PORT_FLAG_NO_REF;
|
||||
if (this->props.live)
|
||||
this->info.flags |= SPA_PORT_INFO_FLAG_LIVE;
|
||||
this->info.flags |= SPA_PORT_FLAG_LIVE;
|
||||
|
||||
spa_log_info(this->log, NAME " %p: initialized", this);
|
||||
|
||||
|
|
|
|||
|
|
@ -852,6 +852,7 @@ static void emit_node_info(struct impl *this)
|
|||
struct spa_node_info info;
|
||||
|
||||
info = SPA_NODE_INFO_INIT();
|
||||
info.max_input_ports = 1;
|
||||
info.change_mask = SPA_NODE_CHANGE_MASK_PROPS;
|
||||
info.props = &SPA_DICT_INIT_ARRAY(node_info_items);
|
||||
|
||||
|
|
@ -1079,7 +1080,7 @@ static int port_set_format(struct spa_node *node,
|
|||
}
|
||||
|
||||
if (this->have_format) {
|
||||
this->info.flags = SPA_PORT_INFO_FLAG_CAN_USE_BUFFERS | SPA_PORT_INFO_FLAG_LIVE;
|
||||
this->info.flags = SPA_PORT_FLAG_CAN_USE_BUFFERS | SPA_PORT_FLAG_LIVE;
|
||||
this->info.rate = this->current_format.info.raw.rate;
|
||||
}
|
||||
|
||||
|
|
@ -1329,7 +1330,9 @@ impl_init(const struct spa_handle_factory *factory,
|
|||
this->node = impl_node;
|
||||
reset_props(&this->props);
|
||||
|
||||
this->info.flags = SPA_PORT_INFO_FLAG_CAN_USE_BUFFERS;
|
||||
this->info = SPA_PORT_INFO_INIT();
|
||||
this->info.change_mask = SPA_PORT_CHANGE_MASK_FLAGS;
|
||||
this->info.flags = SPA_PORT_FLAG_CAN_USE_BUFFERS;
|
||||
|
||||
spa_list_init(&this->ready);
|
||||
|
||||
|
|
|
|||
|
|
@ -170,9 +170,9 @@ static int impl_node_set_param(struct spa_node *node, uint32_t id, uint32_t flag
|
|||
SPA_PROP_live, SPA_POD_OPT_Bool(&this->props.live));
|
||||
|
||||
if (this->props.live)
|
||||
this->info.flags |= SPA_PORT_INFO_FLAG_LIVE;
|
||||
this->info.flags |= SPA_PORT_FLAG_LIVE;
|
||||
else
|
||||
this->info.flags &= ~SPA_PORT_INFO_FLAG_LIVE;
|
||||
this->info.flags &= ~SPA_PORT_FLAG_LIVE;
|
||||
break;
|
||||
|
||||
default:
|
||||
|
|
@ -756,9 +756,9 @@ impl_init(const struct spa_handle_factory *factory,
|
|||
|
||||
this->info = SPA_PORT_INFO_INIT();
|
||||
this->info.change_mask = SPA_PORT_CHANGE_MASK_FLAGS;
|
||||
this->info.flags = SPA_PORT_INFO_FLAG_CAN_USE_BUFFERS | SPA_PORT_INFO_FLAG_NO_REF;
|
||||
this->info.flags = SPA_PORT_FLAG_CAN_USE_BUFFERS | SPA_PORT_FLAG_NO_REF;
|
||||
if (this->props.live)
|
||||
this->info.flags |= SPA_PORT_INFO_FLAG_LIVE;
|
||||
this->info.flags |= SPA_PORT_FLAG_LIVE;
|
||||
|
||||
spa_log_info(this->log, NAME " %p: initialized", this);
|
||||
|
||||
|
|
|
|||
|
|
@ -185,9 +185,9 @@ static int impl_node_set_param(struct spa_node *node, uint32_t id, uint32_t flag
|
|||
SPA_PROP_patternType, SPA_POD_OPT_Id(&p->pattern));
|
||||
|
||||
if (p->live)
|
||||
this->info.flags |= SPA_PORT_INFO_FLAG_LIVE;
|
||||
this->info.flags |= SPA_PORT_FLAG_LIVE;
|
||||
else
|
||||
this->info.flags &= ~SPA_PORT_INFO_FLAG_LIVE;
|
||||
this->info.flags &= ~SPA_PORT_FLAG_LIVE;
|
||||
break;
|
||||
}
|
||||
default:
|
||||
|
|
@ -791,9 +791,9 @@ impl_init(const struct spa_handle_factory *factory,
|
|||
|
||||
this->info = SPA_PORT_INFO_INIT();
|
||||
this->info.change_mask = SPA_PORT_CHANGE_MASK_FLAGS;
|
||||
this->info.flags = SPA_PORT_INFO_FLAG_CAN_USE_BUFFERS | SPA_PORT_INFO_FLAG_NO_REF;
|
||||
this->info.flags = SPA_PORT_FLAG_CAN_USE_BUFFERS | SPA_PORT_FLAG_NO_REF;
|
||||
if (this->props.live)
|
||||
this->info.flags |= SPA_PORT_INFO_FLAG_LIVE;
|
||||
this->info.flags |= SPA_PORT_FLAG_LIVE;
|
||||
|
||||
spa_log_info(this->log, NAME " %p: initialized", this);
|
||||
|
||||
|
|
|
|||
|
|
@ -338,6 +338,7 @@ static void emit_node_info(struct impl *this)
|
|||
struct spa_node_info info;
|
||||
|
||||
info = SPA_NODE_INFO_INIT();
|
||||
info.max_output_ports = 1;
|
||||
info.change_mask = SPA_NODE_CHANGE_MASK_PROPS;
|
||||
info.props = &SPA_DICT_INIT_ARRAY(info_items);
|
||||
|
||||
|
|
@ -968,9 +969,9 @@ impl_init(const struct spa_handle_factory *factory,
|
|||
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_LIVE |
|
||||
SPA_PORT_INFO_FLAG_PHYSICAL |
|
||||
SPA_PORT_INFO_FLAG_TERMINAL;
|
||||
port->info.flags = SPA_PORT_FLAG_LIVE |
|
||||
SPA_PORT_FLAG_PHYSICAL |
|
||||
SPA_PORT_FLAG_TERMINAL;
|
||||
|
||||
port->export_buf = true;
|
||||
port->have_query_ext_ctrl = true;
|
||||
|
|
|
|||
|
|
@ -914,11 +914,11 @@ static int spa_v4l2_set_format(struct impl *this, struct spa_video_info *format,
|
|||
|
||||
port->fmt = fmt;
|
||||
port->info.change_mask = SPA_PORT_CHANGE_MASK_FLAGS | SPA_PORT_CHANGE_MASK_RATE;
|
||||
port->info.flags = (port->export_buf ? SPA_PORT_INFO_FLAG_CAN_ALLOC_BUFFERS : 0) |
|
||||
SPA_PORT_INFO_FLAG_CAN_USE_BUFFERS |
|
||||
SPA_PORT_INFO_FLAG_LIVE |
|
||||
SPA_PORT_INFO_FLAG_PHYSICAL |
|
||||
SPA_PORT_INFO_FLAG_TERMINAL;
|
||||
port->info.flags = (port->export_buf ? SPA_PORT_FLAG_CAN_ALLOC_BUFFERS : 0) |
|
||||
SPA_PORT_FLAG_CAN_USE_BUFFERS |
|
||||
SPA_PORT_FLAG_LIVE |
|
||||
SPA_PORT_FLAG_PHYSICAL |
|
||||
SPA_PORT_FLAG_TERMINAL;
|
||||
port->info.rate = streamparm.parm.capture.timeperframe.denominator;
|
||||
if (this->callbacks && this->callbacks->port_info)
|
||||
this->callbacks->port_info(this->callbacks_data, SPA_DIRECTION_OUTPUT, 0, &port->info);
|
||||
|
|
|
|||
|
|
@ -234,9 +234,9 @@ static int impl_node_set_param(struct spa_node *node, uint32_t id, uint32_t flag
|
|||
SPA_PROP_patternType, SPA_POD_OPT_Int(&p->pattern));
|
||||
|
||||
if (p->live)
|
||||
this->info.flags |= SPA_PORT_INFO_FLAG_LIVE;
|
||||
this->info.flags |= SPA_PORT_FLAG_LIVE;
|
||||
else
|
||||
this->info.flags &= ~SPA_PORT_INFO_FLAG_LIVE;
|
||||
this->info.flags &= ~SPA_PORT_FLAG_LIVE;
|
||||
break;
|
||||
}
|
||||
default:
|
||||
|
|
@ -398,6 +398,7 @@ static void emit_node_info(struct impl *this)
|
|||
struct spa_node_info info;
|
||||
|
||||
info = SPA_NODE_INFO_INIT();
|
||||
info.max_output_ports = 1;
|
||||
info.change_mask = SPA_NODE_CHANGE_MASK_PROPS;
|
||||
info.props = &SPA_DICT_INIT_ARRAY(node_info_items);
|
||||
|
||||
|
|
@ -897,9 +898,9 @@ impl_init(const struct spa_handle_factory *factory,
|
|||
|
||||
this->info = SPA_PORT_INFO_INIT();
|
||||
this->info.change_mask = SPA_PORT_CHANGE_MASK_FLAGS;
|
||||
this->info.flags = SPA_PORT_INFO_FLAG_CAN_USE_BUFFERS | SPA_PORT_INFO_FLAG_NO_REF;
|
||||
this->info.flags = SPA_PORT_FLAG_CAN_USE_BUFFERS | SPA_PORT_FLAG_NO_REF;
|
||||
if (this->props.live)
|
||||
this->info.flags |= SPA_PORT_INFO_FLAG_LIVE;
|
||||
this->info.flags |= SPA_PORT_FLAG_LIVE;
|
||||
|
||||
spa_log_info(this->log, NAME " %p: initialized", this);
|
||||
|
||||
|
|
|
|||
|
|
@ -811,15 +811,15 @@ impl_init(const struct spa_handle_factory *factory,
|
|||
port = GET_IN_PORT(this, 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_IN_PLACE;
|
||||
port->info.flags = SPA_PORT_FLAG_CAN_USE_BUFFERS |
|
||||
SPA_PORT_FLAG_IN_PLACE;
|
||||
spa_list_init(&port->empty);
|
||||
|
||||
port = GET_OUT_PORT(this, 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->empty);
|
||||
|
||||
return 0;
|
||||
|
|
|
|||
|
|
@ -139,6 +139,10 @@ inspect_port_params(struct data *data, struct spa_node *node,
|
|||
static void node_info(void *_data, const struct spa_node_info *info)
|
||||
{
|
||||
struct data *data = _data;
|
||||
|
||||
printf("max input ports: %u\n", info->max_input_ports);
|
||||
printf("max output ports: %u\n", info->max_output_ports);
|
||||
|
||||
if (info->change_mask & SPA_NODE_CHANGE_MASK_PROPS) {
|
||||
printf("node properties:\n");
|
||||
spa_debug_dict(2, info->props);
|
||||
|
|
|
|||
|
|
@ -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