Commit graph

1168 commits

Author SHA1 Message Date
George Kiagiadakis
07a8b5035e m-mixer-api: track monitorVolumes and allow modifying them
This only applies to non-device nodes, because monitorVolumes
are not exposed on device Routes
2021-04-26 17:35:32 +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
3b144fa9ca Add a wp-uninstalled.sh script for easily running programs uninstalled
Similar to pw-uninstalled.sh, but without an interactive shell
2021-04-26 09:59:33 +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
6939d8900a core: use log.level from the pw_context
And don't override PIPEWIRE_DEBUG, unless WIREPLUMBER_DEBUG is set.
This allows pipewire to use log.level as well to set up its logging.

If WIREPLUMBER_DEBUG is set, though, override PIPEWIRE_DEBUG to prevent
log.level from being used.
2021-04-21 19:03:47 +03:00
George Kiagiadakis
61876a97b9 log: factor out the log level configuration into wp_log_level_set()
Initialize the log level with WIREPLUMBER_DEBUG in wp_init()
2021-04-21 13:49:03 +03:00
George Kiagiadakis
bc1413e1cd audio-endpoint: configure adapter for null sink with monitor.channel-volumes
This allows the channelVolumes and mute props to affect the output
of the null sink's monitor ports. This way we will be able to use
channelVolumes to track the configured volume of the endpoint
and the monitorVolumes to implement volume ducking.
2021-04-19 11:08:17 +03:00
George Kiagiadakis
44c96b6c49 impl-node: implement WpPipewireObject
This fixes adjusting volume for bluetooth nodes.
Previously, the spa device would request a software volume change
that we did not handle because WpImplNode was not a WpPipewireObject
and there was no way to set the Props param on it.
2021-04-16 20:02:54 +03:00
George Kiagiadakis
9b74fbc6ac device: debug and enhance spa device event handling 2021-04-16 20:01:56 +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
214fffd84d meson: bump version to 0.3.70 2021-04-15 17:01:02 +03:00
George Kiagiadakis
8861595d55 m-mixer-api: allow calling the action signals even when the plugin is not enabled 2021-04-15 17:00:15 +03:00
George Kiagiadakis
012363ef55 m-default-nodes-api: remove reduntant call to g_clear_object 2021-04-15 16:59:51 +03:00
George Kiagiadakis
400aaf55ed wplua: store closures only with a weak reference
This allows closures to be properly unrefed when they are no longer
used instead of staying alive until wireplumber exits

Because GClosure has no weak references, we are now sharing the
GPtrArray that holds these references among all the active closures
and each closure is responsible for removing itself from the array
when it is finalized. The lua engine holds a reference to a "store"
object that also has a pointer to the array and when this "store"
is finalized, all closures are invalidated and removed. Even if they
stay alive afterwards, they are only holding a ref to an empty array
2021-04-13 21:14:12 +03:00
George Kiagiadakis
c53608874a examples: add example script to get the default sink's volume 2021-04-13 21:07:32 +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
4d5959ffdb lua: add WpObject get_active/supported_features() bindings 2021-04-13 19:34:07 +03:00
George Kiagiadakis
7c617742a9 lua: add g_get_real/monotonic_time() bindings
Useful to tag objects with their creation time
2021-04-13 19:33:06 +03:00
George Kiagiadakis
6d84295fc5 si-audio-endpoint: give better descriptions to endpoints and their null sinks 2021-04-12 16:05:48 +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
Julian Bouzas
5c6d484d08 src: scripts: rename policy-endpoint.lua to policy-endpoint-client.lua 2021-04-09 14:21:03 -04:00
Julian Bouzas
5c781db216 m-audio-endpoint: remove target property
Links between endpoints and device nodes are done externally in LUA
2021-04-09 14:19:25 -04:00
Julian Bouzas
b93f84897a static-endpoints.lua: don't export endpoints, only activate them 2021-04-09 14:18:05 -04:00
George Kiagiadakis
c7e32a638a m-mixer-api: add configurable support for the cubic volume scale
This is also what pulseaudio uses, so now the volumes in wpctl match what
pulseaudio tools report and they make a lot more sense from the user's POV
2021-04-09 15:52:17 +03:00
George Kiagiadakis
1547bc9c5c wpctl: use mixer & default-nodes API modules
* Fixes set-volume & set-mute
* Re-enables volume & mute status printout for audio nodes
2021-04-09 15:52:17 +03:00
George Kiagiadakis
010cd308da m-mixer-api: also add channel-independent volume for ease of use 2021-04-09 15:52:17 +03:00
George Kiagiadakis
64db5d0d6e wpctl: remove obsolete default node/endpoint key macros 2021-04-09 15:52:17 +03:00
George Kiagiadakis
0aefd52593 m-mixer-api: fix getting volume info from nodes that don't have volumeBase & step
and optimize a little bit so that can stop iterating params
as soon as the info is known
2021-04-09 15:52:17 +03:00
George Kiagiadakis
21dccd5edb lua: add a Debug.dump_table() utility function
Prints a table recursively with print()
2021-04-09 15:52:17 +03:00
George Kiagiadakis
4399512891 m-default-nodes-api: load all information before declaring the plugin as "enabled" 2021-04-09 15:52:17 +03:00
George Kiagiadakis
28ff1061f5 lua: add a Core.require_api() utility function
This function loads and enables "api" plugins and makes them
available in the specified callback. This is intended to be used
by interactive scripts in order to get access to "api" plugins
such as the new "default-nodes-api" and "mixer-api"
2021-04-09 15:52:17 +03:00
George Kiagiadakis
523bc7a36d modules: add module-mixer-api
This module provides an API to get/set volume controls on nodes,
using the same logic as pipewire-pulse, which means it will use
the device Route props when a node is associated with a device
that has this capability
2021-04-09 15:52:17 +03:00
Julian Bouzas
380ba4aa39 src: config: do not create endpoints by default 2021-04-08 14:46:13 -04:00
Julian Bouzas
12b1226b37 src: scripts: add policy-endpoint.lua script
Links items with media role set to existing endpoints. The target of the
endpoints is also configured.
2021-04-08 14:45:54 -04:00
Julian Bouzas
7482a05ca2 policy-node.lua: do not handle items with media role if endpoints exist 2021-04-08 14:41:06 -04:00
Julian Bouzas
941da10c28 policy-node.lua: clean up findTarget function 2021-04-08 14:38:31 -04:00
Julian Bouzas
9f77b98b10 src: scripts: add static-endpoints.lua script 2021-04-08 14:07:05 -04:00
Julian Bouzas
b2c9084413 modules: remove unneeded si-audio-convert module 2021-04-08 14:07:05 -04:00
Julian Bouzas
34f5dadad0 src: config: rename session-item support to default-policy 2021-04-08 14:07:05 -04:00
Julian Bouzas
cc51bdb75e create-item.lua: only create items for client and device nodes 2021-04-08 14:07:05 -04:00
Julian Bouzas
f0960a38b2 policy-item.lua: only handle si-audio-adapter and si-nodes links 2021-04-08 14:07:05 -04:00