mirror of
https://gitlab.freedesktop.org/pipewire/pipewire.git
synced 2025-11-10 13:30:05 -05:00
node: make port for_each more powerful
Make an int return from pw_node_for_each_port() so that we can return errors or early exit. Add pw_port_for_each_param() to iterate params. And use this to collect the formats.
This commit is contained in:
parent
425073afd8
commit
91a3670610
6 changed files with 81 additions and 47 deletions
|
|
@ -138,11 +138,14 @@ void pw_node_add_listener(struct pw_node *node,
|
|||
const struct pw_node_events *events,
|
||||
void *data);
|
||||
|
||||
/** iterate the ports in the given direction */
|
||||
bool pw_node_for_each_port(struct pw_node *node,
|
||||
enum pw_direction direction,
|
||||
bool (*callback) (void *data, struct pw_port *port),
|
||||
void *data);
|
||||
/** Iterate the ports in the given direction. The callback should return
|
||||
* 0 to fetch the next item, any other value stops the iteration and returns
|
||||
* the value. When all callbacks return 0, this function returns 0 when all
|
||||
* items are iterated. */
|
||||
int pw_node_for_each_port(struct pw_node *node,
|
||||
enum pw_direction direction,
|
||||
int (*callback) (void *data, struct pw_port *port),
|
||||
void *data);
|
||||
|
||||
|
||||
/** Find the port with direction and port_id or NULL when not found */
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue