Commit graph

947 commits

Author SHA1 Message Date
George Kiagiadakis
c00a706998 scripts: add static-sessions.lua
Replaces the old create-session wireplumber.conf commands
2021-02-03 17:16:51 +02:00
George Kiagiadakis
03b17bcb5f m-lua-scripting/api: add WpImplSession bindings 2021-02-03 17:16:51 +02:00
George Kiagiadakis
f7c0f9cfc6 m-lua-scripting: pass component arguments to scripts 2021-02-03 17:16:51 +02:00
George Kiagiadakis
1c0f0b8684 wplua: pass SANDBOX_CONFIG as a script argument
avoids keeping it forever as a global
2021-02-03 17:16:51 +02:00
George Kiagiadakis
460ff6591d wplua: allow exchanging arguments and results with scripts 2021-02-03 17:16:51 +02:00
George Kiagiadakis
ef9b6ef982 m-lua-scripting: use wplua_table_to_asv() instead of custom function 2021-02-03 17:16:51 +02:00
George Kiagiadakis
81d6f055a0 wplua: add GVariant dictionary conversion functions 2021-02-03 17:16:51 +02:00
George Kiagiadakis
a67116b0b9 wptoml: remove, it's not used anymore
and drop cpptoml dependency as well
2021-02-03 17:16:51 +02:00
George Kiagiadakis
1d0ecc3d88 daemon: refactor
* load config from a lua script
* use a WpTransition to organize the code
* activate plugins before lua scripts
* cleanup
2021-02-03 17:16:51 +02:00
George Kiagiadakis
ddf7eb1ecb m-lua-scripting: fixes 2021-02-03 17:16:51 +02:00
George Kiagiadakis
29559b4065 wp: add wp_get_data_dir() 2021-02-03 17:16:51 +02:00
George Kiagiadakis
e52bd4468d src: move scripts to their own directory, install in $prefix/share/ 2021-02-03 17:16:51 +02:00
George Kiagiadakis
9fa17e04b4 object-interest: add a NOT_EQUALS verb 2021-02-03 17:16:51 +02:00
George Kiagiadakis
fc526af744 m-lua-scripting: allow queuing-in scripts without the plugin being activated
This allows us to load the scripts from the config file without
WpCore being connected yet. We can later activate the lua-scripting
plugin at the right moment to start processing the scripts.
2021-02-03 17:16:51 +02:00
George Kiagiadakis
2d2668100c m-lua-scripting: refactor as a WpComponentLoader
also, add support for loading lua config files, denoted by the
"config/lua" component type
2021-02-03 17:16:51 +02:00
George Kiagiadakis
5647f0bf9e wplua: allow loading relative paths from wplua_load_path()
convert them to absolute before creating the URI
2021-02-03 17:16:51 +02:00
George Kiagiadakis
84f1b4b484 wplua: add g_autoptr support to lua_State 2021-02-03 17:16:51 +02:00
George Kiagiadakis
94d527e187 wplua: add flags to modify the sandbox behavior
with ISOLATE_ENV, it isolates the global environment between scripts
just like it did before; without it, it uses a common environment

with MINIMAL_STD, it restricts even further the available library
functions; useful for configuration files that don't need to do
actual scripting, just to define some tables
2021-02-03 17:16:51 +02:00
George Kiagiadakis
cb228637d6 wp: export functions to get the module & config dirs 2021-02-03 17:16:51 +02:00
George Kiagiadakis
0d072874a1 lib: introduce WpComponentLoader and remove WpModule
The component loader is a more generic and extensible mechanism
of loading components; modules are one type of component...
The idea is to make scripts and config files also be components,
loaded by plugins that inherit WpComponentLoader
2021-02-03 17:16:51 +02:00
George Kiagiadakis
f61e292959 plugin: inherit from WpObject
* use the activate/deactivate system from WpObject,
  which allows async activation and error reporting
* drop 'module' property, use 'core' from WpObject
2021-02-03 17:16:51 +02:00
George Kiagiadakis
596990d718 modules: remove modules that are obsoleted by the lua scripts
+ their configuration
+ their unit tests
2021-01-30 12:58:26 +02:00
George Kiagiadakis
4abd779d69 modules: actually delete module-dbus-reservation.c 2021-01-27 18:13:06 +02:00
George Kiagiadakis
c29d701e4b monitor-alsa: add device reservation logic 2021-01-26 17:24:52 +02:00
George Kiagiadakis
4a15ad05f3 spa-device: add an "object-removed" signal
This is useful for monitors to destroy the associated device reservation
object. And it may be useful for other things in the future...
2021-01-26 16:42:29 +02:00
George Kiagiadakis
13a56a7472 lua: add wp_plugin_find binding 2021-01-26 16:36:47 +02:00
George Kiagiadakis
c78373b1fc modules: delete the old dbus-reservation module 2021-01-26 16:28:22 +02:00
George Kiagiadakis
ef908439c4 modules: implement a new reserve-device module
This one offers API to interract on a lower level with
the D-Bus reservation API and uses GDBus high level bindings only.

Also, this one implements the full Acquire procedure, calling
RequestRelease() on the peer and requesting the name again with
REPLACE_EXISTING
2021-01-26 16:28:22 +02:00
George Kiagiadakis
bf71b73ae2 plugin: add a method to find plugins easily
Similar to wp_si_factory_find()
2021-01-26 16:28:22 +02:00
Julian Bouzas
d315898477 conf: create-endpoint.lua: make sure endpoints always have a valid name 2021-01-25 09:45:52 -05:00
Julian Bouzas
0beefe4d7e conf: create-endpoint.lua: use node id as key in session_items table 2021-01-25 09:44:29 -05:00
George Kiagiadakis
40ce5f0d5f meson: add 'system-lua' project option to toggle the bundled lua
By default system-lua=false, so the bundled version is built.

The default_library for the lua subproject is also set to static
now, so that we don't need to install liblua and mess up the system.
For existing build trees, this needs to be switched manually now with
-Dlua:default_library=static (or just wipe the build dir and start clean)
2021-01-23 19:11:38 +02:00
Julian Bouzas
a3a787c5c8 conf: disable legacy endpoint creation module and replace it with lua script 2021-01-22 10:09:39 -05:00
Julian Bouzas
62f819013d m-lua-scripting: add session item lua API 2021-01-22 10:04:37 -05:00
Julian Bouzas
7c0739af50 session-item: add export API with closure 2021-01-22 09:55:52 -05:00
Julian Bouzas
73c6e65a74 session-item: add activate API with closure 2021-01-22 09:55:52 -05:00
George Kiagiadakis
89d300ea48 docs: update daemon/running.md
pipewire.conf uses a different format now
2021-01-22 12:51:10 +02:00
Julian Bouzas
823abe03ee m-lua-scripting: fix reference count in object manager's lookup API 2021-01-21 07:47:08 -05:00
Julian Bouzas
b7b3ce212b object-interest: add _ref and _unref APIs 2021-01-21 07:46:59 -05:00
George Kiagiadakis
ac87519841 config: enable lua scripts, disable legacy modules 2021-01-21 09:50:50 +02:00
George Kiagiadakis
b8f8238fb4 lua: fix some nasty memory leaks 2021-01-21 09:42:07 +02:00
George Kiagiadakis
7233b7a442 meson: require pipewire 0.3.20
Required for the device event type-info
2021-01-21 09:42:07 +02:00
George Kiagiadakis
674e53c221 spa-device: handle DeviceEvent and configure node props
Depends on DeviceEvent type-info, available on pipewire master as of today
2021-01-21 09:42:07 +02:00
George Kiagiadakis
38f65ca960 m-lua-scripting: do stop the lua engine on deactivate()
deactivate() is normally called from WpCore's dispose() and
that's too late to convert a weak WpCore ref to a strong one,
so we cannot find the WpConfiguration and remove the engine.
So, keep a reference to the WpConfiguration earlier.

If the engine is not stopped on time, proxies on the export_core
are destroyed after their core and pipewire complains
2021-01-21 09:42:07 +02:00
George Kiagiadakis
c0f13fe0f6 main: drop WpConfiguration reference early 2021-01-21 09:42:07 +02:00
George Kiagiadakis
e9c38f365e plugin: debug activation & deactivation 2021-01-21 09:42:07 +02:00
George Kiagiadakis
997e2c7539 wplua: object: unset GValues used when calling action signals 2021-01-21 09:42:07 +02:00
George Kiagiadakis
7b4829f808 config: add lua-based device monitors 2021-01-21 09:42:07 +02:00
George Kiagiadakis
b88ff15725 m-lua-scripting: add bindings required for device monitors
WpDevice, WpSpaDevice, WpNode, WpImplNode, WpObject and object features
2021-01-21 09:42:07 +02:00
George Kiagiadakis
c678cbed2c impl-node: derive from WpProxy 2021-01-21 09:42:07 +02:00