mirror of
https://gitlab.freedesktop.org/pipewire/pipewire.git
synced 2025-11-01 22:58:50 -04:00
node: Add port_info event
Add a port_info event. With this, we get updates to ports pushed to us, which is more convenient and also allows for better dynamic add/remove of ports. We don't need to the PortChanged event anymore We can remove the get_port_ids/get_n_ports/port_get_info methods. Update plugins
This commit is contained in:
parent
3c78036a97
commit
21957e9e8d
37 changed files with 1068 additions and 2288 deletions
|
|
@ -50,10 +50,10 @@ struct buffer {
|
|||
struct link {
|
||||
struct spa_node *out_node;
|
||||
uint32_t out_port;
|
||||
const struct spa_port_info *out_info;
|
||||
uint32_t out_flags;
|
||||
struct spa_node *in_node;
|
||||
uint32_t in_port;
|
||||
const struct spa_port_info *in_info;
|
||||
uint32_t in_flags;
|
||||
struct spa_io_buffers io;
|
||||
bool negotiated;
|
||||
uint32_t n_buffers;
|
||||
|
|
@ -104,17 +104,13 @@ static int make_link(struct impl *this,
|
|||
l->io.status = SPA_STATUS_NEED_BUFFER;
|
||||
l->io.buffer_id = SPA_ID_INVALID;
|
||||
l->n_buffers = 0;
|
||||
l->out_flags = 0;
|
||||
l->in_flags = 0;
|
||||
|
||||
spa_node_port_get_info(out_node,
|
||||
SPA_DIRECTION_OUTPUT, out_port,
|
||||
&l->out_info);
|
||||
spa_node_port_set_io(out_node,
|
||||
SPA_DIRECTION_OUTPUT, out_port,
|
||||
SPA_IO_Buffers,
|
||||
&l->io, sizeof(l->io));
|
||||
spa_node_port_get_info(in_node,
|
||||
SPA_DIRECTION_INPUT, in_port,
|
||||
&l->in_info);
|
||||
spa_node_port_set_io(in_node,
|
||||
SPA_DIRECTION_INPUT, in_port,
|
||||
SPA_IO_Buffers,
|
||||
|
|
@ -287,17 +283,10 @@ static int negotiate_link_buffers(struct impl *this, struct link *link)
|
|||
|
||||
spa_pod_fixate(param);
|
||||
|
||||
if (link->in_info)
|
||||
in_alloc = SPA_FLAG_CHECK(link->in_info->flags,
|
||||
in_alloc = SPA_FLAG_CHECK(link->in_flags,
|
||||
SPA_PORT_INFO_FLAG_CAN_ALLOC_BUFFERS);
|
||||
else
|
||||
in_alloc = false;
|
||||
|
||||
if (link->out_info)
|
||||
out_alloc = SPA_FLAG_CHECK(link->out_info->flags,
|
||||
out_alloc = SPA_FLAG_CHECK(link->out_flags,
|
||||
SPA_PORT_INFO_FLAG_CAN_ALLOC_BUFFERS);
|
||||
else
|
||||
out_alloc = false;
|
||||
|
||||
flags = 0;
|
||||
if (out_alloc || in_alloc) {
|
||||
|
|
@ -514,9 +503,6 @@ static int impl_node_set_param(struct spa_node *node, uint32_t id, uint32_t flag
|
|||
res = -EINVAL;
|
||||
break;
|
||||
}
|
||||
if (this->callbacks && this->callbacks->event)
|
||||
this->callbacks->event(this->user_data,
|
||||
&SPA_NODE_EVENT_INIT(SPA_NODE_EVENT_PortsChanged));
|
||||
break;
|
||||
}
|
||||
case SPA_PARAM_Props:
|
||||
|
|
@ -555,6 +541,49 @@ static int impl_node_send_command(struct spa_node *node, const struct spa_comman
|
|||
return 0;
|
||||
}
|
||||
|
||||
static void emit_port_info(struct impl *this,
|
||||
enum spa_direction direction, uint32_t port,
|
||||
const struct spa_port_info *info)
|
||||
{
|
||||
if (this->callbacks && this->callbacks->port_info)
|
||||
this->callbacks->port_info(this->user_data, direction, port, info);
|
||||
}
|
||||
|
||||
|
||||
static void fmt_input_port_info(void *data,
|
||||
enum spa_direction direction, uint32_t port,
|
||||
const struct spa_port_info *info)
|
||||
{
|
||||
struct impl *this = data;
|
||||
|
||||
if (direction != SPA_DIRECTION_INPUT)
|
||||
return;
|
||||
|
||||
emit_port_info(this, direction, port, info);
|
||||
}
|
||||
|
||||
static struct spa_node_callbacks fmt_input_callbacks = {
|
||||
SPA_VERSION_NODE_CALLBACKS,
|
||||
.port_info = fmt_input_port_info
|
||||
};
|
||||
|
||||
static void fmt_output_port_info(void *data,
|
||||
enum spa_direction direction, uint32_t port,
|
||||
const struct spa_port_info *info)
|
||||
{
|
||||
struct impl *this = data;
|
||||
|
||||
if (direction != SPA_DIRECTION_OUTPUT)
|
||||
return;
|
||||
|
||||
emit_port_info(this, direction, port, info);
|
||||
}
|
||||
|
||||
static struct spa_node_callbacks fmt_output_callbacks = {
|
||||
SPA_VERSION_NODE_CALLBACKS,
|
||||
.port_info = fmt_output_port_info
|
||||
};
|
||||
|
||||
static int
|
||||
impl_node_set_callbacks(struct spa_node *node,
|
||||
const struct spa_node_callbacks *callbacks,
|
||||
|
|
@ -569,43 +598,8 @@ impl_node_set_callbacks(struct spa_node *node,
|
|||
this->callbacks = callbacks;
|
||||
this->user_data = user_data;
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
static int
|
||||
impl_node_get_n_ports(struct spa_node *node,
|
||||
uint32_t *n_input_ports,
|
||||
uint32_t *max_input_ports,
|
||||
uint32_t *n_output_ports,
|
||||
uint32_t *max_output_ports)
|
||||
{
|
||||
struct impl *this;
|
||||
|
||||
spa_return_val_if_fail(node != NULL, -EINVAL);
|
||||
|
||||
this = SPA_CONTAINER_OF(node, struct impl, node);
|
||||
|
||||
spa_node_get_n_ports(this->fmt[SPA_DIRECTION_INPUT], n_input_ports, max_input_ports, NULL, NULL);
|
||||
spa_node_get_n_ports(this->fmt[SPA_DIRECTION_OUTPUT], NULL, NULL, n_output_ports, max_output_ports);
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
static int
|
||||
impl_node_get_port_ids(struct spa_node *node,
|
||||
uint32_t *input_ids,
|
||||
uint32_t n_input_ids,
|
||||
uint32_t *output_ids,
|
||||
uint32_t n_output_ids)
|
||||
{
|
||||
struct impl *this;
|
||||
|
||||
spa_return_val_if_fail(node != NULL, -EINVAL);
|
||||
|
||||
this = SPA_CONTAINER_OF(node, struct impl, node);
|
||||
|
||||
spa_node_get_port_ids(this->fmt[SPA_DIRECTION_INPUT], input_ids, n_input_ids, NULL, 0);
|
||||
spa_node_get_port_ids(this->fmt[SPA_DIRECTION_OUTPUT], NULL, 0, output_ids, n_output_ids);
|
||||
spa_node_set_callbacks(this->fmt[SPA_DIRECTION_INPUT], &fmt_input_callbacks, this);
|
||||
spa_node_set_callbacks(this->fmt[SPA_DIRECTION_OUTPUT], &fmt_output_callbacks, this);
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
|
@ -633,22 +627,6 @@ impl_node_remove_port(struct spa_node *node, enum spa_direction direction, uint3
|
|||
return spa_node_remove_port(this->fmt[direction], direction, port_id);
|
||||
}
|
||||
|
||||
static int
|
||||
impl_node_port_get_info(struct spa_node *node,
|
||||
enum spa_direction direction,
|
||||
uint32_t port_id,
|
||||
const struct spa_port_info **info)
|
||||
{
|
||||
struct impl *this;
|
||||
|
||||
spa_return_val_if_fail(node != NULL, -EINVAL);
|
||||
spa_return_val_if_fail(info != NULL, -EINVAL);
|
||||
|
||||
this = SPA_CONTAINER_OF(node, struct impl, node);
|
||||
|
||||
return spa_node_port_get_info(this->fmt[direction], direction, port_id, info);
|
||||
}
|
||||
|
||||
static int
|
||||
impl_node_port_enum_params(struct spa_node *node,
|
||||
enum spa_direction direction, uint32_t port_id,
|
||||
|
|
@ -875,23 +853,20 @@ static int impl_node_process(struct spa_node *node)
|
|||
|
||||
static const struct spa_node impl_node = {
|
||||
SPA_VERSION_NODE,
|
||||
impl_node_enum_params,
|
||||
impl_node_set_param,
|
||||
impl_node_set_io,
|
||||
impl_node_send_command,
|
||||
impl_node_set_callbacks,
|
||||
impl_node_get_n_ports,
|
||||
impl_node_get_port_ids,
|
||||
impl_node_add_port,
|
||||
impl_node_remove_port,
|
||||
impl_node_port_get_info,
|
||||
impl_node_port_enum_params,
|
||||
impl_node_port_set_param,
|
||||
impl_node_port_use_buffers,
|
||||
impl_node_port_alloc_buffers,
|
||||
impl_node_port_set_io,
|
||||
impl_node_port_reuse_buffer,
|
||||
impl_node_process,
|
||||
.enum_params = impl_node_enum_params,
|
||||
.set_param = impl_node_set_param,
|
||||
.set_io = impl_node_set_io,
|
||||
.send_command = impl_node_send_command,
|
||||
.set_callbacks = impl_node_set_callbacks,
|
||||
.add_port = impl_node_add_port,
|
||||
.remove_port = impl_node_remove_port,
|
||||
.port_enum_params = impl_node_port_enum_params,
|
||||
.port_set_param = impl_node_port_set_param,
|
||||
.port_use_buffers = impl_node_port_use_buffers,
|
||||
.port_alloc_buffers = impl_node_port_alloc_buffers,
|
||||
.port_set_io = impl_node_port_set_io,
|
||||
.port_reuse_buffer = impl_node_port_reuse_buffer,
|
||||
.process = impl_node_process,
|
||||
};
|
||||
|
||||
static int impl_get_interface(struct spa_handle *handle, uint32_t type, void **interface)
|
||||
|
|
|
|||
|
|
@ -70,6 +70,7 @@ struct buffer {
|
|||
};
|
||||
|
||||
struct port {
|
||||
uint32_t direction;
|
||||
uint32_t id;
|
||||
|
||||
struct spa_io_buffers *io;
|
||||
|
|
@ -582,6 +583,14 @@ static int impl_node_send_command(struct spa_node *node, const struct spa_comman
|
|||
return 0;
|
||||
}
|
||||
|
||||
static void emit_port_info(struct impl *this, struct port *port)
|
||||
{
|
||||
if (this->callbacks && this->callbacks->port_info && port->info.change_mask) {
|
||||
this->callbacks->port_info(this->user_data, port->direction, port->id, &port->info);
|
||||
port->info.change_mask = 0;
|
||||
}
|
||||
}
|
||||
|
||||
static int
|
||||
impl_node_set_callbacks(struct spa_node *node,
|
||||
const struct spa_node_callbacks *callbacks,
|
||||
|
|
@ -596,43 +605,8 @@ impl_node_set_callbacks(struct spa_node *node,
|
|||
this->callbacks = callbacks;
|
||||
this->user_data = user_data;
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
static int
|
||||
impl_node_get_n_ports(struct spa_node *node,
|
||||
uint32_t *n_input_ports,
|
||||
uint32_t *max_input_ports,
|
||||
uint32_t *n_output_ports,
|
||||
uint32_t *max_output_ports)
|
||||
{
|
||||
spa_return_val_if_fail(node != NULL, -EINVAL);
|
||||
|
||||
if (n_input_ports)
|
||||
*n_input_ports = 1;
|
||||
if (max_input_ports)
|
||||
*max_input_ports = 1;
|
||||
if (n_output_ports)
|
||||
*n_output_ports = 1;
|
||||
if (max_output_ports)
|
||||
*max_output_ports = 1;
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
static int
|
||||
impl_node_get_port_ids(struct spa_node *node,
|
||||
uint32_t *input_ids,
|
||||
uint32_t n_input_ids,
|
||||
uint32_t *output_ids,
|
||||
uint32_t n_output_ids)
|
||||
{
|
||||
spa_return_val_if_fail(node != NULL, -EINVAL);
|
||||
|
||||
if (n_input_ids && input_ids)
|
||||
input_ids[0] = 0;
|
||||
if (n_output_ids > 0 && output_ids)
|
||||
output_ids[0] = 0;
|
||||
emit_port_info(this, GET_IN_PORT(this, 0));
|
||||
emit_port_info(this, GET_OUT_PORT(this, 0));
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
|
@ -648,28 +622,6 @@ impl_node_remove_port(struct spa_node *node, enum spa_direction direction, uint3
|
|||
return -ENOTSUP;
|
||||
}
|
||||
|
||||
static int
|
||||
impl_node_port_get_info(struct spa_node *node,
|
||||
enum spa_direction direction,
|
||||
uint32_t port_id,
|
||||
const struct spa_port_info **info)
|
||||
{
|
||||
struct impl *this;
|
||||
struct port *port;
|
||||
|
||||
spa_return_val_if_fail(node != NULL, -EINVAL);
|
||||
spa_return_val_if_fail(info != NULL, -EINVAL);
|
||||
|
||||
this = SPA_CONTAINER_OF(node, struct impl, node);
|
||||
|
||||
spa_return_val_if_fail(CHECK_PORT(this, direction, port_id), -EINVAL);
|
||||
|
||||
port = GET_PORT(this, direction, port_id);
|
||||
*info = &port->info;
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
static int port_enum_formats(struct spa_node *node,
|
||||
enum spa_direction direction, uint32_t port_id,
|
||||
uint32_t *index,
|
||||
|
|
@ -1156,23 +1108,20 @@ static int impl_node_process(struct spa_node *node)
|
|||
|
||||
static const struct spa_node impl_node = {
|
||||
SPA_VERSION_NODE,
|
||||
impl_node_enum_params,
|
||||
impl_node_set_param,
|
||||
impl_node_set_io,
|
||||
impl_node_send_command,
|
||||
impl_node_set_callbacks,
|
||||
impl_node_get_n_ports,
|
||||
impl_node_get_port_ids,
|
||||
impl_node_add_port,
|
||||
impl_node_remove_port,
|
||||
impl_node_port_get_info,
|
||||
impl_node_port_enum_params,
|
||||
impl_node_port_set_param,
|
||||
impl_node_port_use_buffers,
|
||||
impl_node_port_alloc_buffers,
|
||||
impl_node_port_set_io,
|
||||
impl_node_port_reuse_buffer,
|
||||
impl_node_process,
|
||||
.enum_params = impl_node_enum_params,
|
||||
.set_param = impl_node_set_param,
|
||||
.set_io = impl_node_set_io,
|
||||
.send_command = impl_node_send_command,
|
||||
.set_callbacks = impl_node_set_callbacks,
|
||||
.add_port = impl_node_add_port,
|
||||
.remove_port = impl_node_remove_port,
|
||||
.port_enum_params = impl_node_port_enum_params,
|
||||
.port_set_param = impl_node_port_set_param,
|
||||
.port_use_buffers = impl_node_port_use_buffers,
|
||||
.port_alloc_buffers = impl_node_port_alloc_buffers,
|
||||
.port_set_io = impl_node_port_set_io,
|
||||
.port_reuse_buffer = impl_node_port_reuse_buffer,
|
||||
.process = impl_node_process,
|
||||
};
|
||||
|
||||
static int impl_get_interface(struct spa_handle *handle, uint32_t type, void **interface)
|
||||
|
|
@ -1240,12 +1189,18 @@ impl_init(const struct spa_handle_factory *factory,
|
|||
this->node = impl_node;
|
||||
|
||||
port = GET_OUT_PORT(this, 0);
|
||||
port->direction = SPA_DIRECTION_OUTPUT;
|
||||
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_list_init(&port->queue);
|
||||
|
||||
port = GET_IN_PORT(this, 0);
|
||||
port->direction = SPA_DIRECTION_INPUT;
|
||||
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_list_init(&port->queue);
|
||||
|
||||
|
|
|
|||
|
|
@ -72,6 +72,7 @@ struct buffer {
|
|||
};
|
||||
|
||||
struct port {
|
||||
uint32_t direction;
|
||||
uint32_t id;
|
||||
|
||||
struct spa_io_buffers *io;
|
||||
|
|
@ -228,6 +229,14 @@ static int impl_node_send_command(struct spa_node *node, const struct spa_comman
|
|||
return 0;
|
||||
}
|
||||
|
||||
static void emit_port_info(struct impl *this, struct port *port)
|
||||
{
|
||||
if (this->callbacks && this->callbacks->port_info && port->info.change_mask) {
|
||||
this->callbacks->port_info(this->user_data, port->direction, port->id, &port->info);
|
||||
port->info.change_mask = 0;
|
||||
}
|
||||
}
|
||||
|
||||
static int
|
||||
impl_node_set_callbacks(struct spa_node *node,
|
||||
const struct spa_node_callbacks *callbacks,
|
||||
|
|
@ -242,43 +251,8 @@ impl_node_set_callbacks(struct spa_node *node,
|
|||
this->callbacks = callbacks;
|
||||
this->user_data = user_data;
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
static int
|
||||
impl_node_get_n_ports(struct spa_node *node,
|
||||
uint32_t *n_input_ports,
|
||||
uint32_t *max_input_ports,
|
||||
uint32_t *n_output_ports,
|
||||
uint32_t *max_output_ports)
|
||||
{
|
||||
spa_return_val_if_fail(node != NULL, -EINVAL);
|
||||
|
||||
if (n_input_ports)
|
||||
*n_input_ports = 1;
|
||||
if (max_input_ports)
|
||||
*max_input_ports = 1;
|
||||
if (n_output_ports)
|
||||
*n_output_ports = 1;
|
||||
if (max_output_ports)
|
||||
*max_output_ports = 1;
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
static int
|
||||
impl_node_get_port_ids(struct spa_node *node,
|
||||
uint32_t *input_ids,
|
||||
uint32_t n_input_ids,
|
||||
uint32_t *output_ids,
|
||||
uint32_t n_output_ids)
|
||||
{
|
||||
spa_return_val_if_fail(node != NULL, -EINVAL);
|
||||
|
||||
if (input_ids && n_input_ids > 0)
|
||||
input_ids[0] = 0;
|
||||
if (output_ids && n_output_ids > 0)
|
||||
output_ids[0] = 0;
|
||||
emit_port_info(this, GET_IN_PORT(this, 0));
|
||||
emit_port_info(this, GET_OUT_PORT(this, 0));
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
|
@ -294,28 +268,6 @@ impl_node_remove_port(struct spa_node *node, enum spa_direction direction, uint3
|
|||
return -ENOTSUP;
|
||||
}
|
||||
|
||||
static int
|
||||
impl_node_port_get_info(struct spa_node *node,
|
||||
enum spa_direction direction,
|
||||
uint32_t port_id,
|
||||
const struct spa_port_info **info)
|
||||
{
|
||||
struct impl *this;
|
||||
struct port *port;
|
||||
|
||||
spa_return_val_if_fail(node != NULL, -EINVAL);
|
||||
spa_return_val_if_fail(info != NULL, -EINVAL);
|
||||
|
||||
this = SPA_CONTAINER_OF(node, struct impl, node);
|
||||
|
||||
spa_return_val_if_fail(CHECK_PORT(this, direction, port_id), -EINVAL);
|
||||
|
||||
port = GET_PORT(this, direction, port_id);
|
||||
*info = &port->info;
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
static int int32_cmp(const void *v1, const void *v2)
|
||||
{
|
||||
return *(int32_t*)v1 - *(int32_t*)v2;
|
||||
|
|
@ -899,23 +851,20 @@ static int impl_node_process(struct spa_node *node)
|
|||
|
||||
static const struct spa_node impl_node = {
|
||||
SPA_VERSION_NODE,
|
||||
impl_node_enum_params,
|
||||
impl_node_set_param,
|
||||
impl_node_set_io,
|
||||
impl_node_send_command,
|
||||
impl_node_set_callbacks,
|
||||
impl_node_get_n_ports,
|
||||
impl_node_get_port_ids,
|
||||
impl_node_add_port,
|
||||
impl_node_remove_port,
|
||||
impl_node_port_get_info,
|
||||
impl_node_port_enum_params,
|
||||
impl_node_port_set_param,
|
||||
impl_node_port_use_buffers,
|
||||
impl_node_port_alloc_buffers,
|
||||
impl_node_port_set_io,
|
||||
impl_node_port_reuse_buffer,
|
||||
impl_node_process,
|
||||
.enum_params = impl_node_enum_params,
|
||||
.set_param = impl_node_set_param,
|
||||
.set_io = impl_node_set_io,
|
||||
.send_command = impl_node_send_command,
|
||||
.set_callbacks = impl_node_set_callbacks,
|
||||
.add_port = impl_node_add_port,
|
||||
.remove_port = impl_node_remove_port,
|
||||
.port_enum_params = impl_node_port_enum_params,
|
||||
.port_set_param = impl_node_port_set_param,
|
||||
.port_use_buffers = impl_node_port_use_buffers,
|
||||
.port_alloc_buffers = impl_node_port_alloc_buffers,
|
||||
.port_set_io = impl_node_port_set_io,
|
||||
.port_reuse_buffer = impl_node_port_reuse_buffer,
|
||||
.process = impl_node_process,
|
||||
};
|
||||
|
||||
static int impl_get_interface(struct spa_handle *handle, uint32_t type, void **interface)
|
||||
|
|
@ -945,15 +894,19 @@ static int init_port(struct impl *this, enum spa_direction direction, uint32_t p
|
|||
struct port *port;
|
||||
|
||||
port = GET_PORT(this, direction, port_id);
|
||||
port->direction = direction;
|
||||
port->id = port_id;
|
||||
|
||||
spa_list_init(&port->queue);
|
||||
port->info = SPA_PORT_INFO_INIT();
|
||||
port->info.change_mask = SPA_PORT_CHANGE_MASK_FLAGS | SPA_PORT_CHANGE_MASK_PROPS;
|
||||
port->info.flags = flags;
|
||||
|
||||
port->info_props_items[0] = SPA_DICT_ITEM_INIT("port.dsp", "32 bit float mono audio");
|
||||
port->info_props = SPA_DICT_INIT(port->info_props_items, 1);
|
||||
port->info.props = &port->info_props;
|
||||
port->have_format = false;
|
||||
emit_port_info(this, port);
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
|
|
|||
|
|
@ -55,6 +55,7 @@ struct buffer {
|
|||
};
|
||||
|
||||
struct port {
|
||||
uint32_t direction;
|
||||
uint32_t id;
|
||||
|
||||
struct spa_io_buffers *io;
|
||||
|
|
@ -112,16 +113,35 @@ struct impl {
|
|||
|
||||
#define PORT_IS_DSP(d,p) (p != 0 || d != SPA_DIRECTION_OUTPUT)
|
||||
|
||||
static void emit_node_info(struct impl *this)
|
||||
{
|
||||
if (this->callbacks && this->callbacks->info) {
|
||||
struct spa_node_info info = SPA_NODE_INFO_INIT();
|
||||
info.change_mask = 0;
|
||||
this->callbacks->info(this->user_data, &info);
|
||||
}
|
||||
}
|
||||
static void emit_port_info(struct impl *this, struct port *port)
|
||||
{
|
||||
if (this->callbacks && this->callbacks->port_info && port->info.change_mask) {
|
||||
this->callbacks->port_info(this->user_data, port->direction, port->id, &port->info);
|
||||
port->info.change_mask = 0;
|
||||
}
|
||||
}
|
||||
|
||||
static int init_port(struct impl *this, enum spa_direction direction, uint32_t port_id,
|
||||
uint32_t rate, uint32_t position)
|
||||
{
|
||||
struct port *port = GET_PORT(this, direction, port_id);
|
||||
int n_items = 0;
|
||||
|
||||
port->direction = direction;
|
||||
port->id = port_id;
|
||||
|
||||
snprintf(port->position, 16, "%s", rindex(spa_type_audio_channel[position].name, ':')+1);
|
||||
|
||||
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_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);
|
||||
|
|
@ -141,6 +161,7 @@ static int init_port(struct impl *this, enum spa_direction direction, uint32_t p
|
|||
spa_list_init(&port->queue);
|
||||
|
||||
spa_log_debug(this->log, NAME " %p: add port %d", this, port_id);
|
||||
emit_port_info(this, port);
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
|
@ -232,6 +253,14 @@ static int impl_node_set_param(struct spa_node *node, uint32_t id, uint32_t flag
|
|||
spa_log_debug(this->log, NAME " %p: profile %d/%d", this,
|
||||
info.info.raw.rate, info.info.raw.channels);
|
||||
|
||||
if (this->callbacks && this->callbacks->port_info) {
|
||||
for (i = 0; i < this->port_count; i++) {
|
||||
this->callbacks->port_info(this->user_data, SPA_DIRECTION_INPUT, i, NULL);
|
||||
if (this->monitor)
|
||||
this->callbacks->port_info(this->user_data, SPA_DIRECTION_OUTPUT, i+1, NULL);
|
||||
}
|
||||
}
|
||||
|
||||
port->have_format = true;
|
||||
port->format = info;
|
||||
|
||||
|
|
@ -245,11 +274,6 @@ static int impl_node_set_param(struct spa_node *node, uint32_t id, uint32_t flag
|
|||
init_port(this, SPA_DIRECTION_OUTPUT, i+1, info.info.raw.rate,
|
||||
info.info.raw.position[i]);
|
||||
}
|
||||
|
||||
if (this->callbacks && this->callbacks->event)
|
||||
this->callbacks->event(this->user_data,
|
||||
&SPA_NODE_EVENT_INIT(SPA_NODE_EVENT_PortsChanged));
|
||||
|
||||
return 0;
|
||||
}
|
||||
default:
|
||||
|
|
@ -286,6 +310,7 @@ impl_node_set_callbacks(struct spa_node *node,
|
|||
void *user_data)
|
||||
{
|
||||
struct impl *this;
|
||||
uint32_t i;
|
||||
|
||||
spa_return_val_if_fail(node != NULL, -EINVAL);
|
||||
|
||||
|
|
@ -294,58 +319,11 @@ impl_node_set_callbacks(struct spa_node *node,
|
|||
this->callbacks = callbacks;
|
||||
this->user_data = user_data;
|
||||
|
||||
return 0;
|
||||
}
|
||||
emit_node_info(this);
|
||||
emit_port_info(this, GET_OUT_PORT(this, 0));
|
||||
for (i = 0; i < this->port_count; i++)
|
||||
emit_port_info(this, GET_IN_PORT(this, i));
|
||||
|
||||
static int
|
||||
impl_node_get_n_ports(struct spa_node *node,
|
||||
uint32_t *n_input_ports,
|
||||
uint32_t *max_input_ports,
|
||||
uint32_t *n_output_ports,
|
||||
uint32_t *max_output_ports)
|
||||
{
|
||||
struct impl *this;
|
||||
|
||||
spa_return_val_if_fail(node != NULL, -EINVAL);
|
||||
|
||||
this = SPA_CONTAINER_OF(node, struct impl, node);
|
||||
|
||||
if (n_input_ports)
|
||||
*n_input_ports = this->port_count;
|
||||
if (max_input_ports)
|
||||
*max_input_ports = this->port_count;
|
||||
if (n_output_ports)
|
||||
*n_output_ports = this->monitor_count + 1;
|
||||
if (max_output_ports)
|
||||
*max_output_ports = this->monitor_count + 1;
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
static int
|
||||
impl_node_get_port_ids(struct spa_node *node,
|
||||
uint32_t *input_ids,
|
||||
uint32_t n_input_ids,
|
||||
uint32_t *output_ids,
|
||||
uint32_t n_output_ids)
|
||||
{
|
||||
struct impl *this;
|
||||
uint32_t i;
|
||||
|
||||
spa_return_val_if_fail(node != NULL, -EINVAL);
|
||||
|
||||
this = SPA_CONTAINER_OF(node, struct impl, node);
|
||||
|
||||
if (input_ids) {
|
||||
n_input_ids = SPA_MIN(n_input_ids, this->port_count);
|
||||
for (i = 0; i < n_input_ids; i++)
|
||||
input_ids[i] = i;
|
||||
}
|
||||
if (output_ids) {
|
||||
n_output_ids = SPA_MIN(n_output_ids, this->monitor_count + 1);
|
||||
for (i = 0; i < n_output_ids; i++)
|
||||
output_ids[i] = i;
|
||||
}
|
||||
return 0;
|
||||
}
|
||||
|
||||
|
|
@ -362,28 +340,6 @@ impl_node_remove_port(struct spa_node *node, enum spa_direction direction, uint3
|
|||
return -ENOTSUP;
|
||||
}
|
||||
|
||||
static int
|
||||
impl_node_port_get_info(struct spa_node *node,
|
||||
enum spa_direction direction,
|
||||
uint32_t port_id,
|
||||
const struct spa_port_info **info)
|
||||
{
|
||||
struct impl *this;
|
||||
struct port *port;
|
||||
|
||||
spa_return_val_if_fail(node != NULL, -EINVAL);
|
||||
spa_return_val_if_fail(info != NULL, -EINVAL);
|
||||
|
||||
this = SPA_CONTAINER_OF(node, struct impl, node);
|
||||
|
||||
spa_return_val_if_fail(CHECK_PORT(this, direction, port_id), -EINVAL);
|
||||
|
||||
port = GET_PORT(this, direction, port_id);
|
||||
*info = &port->info;
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
static int port_enum_formats(struct spa_node *node,
|
||||
enum spa_direction direction, uint32_t port_id,
|
||||
uint32_t *index,
|
||||
|
|
@ -998,23 +954,20 @@ static int impl_node_process(struct spa_node *node)
|
|||
|
||||
static const struct spa_node impl_node = {
|
||||
SPA_VERSION_NODE,
|
||||
impl_node_enum_params,
|
||||
impl_node_set_param,
|
||||
impl_node_set_io,
|
||||
impl_node_send_command,
|
||||
impl_node_set_callbacks,
|
||||
impl_node_get_n_ports,
|
||||
impl_node_get_port_ids,
|
||||
impl_node_add_port,
|
||||
impl_node_remove_port,
|
||||
impl_node_port_get_info,
|
||||
impl_node_port_enum_params,
|
||||
impl_node_port_set_param,
|
||||
impl_node_port_use_buffers,
|
||||
impl_node_port_alloc_buffers,
|
||||
impl_node_port_set_io,
|
||||
impl_node_port_reuse_buffer,
|
||||
impl_node_process,
|
||||
.enum_params = impl_node_enum_params,
|
||||
.set_param = impl_node_set_param,
|
||||
.set_io = impl_node_set_io,
|
||||
.send_command = impl_node_send_command,
|
||||
.set_callbacks = impl_node_set_callbacks,
|
||||
.add_port = impl_node_add_port,
|
||||
.remove_port = impl_node_remove_port,
|
||||
.port_enum_params = impl_node_port_enum_params,
|
||||
.port_set_param = impl_node_port_set_param,
|
||||
.port_use_buffers = impl_node_port_use_buffers,
|
||||
.port_alloc_buffers = impl_node_port_alloc_buffers,
|
||||
.port_set_io = impl_node_port_set_io,
|
||||
.port_reuse_buffer = impl_node_port_reuse_buffer,
|
||||
.process = impl_node_process,
|
||||
};
|
||||
|
||||
static int impl_get_interface(struct spa_handle *handle, uint32_t type, void **interface)
|
||||
|
|
@ -1086,7 +1039,10 @@ impl_init(const struct spa_handle_factory *factory,
|
|||
this->node = impl_node;
|
||||
|
||||
port = GET_OUT_PORT(this, 0);
|
||||
port->direction = SPA_DIRECTION_OUTPUT;
|
||||
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_list_init(&port->queue);
|
||||
|
||||
|
|
|
|||
|
|
@ -68,6 +68,7 @@ struct buffer {
|
|||
};
|
||||
|
||||
struct port {
|
||||
uint32_t direction;
|
||||
uint32_t id;
|
||||
|
||||
struct spa_io_buffers *io;
|
||||
|
|
@ -231,6 +232,14 @@ static int impl_node_send_command(struct spa_node *node, const struct spa_comman
|
|||
return 0;
|
||||
}
|
||||
|
||||
static void emit_port_info(struct impl *this, struct port *port)
|
||||
{
|
||||
if (this->callbacks && this->callbacks->port_info && port->info.change_mask) {
|
||||
this->callbacks->port_info(this->user_data, port->direction, port->id, &port->info);
|
||||
port->info.change_mask = 0;
|
||||
}
|
||||
}
|
||||
|
||||
static int
|
||||
impl_node_set_callbacks(struct spa_node *node,
|
||||
const struct spa_node_callbacks *callbacks,
|
||||
|
|
@ -245,43 +254,8 @@ impl_node_set_callbacks(struct spa_node *node,
|
|||
this->callbacks = callbacks;
|
||||
this->user_data = user_data;
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
static int
|
||||
impl_node_get_n_ports(struct spa_node *node,
|
||||
uint32_t *n_input_ports,
|
||||
uint32_t *max_input_ports,
|
||||
uint32_t *n_output_ports,
|
||||
uint32_t *max_output_ports)
|
||||
{
|
||||
spa_return_val_if_fail(node != NULL, -EINVAL);
|
||||
|
||||
if (n_input_ports)
|
||||
*n_input_ports = 1;
|
||||
if (max_input_ports)
|
||||
*max_input_ports = 1;
|
||||
if (n_output_ports)
|
||||
*n_output_ports = 1;
|
||||
if (max_output_ports)
|
||||
*max_output_ports = 1;
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
static int
|
||||
impl_node_get_port_ids(struct spa_node *node,
|
||||
uint32_t *input_ids,
|
||||
uint32_t n_input_ids,
|
||||
uint32_t *output_ids,
|
||||
uint32_t n_output_ids)
|
||||
{
|
||||
spa_return_val_if_fail(node != NULL, -EINVAL);
|
||||
|
||||
if (n_input_ids && input_ids)
|
||||
input_ids[0] = 0;
|
||||
if (n_output_ids > 0 && output_ids)
|
||||
output_ids[0] = 0;
|
||||
emit_port_info(this, GET_IN_PORT(this, 0));
|
||||
emit_port_info(this, GET_OUT_PORT(this, 0));
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
|
@ -297,28 +271,6 @@ impl_node_remove_port(struct spa_node *node, enum spa_direction direction, uint3
|
|||
return -ENOTSUP;
|
||||
}
|
||||
|
||||
static int
|
||||
impl_node_port_get_info(struct spa_node *node,
|
||||
enum spa_direction direction,
|
||||
uint32_t port_id,
|
||||
const struct spa_port_info **info)
|
||||
{
|
||||
struct impl *this;
|
||||
struct port *port;
|
||||
|
||||
spa_return_val_if_fail(node != NULL, -EINVAL);
|
||||
spa_return_val_if_fail(info != NULL, -EINVAL);
|
||||
|
||||
this = SPA_CONTAINER_OF(node, struct impl, node);
|
||||
|
||||
spa_return_val_if_fail(CHECK_PORT(this, direction, port_id), -EINVAL);
|
||||
|
||||
port = GET_PORT(this, direction, port_id);
|
||||
*info = &port->info;
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
static int port_enum_formats(struct spa_node *node,
|
||||
enum spa_direction direction, uint32_t port_id,
|
||||
uint32_t *index,
|
||||
|
|
@ -836,23 +788,20 @@ static int impl_node_process(struct spa_node *node)
|
|||
|
||||
static const struct spa_node impl_node = {
|
||||
SPA_VERSION_NODE,
|
||||
impl_node_enum_params,
|
||||
impl_node_set_param,
|
||||
impl_node_set_io,
|
||||
impl_node_send_command,
|
||||
impl_node_set_callbacks,
|
||||
impl_node_get_n_ports,
|
||||
impl_node_get_port_ids,
|
||||
impl_node_add_port,
|
||||
impl_node_remove_port,
|
||||
impl_node_port_get_info,
|
||||
impl_node_port_enum_params,
|
||||
impl_node_port_set_param,
|
||||
impl_node_port_use_buffers,
|
||||
impl_node_port_alloc_buffers,
|
||||
impl_node_port_set_io,
|
||||
impl_node_port_reuse_buffer,
|
||||
impl_node_process,
|
||||
.enum_params = impl_node_enum_params,
|
||||
.set_param = impl_node_set_param,
|
||||
.set_io = impl_node_set_io,
|
||||
.send_command = impl_node_send_command,
|
||||
.set_callbacks = impl_node_set_callbacks,
|
||||
.add_port = impl_node_add_port,
|
||||
.remove_port = impl_node_remove_port,
|
||||
.port_enum_params = impl_node_port_enum_params,
|
||||
.port_set_param = impl_node_port_set_param,
|
||||
.port_use_buffers = impl_node_port_use_buffers,
|
||||
.port_alloc_buffers = impl_node_port_alloc_buffers,
|
||||
.port_set_io = impl_node_port_set_io,
|
||||
.port_reuse_buffer = impl_node_port_reuse_buffer,
|
||||
.process = impl_node_process,
|
||||
};
|
||||
|
||||
static int impl_get_interface(struct spa_handle *handle, uint32_t type, void **interface)
|
||||
|
|
@ -932,12 +881,18 @@ impl_init(const struct spa_handle_factory *factory,
|
|||
this->node = impl_node;
|
||||
|
||||
port = GET_OUT_PORT(this, 0);
|
||||
port->direction = SPA_DIRECTION_OUTPUT;
|
||||
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_list_init(&port->queue);
|
||||
|
||||
port = GET_IN_PORT(this, 0);
|
||||
port->direction = SPA_DIRECTION_INPUT;
|
||||
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_list_init(&port->queue);
|
||||
|
||||
|
|
|
|||
|
|
@ -57,6 +57,7 @@ struct buffer {
|
|||
};
|
||||
|
||||
struct port {
|
||||
uint32_t direction;
|
||||
uint32_t id;
|
||||
|
||||
struct spa_io_buffers *io;
|
||||
|
|
@ -110,14 +111,34 @@ struct impl {
|
|||
#define GET_OUT_PORT(this,p) (&this->out_ports[p])
|
||||
#define GET_PORT(this,d,p) (d == SPA_DIRECTION_INPUT ? GET_IN_PORT(this,p) : GET_OUT_PORT(this,p))
|
||||
|
||||
static int init_port(struct impl *this, uint32_t port_id, uint32_t rate, uint32_t position)
|
||||
static void emit_node_info(struct impl *this)
|
||||
{
|
||||
if (this->callbacks && this->callbacks->info) {
|
||||
struct spa_node_info info = SPA_NODE_INFO_INIT();
|
||||
info.change_mask = 0;
|
||||
this->callbacks->info(this->user_data, &info);
|
||||
}
|
||||
}
|
||||
static void emit_port_info(struct impl *this, struct port *port)
|
||||
{
|
||||
if (this->callbacks && this->callbacks->port_info && port->info.change_mask) {
|
||||
this->callbacks->port_info(this->user_data, port->direction, port->id, &port->info);
|
||||
port->info.change_mask = 0;
|
||||
}
|
||||
}
|
||||
|
||||
static int init_port(struct impl *this, enum spa_direction direction,
|
||||
uint32_t port_id, uint32_t rate, uint32_t position)
|
||||
{
|
||||
struct port *port = GET_OUT_PORT(this, port_id);
|
||||
|
||||
port->direction = direction;
|
||||
port->id = port_id;
|
||||
|
||||
snprintf(port->position, 7, "%s", rindex(spa_type_audio_channel[position].name, ':')+1);
|
||||
|
||||
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_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);
|
||||
|
|
@ -136,6 +157,7 @@ static int init_port(struct impl *this, uint32_t port_id, uint32_t rate, uint32_
|
|||
port->format.info.raw.position[0] = position;
|
||||
|
||||
spa_log_debug(this->log, NAME " %p: init port %d %s", this, port_id, port->position);
|
||||
emit_port_info(this, port);
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
|
@ -226,18 +248,19 @@ static int impl_node_set_param(struct spa_node *node, uint32_t id, uint32_t flag
|
|||
|
||||
spa_log_debug(this->log, NAME " %p: profile %d", this, info.info.raw.channels);
|
||||
|
||||
this->have_profile = true;
|
||||
this->port_count = info.info.raw.channels;
|
||||
for (i = 0; i < this->port_count; i++) {
|
||||
init_port(this, i, info.info.raw.rate,
|
||||
info.info.raw.position[i]);
|
||||
if (this->callbacks && this->callbacks->port_info)
|
||||
this->callbacks->port_info(this->user_data, SPA_DIRECTION_OUTPUT, i, NULL);
|
||||
}
|
||||
this->have_profile = true;
|
||||
port->have_format = true;
|
||||
port->format = info;
|
||||
|
||||
if (this->callbacks && this->callbacks->event)
|
||||
this->callbacks->event(this->user_data,
|
||||
&SPA_NODE_EVENT_INIT(SPA_NODE_EVENT_PortsChanged));
|
||||
this->port_count = info.info.raw.channels;
|
||||
for (i = 0; i < this->port_count; i++) {
|
||||
init_port(this, SPA_DIRECTION_OUTPUT, i, info.info.raw.rate,
|
||||
info.info.raw.position[i]);
|
||||
}
|
||||
return 0;
|
||||
}
|
||||
default:
|
||||
|
|
@ -274,6 +297,7 @@ impl_node_set_callbacks(struct spa_node *node,
|
|||
void *user_data)
|
||||
{
|
||||
struct impl *this;
|
||||
uint32_t i;
|
||||
|
||||
spa_return_val_if_fail(node != NULL, -EINVAL);
|
||||
|
||||
|
|
@ -282,55 +306,11 @@ impl_node_set_callbacks(struct spa_node *node,
|
|||
this->callbacks = callbacks;
|
||||
this->user_data = user_data;
|
||||
|
||||
return 0;
|
||||
}
|
||||
emit_node_info(this);
|
||||
emit_port_info(this, GET_IN_PORT(this, 0));
|
||||
for (i = 0; i < this->port_count; i++)
|
||||
emit_port_info(this, GET_OUT_PORT(this, i));
|
||||
|
||||
static int
|
||||
impl_node_get_n_ports(struct spa_node *node,
|
||||
uint32_t *n_input_ports,
|
||||
uint32_t *max_input_ports,
|
||||
uint32_t *n_output_ports,
|
||||
uint32_t *max_output_ports)
|
||||
{
|
||||
struct impl *this;
|
||||
|
||||
spa_return_val_if_fail(node != NULL, -EINVAL);
|
||||
|
||||
this = SPA_CONTAINER_OF(node, struct impl, node);
|
||||
|
||||
if (n_input_ports)
|
||||
*n_input_ports = 1;
|
||||
if (max_input_ports)
|
||||
*max_input_ports = 1;
|
||||
if (n_output_ports)
|
||||
*n_output_ports = this->port_count;
|
||||
if (max_output_ports)
|
||||
*max_output_ports = this->port_count;
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
static int
|
||||
impl_node_get_port_ids(struct spa_node *node,
|
||||
uint32_t *input_ids,
|
||||
uint32_t n_input_ids,
|
||||
uint32_t *output_ids,
|
||||
uint32_t n_output_ids)
|
||||
{
|
||||
struct impl *this;
|
||||
uint32_t i;
|
||||
|
||||
spa_return_val_if_fail(node != NULL, -EINVAL);
|
||||
|
||||
this = SPA_CONTAINER_OF(node, struct impl, node);
|
||||
|
||||
if (n_input_ids > 0 && input_ids)
|
||||
input_ids[0] = 0;
|
||||
if (output_ids) {
|
||||
n_output_ids = SPA_MIN(n_output_ids, this->port_count);
|
||||
for (i = 0; i < n_output_ids; i++)
|
||||
output_ids[i] = i;
|
||||
}
|
||||
return 0;
|
||||
}
|
||||
|
||||
|
|
@ -347,29 +327,6 @@ impl_node_remove_port(struct spa_node *node, enum spa_direction direction, uint3
|
|||
return -ENOTSUP;
|
||||
}
|
||||
|
||||
static int
|
||||
impl_node_port_get_info(struct spa_node *node,
|
||||
enum spa_direction direction,
|
||||
uint32_t port_id,
|
||||
const struct spa_port_info **info)
|
||||
{
|
||||
struct impl *this;
|
||||
struct port *port;
|
||||
|
||||
spa_return_val_if_fail(node != NULL, -EINVAL);
|
||||
spa_return_val_if_fail(info != NULL, -EINVAL);
|
||||
|
||||
this = SPA_CONTAINER_OF(node, struct impl, node);
|
||||
|
||||
spa_return_val_if_fail(CHECK_PORT(this, direction, port_id), -EINVAL);
|
||||
|
||||
port = GET_PORT(this, direction, port_id);
|
||||
|
||||
*info = &port->info;
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
static int port_enum_formats(struct spa_node *node,
|
||||
enum spa_direction direction, uint32_t port_id,
|
||||
uint32_t *index,
|
||||
|
|
@ -931,23 +888,20 @@ static int impl_node_process(struct spa_node *node)
|
|||
|
||||
static const struct spa_node impl_node = {
|
||||
SPA_VERSION_NODE,
|
||||
impl_node_enum_params,
|
||||
impl_node_set_param,
|
||||
impl_node_set_io,
|
||||
impl_node_send_command,
|
||||
impl_node_set_callbacks,
|
||||
impl_node_get_n_ports,
|
||||
impl_node_get_port_ids,
|
||||
impl_node_add_port,
|
||||
impl_node_remove_port,
|
||||
impl_node_port_get_info,
|
||||
impl_node_port_enum_params,
|
||||
impl_node_port_set_param,
|
||||
impl_node_port_use_buffers,
|
||||
impl_node_port_alloc_buffers,
|
||||
impl_node_port_set_io,
|
||||
impl_node_port_reuse_buffer,
|
||||
impl_node_process,
|
||||
.enum_params = impl_node_enum_params,
|
||||
.set_param = impl_node_set_param,
|
||||
.set_io = impl_node_set_io,
|
||||
.send_command = impl_node_send_command,
|
||||
.set_callbacks = impl_node_set_callbacks,
|
||||
.add_port = impl_node_add_port,
|
||||
.remove_port = impl_node_remove_port,
|
||||
.port_enum_params = impl_node_port_enum_params,
|
||||
.port_set_param = impl_node_port_set_param,
|
||||
.port_use_buffers = impl_node_port_use_buffers,
|
||||
.port_alloc_buffers = impl_node_port_alloc_buffers,
|
||||
.port_set_io = impl_node_port_set_io,
|
||||
.port_reuse_buffer = impl_node_port_reuse_buffer,
|
||||
.process = impl_node_process,
|
||||
};
|
||||
|
||||
static int impl_get_interface(struct spa_handle *handle, uint32_t type, void **interface)
|
||||
|
|
@ -1014,7 +968,10 @@ impl_init(const struct spa_handle_factory *factory,
|
|||
this->node = impl_node;
|
||||
|
||||
port = GET_IN_PORT(this, 0);
|
||||
port->direction = SPA_DIRECTION_INPUT;
|
||||
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;
|
||||
|
||||
return 0;
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue