impl-port: support mode port.passive values

Add a port.passive = follow mode and the node.passive equivalents
out-follow, in-follow, follow.

This makes it possible to control how a port influences the state of
the peer and how the peer influences the state of the node independently.

In passive mode, the port will not make the peer runnable and will also
not become runnable when the peer activates.

In the follow mode, the port will not make the peer runnable but it will
become runnable when the peer is active.

This makes it possible to do new things like (f for follow):

  Source -> (f)loopback1-in|loopback1-out(f) -> Sink

It will not make the source and sink run but when one of them start, all
will become runnable.

Or you can now better do the leak node hack that was previously used:

  Source -> (f)pw-record

That will only start running when the source is activated by something
else.

With port.passive = true|false|follow there is a potential 4th case
which would activate the peer but not be activated by the peer, which is
not something that makes sense.
This commit is contained in:
Wim Taymans 2026-03-06 09:35:17 +01:00
parent 437a8d32f2
commit 118d8574c8
6 changed files with 90 additions and 28 deletions

View file

@ -450,11 +450,25 @@ Whether the node target may be changed using metadata.
@PAR@ node-prop node.passive = false
\parblock
This is a passive node and so it should not keep sinks/sources busy. This property makes the session manager create passive links to the sink/sources. If the node is not otherwise linked (via a non-passive link), the node and the sink it is linked to are idle (and eventually suspended).
This can be used to configure the port.passive property for all ports of this node.
Possible values are:
* "out": output ports are passive, They will not make the peers active and active peers will
not make this node active.
* "in": input ports are passive, They will not make the peers active and active peers will
not make this node active.
* "true": A combination in "in" and "out", both input and output ports are passive.
* "out-follow": output ports will not make the peer active but when the peer is activated via
some other way, this node will also become active.
* "in-follow": input ports will not make the peer active but when the peer is activated via
some other way, this node will also become active.
* "follow": A combination of "in-follow" and "out-follow".
This is used for filter nodes that sit in front of sinks/sources and need to suspend together with the sink/source.
\endparblock
@PAR@ node-prop node.link-group = ID
Add the node to a certain link group. Nodes from the same link group are not automatically linked to each other by the session manager. And example is a coupled stream where you don't want the output to link to the input streams, making a useless loop.
@ -1420,6 +1434,11 @@ them. Below are some port properties may interesting for users:
\copydoc PW_KEY_PORT_ALIAS
\endparblock
@PAR@ port-prop port.passive # string
\parblock
\copydoc PW_KEY_PORT_PASSIVE
\endparblock
\see pw_keys in the API documentation for a full list.
# LINK PROPERTIES @IDX@ props