Commit graph

1037 commits

Author SHA1 Message Date
George Kiagiadakis
efc2039795 meson: install configuration in $prefix/share 2021-08-19 10:31:27 +03:00
George Kiagiadakis
27ed36c2da wp: make the config file lookup methods more generic
* Make the flags public and give them nicer names
* Pass down the flags from the caller, so the caller can now explicitly
  ask for looking into specific directories
* Rename the methods
* Remove and inline the wp_get_xdg_config_dir() method, since it's only
  used internally
* Refactor the lookup dirs ordering to get both WIREPLUMBER_*_DIR env
  variables to replace all the other directories. Previously, we were looking
  for scripts in WIREPLUMBER_DATA_DIR, but we were also looking in /etc at
  the same time (with precedence, even), which could result in unexpected
  behaviour. Now, if a WIREPLUMBER environment variable is specified,
  we only look in there.
2021-08-19 10:06:37 +03:00
Julian Bouzas
8c9da58d76 src: scripts: add alsa-mini.lua monitor 2021-08-10 11:50:51 +03:00
Julian Bouzas
907a67fcb1 modules: add new API module to monitor files 2021-08-10 11:50:51 +03:00
Peter Hutterer
d38c3fb4cc lib: add functions to search in configuration/data directories
The previous approach to loading config files was to ask WP for the
directory and then search those for the config files. This patch changes the
approach - a caller now asks WP to search for a specific config file or
iterate over a config file directory.

This allows us to implement a directory lookup order, i.e.
"wireplumber.conf" may be in XDG_CONFIG_DIR, /etc/,
/usr/share and the first one found is used.

For configuration directories, the new method iterates over all matching
entries (files + directories) and invokes a callback for each entry.

This enables distributions to ship default files in /usr/share/wireplumber
but have admins and users override them on a local basis. For lua scripts in
particular, overriding a distribution-provided file with an empty file
effectively disables it, adding a file adds it in the right sort order.
2021-07-15 15:17:01 +00:00
Peter Hutterer
6c3a8d2f83 main: assemble the full config file name and pass that to pipewire
Previously we had the config file split in pipewire-fashion: CONFIG_NAME for
the filename and CONFIG_PREFIX for the (absolute) config directory the file
resides in. Since we always resolved CONFIG_PREFIX to be an absolute path we
might as well just pass the fully resolved config file to pipewire instead.

This will eventually allow us to have multiple lookup directories.
2021-07-15 15:17:01 +00:00
Julian Bouzas
2792cecbcf properties: use a boxed WpPropertiesItem type when iterating
Needed for JavaScript bindings
2021-07-15 08:55:00 -04:00
Niklāvs Koļesņikovs
d8365fe33e
meson: adds summary() to auto features 2021-07-05 12:30:49 +03:00
George Kiagiadakis
c6d104a66b access-portal: fix granting access to camera device nodes
The constraint for nodes wasn't supposed to have a client.id
Also make the nodes_om global, to avoid leaking it in potential ref loops
2021-06-25 11:47:13 +03:00
Arun Raghavan
e1c40a567c scripts: Add an intended-roles policy script
This routes streams of a given media.role to devices which specify that
role in device.intended-roles.
2021-06-20 18:45:28 -04:00
George Kiagiadakis
87741e39ec s/metadatas/metadata/g
data is already plural
2021-06-18 10:44:24 +03:00
George Kiagiadakis
a57647769a metadata: filter for the "default" metadata object in all places where we use it
there can be more metadata objects around...
2021-06-18 10:39:47 +03:00
George Kiagiadakis
950c358180 create-item: handle all kinds of Audio/Video & Stream nodes
And be careful not to handle nodes created by si-audio-endpoint,
by using a specific property for that.

Also, use Audio/{Source,Sink}/Virtual as the media class of null sinks
created by si-audio-endpoint, it sounds more appropriate.

Fixes #34
2021-06-10 16:41:01 +03:00
George Kiagiadakis
cead4dffb8 config: document the duck.level policy property 2021-06-10 14:53:09 +03:00
George Kiagiadakis
4cdfeb9c32 scripts: change debug level for some messages 2021-06-10 14:53:08 +03:00
George Kiagiadakis
86fde56ddd daemon/wpexec: standardize exit codes based on sysexits.h 2021-06-08 20:39:36 +03:00
George Kiagiadakis
5ef8faa730 daemon: replace the exit_message with direct message printouts
and use fprintf() for fatal errors, to make sure they are shown
2021-06-08 20:39:36 +03:00
George Kiagiadakis
aa618e99cb wpexec: force the log level to be at least 1 and use fprintf() for local errors
pipewire's client.conf sets the default log level to 0, which is not
good for wpexec, as lua runtime errors are reported as warnings currently.

Also, let's use fprintf() for local cli errors to make sure they get printed
even if the log level is 0
2021-06-08 20:39:36 +03:00
George Kiagiadakis
31f56c7be5 daemon: exit with 0 both in case of a signal and in case of disconnection
systemd stops wireplumber with SIGTERM and this should exit gracefully.
if wireplumber is started by other means, it may just stop when pipewire
stops... that's also fine
2021-06-08 20:39:36 +03:00
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