Commit graph

820 commits

Author SHA1 Message Date
Julian Bouzas
8935837cda scripts: remove settings-manager and use the Settings API
The settings manager is not needed anymore because the WpSettings Lua API
returns now the default value from the schema if the setting is not found.
2024-02-28 10:20:31 -05:00
Julian Bouzas
f18a8c5a35 wpctl: use WpSettings API instead of metadata in 'settings' sub-command
Also adds -r flag to reset settings to their default value.
2024-02-28 10:20:31 -05:00
Julian Bouzas
a492d23019 m-settings: add settings schema to metadata
This patch improves module-settings to load the settings schema into a
'schema-sm-settings' metadata for clients to know what values types and range
are accepted for each particular setting. This settings schema is defined in
the wireplumber.conf, under a new section called 'wireplumber.settings.schema'.
2024-02-28 08:15:21 -05:00
Julian Bouzas
a23248847a metadata: remove wp_metadata_iterator_item_extract() API
Similar to WpPropertiesItem, this implements a new WpMetadataItem type that is
returned when iterating metadata
2024-02-28 08:15:17 -05:00
Julian Bouzas
bebfc07d84 wpctl: add settings subcomand to show, delete or change settings 2024-02-14 12:04:41 -05:00
George Kiagiadakis
4dc7317010 docs: update ALSA documentation 2024-02-14 15:58:19 +02:00
Ashok Sidipotu
89b9218031 device-profile-hooks: add a hook to prioritize the profiles 2024-02-12 13:15:02 +05:30
Ashok Sidipotu
112a45a230 device-profile-hooks: move the selected profile check
move the check to the beginning of the hook.
2024-02-12 13:15:02 +05:30
George Kiagiadakis
4d33aff107 monitors: improve notice messages about missing SPA plugins 2024-02-10 11:44:19 +02:00
Julian Bouzas
b703c01d4c wpctl: show persistent settings and add sub-command to clear them 2024-02-07 11:53:01 -05:00
Julian Bouzas
9bf646aed0 wpctl: show filters in the status output 2024-02-07 11:43:37 -05:00
Stefan Ursella
ac508aef57 linking: handle 'node.linger' property when target node not known
Do not send an error to the client when the target is not defined
and the 'node.linger' property is set.

It is not absolutely necessary that every node has a defined target.

We can have a 'Stream/Output/*' node which can be linked to
multiple 'Stream/Input/*' nodes and only the 'Stream/Input/*'
nodes have a defined target.
2024-02-04 17:33:46 +01:00
Julian Bouzas
1d2fe9b62d module-settings: remove 'settings.persistent' option
This patch removes the 'settings.persistent' option from the configuration as it
only allowed making settings persistent globally instead of individually. This
issue has been addressed in a simpler way by creating a 'persistent-sm-settings'
metadata. If a user wants to make a setting persistent, he can change the
'persistent-sm-settings' metadata object, if the user does not want to make a
persistent change, he can use the 'sm-settings' metadata object. Any changes in
the 'persistent-sm-settings' metadata will be also reflected in the 'sm-settings'
metadata object.
2024-02-02 14:02:49 -05:00
Julian Bouzas
b3a71e3f1c linking: rename props to 'node.dont-fallback', 'node.dont-move' and 'node.linger'
This makes those properties more consistent with 'node.dont-reconnect'.
2024-02-02 11:15:31 +00:00
Julian Bouzas
d01441ca0a scripts: move filter-forward-format.lua from 'linking' to 'node' subdirectory
This is because 'filter-forward-format.lua' only configures nodes, and therefore
does not have anything to do with the linking logic. The setting has also been
renamed to 'node.filter.forward-format'.
2024-02-01 10:00:22 -05:00
Pauli Virtanen
6d9205cfe0 filter-utils: fix indexing nil value
Check target is not nil, which sometimes occurs, before trying to access
its .id property.

Fixes lua errors in logs.
2024-01-31 09:04:54 +00:00
George Kiagiadakis
c6e3dbf887 scripts/linking/rescan.lua: fix log access
The log object should be used with : in order to make sure that the
log handler has the correct topic in context.
2024-01-31 11:00:37 +02:00
Julian Bouzas
5581a9c2b7 scripts: only log session item Id when unhandling it
This is because the associated node does not exist anymore. This change also
logs the session item Id when handling it, so that it is easy to know if the
unhandled session item was handled or not.
2024-01-30 11:51:17 -05:00
Julian Bouzas
9cdb8f3110 bluez.lua: always hide sco-source nodes from applications
Since the loopback bluetooth source node is meant to be always used by
applications, this change hides the actual bluez sco-source node by marking
them as internal. This avoids showing 2 input devices in pavucontrol per BT
device if HSP/HFP profile is enabled.
2024-01-29 12:11:45 -05:00
George Kiagiadakis
8b4885d21d conf: split out unneeded example sections to log.conf and settings.conf fragments 2024-01-29 11:55:18 +02:00
George Kiagiadakis
bdc7839ff2 m-settings: rename persistent.settings to settings.persistent
This makes it more consistent with the nomenclature of other settings
2024-01-29 11:55:18 +02:00
George Kiagiadakis
a511c54c5c m-settings: split out the WpSettings instance loading to a new built-in component
When running multi-instance setups or when clients like wpctl want to
access the WpSettings instance, it makes no sense to load the entire
module-settings, which will also create sm-settings metadata instances.
2024-01-29 11:55:18 +02:00
Julian Bouzas
95ae88d3e7 bluez.lua: set the loopback input stream media class to internal
This hides the loopback stream node from applications, making desktop
environments to not show the 'recording from microphone' icon (Eg gnome-panel)
when the bluetooth device is not recording yet.
2024-01-23 11:59:57 -05:00
Julian Bouzas
874a432c69 autoswitch-bluetooth-profile: remove applications array and use loopback filter
This patch improves the bluetooth profile autoswitch so that it works with any
application that wants to capture from a bluetooth device. To do so, a loopback
source filter is created per connected bluetooth device. If an application wants
to capture audio from such loopback source filter, the profile in the associated
bluetooth device is changed to HSP/HFP. If there isn't any application connected
to the loopback source filter, the profile switches back to A2DP.
2024-01-22 10:15:16 +00:00
Julian Bouzas
68c6fc2a38 filter-utils: always convert to string when checking if target rules match
This fixes the target not being found when setting non-string values in the
JSON matching rules of the 'filter.smart.target' property.
2024-01-22 10:15:16 +00:00
Julian Bouzas
caded6070d linking: remove redundant 'dont_move' parameter
The 'target.dont_move' property is only meant to be used with 'target.object'
metadata property, not smart filters metadata properties. This was probably
left accidentaly unused when designing a solution for #524 involving smart
filters.

Fixes #558
2024-01-19 13:29:02 -05:00
Pauli Virtanen
6f3eb32937 config: update example bluetooth.conf
bluez5.auto-connect is by default disabled. device.profile does not
exist. MIDI nodes also have node.latency-offset-msec
2024-01-14 21:26:06 +02:00
Sergio Costas
2ec202dfa1 client access: add support for snap permissions
This patch adds to wireplumber code to manage the Snap audio
permissions.

SNAP containers have two main "audio" rules:

 * audio-playback: the applications inside the container can
   send audio samples into a sink
 * audio-record: the applications inside the container can
   get audio samples from a source

Also, old SNAP containers had the "pulseaudio" rule, which just
exposed the pulseaudio socket directly, without limits. This
is similar to the current Flatpak audio permissions.

In the pulseaudio days, an specific pulseaudio module was used
that checked the permissions given to the application and
allowed or forbide access to the pulseaudio operations.
With the change to pipewire, this functionality must be
implemented in pipewire-pulse and wireplumber to guarantee
the sandbox security.

The current code checks for the presence of the pipewire.snap.id
property in a client, in which case it will read the
pipewire.snap.audio.playback and pipewire.snap.audio.record
properties, and allow or deny access to that client to
the nodes with Audio/Sink or Audio/Source media.class
property.

See !567 and pipewire!1779
2024-01-13 16:18:13 +00:00
Julian Bouzas
598b3c83ce filter-utils: handle new 'filter.smart.targetable' property
This property indicates whether the filter can be directly linked with clients
that have a defined target (Eg: pw-play --target <filter-name>) or not. This can
be useful when a client wants to be linked with a filter that is in the middle
of the chain in order to bypass the filters that are placed before the selected
one. If the property is not set, wireplumber will consider the filter not
targetable by default, meaning filters will never by bypassed by clients, and
clients will always be linked with the first filter in the chain.

Fixes #554
2024-01-11 10:54:41 -05:00
Julian Bouzas
cdeac07814 linking: handle defined target properly with smart filters
This patch fixes the policy to not link the client to the default filter if the
client's defined target is found, is not a filter, does not have any other
filters linked with it. In this case, the client is therefore linked to the
actual defined target. On the other hand, if the client's defined target is a
filter, the client is linked to the first filter in the chain that has the same
target as the defined filter's target.
2024-01-11 10:48:27 -05:00
Julian Bouzas
c37f95169d filter-utils: improve get_filter_from_target API to also work with filters 2024-01-11 10:34:13 -05:00
George Kiagiadakis
c5c5317599 state-routes: use the correct device id when restoring route properties
Fixes: #551
2024-01-08 12:28:21 +02:00
George Kiagiadakis
0b0595a156 apply-routes.lua: rename variable to make the code easier to understand 2024-01-08 12:28:21 +02:00
George Kiagiadakis
a7d0dacd12 state-routes: fix restoring volumes when a Route is changed manually
When a manual change is applied, the store-or-restore-routes is the only
hook that gets executed for this event. In order to be able to test if a
route was changed, we need to reset all of them to 'active = false',
record the previous value of 'active' and test their difference.

Testing only the 'active' variable (and discarding 'prev_active') sounds
tempting here, but if a route is changed back and forth (from A to B
and back to A), there is nothing to reset the 'active' variable of A
when it gets deactivated and it will appear as previously active on
the second switch.

Related to: #551
2024-01-08 12:21:27 +02:00
George Kiagiadakis
eb2d6efcd4 state: add save_after_timeout() method to replace all custom timeout code
This was a common pattern that we had in many places, so it makes sense
to consolidate it.
2024-01-04 16:38:33 +02:00
George Kiagiadakis
7fa16292c3 common-utils: remove the simple serializer functions that were used for state files 2024-01-04 10:38:23 +02:00
George Kiagiadakis
38b6eec456 state-routes: use json to store info in the state file 2024-01-04 10:27:02 +02:00
George Kiagiadakis
5d41ef2311 scripts: s/putils/lutils/g ("policy" utils -> "linking" utils) 2024-01-03 11:10:56 +02:00
George Kiagiadakis
994f1c1f4a Merge branch 'master' into next 2024-01-03 10:47:16 +02:00
Ferdinand Bachmann
3a40a8795b wpctl: resolve device id and route device internally 2023-12-27 19:36:56 +01:00
Ferdinand Bachmann
f01177d08a wpctl: add set-route subcommand 2023-12-25 23:06:32 +01:00
Pauli Virtanen
43e190e3b4 wpctl: add set-log-level command
Add command for changing log level for Pipewire or Wireplumber daemons
at runtime.

It can be done with pw-metadata, but make it easier so that the user
doesn't need to look up Wireplumber client ids.
2023-12-24 17:59:59 +02:00
Pauli Virtanen
6037a6af94 m-log-settings: add module for changing log level at runtime
Pipewire server uses the global "settings" metadata for adjusting its
own log level.

Make it a convention that clients may watch "log.level" in this metadata
with their client id as subject, for setting their own log level
dynamically.

Watch the global "settings" metadata for "log.level" changes for our id.
On changes, set our log level accordingly.
2023-12-24 17:59:59 +02:00
George Kiagiadakis
c2d125b0da Merge branch 'master' into next 2023-12-23 18:34:00 +02:00
George Kiagiadakis
7dfc346a7b script docs: rewrite all csv-table to list-table for better source readability 2023-12-23 11:32:56 +02:00
George Kiagiadakis
59972b6e4f systemd: change the template services to load different profiles instead of conf files 2023-12-21 11:28:50 +02:00
George Kiagiadakis
0037733545 daemon: add cmdline option to load custom profile and report error if not found 2023-12-18 17:58:09 +02:00
George Kiagiadakis
c0b212bb0e scripts: common-utils: do not crash if the defaults table is nil
Fixes #542, #544
2023-12-18 10:56:30 +02:00
George Kiagiadakis
32b31232d1 docs: document components, profiles, features and settings 2023-12-14 16:49:12 +02:00
George Kiagiadakis
c4a0f5317e meson: exclude rst files from being installed with the scripts
and add them nicely to the sphinx_files without referencing '..' paths
2023-12-13 16:31:50 +02:00