Commit graph

595 commits

Author SHA1 Message Date
George Kiagiadakis
2e3d2b2bb9 scripts/policy-desktop: fix the code of the find-target hooks to work again
* Use a common function to unwrap the objects out of the event
* Use the same common function to get the si flags
* Do not store back the si flags - there is no point in doing that,
  tables are objects in lua and they are passed around by reference
* Store the target on the event
2023-04-17 07:48:18 -04:00
George Kiagiadakis
013a61b440 scripts/lib: add policy-config script library 2023-04-17 07:48:18 -04:00
George Kiagiadakis
e5764e33a4 scripts: split policy-hooks into separate files, one for each hook 2023-04-17 07:48:18 -04:00
Ashok Sidipotu
7be388c881 main: Free the component deps using the correct API 2023-04-17 07:48:18 -04:00
Ashok Sidipotu
904751ede1 main.c: refactor the init transition with priority tag
- Support `priority` tag in definition of wireplumber components in json
  config files.
- Support loading dangling components. These are components which are
  NOT present in the json config files but present in the wireplumber
  lookup folders.
- Simplify the init transition by removing the unneeded steps.
2023-04-17 07:48:18 -04:00
Julian Bouzas
78b0dd58db conf: move endpoints into wireplumber.settings 2023-04-17 07:48:18 -04:00
Julian Bouzas
36cba7fe55 config: comment all remaining rules 2023-04-17 07:48:18 -04:00
Julian Bouzas
6afca096e8 policy-device-profile.lua: use default rules if none are defined 2023-04-17 07:48:18 -04:00
Julian Bouzas
56087777f6 bluez.lua: use default rules if none are defined 2023-04-17 07:48:18 -04:00
Julian Bouzas
ed79e9a4d0 alsa.lua: use default rules if none are defined 2023-04-17 07:48:18 -04:00
Julian Bouzas
4bb949fd89 access-default.lua: use default rules if none are defined 2023-04-17 07:48:18 -04:00
Ashok Sidipotu
0fadd4f4fd wpexec: Add support for event dispatcher
-Scripts loaded with wpexec will also need 'module-standard-event-source'
 to be able to convert the pipewire signals to wireplumber events.
-Simplify the init transition states.
2023-04-17 07:48:18 -04:00
Julian Bouzas
a8d6d50e2a config: use wireplumber nomenclature for the setting names 2023-04-17 07:48:18 -04:00
Julian Bouzas
fe21c2f8b2 config: comment persistent.settings to false as it is its default value 2023-04-17 07:48:18 -04:00
Julian Bouzas
6a612db57a config: make remaining non rule settings optional 2023-04-17 07:48:18 -04:00
Julian Bouzas
f1fbeaa661 m-lua-scripting: add fallback value for parse_{array|object}_safe() APIs 2023-04-17 07:48:18 -04:00
Julian Bouzas
f416482f65 config: always comment the default values
This allows users to know what values are set by default.
2023-04-17 07:48:18 -04:00
Julian Bouzas
f6c4590299 config: consider dependency valid if not defined in WpSettings
Needed so that the configuration is fully commented.
2023-04-17 07:48:18 -04:00
Julian Bouzas
c5c36b26ba config: move all components into wireplumber.conf 2023-04-17 07:48:18 -04:00
Julian Bouzas
8df09a872b config: fix flags for libpipewire-module-rt 2023-04-17 07:48:18 -04:00
Julian Bouzas
d79d3e1465 policy-device-endpoint.lua: remove unused move configuration 2023-04-17 07:48:18 -04:00
Julian Bouzas
a23168af52 policy-hooks.lua: set move configuration to true by default 2023-04-17 07:48:18 -04:00
Julian Bouzas
048a975818 common-utils.lua: use different timeout callbacks for different states
This allows saving different states at the same time.
2023-04-17 07:48:18 -04:00
Julian Bouzas
c64139afbe conf: comment persistent.settings as it is disable by default 2023-04-17 07:48:18 -04:00
Ashok Sidipotu
f4382da5ba policy-hooks.lua: An example of user injectible hook 2023-04-17 07:48:18 -04:00
Ashok Sidipotu
bbe3b919d3 policy-{node|hooks}.lua: Fix issues in Zoom Desktop Video Sharing.
Fixes #339
2023-04-17 07:48:18 -04:00
Julian Bouzas
61fe102c28 main: parse component flags in a more robust way 2023-04-17 07:48:18 -04:00
Julian Bouzas
90eb2c831f main: always expect component deps to be a JSON array
Makes the configuration simpler
2023-04-17 07:48:18 -04:00
Julian Bouzas
0491fd172f main: use smart pointers to avoid wp_spa_json_unref() 2023-04-17 07:48:18 -04:00
Julian Bouzas
42fc17b234 config: clean and comment all configuration that is not needed by default
Most of the configuration settings have a default value when they are loaded by
the Lua scripts if they are not present, so we leave them commented in the
configuration. This will make the configuration smaller when supporting layered
configuration, as all the commented sections will be part of the override files.
2023-04-17 07:48:16 -04:00
Ashok Sidipotu
e1ff6bf4bf main.c: Allow for array of dependencies
A Wireplumber component can now be loaded dependent on an array of
wireplumber settings.
2023-04-17 07:47:09 -04:00
Ashok Sidipotu
efb0c5a635 Wireplumber Settings: Port the latest changes from master
Port them from Lua config to JSON config.
2023-04-17 07:47:09 -04:00
Ashok Sidipotu
6762de3990 policy-{bluetooth|device-profile|device-routes}.lua: Optimize for Event stack
- Sharpen the hooks.
- Make settings live, apply them when they are changed.
- Move some of the common functions to common_utils.lua
2023-04-17 07:47:09 -04:00
Ashok Sidipotu
66c63a91a9 monitors: Align nomenclature of the settings and rules 2023-04-17 07:47:09 -04:00
Ashok Sidipotu
335fe69461 restore-stream.lua: optimize for event-stack
- Sharpen the hooks.
- Make settings live, apply them when they are changed.
- Move common funtions to common-utils.lua
2023-04-17 07:47:09 -04:00
Ashok Sidipotu
4dd8dd6ce5 policy-node.lua: apply policy settings live
Also change the setting names as per nomenclature.
2023-04-17 07:47:09 -04:00
Julian Bouzas
a512ddaaf3 scripts: use the WpSettings safe APIs
Avoids Lua errors if a setting cannot be parsed or does not exist.
2023-04-17 07:47:09 -04:00
Ashok Sidipotu
a060c6a130 m-default-nodes{-api}: optimize for event-stack
- Sharpen the hooks, so that they are called only when needed.
- Make settings live, apply them when they are changed.
- Remove the state saver after events hook, call it directly.
- Remove the settings bookkeeping as the gobject properties.
- Remove the scheduling of default-nodes-changed signal via core.
2023-04-17 07:47:09 -04:00
Ashok Sidipotu
a5a6300662 policy-node.lua: fix the session items unhandling 2023-04-17 07:47:09 -04:00
Julian Bouzas
0983326433 scripts: use the new object ID as index in the Lua tables
We cannot guarantee that the object's bound-id is always valid when an event is
triggered, especially when an object is removed. This patch uses the new object
wireplumber unique ID to index Lua tables, fixing runtime WP_PROXY_FEATURE_BOUND
check warnings.
2023-04-17 07:47:09 -04:00
Ashok Sidipotu
72536261e9 policy-node.lua: Second round of cleanup.
- WirePlumber Lua now facilitates Lua libraries/modules, utilize this and create
  modules. Add some tests around this functionality.
- Create policy-hooks.lua containing all the hooks to find-target events
- Create policy-utils.lua module and push all the policy utility functions to it.
- Create common-utils.lua module and push the common utility functions to it.
- Remove all the above functionality from policy-node.lua and clean it up.
2023-04-17 07:47:09 -04:00
Ashok Sidipotu
3832e14c1c policy-node.lua: First round of cleanup
- remove scheduling rescan via core APIs instead use the event stack for proper
  scheduling.
- The rescan & handlelinkable hooks will push new findTargetSiAndLink events one
  per session item.
- Register a new "after-events-with-event" hook for findTargetSiAndLink event,
  it runs with lower priority than the rescan hook and so rescan hook can cancel
  unneeded findTargetSiAndLink events.
- Register hooks for move and follow properties.
2023-04-17 07:47:09 -04:00
Julian Bouzas
2f1aece8b6 settings: remove _get_{boolean|int|float|string}() APIs
They is really no needed with the new _get() API and the WpSpaJson API. In C,
users can use 'wp_spa_json_parse_{boolean|int|float|string}()' APIs to parse the
WpSpaJson. In Lua, users can just do 'Settings.get(setting, m):parse()'.
2023-04-17 07:47:09 -04:00
Julian Bouzas
5e6262718a monitors: use new Settings.get_all() API 2023-04-17 07:47:09 -04:00
Julian Bouzas
a76e780b4b docs: update new configuration file names 2023-04-17 07:47:09 -04:00
Julian Bouzas
4d41490f82 conf: rename '*-settings.conf' files to just '*.conf' 2023-04-17 07:47:09 -04:00
Ashok Sidipotu
074294568b create-node.lua: Adjust style 2023-04-17 07:47:09 -04:00
Ashok Sidipotu
72226e3934 policy-node.lua: Adjust style 2023-04-17 07:47:09 -04:00
Ashok Sidipotu
5550777983 policy-bluetooth.lua: Port onto Event-stack 2023-04-17 07:47:09 -04:00
Ashok Sidipotu
1f77be36e5 policy-bluetooth.lua: Adjust style 2023-04-17 07:47:09 -04:00