Commit graph

735 commits

Author SHA1 Message Date
George Kiagiadakis
0a7bd4fe86 si-standard-link: remove the "passive" property
PipeWire no longer uses the link.passive property, so there's no
point in adding it here. The node.passive property is used directly.
2023-11-20 12:00:54 +02:00
George Kiagiadakis
5b1ff7377f si-audio-endpoint: mark the nodes as passive instead of marking the links
This is a behavioural change in effect since pipewire 0.3.68, where
pipewire's link-factory ignores the link.passive property and the
node.pasive = in/out/true is used instead.
2023-11-20 11:56:07 +02:00
George Kiagiadakis
cf4fb87b35 lua api: allow nil to be passed on all constructors that take optional properties 2023-11-10 13:23:50 +02:00
George Kiagiadakis
a6bea40172 core: add wp_core_get_own_bound_id() method
This allows retrieving the bound-id of our own client
2023-11-10 11:27:13 +02:00
George Kiagiadakis
e88fa840f2 lua: json: add optional argument in the json parse() method to limit the number of recursions
This allows partially parsing a json object, allowing some parts to be
passed on as strings to another component that does its own parsing
(ex. a pipewire module)
2023-11-10 11:27:13 +02:00
George Kiagiadakis
0bc6ca6a2d lua: json: allow keys inside objects to be without quotes 2023-11-10 11:27:13 +02:00
Julian Bouzas
98f622f718 m-default-nodes: clear all previous configured nodes if metadata changes to NULL
This will completely clear all the default nodes (current and previous ones)
if the configured metadata value has been set to NULL. This is needed so that
the 'wpctl clear-default' command completely clears all the default nodes state.
2023-10-26 13:21:55 -04:00
Dmitry Sharshakov
2ae1b3cbd9 api: module: support loading arguments from file 2023-09-22 19:35:10 +03:00
Julian Bouzas
227dd97036 m-lua-scripting: always parse JSON to String if its type is not recognized
This allows parsing JSON strings without quotes.
2023-08-11 14:48:13 -04:00
Robert Mader
04bf9b013e m-si-link: propagate WpLink errors
Add a new signal that gets emitted if any WpLink changes to an error
state. This allows better error handling in cases where e.g. no format
could be negotiated.
2023-02-16 10:39:31 +00:00
Julian Bouzas
c8be8d91be m-lua-scripting: increase refcount of export_core before pushing into the Lua state 2023-02-10 10:54:52 -05:00
Julian Bouzas
6b761c03e1 m-lua-scripting: ignore string/integer table keys when constructing a JSON Array/Object 2023-01-04 11:20:14 -05:00
Dylan Aïssi
5d9fb9f678 Fix typo: numner to number 2022-12-14 10:51:52 +01:00
Carlos Rafael Giani
784f03d57a module-si-audio-adapter: Pass through encoded audio 2022-12-07 15:18:25 +00:00
Sanchayan Maity
217f2babdf module-si-audio-adapter: Do not set channels if parsed result is 0 2022-12-07 15:18:25 +00:00
Pauli Virtanen
7a1b48b741 module-default-nodes: prioritize previous configured defaults
The node priorities are difficult to configure for users, and are
not necessarily meaningful for them.

When there is no configured default node, or the configured default node
does not exist, prioritize previously configured default nodes over the
automatic node priorities.

Keep track of a stack of previous configured nodes, and update the stack
when the configured node changes.
2022-09-27 18:53:45 +03:00
Julian Bouzas
ab6bc62c88 m-portal-permissionstore: remove old unused header
Missed change from commit 2c53486e
2022-09-15 09:06:44 -04:00
Pauli Virtanen
370b692933 m-si-link: don't wait for establish before activation + cleanup links
SiLink should not wait for WpLinks becoming ESTABLISHED, before
activation. That flag shows whether a link has moved away from the
"init" state, however, links to e.g. Pulseaudio corked streams can stay
in "init" state until uncorking.  This causes trouble for policies,
which needlessly wait for such links to establish.

The WpLink objects may also be kept alive by other referents, and
just unrefing them does not necessarily destroy the PW objects.

Activate SiLink even if the WpLink is still in "init" state. It's enough
that the link otherwise successfully establishes.

At dispose time, explicitly request destroying the WpLinks that were
created by the SiLink, to ensure they are removed even if there's
something else referring to them.
2022-08-14 19:47:11 +00:00
Fabian Vogt
d5029697de Fix leftover use of module-reserve-device's state property
The move to the WpDbus API dropped the "state" property from the plugin,
but left the property enum and use of it in alsa.lua. Remove the enum and
port over the code in alsa.lua.
2022-07-14 13:02:19 +00:00
George Kiagiadakis
9def3f96d2 link: add WP_LINK_FEATURE_ESTABLISHED to track when a link is PAUSED/ACTIVE
This allows to transparently wait until a link is PAUSED before
returning from the activation transition. This way we can also
catch negotiation/allocation errors while activating a link.

PAUSED is used instead of ACTIVE because ACTIVE depends on the
nodes being activated as well. There are cases where a link may not
activate the nodes (ex, a passive link) and the link may remain
PAUSED for a long time.

Related to: #294
2022-07-02 17:10:22 +03:00
George Kiagiadakis
efaaf3b43a lua: add Core.get_vm_type() method 2022-06-28 14:06:48 +03:00
George Kiagiadakis
261ccf9972 si-node: skip control ports from the list of ports to be linked
Related to: #294
2022-06-28 10:52:49 +03:00
George Kiagiadakis
ba30a4fcec si-audio-adapter: skip control ports from the list of ports to be linked
Related to: #294
2022-06-27 17:35:29 +03:00
Julian Bouzas
0996f5a5ca spa-json: add wp_spa_json_to_string() API
Since the string length returned by wp_spa_pod_get_data() does not always match
the size of the actual json object because it is stored in contiguous memory, we
cannot always rely on that API to get the json string data.

The new wp_spa_pod_to_string() always allocates a new string with the same
length as the json size, guaranteeing that the string returned always represents
the json object, regardless of whether it is nested or not. It is always
recommented to use wp_spa_pod_to_string() unless you know what you are doing.
2022-06-27 10:07:16 +00:00
Julian Bouzas
76d87813a1 m-default-nodes: reevaluate nodes when ports changed
Currently, if the default node appears without ports for a short period of time,
the default nodes module will never select it immediately because it does not
listen for port changes. We want to listen for port changes to reevaluate again
the nodes that did not have ports before. This allows switching to the default
node as soon as it has ports if it did not had ports before.
2022-06-27 08:52:36 +00:00
Julian Bouzas
04198820f1 device: add new wp_spa_device_managed_object_new_iterator API 2022-06-27 08:52:36 +00:00
Julian Bouzas
46e7c5c144 m-reserve-device: use WpDbus API 2022-06-02 12:34:16 -04:00
Julian Bouzas
69b559399d modules: move all portal-permissionstore code into one file 2022-06-02 12:34:16 -04:00
Julian Bouzas
2c53486e0d m-portal-permissionstore: use WpDbus API 2022-06-02 12:34:16 -04:00
Michael Olbrich
13b85bd4a2 m-lua-scripting: fix object refcounting
7908b8d7be2a2992c57cd549054eda7ce46e4b44 ("m-lua-scripting: allow
converting GValue holding NULL objects to Lua") accidentally added a second
refcount. As a result, the objects are never freeded.

Remove the second refcount to fix this.
2022-05-24 11:40:35 +02:00
Julian Bouzas
392cce2136 m-default-nodes: don't check if all device nodes are ready when finding default node
This check was originally added to avoid a small audio glitch when changing
default nodes while also changing the device profile (eg Gnome Sound Settings).
The check is removed because it causes issues when disabling alsa nodes. There
are plans to fix the audio glitch issue in the future with the planned
event-dispatcher architecture.

Fixes #279
2022-05-20 13:39:47 +00:00
Julian Bouzas
c2f31bb550 m-lua-scripting: allow converting GValue holding NULL objects to Lua 2022-05-19 07:43:12 -04:00
George Kiagiadakis
2eed279c9d i18n: remove the module and embed the gettext calls into the lua api
There is no need to have this as an optional module, since libintl
is a hard dependency of both PipeWire and GLib. This way we can keep
things a bit simpler and faster (no string copies and plugin lookups)

Bump meson dependency to 0.59 to benefit of the libintl lookup that
is now built into meson's dependency() function.
2022-05-10 15:16:09 +03:00
Julian Bouzas
07179452e2 m-lua-scripting: add WpSiAdapter APIs 2022-05-05 08:09:21 +00:00
Julian Bouzas
1675b37617 si-adapter: add ports state change signal 2022-05-05 08:09:21 +00:00
Krisztian Kovacs
8af6f3df1c modules/logind: be more specific when creating the login monitor
We're only interested in notifications for user state changes, so we should
better be more specific about it when creating the systemd login monitor.

This avoids issues with sd_login_monitor_new() returning EINVAL if
systemd-machined is not running (and thus /run/systemd/machines does
not exist).
2022-05-02 08:27:43 +00:00
George Kiagiadakis
7b8e3e8088 m-mixer-api: fix channelVolumes array iteration in set-volume
Fixes: #250
2022-05-02 11:02:40 +03:00
George Kiagiadakis
81af8c2069 lua: sandbox: remove all traces of the minimal_std flag, as it's no longer used 2022-04-23 20:14:59 +03:00
George Kiagiadakis
ecb6100b77 m-lua-scripting: wrap every script in a WpPlugin and expose async activation api
This allows scripts to declare when they have finished their loading,
so we can now also know when wireplumber is done loading and ready to
handle clients

Related to !313
2022-04-23 20:14:59 +03:00
George Kiagiadakis
031bc65c20 lua: sandbox: relax the sandbox to allow more functionality in scripts
This enables the debug and coroutine libraries and some more functions
that are not really so risky to have around

Related to #121
2022-04-23 20:14:59 +03:00
George Kiagiadakis
9387ce0d95 wplua: implement reference counting of the lua_State 2022-04-23 20:14:59 +03:00
George Kiagiadakis
9c22f6076a wplua: enable the use of require() to load lua libraries from scripts/lib 2022-04-23 20:14:59 +03:00
George Kiagiadakis
e1d0240bc9 wplua: split the functionality of the load functions into smaller functions
The load functions used to do 3 things:
- push the sandbox function on the stack
- load the file and push it as a function on the stack
- call the sandbox (or the file)

Now there are separate functions to do these 3:
- wplua_push_sandbox
- wplua_load_*
- wplua_pcall
2022-04-23 20:14:59 +03:00
Pauli Virtanen
bbe9ac00f3 modules: add m-i18n
Add simple gettext i18n module.

Add Lua script API functions I18n.gettext, I18n.ngettext.
2022-04-11 19:20:43 +03:00
George Kiagiadakis
17a257ddbe wplua: move under modules/module-lua-scripting
It's unlikely that wplua will ever be useful outside the context
of module-lua-scripting, so let's move it to keep all the code in one place
2022-03-24 09:47:59 +02:00
Wim Taymans
afbc0ce57a si-audio-adapter: relax format parsing
Some nodes can omit the format/rate/channels to indicate that they can
deal with all possibilities and adapt to what they are linked to.

See pipewire#876
2022-02-25 16:47:09 +00:00
Julian Bouzas
b3446efa16 config: port device-activation module to policy-device.profile.lua
Because all wireplumber policies are in Lua.
2022-02-16 13:37:40 -05:00
George Kiagiadakis
ca906362cd lua-scripting: expose WpImplMetadata on the API 2022-02-03 13:04:55 +02:00
Julian Bouzas
b1b603443f restore-stream: use the new Json API and remove route-settings-api module 2022-02-02 18:37:39 +00:00
Julian Bouzas
384c5775f8 default-nodes: add option to auto-switch to echo-cancel nodes
This option is enabled by default now.
2022-01-27 14:55:21 -05:00