Commit graph

281 commits

Author SHA1 Message Date
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
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
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
Ashok Sidipotu
d57e387f75 event-hooks: give unique names to event hooks 2023-04-17 07:47:09 -04:00
Ashok Sidipotu
82a8bc5673 event-hooks: remove the unwanted second arg in simple hooks 2023-04-17 07:47:09 -04:00
Ashok Sidipotu
695b99f0e8 device-profiles: Port to event-stack 2023-04-17 07:47:09 -04:00
Ashok Sidipotu
464cda4cad create-item.lua: Adjust style 2023-04-17 07:47:09 -04:00
Ashok Sidipotu
ebffbc9ca1 restore-stream.lua: Adjust style 2023-04-17 07:47:09 -04:00
Ashok Sidipotu
78c2e3167a device-profiles: Add summary 2023-04-17 07:47:09 -04:00
Ashok Sidipotu
9197dac94d policy-device-profile.lua: Adjust style 2023-04-17 07:47:09 -04:00
Ashok Sidipotu
bc2d403396 policy-device-routes.lua: Port to event-stack 2023-04-17 07:47:09 -04:00
Ashok Sidipotu
f8072889aa policy-device-routes.lua: Add summary and enhance the debug messages 2023-04-17 07:47:09 -04:00
Ashok Sidipotu
5ebef4be6e policy-device-defaults.lua: Adjust style 2023-04-17 07:47:09 -04:00
Ashok Sidipotu
6e31b47c28 event-dispatcher: Add an enumeration of default event hook priorities
This scheme provides for an orderly execution of hooks as the priorities
are controlled from one single place. Enumeration is defined in such a
way that new items can be added easily.

All the event hooks are changed to get the priorities from this
enumeration.
2023-04-17 07:47:09 -04:00
Ashok Sidipotu
9337bb25ef m-default-nodes*: Remove suffixes in hooks name
Suffix is redundant for on events as Events names and Event chains are
printed with 847c0.

Update the settings file used.
2023-04-17 07:47:09 -04:00
Ashok Sidipotu
ff03094d67 restore-stream.lua: Port to event-stack 2023-04-17 07:47:09 -04:00
Ashok Sidipotu
dc3e523240 policy-node.lua: Update settings file used 2023-04-17 07:47:09 -04:00
Ashok Sidipotu
ff833b138d event-dispatcher: log event and hook names and chains
- Add a new variable "name" in WpEventHook and use it to log all the
  hooks(by name) picked up in _push_event(). This gives a clear picture
  if hook is registered for a given event.
- Form a name for an event and a chain of events for an event run, log
  both of them. This gives a clear picture of the events executed and
  order in which they are dispatched.
- Similarly build hooks chain and print it in _source_dispatch(), this
  gives a clear picture of the hooks picked and the order in which they
  are dispatched.
- Log only the dispatchable(with hooks) events, this de-clutters
  the log messages.
2023-04-17 07:47:09 -04:00
Ashok Sidipotu
11dacb9b5f policy-node.lua: Update the summary
Update the summary of what the script does.
2023-04-17 07:47:09 -04:00
Ashok Sidipotu
18727d41e4 create-item.lua: Update the summary
Update the summary of what the script does.
2023-04-17 07:47:09 -04:00
Ashok Sidipotu
d2770123d3 policy-node: Adjust the priority of policy event
handlelinkable() should run after the linkable is created by the
create-item adjust the Priorities accordingly.
2023-04-17 07:47:09 -04:00
Ashok Sidipotu
fbac3a38a9 policy-node: Port to Event Stack design
- register hooks(simple) for handling linkable object-added/removed
  events.
- register simple rescanning after-event hook for "linkable
  addition/removal" and "device added" events.
2023-04-17 07:47:09 -04:00
George Kiagiadakis
aefc50da3d create-item: push linkable events.
push linkable object-added/removed events.
2023-04-17 07:47:09 -04:00
George Kiagiadakis
fd91d8a35b WIP: port create-item.lua to use event hooks 2023-04-17 07:47:09 -04:00
Ashok Sidipotu
8a0c4fde4c policy: Switch policy settings to JSON
- Create policy-settings.conf and move all the policy settings to it.
- Change all the policy scripts to fetch the settigs from WpSettings
  API.
- Remove all the references to config/lua.
2023-04-17 07:44:19 -04:00
Ashok Sidipotu
2f60077460 endpoints: Switch endpoints config to JSON
- Move the endpoints defination to wireplumber.conf under a new section
  in the form of two JSON objects, namely endpoints and
  endpoints-roles.
- Treat the endpoint objects as settings, for the sake of loading,
  parsing and querying.
- m-settings loads the objects and WpSettings parses them as any other
  settings.
- Make the following changes in endpoint scripts.
   - Get the endpoint settings using the _get_string() API.
   - Parse and use the data.
   - Remove references to the config/lua
- Remove the endpoints defination in config/lua
2023-04-17 07:44:19 -04:00
Ashok Sidipotu
2ef76f823a bluez.lua: Switch bluez lua monitor to wpsettings
- Monitor to use the JSON APIs and move away from config/lua
- Enhance logic in wpsettings to parse settings which are JSON arrays,
  some of the bluetooth properties are JSON arrays and parsing
  logic confused them for a rule.
- Add corresponding tests around this logic as well.
2023-04-17 07:44:19 -04:00
Ashok Sidipotu
4282dff187 wpsettings: switch settings in main.lua.d to JSON
- switch stream based lua script and their configs to wpsettings,
  remove all the config/lua references
- move last remaining scripts and modules from 90-enable-all.lua to
  wireplumber.conf
- delete all files in main.lua.d
2023-04-17 07:44:19 -04:00
Ashok Sidipotu
e180ff2f94 device-settings: Switch device settings to wpsettings
- move all the device based settings and scripts to JSON config and
  remove config/lua references.
2023-04-17 07:44:19 -04:00
Ashok Sidipotu
161c43b71a lua monitors: switch to wpsetttings
- switch alsa.lua, v4l2.lua & libcamera.lua
- remove the config/lua references for these scripts
- fix the wpsettings deps parsing bug.
2023-04-17 07:44:19 -04:00
Ashok Sidipotu
a4f16a98f0 main: Add support for deps flag in loading modules
- support loading modules dependent on wireplumber settings in JSON
  config.
- load the settings module before parsing wireplumber.components,
  so that dependencies can be fetched during parsing.
- access lua scripts are switched to JSON based config and lua configs
  are removed.
2023-04-17 07:44:19 -04:00
Pauli Virtanen
faf98ae76e bluez: emit combine-stream for BAP device sets
For Bluetooth LE Audio device sets (e.g. pair of earbuds), bluez5-device
emits "internal" nodes for each individual device, and a combine node
for the device set.

Make the bluetooth monitor to create the combine nodes using
module-combine-stream.

Do some shenanigans to route ObjectConfig events from bluez5-device to
the correct combine node: look for combine nodes associated with device
sets, and put them as managed objects of the Spa devices.
2023-04-08 23:18:58 +03:00
Ashok Sidipotu
b78e441c79 libcamera.lua: add support for disabling nodes
Fixes #418
2023-02-22 14:13:17 +00:00
Robert Mader
979fd59329 policy-node: do not hold references in link-error handler
Using `si` and `si_target` in the error handler results in references to
the objects getting added, keeping them alive indefinitely. Look them up
using their ids instead.

Fixes b8201d2716

Closes https://gitlab.freedesktop.org/pipewire/wireplumber/-/issues/419
2023-02-20 15:05:25 +01:00
Wim Taymans
eae8d2d0b5 alsa: boost pro- profiles priority
So that they are more likely to become the driver in the graph.
2023-02-16 10:44:48 +00:00
Robert Mader
b8201d2716 policy-node: handle WpSiStandardLink link-error signal
It gets emitted e.g. on format negotiation errors. Send `-EPIPE`
errors to the respective clients to let them close the connection.
2023-02-16 10:39:31 +00:00
Julian Bouzas
a0e8470764 restore-stream: add default-channel-volume config option
Allows users to set a default channel volume for streams whose properties have
never been saved before.
2023-01-31 17:06:10 +00:00
Pauli Virtanen
2daa2da773 bluez-midi: add property for setting latency offset 2023-01-24 17:01:20 +02:00
Pauli Virtanen
69fcdb5b69 bluez-midi: set api.glib.mainloop
Indicate to the plugin that Glib mainloop = PW mainloop.
2023-01-24 17:01:20 +02:00
Pauli Virtanen
0978c224dc scripts: add bluez-midi monitor and its configuration
Add support for BLE MIDI devices and local endpoints.

Disabled by default for now, as the feature currently faces some
DBus/SELinux policy issues e.g. on Fedora.
2023-01-24 17:01:20 +02:00
Wim Taymans
f6dc1b3347 alsa-monitor: handle snd_aloop devices better
Place Loopback as the device description for snd_aloop devices.

Fixes pipewire#2214
2022-12-13 15:19:06 +01:00