Commit graph

979 commits

Author SHA1 Message Date
Julian Bouzas
f693e1a4c7 m-lua-scripting: add WpClient LUA api 2021-02-12 14:28:32 -05:00
George Kiagiadakis
6376bc6e4b Revert "meson: relax meson version dependency when building with system lua"
meson can't find project options before executing the project() command :(

This reverts commit 8bff0cc630.
2021-02-11 16:14:40 +02:00
George Kiagiadakis
8bff0cc630 meson: relax meson version dependency when building with system lua 2021-02-11 16:07:16 +02:00
George Kiagiadakis
a0fb8872a2 lua/pod: optimize push_primitive_values() 2021-02-05 20:15:32 +02:00
George Kiagiadakis
6039223642 tests/wplua: set WIREPLUMBER_CONFIG_DIR to an invalid directory
... because loading a script first looks in that directory, so it's
easy to make tests break by a conflicting file in the system config dir,
for instance, /etc/wireplumber/scripts/pod.lua
2021-02-05 19:49:52 +02:00
George Kiagiadakis
e916ff6b76 lua/pod: simplify spa_pod_object_new() 2021-02-05 19:49:25 +02:00
George Kiagiadakis
38039bdfe1 lua/pod: optimize lookups in primitive_lua_type and fix some mistakes
Use the numeric values of the spa types instead of their string representation
2021-02-05 19:33:55 +02:00
George Kiagiadakis
2ca3564b67 lua/pod: lookup the object type and values table only once when constructing objects 2021-02-05 19:23:09 +02:00
George Kiagiadakis
33e546d79b lua/pod: convert Id object fields to strings, if possible 2021-02-05 18:58:02 +02:00
Julian Bouzas
dc2ad1f25d rename all foo_iterate APIs to foo_new_iterator
Avoids confusion with LUA iterate API
2021-02-05 11:33:23 -05:00
George Kiagiadakis
d0113e54cb m-lua-scripting/pod: push pod constructors using luaL_newlib instead of manually 2021-02-05 12:11:15 +02:00
George Kiagiadakis
55f186ccec modules: remove m-node-suspension 2021-02-05 12:05:54 +02:00
George Kiagiadakis
148a33187e m-lua-scripting/api: fix om:lookup() to return nil when no object was found 2021-02-05 12:03:41 +02:00
George Kiagiadakis
d94b0a2f0c scripts: add suspend-node.lua to replace m-node-suspension
... plus the necessary API for it to work
2021-02-05 12:03:07 +02:00
George Kiagiadakis
7b37b31af9 wplua: fix enum <-> lua conversion
Sometimes the GEnumClass is not instantiated, so _peek() doesn't work
We need to acquire a strong ref to make sure it is
2021-02-05 12:00:24 +02:00
George Kiagiadakis
7ca6717ff9 create-endpoint.lua: fix some issues 2021-02-05 11:58:53 +02:00
George Kiagiadakis
2efa85e3fd create-endpoint.lua: fix indentation 2021-02-05 11:33:15 +02:00
George Kiagiadakis
ce66025846 node: change send_command() to take a string
Use the spa type system to locate the enumeration value that corresponds
to that string and send that
2021-02-05 11:05:26 +02:00
Julian Bouzas
b32072a2ed tests: wplua: add pod.lua script to validate pod API 2021-02-05 08:47:27 +00:00
George Kiagiadakis
b58eff2b69 tests: wplua: add a script tester to validate lua scripts 2021-02-05 08:47:27 +00:00
Julian Bouzas
81163a52c0 m-lua-scripting: add WpSpaPod api 2021-02-05 08:47:27 +00:00
Julian Bouzas
a634bf88fd wplua: fix vtables lookup in boxed __index function 2021-02-05 08:47:27 +00:00
George Kiagiadakis
e3a60c6233 examples: add an example interactive lua script 2021-02-04 17:32:59 +02:00
George Kiagiadakis
651b4b7377 m-lua-scripting/api: add wp_object_manager_iterate_filtered() 2021-02-04 17:31:25 +02:00
George Kiagiadakis
096a9b4c15 proxy: add a method to query the interface type 2021-02-04 16:51:25 +02:00
George Kiagiadakis
e0f1c8710f daemon: add a mode to execute lua scripts from the command line
This can be useful for quick testing of scripts, or to build small
utilities that do something in pipewire utilizing our lua API
2021-02-04 16:44:56 +02:00
George Kiagiadakis
02142b899b m-lua-scripting/api: add WpCore bindings 2021-02-04 13:52:24 +02:00
George Kiagiadakis
fb5706eacc m-lua-scripting/api: fix access to core in session_item_new() 2021-02-03 18:02:03 +02:00
George Kiagiadakis
1bd8e31872 meson: bump version 2021-02-03 17:25:55 +02:00
George Kiagiadakis
36598aede4 meson: remove C++ support, there's no C++ code anymore 2021-02-03 17:18:41 +02:00
George Kiagiadakis
2142fffc0e monitor-alsa: simplify reserve-device connection logic
Because of the new design of the daemon and the async activation of plugins,
the reserve-device plugin connects to d-bus before monitor-alsa is executed
and therefore there is no need to wait for the connection
2021-02-03 17:16:51 +02:00
George Kiagiadakis
88f59f07cb monitor-alsa: receive script configuration from config.lua 2021-02-03 17:16:51 +02:00
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