Commit graph

1983 commits

Author SHA1 Message Date
Julian Bouzas
2223cd47d4 settings: use WpSpaJson to parse the settings
We need to use WpSpaJson to parse the values in WpSettings. This is because the
wireplumber configuration is written in JSON, so WpSettings should only hold
JSON values. To fix this, 2 API changes have been done:

- wp_settings_get_int() only accepts gint values, instead of gint64 values. This
is because the WpSpaJson API only parses int values, like spa_json_parse_int().

- wp_settings_get_string() now returns a newly allocated string, this is because
the string needs to be decoded in case it has quotes.
2023-04-17 07:47:09 -04:00
Julian Bouzas
9f2168e022 spa-json: add _add_from_string() and _add_from_stringn() builder APIs 2023-04-17 07:47:09 -04:00
Julian Bouzas
bef5b2ef04 settings: use TRUE/FALSE instead of true/false 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
cc36ea2fac m-default-profile: Adjust style and update summary. 2023-04-17 07:47:09 -04:00
Ashok Sidipotu
3878b88952 tests/events.c: Adjust style 2023-04-17 07:47:09 -04:00
Ashok Sidipotu
3ff9f240c8 event-dispatcher: after-events hooks to get the trigger event info
after-events hooks will get the original event triggering it, instead of the
rescan event.

after-events hook can register with any event, but it is called with rescan event
info. This is so because, after-events hook run after all the on-events hooks
are done with and as a part of the rescan event. so it is triggered with rescan
event data, which doesnt carry much info, instead of rescan event, it makes more
sense to call the after-events hook with the original event which triggered it.
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
da2ac1b7a1 lib: event-dispatcher: Dont push empty events
Empty events are the events without any hooks, refine log msgs further.
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
6bdc6fb697 event-dispatcher: Donot cancel the object-removed event
The event is not reaching the object-removal hooks due to this.
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
a6b3f1c1fb m-standard-event-source: fix params of on-params-changed event 2023-04-17 07:47:09 -04:00
Ashok Sidipotu
025b0f6e2e m-default-nodes: Port to Event stack 2023-04-17 07:47:09 -04:00
Ashok Sidipotu
d61be3c397 doc: event-dispatcher: Update the annotations 2023-04-17 07:47:09 -04:00
Ashok Sidipotu
f5f4acf95d m-standard-event-source: fix metadata changed evnt
Assign type and priority for metadata events
2023-04-17 07:47:09 -04:00
Ashok Sidipotu
869a1068a4 event-dispatcher: Merge global properties
Global properties are needed for event stack to deal with global
objects.

Refine debug 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
655e052f59 lib: Refine trace messages 2023-04-17 07:47:09 -04:00
Ashok Sidipotu
4d1a86ced1 m-lua-scripting: Fix bug in WpEvent referencing
While calling async execute closure, take a reference to the WpEvent
object before pushing it to the Lua stack. Otherwise Lua garbage
collector frees it, which leads to invalid memory access.
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
Ashok Sidipotu
3c2c954107 wireplumber.conf: add m-standard-event-source 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
George Kiagiadakis
d72f31e803 lua: add EventInterest convenience constructor for declaring interest on events 2023-04-17 07:47:09 -04:00
George Kiagiadakis
2cffd9177a tests: wplua: add event hooks lua test 2023-04-17 07:47:09 -04:00
George Kiagiadakis
01a56496e2 event-dispatcher: use an eventfd to make the source ready
- the source shouldn't become ready if there is nothing to do,
  otherwise idle sources do not run (since they have lower priority)
- when the source becomes ready, we need a fd to wake up GLib's event
  dispatching mechanism to continue processing, otherwise nothing happens
2023-04-17 07:47:09 -04:00
George Kiagiadakis
9db63e8ca6 event-hook: do not expose the dispatcher in the public API
It's a singleton, we can get it from its instance function...
2023-04-17 07:47:09 -04:00
George Kiagiadakis
f91ff40a2d simple-event-hook: do not pass the dispatcher as argument to the closure 2023-04-17 07:47:09 -04:00
George Kiagiadakis
4c7cb5145d lua: implement EventDispatcher.push_event 2023-04-17 07:47:09 -04:00
George Kiagiadakis
5c2565c9b1 lua: add WpAsyncEventHook bindings 2023-04-17 07:47:09 -04:00