Commit graph

1423 commits

Author SHA1 Message Date
Julian Bouzas
8c9da58d76 src: scripts: add alsa-mini.lua monitor 2021-08-10 11:50:51 +03:00
Julian Bouzas
9b8a876662 m-lua-scripting: add GLib access Lua API 2021-08-10 11:50:51 +03:00
Julian Bouzas
907a67fcb1 modules: add new API module to monitor files 2021-08-10 11:50:51 +03:00
jakobrs
92d99f4a75 dump_table: Sort keys before printing 2021-08-10 07:50:01 +00:00
jakobrs
86bfdbea13 Fix not-equals verb having the wrong number of arguments in Lua API 2021-08-08 20:45:56 +02:00
George Kiagiadakis
9ebea2976d wp: refactor and rename wp_iter_conf_files() to use WpIterator
This also corrects the logic of loading config files in m-lua-scripting.
Previously, if an error occured within the iteration function,
the error was not properly propagated to the caller because -EINVAL
was being added to nfiles instead of checked.
2021-07-20 14:42:42 +03:00
George Kiagiadakis
edd8ea7297 wp: polish documentation and add annotations for the config-related functions 2021-07-20 14:42:42 +03:00
George Kiagiadakis
3ff53f19e4 lib: s/G_GNUC_DEPRECATED/G_DEPRECATED/
This one is more portable
2021-07-20 14:42:42 +03:00
George Kiagiadakis
0830362807 lib: explicitly ignore the return value of g_strlcpy() to silence coverity 2021-07-20 14:42:42 +03:00
Julian Bouzas
8b95b4ae23 tests: skip test if specific spa lib is not installed
Avoids tests failing if pipewire was built without the spa lib
2021-07-19 09:40:19 -04:00
Julian Bouzas
eb8f9a1a83 tests: common: add API to check if spa lib is installed
Allows to skip tests if specific spa lib is not installed
2021-07-16 11:49:35 -04:00
Peter Hutterer
ece8f7a78d lib: deprecate the functions to fetch the config directory
Both have been replaced by functions that directly find configuration files
in a hierarchy of paths.
2021-07-15 15:17:01 +00:00
Peter Hutterer
d38c3fb4cc lib: add functions to search in configuration/data directories
The previous approach to loading config files was to ask WP for the
directory and then search those for the config files. This patch changes the
approach - a caller now asks WP to search for a specific config file or
iterate over a config file directory.

This allows us to implement a directory lookup order, i.e.
"wireplumber.conf" may be in XDG_CONFIG_DIR, /etc/,
/usr/share and the first one found is used.

For configuration directories, the new method iterates over all matching
entries (files + directories) and invokes a callback for each entry.

This enables distributions to ship default files in /usr/share/wireplumber
but have admins and users override them on a local basis. For lua scripts in
particular, overriding a distribution-provided file with an empty file
effectively disables it, adding a file adds it in the right sort order.
2021-07-15 15:17:01 +00:00
Peter Hutterer
153e84c8b8 lib: always return the full path from wp_get_config/data_dir
Remove the need for the caller to check if the returned path is absolute or
relative.
2021-07-15 15:17:01 +00:00
Peter Hutterer
2e88a115d1 lib: add a function to return the XDG_CONFIG_DIR 2021-07-15 15:17:01 +00:00
Peter Hutterer
6c3a8d2f83 main: assemble the full config file name and pass that to pipewire
Previously we had the config file split in pipewire-fashion: CONFIG_NAME for
the filename and CONFIG_PREFIX for the (absolute) config directory the file
resides in. Since we always resolved CONFIG_PREFIX to be an absolute path we
might as well just pass the fully resolved config file to pipewire instead.

This will eventually allow us to have multiple lookup directories.
2021-07-15 15:17:01 +00:00
Peter Hutterer
2461654017 doc: fix documentation for passing a config file
WIREPLUMBER_CONFIG_FILE support was replaced with the --config-file option
in 1d0ecc3d88
2021-07-15 15:17:01 +00:00
Peter Hutterer
1132b37f0b modules: fix g_file_test for regular files
From the g_file_test documentation:
"For example, (G_FILE_TEST_EXISTS | G_FILE_TEST_IS_DIR) will return TRUE if
the file exists; the check whether it's a directory doesn't matter since the
existence test is TRUE. With the current set of available tests, there's no
point passing in more than one test at a time."
2021-07-15 15:17:01 +00:00
Julian Bouzas
2792cecbcf properties: use a boxed WpPropertiesItem type when iterating
Needed for JavaScript bindings
2021-07-15 08:55:00 -04:00
Niklāvs Koļesņikovs
cb41ecc6c6 meson.build: adds summary() about Lua implementation used 2021-07-14 14:27:04 +00:00
Peter Hutterer
be1a077eaf state: store our WpState files in $XDG_STATE_HOME/wireplumber 2021-07-14 14:44:11 +10:00
Peter Hutterer
ab62af1748 lib: add a function to get the xdg state dir
Added recently to the XDG spec, XDG_STATE_HOME ($HOME/.local/state/) is for
files that are neither configuration/data files nor runtime/cache files.
2021-07-14 13:18:49 +10:00
Peter Hutterer
fd37c0cd2e meson.build: let meson handle the prefix + bindir concatination
For bindir, libdir and datadir, meson enforces that either
- the value is an absolute path that is a subdir of $prefix
- the value is a relative path that is then made a subdir of $prefix

Example meson error message:
ERROR: The value of the 'bindir' option is '/usr/foobar' which must be a subdir of the prefix '/usr/local'.
Note that if you pass a relative path, it is assumed to be a subdir of prefix.

And meson handles absolute paths for those directories correctly (ignoring
$prefix), so we don't need to manually compose those.

Only exception is sysconfdir which may be outside the prefix but there too
meson handles an absolute path correctly.
2021-07-06 09:40:39 +10:00
Niklāvs Koļesņikovs
d8365fe33e
meson: adds summary() to auto features 2021-07-05 12:30:49 +03:00
George Kiagiadakis
6ef84a1309 docs: document the lua ObjectManager / Interest / Constraint APIs 2021-07-02 20:24:25 +03:00
George Kiagiadakis
ec397aaaca lua: add not-equals to the possible constraint verbs 2021-07-02 20:24:25 +03:00
Julian Bouzas
0c51cf9a7b session-item: fix reference leak when getting properties 2021-07-02 11:59:42 -04:00
George Kiagiadakis
6e6852b391 tests: create wpipc tests sockets also in /tmp with a random name
See #39, #16
2021-07-02 16:34:31 +03:00
George Kiagiadakis
655898e61f tests: run with PIPEWIRE_RUNTIME_DIR=/tmp
... and hope for the best, because sockets apparently can't
have more than 108 characters in their path

See #39, #16
2021-07-02 16:34:28 +03:00
Julian Bouzas
2900dc1c23 object-manager: remove old global when exposing new global with same id
Sometimes, especially when running the wireplumber daemon with valgrind, a new
global with the same Id as another old global owned by a proxy wants to be
exposed before the old proxy is destroyed. If this happens, instead of returning
with an assertion error, we remove the old global and we export the new one.
2021-07-01 14:49:28 -04:00
Julian Bouzas
4275d91675 global-proxy: add extra checks to make sure binding is successful
Globals can be removed by the object manager when their associated proxy is
currently being bound. Adding extra checks in wp_global_proxy_bin() to return
a transition error avoids binding the proxy when that happens.
2021-07-01 14:37:42 -04:00
Julian Bouzas
dc6fa6cbfe m-lua-scripting: unref value pod after adding it to control 2021-06-30 14:06:48 -04:00
George Kiagiadakis
888d6e5033 lua: add Port.get_direction() + documentation for it 2021-06-30 19:51:21 +03:00
George Kiagiadakis
532340cc8f docs: mention the new matrix room in the community resources 2021-06-30 19:51:21 +03:00
George Kiagiadakis
068f7f3000 docs: complete lua Node api docs and fix some ref links 2021-06-30 19:51:21 +03:00
George Kiagiadakis
18fe17fa01 lua: fail if an optional Interest is not none, nil, Interest or table 2021-06-30 19:51:21 +03:00
George Kiagiadakis
795a37d029 lua: complete the WpNode bindings 2021-06-30 19:51:21 +03:00
George Kiagiadakis
7fedb5e9e1 wplua: expose functions to convert enums to strings for lua and vice versa 2021-06-30 19:51:21 +03:00
Julian Bouzas
ee190411f4 state: escape invalid key file characters 2021-06-30 08:48:57 -04:00
Julian Bouzas
8505078a80 tests: endpoint: fix coverity 'side effect in assertion' error 2021-06-30 08:44:35 -04:00
George Kiagiadakis
d576fde2d7 tests: set PIPEWIRE_RUNTIME_DIR and stop using XDG_RUNTIME_DIR
Using XDG_RUNTIME_DIR is problematic in test-reserve-device
because GTestDBus also exports XDG_RUNTIME_DIR and then unsets it,
which makes pipewire end up using $HOME for its socket.
Using PIPEWIRE_RUNTIME_DIR is safer, as this variable is only used
by pipewire.

Also use the build directory as a runtime dir (it always exists and
nothing is going to interfere with it) and unset XDG_RUNTIME_DIR from
the CI scripts, since nothing else is using it.

Closes #39
2021-06-30 11:53:21 +03:00
George Kiagiadakis
b741b2c8c8 release 0.4.1 2021-06-29 13:27:19 +03:00
George Kiagiadakis
b52e945cb6 ci: enable testing of wpipc 2021-06-28 20:37:34 +03:00
Julian Bouzas
85820f7aef tests: examples: print error if buffer is not valid in wpipc-client
If we lose connection with the server while a request was pending, the request
callback is still triggered but with NULL buffer.
2021-06-28 11:38:38 -04:00
Julian Bouzas
9fd76570c4 tests: wpipc: check if new connection to new receiver is valid after losing connection 2021-06-28 11:38:37 -04:00
Julian Bouzas
6b8ea83404 wpipc: sender: disconnect and clear all pending tasks if connection was lost
If we don't remove the socket from epoll when the connection is lost, we risk
having the lost callback triggered more than once by epoll, creating race
condition in the unit test because more than 1 event happened. The epoll thread
and socket will be re-created again when re-connecting.

Note that we cannot destroy the epoll thread before triggering the lost
connection callback because we are running the callback in the epoll thread,
which is why removing the socket from epoll is the only way to make sure the
lost connection callback is only triggered once.
2021-06-28 11:38:37 -04:00
Julian Bouzas
313f872570 wpipc: receiver: also emit sender disconnected when failed to read 2021-06-28 11:38:37 -04:00
Julian Bouzas
f4a4f8bcc7 wpipc: protocol: make sure buffer is initialized to 0 before building reply/request
Fixes valgrind errors
2021-06-28 11:38:37 -04:00
Julian Bouzas
8a5a8fc015 wpipc: change epoll thread func type name to be more consistent 2021-06-28 11:38:37 -04:00
Julian Bouzas
ac4d5bd22a tests: wpipc: use GCond instead of while loop to wait for events
Fixes hanging issues when running test with valgrind.
2021-06-28 11:38:37 -04:00