Commit graph

1024 commits

Author SHA1 Message Date
George Kiagiadakis
51e24c58b5 m-lua-scripting/pod: retrieve Ids in Array & Choice as strings, if possible
When an Array or Choice that contains Spa:Id appears as a value for an object
field, it is possible to retrieve the Id type from that object field type.
2021-02-23 13:56:38 +02:00
George Kiagiadakis
5302700c6d m-lua-scripting/pod: s/id_type/object_id/ as commented on !125 2021-02-23 12:47:24 +02:00
Julian Bouzas
bd65f9578d m-lua-scripting: add support for choices when creating object pods 2021-02-23 10:41:46 +00:00
Julian Bouzas
0694889245 m-lua-scripting: refactor array and choice pod constructors to accept Id names 2021-02-23 10:41:46 +00:00
Julian Bouzas
910ff838e4 m-lua-scripting: allow constructing pod Ids with the Id name 2021-02-23 10:41:46 +00:00
Julian Bouzas
cd2e648b3c m-lua-scripting: set id_type field when parsing pod objects 2021-02-23 10:41:46 +00:00
Julian Bouzas
2465088c5a m-lua-scripting: set pod_type and value_type fieds when parsing non-primitive pods 2021-02-23 10:41:46 +00:00
Julian Bouzas
8fa6116786 m-lua-scripting: start indices from 1 when parsing pods
For consistency with LUA
2021-02-23 10:41:46 +00:00
George Kiagiadakis
b485f0a67d test-endpoint: fix failure with pipewire master 2021-02-23 12:30:08 +02:00
George Kiagiadakis
6690f12637 config: split flatpak access configuration 2021-02-19 10:01:17 +02:00
George Kiagiadakis
24a260030b scripts/access: update access scripts to call update_permissions() cleanly
and fix some coding style issues
2021-02-18 16:53:41 +02:00
George Kiagiadakis
d6ea7ffe76 lua/api: fix client update_permissions()
* the type checks were wrong, it was requiring the key to be string
  and the value integer
* add the ability to use "any" or "all" for a key, saving us the trouble
  of passing -1 from lua (int64) into a uint32 (ugh!)
* use a GArray instead of manual malloc/realloc
* allocate the array as late as possible, to minimize the risk of leaking
  its memory if we hit luaL_error()
2021-02-18 16:41:42 +02:00
George Kiagiadakis
e6112d7579 examples: interactive.lua: add a shebang and update running instructions 2021-02-18 14:53:33 +02:00
George Kiagiadakis
e2d6e5b992 lua: enable loading scripts with a shebang
* skip the shebang before loading the file in the interpreter,
  as # is not a valid lua comment
* allow loading scripts with a relative path in interactive mode
2021-02-18 13:47:34 +02:00
George Kiagiadakis
6c85b8958d lua/api: log using a debug category unique for the calling script file
filename: foo.lua -> category: script/foo
2021-02-18 12:52:39 +02:00
George Kiagiadakis
cb8a8936aa lua/api: ensure the function name in the debug output is non-null
NULL crashes the journald writer
2021-02-18 12:24:01 +02:00
George Kiagiadakis
98151fdb69 monitor-alsa: fix node description on strange embedded devices
Ensure that no part of the description string is empty, otherwise fall back
Fix logic with dev and/or subdev being 0
2021-02-18 10:23:07 +02:00
George Kiagiadakis
beb9902589 suspend-node: honor "session.suspend-timeout-seconds"
6079830591
2021-02-18 09:15:24 +02:00
George Kiagiadakis
20c7733640 monitors: sanitize node descriptions too
aea79cd79c
2021-02-18 09:02:41 +02:00
George Kiagiadakis
7c1fc1c567 wplua: table_to_properties: use luaL_tolstring to do string conversions
The advantage is that luaL_tolstring behaves the same as the native lua
tostring() function, while lua_tostring() does not. In particular, boolean
values are converted properly to "true" and "false" now, while they were
not converted with lua_tostring()

Add a unit test too
2021-02-16 16:53:22 +02:00
George Kiagiadakis
7336c271a2 config: bluez-monitor: add hfp_hf in the supported roles comment 2021-02-16 16:53:22 +02:00
Raghavendra
c791ed3a62 m-lua-scripting: add WpPipewireObject api 2021-02-16 20:15:13 +05:30
George Kiagiadakis
f4b899c9e3 config: move loading of all audio support modules in 90-enable-audio-all
This file is meant to provide the equivalent of pipewire-media-session's
'with-pulseaudio' flag file
2021-02-15 20:17:15 +02:00
George Kiagiadakis
be78fbbc7d config: split configuration for endpoints support in config.lua.d 2021-02-15 20:11:52 +02:00
George Kiagiadakis
115c9c3e4f monitors: drop the monitor- prefix from the filenames and s/bluez5/bluez/ 2021-02-15 19:55:06 +02:00
George Kiagiadakis
f2f889a3e0 config: make the monitor properties & rules available in global tables
This allows altering monitor properties or adding rules in different
lua files that get loaded before 90-enable*.lua
2021-02-15 19:48:06 +02:00
George Kiagiadakis
1d40e7713f config: load reserve-device only if alsa.reserve is true
and also make the default of alsa.reserve to be false, for easier scripting
2021-02-15 19:43:07 +02:00
George Kiagiadakis
4538d43bcb monitor-bluez: fix source priority assignment
pipewire/pipewire!456
2021-02-15 19:24:42 +02:00
George Kiagiadakis
4ae15a14ac monitors: sanitize node names to match media-session's behavior 2021-02-15 19:18:07 +02:00
George Kiagiadakis
e92351b23b wplua: gvariant_to_lua: convert dictionary keys to integers if possible
When we convert from a lua table to a GVariant dictionary, it is not
possible to maintain the hybrid string & integer keys approach that Lua
has for tables, so we convert all keys to strings and a table becomes a{sv}

When we convert back from a{sv} to a table, it is desirable to get back
the integer keys wherever possible.

The use case is to pass "arrays" (i.e. tables with integer keys) from
the configuration files to the lua scripts, without losing the properties
of the "array"
2021-02-15 18:50:56 +02:00
George Kiagiadakis
73a07d0097 monitor-alsa: sync logic, properties and configuration with media-session 2021-02-15 18:49:57 +02:00
George Kiagiadakis
b3ff7347cd wplua: improve GVariant array conversion
* index array items from 1
* handle any kind of value, not just GVariant basic types
* unit test
2021-02-15 14:43:18 +02:00
George Kiagiadakis
dacf19d9c7 wplua: improve gvariant <-> lua conversion functions
* Add more generic lua -> gvariant conversion
* Cleanup the gvariant -> lua function and rename it
2021-02-15 14:43:18 +02:00
George Kiagiadakis
413ff73bab wplua: remove VARDICT handling in gvariant->lua conversion
G_VARIANT_TYPE_DICTIONARY also catches the VARDICT case
2021-02-15 14:43:18 +02:00
George Kiagiadakis
4fdccf5292 config: mimick media-session's v4l2-monitor.conf 2021-02-15 14:43:18 +02:00
George Kiagiadakis
100e6dc360 monitor-v4l2: copy properties and rules logic from media-session 2021-02-15 14:43:18 +02:00
George Kiagiadakis
989708a880 config: immitate media-session's bluez-monitor.conf 2021-02-15 14:43:18 +02:00
George Kiagiadakis
d9bf776cb8 monitor-bluez: copy all properties and the rules functionality from media-session 2021-02-13 11:55:00 +02:00
George Kiagiadakis
41a4c89a41 lua/config: load split config files in alphanumeric order 2021-02-13 11:55:00 +02:00
George Kiagiadakis
0196b49453 tests/lua: test monitor configuration rules code 2021-02-13 11:55:00 +02:00
George Kiagiadakis
807103e9df lua/api: add wp_object_interest_matches() binding 2021-02-13 11:55:00 +02:00
George Kiagiadakis
47b6417bbe object-interest: allow matching against WpProperties objects 2021-02-13 11:55:00 +02:00
Julian Bouzas
b1e1e5ced0 scripts: add portal access script
Includes a plugin to handle the portal permission store dbus interface
2021-02-12 14:28:45 -05:00
Julian Bouzas
fdc8053d9f scripts: add flatpak access lua script
Replaces old module-client-permissions module
2021-02-12 14:28:38 -05:00
Julian Bouzas
cbe90a5c75 wplua: handle more GVariant cases 2021-02-12 14:28:38 -05:00
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