mirror of
https://gitlab.freedesktop.org/pipewire/pipewire.git
synced 2025-11-03 09:01:54 -05:00
modules: nmake dynamic ports work in link-factory
Just making a port and adding it to a node does not make it a working port.. Make a new node function to get a new free port, this will actually call the implementation spa_node_add_port(), which will add the new port which we can then pick up and use. See #4876
This commit is contained in:
parent
9f88d6997f
commit
1bf5ca28d8
3 changed files with 17 additions and 18 deletions
|
|
@ -279,28 +279,12 @@ static const struct pw_impl_link_events link_events = {
|
|||
static struct pw_impl_port *get_port(struct pw_impl_node *node, enum spa_direction direction)
|
||||
{
|
||||
struct pw_impl_port *p;
|
||||
struct pw_context *context = pw_impl_node_get_context(node);
|
||||
int res;
|
||||
|
||||
p = pw_impl_node_find_port(node, direction, PW_ID_ANY);
|
||||
|
||||
if (p == NULL || pw_impl_port_is_linked(p)) {
|
||||
uint32_t port_id;
|
||||
if (p == NULL || pw_impl_port_is_linked(p))
|
||||
p = pw_impl_node_get_free_port(node, direction);
|
||||
|
||||
port_id = pw_impl_node_get_free_port_id(node, direction);
|
||||
if (port_id == SPA_ID_INVALID)
|
||||
return NULL;
|
||||
|
||||
p = pw_context_create_port(context, direction, port_id, NULL, 0);
|
||||
if (p == NULL)
|
||||
return NULL;
|
||||
|
||||
if ((res = pw_impl_port_add(p, node)) < 0) {
|
||||
pw_log_warn("can't add port: %s", spa_strerror(res));
|
||||
errno = -res;
|
||||
return NULL;
|
||||
}
|
||||
}
|
||||
return p;
|
||||
}
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue