node: make add_listener method

Make struct spa_node_events for events emited from the main thread
and keep the spa_node_callbacks for the data thread callbacks.

The add_listener method installs the events and it's possible to
install multiple handles. Adding a listener first emits the info
and port_info events when installed, similar to how the PipeWire
proxy bind works.

This removes the need for the spa_pending_queue and makes it easier
to implement the _sync versions.

Add some helpers to make it easier for plugins to emit all the info
to new listeners.

Use the listeners for devices as well.
This commit is contained in:
Wim Taymans 2019-03-01 12:00:42 +01:00
parent 61ce4e77f6
commit 0390969228
53 changed files with 1774 additions and 1307 deletions

View file

@ -265,6 +265,7 @@ struct pw_device {
struct spa_param_info params[32];
struct spa_device *implementation; /**< implementation */
struct spa_hook listener;
struct spa_hook_list listener_list;
struct spa_list node_list;
@ -353,6 +354,7 @@ struct pw_node {
struct spa_list driver_link;
struct spa_node *node; /**< SPA node implementation */
struct spa_hook listener;
struct spa_list input_ports; /**< list of input ports */
struct pw_map input_port_map; /**< map from port_id to port */
@ -371,8 +373,6 @@ struct pw_node {
struct pw_loop *data_loop; /**< the data loop for this node */
struct spa_pending_queue *pending;
uint32_t quantum_size; /**< desired quantum */
struct spa_source source; /**< source to remotely trigger this node */
struct pw_memblock *activation;