node: export method to update ports

This commit is contained in:
Wim Taymans 2018-03-05 12:43:42 +01:00
parent 2660b5c4f5
commit 1b2e73de0c
3 changed files with 8 additions and 2 deletions

View file

@ -1030,6 +1030,7 @@ client_node_port_update(void *data,
change_mask, change_mask,
n_params, params, info); n_params, params, info);
} }
pw_node_update_ports(impl->this.node);
} }
static void client_node_set_active(void *data, bool active) static void client_node_set_active(void *data, bool active)

View file

@ -189,7 +189,7 @@ static void update_port_map(struct pw_node *node, enum pw_direction direction,
} }
} }
static int update_port_ids(struct pw_node *node) int pw_node_update_ports(struct pw_node *node)
{ {
uint32_t *input_port_ids, *output_port_ids; uint32_t *input_port_ids, *output_port_ids;
uint32_t n_input_ports, n_output_ports, max_input_ports, max_output_ports; uint32_t n_input_ports, n_output_ports, max_input_ports, max_output_ports;
@ -337,12 +337,15 @@ int pw_node_register(struct pw_node *this,
pw_log_debug("node %p: register", this); pw_log_debug("node %p: register", this);
if (this->registered)
return -EEXIST;
if (properties == NULL) if (properties == NULL)
properties = pw_properties_new(NULL, NULL); properties = pw_properties_new(NULL, NULL);
if (properties == NULL) if (properties == NULL)
return -ENOMEM; return -ENOMEM;
update_port_ids(this); pw_node_update_ports(this);
pw_loop_invoke(this->data_loop, do_node_add, 1, NULL, 0, false, this); pw_loop_invoke(this->data_loop, do_node_add, 1, NULL, 0, false, this);

View file

@ -557,6 +557,8 @@ int pw_node_set_state(struct pw_node *node, enum pw_node_state state);
/** Update the state of the node, mostly used by node implementations */ /** Update the state of the node, mostly used by node implementations */
void pw_node_update_state(struct pw_node *node, enum pw_node_state state, char *error); void pw_node_update_state(struct pw_node *node, enum pw_node_state state, char *error);
int pw_node_update_ports(struct pw_node *node);
/** Activate a link \memberof pw_link /** Activate a link \memberof pw_link
* Starts the negotiation of formats and buffers on \a link and then * Starts the negotiation of formats and buffers on \a link and then
* starts data streaming */ * starts data streaming */