Commit graph

1044 commits

Author SHA1 Message Date
George Kiagiadakis
7eed2acd76 lib: documentation fixes 2021-03-04 19:10:10 +02:00
George Kiagiadakis
15a74052a1 lua/api: add Link() constructor 2021-03-03 13:15:13 +02:00
Arnaud Ferraris
bf72973db4 module-default-routes: store/restore route properties
This commit enhance `module-default-routes` so that the route properties
(such as volume, channel map...) are saved on modification, and re-applied
each time a particular route is selected.
2021-03-02 18:17:56 +01:00
Arnaud Ferraris
b63b172b0a module-device-activation: apply default route on each new device
This commit modifies `module-device-activation` so that it can restore
the default routes when a device appears.
2021-03-02 18:17:56 +01:00
Arnaud Ferraris
a499e02ad9 modules: add module-default-routes for storing/restoring routes
This commit adds a WirePlumber module which stores the current route for
a given device, and implements the necessary interfaces to restore those
on startup.

The routes are stored as an array of objects in JSON format.

Please note that actually restoring routes on startup is not done by this
module but will be implemented separately in a future commit.
2021-03-02 18:17:56 +01:00
George Kiagiadakis
79ba66e46b lua/api: default Constraint type always to pw-global
now that interest is declared on G_TYPE_OBJECT by default
(in optional Interest function arguments), this conditional default
no longer works as expected...

besides, it may be confusing to have a different default depending
on the interest type
2021-03-02 18:26:34 +02:00
George Kiagiadakis
941b0324e5 object-interest: remove type checks
They are not strictly necessary and just make our life harder
2021-03-02 18:25:34 +02:00
George Kiagiadakis
9399f3db66 lua/api: simplify & improve session_item_configure 2021-03-02 14:39:00 +02:00
George Kiagiadakis
a4ec7538bc lua/api: make the type optional when declaring Interest as a function argument
it makes no sense to specify the type when calling, for instance,
session:lookup_endpoint() or similar functions

it also makes it easier to use iterate or lookup in the object
manager, when we already know the type of the objects that the om
contains
2021-03-02 14:08:43 +02:00
George Kiagiadakis
905636dc8d lua/api: improve getting optional Interest arguments
Add the ability to construct an Interest argument without
using the Interest keyword, so instead of:

  om:lookup(Interest { type = "session" })

we can now write:

  om:lookup { type = "session" }

... and also remove lookup_filtered from ObjectManager
2021-03-02 13:11:54 +02:00
Julian Bouzas
6c2bfea55b scripts: policy-endpoints: add move and follow options
If 'move' is set to true, endpoints will be moved to the new target when the
metadata 'target.node' key is present. If 'follow' is set to true, endpoints
will be moved to the newly changed default device automatically.
2021-03-01 15:36:28 -05:00
Julian Bouzas
862e253607 m-lua-scripting: add get_n_streams endpoint API 2021-03-01 13:14:57 -05:00
Julian Bouzas
2052eb2b1f m-lua-scripting: add lookup session API
Also improves session API to accept object interests.
2021-03-01 13:14:57 -05:00
George Kiagiadakis
e9e73a2141 examples: add bt-profile-switch example 2021-03-01 18:10:40 +02:00
George Kiagiadakis
5b4fe3cd85 lua/pod: don't crash on parsing objects with unknown keys, just ignore them 2021-03-01 17:57:32 +02:00
George Kiagiadakis
9f50117fa7 lib: remove module.{c,h} 2021-02-25 17:12:04 +02:00
George Kiagiadakis
31cbbcd4c0 meson: fix glib version requirement checks
The == are not valid checks to appear in a .pc file, apparently,
and this breaks the generated wireplumber-0.4.pc file that copies
these version checks as they appear in meson.build
2021-02-25 16:58:47 +02:00
George Kiagiadakis
92b621ab8a systemd: use the older version of the systemd pkgconfig variables
For compatibility with older versions of systemd
2021-02-25 14:10:30 +02:00
George Kiagiadakis
9e7f3d4740 systemd: remove RuntimeDirectory from the system service
See pipewire/pipewire!484
2021-02-25 11:38:09 +02:00
George Kiagiadakis
56f8a82ad7 daemon: add systemd unit files
see also pipewire/pipewire!481
2021-02-23 18:47:50 +02:00
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