Commit graph

309 commits

Author SHA1 Message Date
Wim Taymans
7907d39aff scripts: add libcamera monitor 2021-10-06 10:22:36 +02:00
Wim Taymans
a13308bac7 implement route-settings metadata and notification volume
Make a module that creates a route-settings metadata and provides
some helper functions to parse the json fields.

Load the route-settings module in the policy.

Move the Notification settings to the metadata. Listen for metadata
updates and update our state table.

Fixes #51
2021-10-05 15:47:46 +00:00
Wim Taymans
8c82265752 restore-stream: don't include the final : in the key name
Just make the key and let the user of the key add a separator when
needed.
2021-10-05 15:47:46 +00:00
Wim Taymans
65d5f6442b restore-stream: stop when we find the first suitable key 2021-10-05 15:47:46 +00:00
Wim Taymans
8e7331a23d default-routes: save and restore iec958Codecs
Similar to the volume and latencyOffset we need parse, save and restore
the configured iec958Codecs on the node.

Pavucontrol will use the device-restore extension to set the configured
iec958Codecs on the Node/Route. This will make the node enumerate
audio/iec958 formats, which can be matched against streams that can
provide this format to configure passthrough.

Fixes #64
2021-10-04 10:11:03 +00:00
George Kiagiadakis
2a99d6a835 default-access: grant full permissions to flatpak "Manager" apps
Fixes: #59
2021-10-04 09:20:53 +03:00
Julian Bouzas
151ba8425e m-si-audio-adapter: add 'disable.dsp' configuration property
If 'disable.dsp' is set to TRUE, the adapter will always be configured in
passthrough mode. Then, if 2 adapters want to be linked with different formats,
the si-standard-link session item will automatically reconfigure one of the
adapters in convert mode so that the format matches.
2021-09-29 14:03:27 -04:00
Pauli Virtanen
e9b7d02b22 config: bluez: update to match current bluez5 spa module
Update 50-bluez-config.lua from media-session.d/bluez-monitor.conf
2021-09-29 19:18:18 +03:00
George Kiagiadakis
2bc999594c main: fail to start with a warning if media-session is also running
Related to #56
2021-09-28 11:45:49 +03:00
George Kiagiadakis
a253aa4c49 modules: implement logind module and integrate with bluez monitor
This copies the logic of media-session's logind module and allows
the bluez monitor to be active in only one user session at a time.
This is especially useful to avoid interference between the gdm
session and the actual user session, which momentarily both have
wireplumber running when logging in/out.

Fixes #54
2021-09-27 18:30:32 +03:00
Julian Bouzas
450a38da50 scripts: handle dbus service restarts if reserve device is enabled
This destroys the ALSA monitor when the DBus connection is closed, and
re-creates again the monitor when the Dbus connection is connected, so that
device reservation is restarted.
2021-09-24 08:53:50 -04:00
Julian Bouzas
9dd5c0c758 systemd: add GIO_USE_VFS=local environment variable
Avoids GIO to connect to the session bus. This prevents wireplumber to receive
a SIGTERM signal when the dbus service is restarted.
2021-09-23 09:40:07 -04:00
Peter Hutterer
841a1055fb main: print the type of signal that stopped us
Unfortunately glib's signal handling doesn't pass the signal type to the
handler but it's easy enough to wrap.

Related to #48
2021-09-23 20:15:51 +10:00
Ashok Sidipotu
33d4e61b97 alsa-monitor: add check for nill monitor 2021-09-20 10:43:33 +05:30
Niklāvs Koļesņikovs
3b41df35a8
v4l: add basic check for nil monitor
If PipeWire is built without V4L support, then

`monitor = SpaDevice("api.v4l2.enum.udev", config.properties or {})`

will result in a nil monitor. This commit adds a basic sanity check
to avoid further using the nil variable.

Thanks-to: Pascal Flöschel (initial bug report)
Thanks-to: George Kiagiadakis <george.kiagiadakis@collabora.com>
Bug: https://bugs.gentoo.org/813043
2021-09-15 13:54:03 +03:00
Niklāvs Koļesņikovs
32d96189b8
bluez: add basic check for nil monitor
If PipeWire is built without Bluetooth support, then

`monitor = SpaDevice("api.bluez5.enum.dbus", monitor_props)`

will result in a nil monitor. This commit adds a basic sanity check
to avoid further using the nil variable.

Thanks-to: Pascal Flöschel (initial bug report)
Thanks-to: George Kiagiadakis <george.kiagiadakis@collabora.com>
Bug: https://bugs.gentoo.org/813043
2021-09-15 13:52:29 +03:00
Julian Bouzas
640b6b217c policy-node: schedule pending rescan if old link is not active
Removing a link before it finished activating can lead to race conditions. If
the link is not active, we should schedule a pending rescan to make sure the
old link is only removed when active. This should fix the proxy activation
failed warnings.
2021-09-14 13:48:22 -04:00
Julian Bouzas
910273cba7 policy-node: don't try to link to the same link-group
Avoids linking streams to a node of the same link-group because that
would be a circular link.
2021-09-14 08:44:10 -04:00
Julian Bouzas
8f19c00b3e policy-node: re-evaluate all nodes when changed
This is needed so that client nodes can be moved to new default device nodes
when they are added if wireplumber is already running.
2021-09-14 08:43:21 -04:00
Björn Daase
f769e2ea36 50-alsa-config.lua: Add missing commas
Be consistent with all other files and add commas at the end of sections.
2021-09-10 08:53:34 +00:00
George Kiagiadakis
8949e98d1f remove wpipc
This component has been split out to form a separate project,
moved to https://git.automotivelinux.org/src/pipewire-ic-ipc/
2021-08-19 16:53:28 +03:00
George Kiagiadakis
c3d48e57d4 systemd: remove AssertPathExists from the templated units
The config files can now be in multiple places, so there is no
good way to check if a file exists before starting wireplumber.
2021-08-19 10:33:55 +03:00
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