This allows scripts to declare when they have finished their loading,
so we can now also know when wireplumber is done loading and ready to
handle clients
Related to !313
The load functions used to do 3 things:
- push the sandbox function on the stack
- load the file and push it as a function on the stack
- call the sandbox (or the file)
Now there are separate functions to do these 3:
- wplua_push_sandbox
- wplua_load_*
- wplua_pcall
In Lua, `0` is a truthy value, which means `not 0` is `false`. Compare
the resulting value from bitwise AND with 0 instead of checking it with
`if not` to ensure correctness.
This script, base on PipeWire module fallback-sink will create a fallback
sink node if there's no other sink available except the endpoints created
by WirePlumber.
Filter-like streams (e.g. output stream from filter-chain) should not
start following default sink, as usually the user intends their routing
to remain static, and not change unless explicitly requested.
Pulseaudio has special handling for streams associated with filter
sinks/sources, and does not make such streams follow default.
Use presence of node.link-group to determine which streams are
associated with filter sinks/sources, and don't make them to follow
default.
Previously, pw_init calls setlocale(), but this will change in future.
Setting the locale should be done by the main application, and is needed
in wireplumber for e.g. for translated UI elements.
Set the locale in main() for wireplumber daemon and tools, to have the
locale set also with the new pw_init behavior.
Set also LC_NUMERIC to C, to match old pw_init behavior.
The spa-json parser allows some interesting things to happen, which
are not valid JSON, but we use them for readability in config files...
- The separator may be = or just a space instead of :
- Strings may be unquoted
- Commas may be omitted
The string size is always less or equal to the size of the token (len),
so by allocating len+1 bytes we have enough space to write the whole
token and the null byte, if needed.
- pipewire supports parsing unquoted strings and they are used
extensively in JSON .conf files.
- Extend this support into wireplumber, as it wants to use the pipewire
like syntax in its JSON .conf files.
Some devices (Mostly USB devices) have a generic pcm name (USB Audio)
that is quite useless. Filter this out and fall back to the device nick
in that case.
Since nodes may have a target specified in their props, the logic in
cleanupTargetNodeMetadata does not work correctly.
Instead, emulate what Pulseaudio does: if we see a reconnectable node
with target defined by node props, but not by metadata, which is linked
to the default sink, then make the stream follow the default from that
point on.
Setting node target by id is not safe due to id reuse, and so
target.object which specifies the target by its object.serial was
introduced, and is used e.g. by pipewire-pulse.
Use target.object specifications in policy-node if they are present.
wp_transition_get_completed incorrectly returns TRUE for transitions
that have not been advanced at least once, and hence are obviously not
completed. This is because transitions start at STEP_NONE, and
completed transition is also indicated by STEP_NONE.
Fix this by adding a private flag to track whether transition was
started.
Fixes object managers sometimes missing object-changed events. How that
happens is the following:
- object activation transitions are advanced in idle callback
- they are aborted on registry global removal events
- registry global removal event can arrive before the idle callback
- wp_object_abort_activation uses wp_transition_get_completed to
determine whether transition was completed, but it returned bogus
values on transitions that hadn't been started.
This avoids using device.nick, which is the card name, on all nodes
of a card. Useful on UCM, where analog, hdmi, etc are all exposed
as nodes on a single profile.
Some nodes can omit the format/rate/channels to indicate that they can
deal with all possibilities and adapt to what they are linked to.
See pipewire#876
Connecting dont-reconnect nodes that have a defined target to fallback
probably does not make sense.
They will be linked to a target that the client likely did not intend,
and the link will not be changed later on.
In Pulseaudio, if the defined target is not found, streams are not
connected to the fallback but instead fail. This happens also with
streams that don't have DONT_MOVE specified.
Pipewire-media-session also did not link dont-reconnect streams with a
defined target to the fallbacks.
Dont-reconnect streams should not be moved to a new target, even though
other streams would move.
Pulseaudio DONT_MOVE works like this, and also pipewire-media-session
worked like this.
When device nodes go away, we should remove links and peer_id references
concerning them, so that we don't leave behind stale links and stale id
entries in the peer_id tables.
Also fix bug in si_flags[out_id] handling in unhandleLinkable.