Commit graph

623 commits

Author SHA1 Message Date
George Kiagiadakis
26e47db4b4 scripts: default-nodes: fix mistakes to make default-node selection work 2023-04-17 07:48:18 -04:00
George Kiagiadakis
28548e0933 scripts: move create-item.lua under node/ and modernize it 2023-04-17 07:48:18 -04:00
George Kiagiadakis
258d9f32e1 scripts: rename all hooks to follow a nicer naming scheme
Use the directory name and file name to construct the hook's name,
like a path. This way, when you see a hook name, it is clear where
to find that hook in the source code.
2023-04-17 07:48:18 -04:00
George Kiagiadakis
652a6a6698 scripts: rename directories to follow the new naming scheme
* client: Logic that deals with configuring clients (basically, permissions)
* device: Anyhing that that deals with configuring devices (profiles, routes, ...)
* node: Anything that deals with node objects: configuring nodes, changing
  their state, their properties and also creating new nodes (but NOT linking them)
* linking: All the logic for creating links between nodes (and obviously,
  deciding which links to create)
* monitors: Scripts that deal with hardware subsystems, mainly monitoring
  hardware changes and reflecting them on pipewire
* default-nodes: All the logic for selecting the default sinks and sources
2023-04-17 07:48:18 -04:00
George Kiagiadakis
08a9d39295 events: rename find-target-si-and-link to select-target
And make sure it does not get prefixed with the subject type
2023-04-17 07:48:18 -04:00
George Kiagiadakis
d46d54f261 wireplumber.conf: update the list of loaded modules and scripts
A bit dirty for now, as the script auto-loading feature does not
work properly yet
2023-04-17 07:48:18 -04:00
George Kiagiadakis
2325178d5c default-nodes: port to a set of scripts with hooks 2023-04-17 07:48:18 -04:00
George Kiagiadakis
d8e461940f scripts: refactor restore-stream into node/state-stream
* Use more hooks and no custom object managers
* Use the settings manager for the config values
* Allow fully disabling the hooks when both restore-props and restore-target
  are disabled in the settings
* Change the format AND the name of the state file; use json directly
  in the values now that we can
2023-04-17 07:48:18 -04:00
George Kiagiadakis
85858c8a84 state-profile: dynamically respond to config.use-persistent-storage changes 2023-04-17 07:48:18 -04:00
George Kiagiadakis
b5d8a7982f scripts: split/refactor the policy-device-routes script into smaller hooks 2023-04-17 07:48:18 -04:00
George Kiagiadakis
9891758c70 remove policy-device-profile and m-default-profile 2023-04-17 07:48:18 -04:00
George Kiagiadakis
f99c3005f2 scripts: rewrite policy-device-profile and m-default-profile into a set of hooks
... excluding the persistent profile functionality for now (I am not convinced)
2023-04-17 07:48:18 -04:00
George Kiagiadakis
e1a8c3459a scripts: remove priority from all hooks and set up some basic dependencies 2023-04-17 07:48:18 -04:00
George Kiagiadakis
b100bdda4a event-hook: remove the exec type property & enumeration
With the latest changes, we can implement the "after-events" type
with external code that pushes a very low priority event that is
the "rescan" event.
2023-04-17 07:48:18 -04:00
George Kiagiadakis
bcb4e80723 m-std-event-source: use type-specific event names and multiple object managers
It is better to have type-specific event names to minimize the amount
of constraint string matches we do on hooks, as most hooks (if not all)
are interested on specific types of objects only.

Similarly, use a different object manager for each object type to
minimize the performance impact of iterations and lookups, as all
such actions are interested in only 1 object type every time.

Port all existing hooks to the new event names and the get-object-manager API.
2023-04-17 07:48:18 -04:00
George Kiagiadakis
54b14d1a29 scripts: port suspend-node.lua to the event dispatcher architecture 2023-04-17 07:48:18 -04:00
George Kiagiadakis
6668b40941 scripts: simplify policy-device-profile.lua 2023-04-17 07:48:18 -04:00
George Kiagiadakis
c2c95bf726 scripts: port misc hooks to use the new priority enumerations 2023-04-17 07:48:18 -04:00
George Kiagiadakis
374e4ecaff m-standard-event-source: simplify push_event, removing the subject_type
This avoids having to determine the subject type prior to pushing
an event from lua code and makes the call more convenient

Also add a debug statement to trace calls to push_event
2023-04-17 07:48:18 -04:00
George Kiagiadakis
5c113d2745 scripts: delete policy-node.lua
This has been split into smaller files in policy-desktop/
2023-04-17 07:48:18 -04:00
George Kiagiadakis
993a2686f6 scripts/policy-desktop: add main rescan script 2023-04-17 07:48:18 -04:00
George Kiagiadakis
dd733df9c3 scripts/policy-desktop: add script for the filter-forward-format logic 2023-04-17 07:48:18 -04:00
George Kiagiadakis
6bc782d070 scripts/policy-desktop: add move & follow settings handlers 2023-04-17 07:48:18 -04:00
George Kiagiadakis
67ab0eced2 scripts/lib: update policy-config to use the settings manager 2023-04-17 07:48:18 -04:00
George Kiagiadakis
57d4a8cb07 scripts/lib: add a new settings manager lua library
This intends to reduce the amount of code needed to maintain
tables of settings values across different scripts
2023-04-17 07:48:18 -04:00
George Kiagiadakis
73870c528b scripts: policy-node: use policy-config library 2023-04-17 07:48:18 -04:00
George Kiagiadakis
aafac752a1 scripts: remove policy-hooks.lua 2023-04-17 07:48:18 -04:00
George Kiagiadakis
6c27da6365 scripts/policy-desktop: add back the sample user hook on a separate file 2023-04-17 07:48:18 -04:00
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