Commit Graph

18 Commits

Author SHA1 Message Date
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
George Kiagiadakis
60c5982cd0 lua: add bindings for event / hook / dispatcher 2023-04-17 07:47:09 -04:00
Ashok Sidipotu
cfd51d9fe2 lib: wpsettings: Add _register_callback () API 2023-04-17 07:44:19 -04:00
Ashok Sidipotu
3a25bc14d2 lib: Add _get_float() wpsettings API
- also add the corresponding C & Lua tests.
2023-04-17 07:44:19 -04:00
George Kiagiadakis
893e44c51e lua: fix number of returned values in Settings.apply_rule 2023-04-17 07:44:19 -04:00
Ashok Sidipotu
7d304096e5 lib: Add _get_{int,string}() APIs
- add integer and string version of the APIs,
- Also Refine the APIs, return value to indicate the setting existance
  and a new param to return the value of the setting.
- add their lua bindings as well, in lua binding the return value nil
  indicates that the setting is not defnied.
- Add corresponding C and lua tests as well.
- Add a few handy debug msgs.
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
Ashok Sidipotu
a5d62b7bbd lib: Add wp_settings_apply_rule() API
- add C based tests
- add lua binding for the API and corresponding lua tests
- address comments from previous commits
2023-04-17 07:44:19 -04:00
Ashok Sidipotu
4d7ce2292e tests: Add tests for WpSettings object
- settings.c tests conf file loading & parsing, metadata updates,
  wpsetttings object creation and its API.
- settings.lua tests the API from lua scripts.
- Add a sample settings.conf file, this file contains sections copied
  over from client.conf along with the settings section. Add a file
  each for wp side and lua side of scripts.
- Make changes in base test infrastructure to take a custom conf file.
- Enhance the wp_settings_get_instance_api() to be take metadata_name
  parameter. So, Wpsetttings is now a singleton instance for a given
  metadata file.
- Enhance the m-settings module also to be take metadata_name parameter.
  this is handy for lua side of tests as its cumbersome to do this is
  lua.
2023-04-17 07:44:19 -04:00
Ashok Sidipotu
8fd8b01b7a lib: Introduce WpSettings API
- WpSettings is a singleton object which attaches itself to the core
  and registry, it provides a get_instance () for its clients.
- WpSettings provides API to get/set wireplumber settings and rules.
- main.c loads the new object and makes sure it is available for
  for all the modules and scripts. This is achieved by introducing
  a new activation step.
- Add the lua bindings for get_setting API.
2023-04-17 07:44:19 -04:00
George Kiagiadakis
efaaf3b43a lua: add Core.get_vm_type() method 2022-06-28 14:06:48 +03:00
Julian Bouzas
04198820f1 device: add new wp_spa_device_managed_object_new_iterator API 2022-06-27 08:52:36 +00:00
George Kiagiadakis
2eed279c9d i18n: remove the module and embed the gettext calls into the lua api
There is no need to have this as an optional module, since libintl
is a hard dependency of both PipeWire and GLib. This way we can keep
things a bit simpler and faster (no string copies and plugin lookups)

Bump meson dependency to 0.59 to benefit of the libintl lookup that
is now built into meson's dependency() function.
2022-05-10 15:16:09 +03:00
Julian Bouzas
07179452e2 m-lua-scripting: add WpSiAdapter APIs 2022-05-05 08:09:21 +00:00
George Kiagiadakis
ecb6100b77 m-lua-scripting: wrap every script in a WpPlugin and expose async activation api
This allows scripts to declare when they have finished their loading,
so we can now also know when wireplumber is done loading and ready to
handle clients

Related to !313
2022-04-23 20:14:59 +03:00
George Kiagiadakis
e1d0240bc9 wplua: split the functionality of the load functions into smaller functions
The load functions used to do 3 things:
- push the sandbox function on the stack
- load the file and push it as a function on the stack
- call the sandbox (or the file)

Now there are separate functions to do these 3:
- wplua_push_sandbox
- wplua_load_*
- wplua_pcall
2022-04-23 20:14:59 +03:00
George Kiagiadakis
17a257ddbe wplua: move under modules/module-lua-scripting
It's unlikely that wplua will ever be useful outside the context
of module-lua-scripting, so let's move it to keep all the code in one place
2022-03-24 09:47:59 +02:00