Commit graph

585 commits

Author SHA1 Message Date
Peter Hutterer
21266a5bec lib: correct documentation for wp_iterator_fold/foreach 2021-11-18 12:09:57 +00:00
Peter Hutterer
1121618387 lib: fix some incorrect docs for signals 2021-11-18 12:09:57 +00:00
Peter Hutterer
9208ea051c Fix some typos 2021-11-18 12:09:57 +00:00
Pauli Virtanen
0446b4fe3d wp: invalidate WpGlobal id when removed from registry
Once an object is removed from the registry, its id is invalidated and
can be later reused by other objects. WpGlobal objects may be
long-lived: e.g. those in tmp_globals may live over an add,remove,add
sequence for the same id, and a new WpGlobal must be used for the second
add. However, currently e.g. wp_registry_prepare_new_global may pick the
WpGlobal for a previously removed object from the tmp_globals list.

To address this, invalidate the WpGlobal id immediately when we get the
registry remove event.
2021-11-11 09:13:04 +00:00
Ashok Sidipotu
e2e3c5a69c wp-factory: enumerate pw_factory objects
pw_factory objects allow permissions to be set on its clients,
wp-factory exposes this funtionality to wireplumber clients.
2021-10-19 05:46:46 +00:00
George Kiagiadakis
5c23000c54 wplua: handle re-entrancy in _wplua_closure_marshal
* First of all, do not clear the stack... it's not necessary to do
  so and it causes trouble if this function is called from within
  itself, as it clears the stack of the previous context
* Then, do not stop/restart the garbage collector unless this is
  the base call

Fixes #73
2021-10-15 15:04:46 +03:00
Pauli Virtanen
fbb66cc290 wp: implement topics in SPA log interface
Implement SPA log topic API, showing log topics as GLIB_DOMAIN,
and enabling based on WIREPLUMBER_DEBUG.
2021-10-14 23:40:59 +03:00
George Kiagiadakis
3fa4165513 object-manager: downgrade proxy activation failure message
there is no point in showing this message, unless we are debugging...
it's pretty common when clients create & destroy objects very quickly
2021-10-14 22:49:02 +03:00
George Kiagiadakis
52c4839a8c spa-pod: accept NULL object/struct/pod in a property field
This is what the original SPA_POD_BUILDER_COLLECT() does as well
2021-10-13 11:51:22 +03:00
George Kiagiadakis
9dca92c698 spa-pod: add _filter() method 2021-10-13 11:10:32 +03:00
George Kiagiadakis
079139f01d client: add _send_error() method 2021-10-13 11:09:11 +03:00
George Kiagiadakis
9e5aaccab0 spa-pod: add _fixate() method 2021-10-12 20:00:10 +03:00
Wim Taymans
fb28b076a1 Revert "wp: fix spa_log_methods version"
This reverts commit 86eecfc7e1.

The logger now correctly calls the old implementation when the new
method is not implemented.
2021-10-07 10:17:15 +02:00
George Kiagiadakis
4f97def376 lib: node: add gobject properties for state & {n,max}-{input,output}-ports 2021-10-05 17:19:52 +03:00
Wim Taymans
6b135af1f1 metadata: fix properties
The spa_dict does not live outside of the scope it is created in
and so no metadata name is passed to the export function.

Use and initialize a variable outside of the scope instead.
2021-10-04 16:32:50 +02:00
Wim Taymans
8e7331a23d default-routes: save and restore iec958Codecs
Similar to the volume and latencyOffset we need parse, save and restore
the configured iec958Codecs on the node.

Pavucontrol will use the device-restore extension to set the configured
iec958Codecs on the Node/Route. This will make the node enumerate
audio/iec958 formats, which can be matched against streams that can
provide this format to configure passthrough.

Fixes #64
2021-10-04 10:11:03 +00:00
Pauli Virtanen
86eecfc7e1 wp: fix spa_log_methods version
Wireplumber implements version 0 of spa_log methods. Fixes logging on
current pipewire.
2021-10-04 07:00:28 +00:00
Pauli Virtanen
24882f37a7 wp: fix pw_log_set usage
pw_log_set resets the log level of the logger to the Pipewire's current
level.  Here, it's instead expected that the level is retained, so call
pw_log_set_level first.

It used to be that pw_init set the log level based on PIPEWIRE_DEBUG
value, but this is now done only when using Pipewire's default logger.
2021-10-04 07:00:28 +00:00
George Kiagiadakis
3db3229359 object-manager: guard self in the idle callback using g_cclosure_new_object
The idle callback may be called after the object manager has been
destroyed, or the object manager may be destroyed while emitting
one of the signals from the idle callback, so it needs to be ref'ed
while the callback is running. g_cclosure_new_object ensures that
in both cases the code behaves correctly.
2021-09-28 11:46:46 +03:00
Julian Bouzas
711d1ee686 spa-pod: add support for custom Id properties
Allows creating and parsing Pod Objects with custom properties.
2021-09-21 12:29:54 -04:00
Julian Bouzas
f0e587ef0e metadata: use pw_impl_metadata for WpImplMetadata 2021-09-17 09:08:48 -04:00
Niklāvs Koļesņikovs
05334c1ec7
lib/wp/device: demote missing SPA warning to message
Warnings can be scary, so best not to scare users with what's likely
intentional omission of a particular SPA plugin (currently V4L & BlueZ).
2021-09-15 13:54:07 +03:00
George Kiagiadakis
cef9b00daf docs: impl-module: add since markers and improve the Lua doc appearence 2021-08-19 17:58:07 +03:00
George Kiagiadakis
8949e98d1f remove wpipc
This component has been split out to form a separate project,
moved to https://git.automotivelinux.org/src/pipewire-ic-ipc/
2021-08-19 16:53:28 +03:00
George Kiagiadakis
3cd9384805 wp: make wp_get_xdg_state_dir() private
It's not used elsewhere, so there is no good reason yet to expose it.
Besides, I expect that GLib will likely add a method in the future
to return the XDG_STATE_HOME (which is relatively new in the xdg spec)
2021-08-19 10:06:37 +03:00
George Kiagiadakis
27ed36c2da wp: make the config file lookup methods more generic
* Make the flags public and give them nicer names
* Pass down the flags from the caller, so the caller can now explicitly
  ask for looking into specific directories
* Rename the methods
* Remove and inline the wp_get_xdg_config_dir() method, since it's only
  used internally
* Refactor the lookup dirs ordering to get both WIREPLUMBER_*_DIR env
  variables to replace all the other directories. Previously, we were looking
  for scripts in WIREPLUMBER_DATA_DIR, but we were also looking in /etc at
  the same time (with precedence, even), which could result in unexpected
  behaviour. Now, if a WIREPLUMBER environment variable is specified,
  we only look in there.
2021-08-19 10:06:37 +03:00
Julian Bouzas
7abd3728e7 build: fix volatile compatible-pointer-types warnings
Happens when compiling with GCC 11
2021-08-18 09:17:05 -04:00
George Kiagiadakis
b9b722c125 properties: adjust documentation for the recent WpPropertiesItem changes 2021-08-11 20:25:16 +03:00
Arun Raghavan
032aa8edf2 wp: Add a WpImplModule for loading modules in WirePlumber context 2021-08-10 11:33:01 -04: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
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
Julian Bouzas
2792cecbcf properties: use a boxed WpPropertiesItem type when iterating
Needed for JavaScript bindings
2021-07-15 08:55:00 -04: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
Julian Bouzas
0c51cf9a7b session-item: fix reference leak when getting properties 2021-07-02 11:59:42 -04: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
George Kiagiadakis
888d6e5033 lua: add Port.get_direction() + documentation for it 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
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