Commit Graph

2604 Commits

Author SHA1 Message Date
George Kiagiadakis
95cfa9e453 wpctl: fix settings --help listing
GOptionEntry arrays need to be NULL terminated, otherwise garbage
will be printed after the last entry...
2024-03-12 16:50:25 +02:00
George Kiagiadakis
857cee10cf docs: conf_file: small updates 2024-03-12 16:39:44 +02:00
George Kiagiadakis
1ebed7804c docs: installing: update dependency versions 2024-03-12 16:35:14 +02:00
George Kiagiadakis
7d217e37ce si-linkables: do not fully reset when the underlying proxy is destroyed
Reset back to the session item's "configured" state instead of clearing
the si properties completely. This allows the "session-item-removed"
event to be dispatched with all the original properties of the node
intact, for constraint matching purposes.

Fixes #588
2024-03-12 12:44:32 +02:00
George Kiagiadakis
ad743a2143 registry: move to a separate file and decouple it from the object manager
So that it can have its own log topic...
It also makes the code a bit easier to navigate.
2024-03-12 11:55:45 +02:00
George Kiagiadakis
8caf6a6271 log: docs: document the log topic definition macros 2024-03-12 11:55:45 +02:00
Julian Bouzas
f6fede9ee4 monitors/bluez: add 'internal' prefix to internal bluez node names.
And name the loopback source node the same as bluez source without 'internal'
prefix. This keeps consistency with input/output node names when switching
bluetooth profiles.
2024-03-11 13:49:01 -04:00
Julian Bouzas
5f9b3a9659 monitor/bluez: set node.name property when creating combine stream 2024-03-11 13:41:23 -04:00
Julian Bouzas
9caa44cfab meson: bump min pipewire version to 1.0.2
This is because of using 'api.bluez5.internal' property in bluez.lua.

See !589
2024-03-11 12:07:18 -04:00
Julian Bouzas
5e19722491 scripts: fix regression in state-routes.lua when marking routes as 'active'
Like WirePlumber 0.4.17, we need to mark the current routes as 'active' if they
were previously not active as soon as we detect it. This avoids a possible
infinite loop that restores the routes and saves them constantly, which happens
when the device's Route param has changed more than once before the event
'select-routes' is triggered.
2024-03-11 09:47:31 +00:00
Julian Bouzas
bed3b62e0d scripts: improve linking logs 2024-03-11 09:47:31 +00:00
Ashok Sidipotu
88f893e2ce monitors: use parseBool for boolean properties in rules
The boolean values of properties in rules are strings in JSON config files and
they will retain the same type when they are translated to Lua.
Use cutils.parseBool() function when they have to be interpreted as bools.

Fixes: #586
2024-03-11 07:19:27 +00:00
Ashok Sidipotu
08ae195cdb config: add {device|node}.disable 2024-03-11 07:19:27 +00:00
George Kiagiadakis
dee7403f69 object-interest: make WP_INTEREST_MATCH_ALL part of the enum
This is to avoid potential issues with g-i parsing.

See #540
2024-03-09 17:26:52 +02:00
George Kiagiadakis
6ed05b3f00 proxy: make the FEATURES_MINIMAL and FEATURES_ALL constants part of the enum
This fixes their parsing by g-i, correcting their values in the bindings,
which were previously wrong.

Fixes #540
2024-03-09 17:25:03 +02:00
George Kiagiadakis
b106b774f8 log: fix WP_LOG_LEVEL_TRACE value in the g-i bindings
See #540
2024-03-09 17:23:32 +02:00
George Kiagiadakis
f4d8fa94d7 base-dirs: wrap flag groups in parenthesis
The absence of parenthesis confuses the gobject-introspection parser
for some reason, making it emit WP_BASE_DIRS_FLAG_SUBDIR_WIREPLUMBER
multiple times in the .gir file
2024-03-09 16:30:15 +02:00
George Kiagiadakis
e9d8eeedef log.h: define G_LOG_DOMAIN only if WP_USE_LOCAL_LOG_TOPIC_IN_G_LOG is defined
Define WP_USE_LOCAL_LOG_TOPIC_IN_G_LOG in project scope, so that we always
use this feature in our codebase without causing problems for other projects.

Fixes #571
2024-03-09 15:58:01 +02:00
George Kiagiadakis
d8b1efcba7 meson: make sure the boolean options have boolean values
meson 1.1.0 has deprecated the use of strings for boolean options
2024-03-09 15:58:01 +02:00
George Kiagiadakis
3fa5228d22 meson: move the common CFLAGS to project-wide scope 2024-03-09 15:58:01 +02:00
Julian Bouzas
d0f16e4757 scripts: make sure target is not nil when iterating filters with matching targets 2024-03-08 10:56:34 -05:00
George Kiagiadakis
f24edf67fa docs: update the documentation around file search locations 2024-03-07 19:58:52 +02:00
Julian Bouzas
22de7513c1 scripts: rescan linkables when device EnumRoute param changes
This is needed for some devices that expose both Headset and Speaker nodes, so
that the applications are automatically linked to the Headset node or Speakers
node automatically when plugging and unplugging a headset.
2024-03-06 10:46:50 -05:00
Julian Bouzas
e496222a03 scripts: fix available routes check when selecting the default node
Also reevaluates default nodes when the device params changed.
2024-03-06 10:46:50 -05:00
George Kiagiadakis
a141ec0c68 scripts: fix typo in rescan-virtual-links.lua 2024-03-05 16:34:11 +02:00
George Kiagiadakis
2249d8d9df 0.4.90 (0.5.0~rc1) 2024-03-04 19:29:09 +02:00
Julian Bouzas
9da732d88c m-mixer-api: use gboolean instead of bool
The WpSpaPodParser always expects gboolean for boolean values. We should never
use bool in WirePlumber unless strictly necessary.

Fixes #584
2024-03-04 17:22:03 +00:00
George Kiagiadakis
9c3aa5409e core: close the configuration file after loading all components
All components are supposed to read the configuration file during
initialization. After that, the file is not needed anymore.
2024-03-04 16:33:14 +00:00
George Kiagiadakis
6321ff9f62 scripts: access: cache the access.rules in a global config variable 2024-03-04 16:33:14 +00:00
George Kiagiadakis
655a24acf0 scripts: remove cutils.evaluateRulesApplyProperties()
Cache the rules in a global variable in each script, as JSON,
and use JsonUtils directly to evaluate them. This will allow us to
close the WpConf in the future after loading the scripts.

Also change the order of the return values of the match_rules_apply_properties
function to be able to easily ignore the number of changed values,
which is useless in most cases.
2024-03-04 16:33:14 +00:00
George Kiagiadakis
3fbf1286e6 lua: change the Conf API to have methods for getting sections as specific types
In some cases we need to get a section as JSON, so that we can pass it
down to the rules parser, while in other cases we neeed to get it as a
table to use it natively, and in that case we even need to differentiate
between it being an object, an array or an object with WpProperties.

Make it also possible to optionally pass tables with default values to
the functions so that we can get rid of cutils.get_config_section()
as well.
2024-03-04 16:33:14 +00:00
Julian Bouzas
91b5ba5e92 meson: bump min pipewire version to 0.3.82 2024-03-04 16:13:47 +00:00
George Kiagiadakis
acb446d26e meson: fix typo in lib/wp/meson.build: @0 -> @0@ 2024-03-04 17:34:21 +02:00
Julian Bouzas
00e5c0d7f8 settings: log warnings if setting does not exist in the schema 2024-03-04 09:03:51 -05:00
Julian Bouzas
ee366446b6 conf: fix settings schema typos
Fixes #583
2024-03-04 09:03:51 -05:00
George Kiagiadakis
4b0024ed27 base-dirs: add missing (nullable) annotation 2024-03-04 07:07:56 +00:00
George Kiagiadakis
8040967e47 base-dirs: ensure we skip non-absolute paths in the XDG env variables
The XDG basedir spec explicitly says non-absolute paths must be ignored
and the glib wraper functions don't check that.
2024-03-04 07:07:56 +00:00
George Kiagiadakis
a873f47d2e base-dirs: tidy up the build-time base dirs and honor the SUBDIR_WIREPLUMBER flag
Add a new private header file, wpbuildbasedirs.h, that contains the
build-time base directories passed directly from meson, without
the "wireplumber" suffix.

Use this to set the WP_BASE_DIRS_BUILD_* and adjust the code to honor
the SUBDIR_WIREPLUMBER flag.
2024-03-04 07:07:56 +00:00
George Kiagiadakis
ad4c6999e8 base-dirs: add a SUBDIR_WIREPLUMBER flag to append "/wireplumber" to the base dirs
This removes the previous hardcoding of this suffix and allows the
functions to be useful to other projects that use libwireplumber
and want to use this code to locate their data & config.
2024-03-04 07:07:56 +00:00
George Kiagiadakis
e7484c16a3 base-dirs: rename ETC & PREFIX* flags to BUILD* and improve documentation
The directories specified by these flags are build-time constants,
so the BUILD* prefix is more appropriate.
2024-03-04 07:07:56 +00:00
George Kiagiadakis
14daab576b docs: add base-dirs in the generated C API documentation 2024-03-04 07:07:56 +00:00
George Kiagiadakis
c841ec97a8 conf: drop all the _get_value() functions and remove the fallback from _get_section()
We do not use these APIs, so there's no point in keeping them.

Realistically, every component that needs a section just does its
own parsing on it, so the _get_value() functions are not needed.

The fallback in _get_section() is also not needed, as we always
pass NULL and then test for it. In Lua, however, it seems we are
using the fallback to return an empty object, so that getting
a section does not expand to multiple lines of code. For that reason,
I have kept the syntax there and implemented it in the bindings layer.
2024-03-04 07:07:56 +00:00
George Kiagiadakis
4596b7162e conf: add a simple check for old format wireplumber.conf files 2024-03-04 07:07:56 +00:00
George Kiagiadakis
08df33d7a3 wireplumber.conf: document the main difference between context.modules and wp.components 2024-03-04 07:07:56 +00:00
George Kiagiadakis
3d5cee55d8 meson: install configuration files back in $wireplumber_data_dir 2024-03-04 07:07:56 +00:00
George Kiagiadakis
60382df63f conf: refactor configuration loading
Changes:

- Configuration files are no longer located by libpipewire,
  which allows us to control the paths that are being looked up.
  This is a requirement for installations where pipewire and
  wireplumber are built using different prefixes, in which case
  the configuration files of wireplumber end up being installed in
  a place that libpipewire doesn't look into...

- The location of conf files is now again $prefix/share/wireplumber,
  /etc/wireplumber and $XDG_CONFIG_HOME/wireplumber, instead of using
  the pipewire directories. Also, since the previous commits, we now
  also support $XDG_CONFIG_DIRS/wireplumber (typically /etc/xdg/wireplumber)
  and $XDG_DATA_DIRS/wireplumber for system-wide configuration.

- Since libpipewire doesn't expose the parser, we now also do the
  parsing of sections ourselves. This has the advantage that we can
  optimize it a bit for our use case.

- The WpConf API has changed to not be a singleton and it is a
  property of WpCore instead. The configuration is now expected
  to be opened before the core is created, which allows the caller
  to identify configuration errors in advance. By not being a singleton,
  we can also reuse the WpConf API to open other SPA-JSON files.

- WpConf also now has a lazy loading mechanism. The configuration
  files are mmap'ed and the various sections are located in advance,
  but not parsed until they are actually requested. Also, the sections
  are not copied in memory, unlike what happens in libpipewire. They
  are only copied when merging is needed.

- WpCore now disables loading of a configuration file in pw_context,
  if a WpConf is provided. This is to have complete control here.
  The 'context.spa-libs' and 'context.modules' sections are still
  loaded, but we load them in WpConf and pass them down to pw_context
  for parsing. If a WpConf is not provided, pw_context is left to load
  the default configuration file (client.conf normally).
2024-03-04 07:07:56 +00:00
George Kiagiadakis
64c233f3f4 spa-json: wrap the data instead of the spa_json* in _parser_get_json()
This allows the returned WpSpaJson object to be kept around
after the parser has advanced to the next token. The behaviour
of the _new_wrap() function is to wrap the underlying spa_json*
and it breaks as soon as the parser advances.
2024-03-04 07:07:56 +00:00
George Kiagiadakis
ccdca1ffb4 tests/wp/spa-json: add "undefined" parser unit test 2024-03-04 07:07:56 +00:00
George Kiagiadakis
d07b6188e5 spa-json: add new "undefined" parser constructor
This allows reading non-standard JSON data that is not a valid JSON
object or array, but can be treated as such.
2024-03-04 07:07:56 +00:00
George Kiagiadakis
9e77240b64 base-dirs: return NULL from lookup_dirs() when the searched path is absolute
This allows the files iterator to lookup in a specific directory
when the given path is absolute, similar to how pipewire behaves
for configuration files (e.g. /foo/bar/wireplumber.conf must
include /foo/bar/wireplumber.conf.d/*.conf).

This also allows improving the wp_base_dirs_find_file() structure to
avoid duplicated code and add a debug message easily.
2024-03-04 07:07:56 +00:00