Commit graph

268 commits

Author SHA1 Message Date
George Kiagiadakis
0a987ea367 restore-stream: implement storing/restoring of target.node metadata
Closes #33
2021-06-08 13:40:13 +03:00
George Kiagiadakis
12f9e621e1 default-routes: use a constraint to check if device.name is present 2021-06-07 17:47:42 +03:00
George Kiagiadakis
2af0641a8b default-routes: fix storing dev_info 2021-06-07 17:47:42 +03:00
George Kiagiadakis
2e56aeb44a scripts: initial restore-stream implementation
Related to #33
2021-06-07 17:47:42 +03:00
Wim Taymans
342c3a7ea2 si-adapter: handle autoconnect property
When the autoconnect property is not available or false, we must
simply configure the stream in its default channel map and leave it
unconnected.

Fixes pw-cat -p --target=0 ..
2021-06-07 10:29:25 +02:00
George Kiagiadakis
38f7483793 state: remove support for groups and propagate save errors
There is no real use for groups in our API. Just use the name of
the file as the default group and be done with it...
Storing multiple groups with this API is problematic because it
forces flushing the file to disk multiple times, one for each group,
and it's just more performant if we use a prefix in the keys
to implement some form of logical separation.

This commit also makes the GKeyFile a temporary object. As we
always load the file from the file system in _load()
and we always replace its contents with a new dictionary in _save(),
there is no point in keeping the keyfile's internal data structures
stored in memory.

Save errors are now also propagated to adhere to the programming
practices of GObject
2021-06-04 18:36:19 +03:00
George Kiagiadakis
917cef25d8 policy: don't crash if some node properties are not set
- sanitize printing properties with tostring(), which will properly
  convert nil values to the string "nil"
- ensure some properties become empty strings if they are nil
2021-06-04 18:36:19 +03:00
George Kiagiadakis
47ed9bb527 monitors: sanitize device names like media-session does 2021-06-03 18:58:49 +03:00
George Kiagiadakis
ee87161d29 default-routes: re-implement the default-routes module in lua
using the logic from the default-routes of pipewire-media-session

Fixes: #28, #30
Related: !156
2021-06-03 16:26:28 +03:00
Julian Bouzas
35c7196454 policy: destroy node if defined target was not found and reconnect is false
Avoids number of PulseAudio Volume Control nodes to keep growing each time a
new client node is linked.
2021-06-02 16:42:15 +00:00
George Kiagiadakis
7c8b91c94e policy-{node,endpoint-client}: do not crash if media.class is nil 2021-05-28 18:44:11 +03:00
George Kiagiadakis
94dd3c4c1c config: disable role-based endpoints in the default configuration 2021-05-28 17:36:57 +03:00
Julian Bouzas
7741c2e43a policy-endpoint-device: wait until previous links are activated
Makes sure links are activated before starting scanning again.
2021-05-24 11:07:59 -04:00
Julian Bouzas
bd90783398 m-si-standard-link: remove unused manage.lifetime configuration property 2021-05-24 11:07:59 -04:00
George Kiagiadakis
ac23e60267 wpctl: fix iterator cleanup 2021-05-21 20:04:27 +03:00
George Kiagiadakis
fd7b68dfd7 scripts: remove static-sessions 2021-05-21 19:57:31 +03:00
George Kiagiadakis
ac9e1e89c4 wp: remove WpSession and WpEndpointLink
We have ended up not using them, so let's not carry them
in the ABI of 0.4

We can always revert that, but let's first decide how
these objects should be used
2021-05-21 19:57:31 +03:00
Julian Bouzas
b3b10db529 policy: don't link endpoints on startup
Sometimes the default device node might not exist when reevaluating endpoints
for the first time on startup, so the policy would link endpoints to another
device node. Then, the default device node appears and the policy moves the
endpoints to the default device node while the previous link has not finish its
activation yet. This race condition can cause endpoint links to fail when being
activated. Delaying the reevaluation of endpoint links until the first client
link is created avoids this issue.
2021-05-20 11:18:19 -04:00
Julian Bouzas
0ff0ef77f2 policy: reevaluate all linkables if one linkable was removed
Allows relinking client nodes to other devices if the current device has been
removed. This allows audio to keep playing in a different device if a bluetooth
device is disconnected.
2021-05-20 11:18:15 -04:00
Frédéric Danis
20a2f5a232 systemd: Add conflicts with pipewire-media-session
This allows to run WirePlumber preferably when pipewire-media-session is
also installed.
2021-05-19 11:34:57 +02:00
Julian Bouzas
b8030e138d alsa-monitor: activate BOUND feature in JACK device 2021-05-17 15:23:24 -04:00
Julian Bouzas
f0166d6b3c policy: fix removing of item links when linkable is removed 2021-05-13 08:46:02 -04:00
Julian Bouzas
d68636f9b3 si-interfaces: rename WpSiPortInfo to WpSiLinkable 2021-05-11 10:56:44 -04:00
Julian Bouzas
ee121e3093 scripts: cleaned and improved policy scripts
The policy scripts can handle now client nodes that want to be linked with other
client nodes. This is needed for nodes created by the Pulse Audio Volume Control
to monitor audio comming from other application client nodes.
2021-05-10 15:24:40 -04:00
Julian Bouzas
b46a907df4 create-item.lua: always enable monitor ports by default 2021-05-10 15:19:25 -04:00
George Kiagiadakis
c0099a99d6 config: bluez: update to match media-session's bluez-monitor.conf 2021-05-07 12:10:31 +03:00
George Kiagiadakis
fc5aa7db1f lua: rename Plugin() to Plugin.find()
Plugin() is confusing because it's not a constructor, it just finds
an existing instance of a plugin object. All other camel-case
functions are constructors in the current lua API.
2021-05-07 11:53:47 +03:00
George Kiagiadakis
157d4d95c9 config: disable ipc module by default and move it to the main instance
This is not part of the policy, it's something standalone that writes metadata

Needs to be disabled by default, since it's not built by default now
2021-05-06 15:19:55 +03:00
George Kiagiadakis
86ffac19e5 wpipc: place sockets in the same runtime directory as pipewire 2021-05-06 14:15:24 +03:00
George Kiagiadakis
cb4fa024b2 meson: replace join_paths() with operator / 2021-05-06 12:15:52 +03:00
George Kiagiadakis
272022b8ea policy-node: accept node names or paths in a stream's node.target property 2021-05-05 18:26:16 +03:00
Julian Bouzas
48b4f00d8c policy-endpoint-client-links.lua: consider 'suspend.playback' metadata 2021-05-04 19:52:14 -04:00
Julian Bouzas
207268e189 modules: add ipc module
Handles SUSPEND and RESUME wpipc requests in order to set metadata that will
eventually unlink or re-link endpoints.
2021-05-04 19:52:09 -04:00
George Kiagiadakis
28a4229681 config: unify config and config-split
After all, we can just load multiple lua config files/directories
from a single .conf file and so have both styles available for the
user to choose at runtime
2021-04-27 19:50:38 +03:00
George Kiagiadakis
14f4337cdb systemd: add templated systemd unit files
These allow running multiple instances of wireplumber with
different config files. The config file is denoted on the service
name, ex: wireplumber@bluetooth loads bluetooth.conf
2021-04-27 19:06:08 +03:00
George Kiagiadakis
4f79bccbe8 policy-endpoint: implement volume ducking 2021-04-26 18:31:19 +03:00
George Kiagiadakis
42e75028d2 access: add a more generic "default" access policy script
Configurable. Replaces the "flatpak" access policy.
2021-04-26 16:56:17 +03:00
George Kiagiadakis
c7ff629f99 config: add an example of split-instance configuration
This configuration allows splitting wireplumber into multiple instances.
The "main" instance takes care of loading and managing devices
The "policy" instance does all the linking and implements endpoints
The "bluetooth" instance runs the bluetooth devices & nodes

Test with (in separate terminals):
./wp-uninstalled.sh -c config-split -- wireplumber -c main.conf
./wp-uninstalled.sh -c config-split -- wireplumber -c policy.conf
./wp-uninstalled.sh -c config-split -- wireplumber -c bluetooth.conf
2021-04-26 10:02:27 +03:00
George Kiagiadakis
c2834ea344 lua: remove the ability to specify spa_libs in the lua config
This is not useful, we can do this on the pipewire-style config files
2021-04-22 17:44:17 +03:00
George Kiagiadakis
af9b9a84f0 daemon: init export core in the daemon and share it with modules
Also, use a context property to control whether to enable this core
or not and enable it only in the daemon
2021-04-22 15:07:47 +03:00
George Kiagiadakis
b46587393c lua: change the "wireplumber.interactive" property to "wireplumber.daemon"
with inverted semantics
2021-04-22 13:48:06 +03:00
George Kiagiadakis
9c8e5b3081 daemon: Use a pipewire-style config file to load initial configuration
This allows configuring:
* the scripting engine, in case we ever add another one
* the app name, so that we can distinguish multiple instances
  of wireplumber
* the log level in the same way as pipewire
* wireplumber components to load. This allows loading components
  even without a scripting engine (for a mimimal daemon) and also
  allows configuring which lua config file(s) to load
* additional pw_context properties that pipewire modules may be using
* the exact pipewire modules to load (instead of relying on client.conf)
2021-04-22 13:28:58 +03:00
George Kiagiadakis
fdac497f0b config: policy: improve the endpoints & roles example config 2021-04-15 18:18:13 +03:00
George Kiagiadakis
d1da39b4f6 policy-endpoint-client: remove handling of move & follow and endpoint priorities
These don't make much sense here. In the endpoint policy we want
the clients to be linked to the endpoint that matches their role
and never move.

Also, endpoint priorities are useless. If no endpoint matches the
role, then just ignore the client.
2021-04-15 18:14:25 +03:00
George Kiagiadakis
155ad32212 scripts: add policy for links between clients and endpoints
This script takes links that are created by policy-endpoint-client
and activates only the ones that should be active based on role
priorities
2021-04-13 19:37:06 +03:00
George Kiagiadakis
7d65dc2a09 static-endpoints: avoid capturing session item reference in the activate closure 2021-04-12 16:04:34 +03:00
George Kiagiadakis
45e0ad1092 policy: export endpoints, do not export endpoint links
As with endpoint streams, there is not much use for endpoint links
in this updated design. This will be re-evaluated.
2021-04-12 12:48:48 +03:00
George Kiagiadakis
e13b2bc8ad wpctl: handle endpoints nicely and enable volume controls on them
Instead of adding Props on endpoints again and syncing with the associated
node, it is easier to just use the volume controls of the associated node
2021-04-12 12:46:40 +03:00
George Kiagiadakis
1ba99739c2 tools: split wireplumber script execution mode to a separate wpexec tool
This is mainly for security reasons. This way, we can limit the
permissions of wpexec without limiting wireplumber, for instance
with pipewire's default module-access, which limits apps based on
their executable name
2021-04-12 09:53:30 +03:00
George Kiagiadakis
e654f7709f tools: move under the 'src' directory 2021-04-12 09:53:30 +03:00