Commit graph

372 commits

Author SHA1 Message Date
Ashok Sidipotu
0dcd28e50f Lua scripts: replace "policy" with "linking" 2023-09-26 10:09:03 +03:00
Ashok Sidipotu
1f92767d4b config: replace "policy" with "linking" 2023-09-26 10:07:57 +03:00
Julian Bouzas
06fa06ca5c scripts: fix minor issues with smart filters policy
The filter's destination target was not being found properly due to iterating
the matching rules table with ipairs instead of pairs... the later is meant to
be used with JSON objects. In addition, the filters were not being re-evaluated
and linked properly when a device node was removed, this is because of a typo in
the find-best-target.lua script.

See #501
2023-09-21 09:04:31 -04:00
Julian Bouzas
56017fdbe6 scripts: use filter-utils to implement smart filter policy 2023-09-03 14:33:34 +00:00
Julian Bouzas
1ba3844f2c scripts: add filter-utils.lua
Utilities Lua script for the policy to easily handle filter nodes.
2023-09-03 14:33:34 +00:00
Julian Bouzas
b984af7c87 scripts: add filters_metadata.lua
Creates a filters metadata to configure filters at runtime.
2023-09-03 14:33:34 +00:00
Julian Bouzas
d383762812 device: remove echo-cancel configuration
This will be possible to do with the new filter-utils.lua design.
2023-09-03 14:33:34 +00:00
George Kiagiadakis
67f9f63520 Merge branch '0.4' into next 2023-09-01 19:12:20 +03:00
George Kiagiadakis
02e1393c9f policy-node: destroy node only after sending an error to the client
if the node is destroyed before, pw_stream shuts down and doesn't
relay the error to the application
2023-09-01 16:23:09 +03:00
Julian Bouzas
dcee74fcca scripts: do not store the link in si_flags
Otherwise the link is not destroyed right away when doing silink:remove()
2023-08-15 16:32:19 -04:00
Ashok Sidipotu
591d0b4370 camera-monitors: add a config property for camera discovery timeout 2023-08-15 07:14:59 +00:00
Ashok Sidipotu
359ea7b17d monitor-utils: use uniform naming style for lib apis 2023-08-15 07:14:59 +00:00
Ashok Sidipotu
426e1bbffe camera monitors: introduce cam device arbitration logic 2023-08-15 07:14:59 +00:00
Ashok Sidipotu
7bca8cacde camera monitors: pass device and node properties as event data
This avoids event properties show up in device and node properties.
2023-08-15 07:14:59 +00:00
Ashok Sidipotu
f45d7b43f3 v4l2/monitors: rebase v4l2 monitor into a bunch of hooks 2023-08-15 07:14:59 +00:00
Ashok Sidipotu
bb0e15e631 libcamera/monitors: rebase libcamera monitor into a bunch of hooks 2023-08-15 07:14:59 +00:00
Ashok Sidipotu
6596d71c4f monitor-utils: introduce monitor utils lua library 2023-08-15 07:14:59 +00:00
Stefan Ursella
407c2f04de scripts: run find-best-profile hook before running apply-profile hook 2023-07-17 17:33:40 +02:00
Duncan Overbruck
760ce55de1
device/state-routes.lua: fix finding stored routes
This wrongly stored the matched route in a new variable instead of the
locally declared variable it supposed to use.
2023-06-23 13:13:44 +02:00
Duncan Overbruck
7eb6ff3b9e
device/state-routes.lua: fix check for empty selected-routes
This hook and previous hooks hooks default to setting the
selected-routes event property to an empty table, not nil.
2023-06-23 13:13:44 +02:00
Ashok Sidipotu
b0460d8050 src/scripts: add few comments 2023-06-22 16:28:56 +05:30
George Kiagiadakis
a0497b4256 Merge branch '0.4' into next 2023-06-21 20:59:04 +03:00
George Kiagiadakis
5d4db78427 suspend-node: check if the node still exists before suspending it
After a timeout, it's possible that something else may have
destroyed the node already. This can happen for example with virtual
sinks that were created from another process.

Fixes: #467
2023-06-14 23:26:30 +03:00
George Kiagiadakis
982bebe5aa scripts: use log topics 2023-05-19 20:12:08 +03:00
George Kiagiadakis
4f27d18bd3 log: rename "message" level to "notice" and print criticals with "E"
Syslog calls this level "notice" and I prefer it because we use it
to display significant messages that are not warnings, but they
are not really "standard", as GLib wants them to be. There is nothing
"standard" about log messages in general.

Also, make these notice messages be enabled at debug level 2, together
with warnings. The default log.level is 2 and it is a good idea to show
notices by default too.

Finally, show them in the log with "N" and also change criticals to be
shown with "E", meaning "error"... Then promote G_LOG_LEVEL_ERROR
messages to be shown with "F", meaning "fatal", because in fact these
messages are always fatal and always call abort(). Still, keep the term
"critical" in the functions to make sure that whoever uses them is aware
that this level is only for critical conditions and not suitable to
display any kind of error.
2023-05-18 16:19:49 +03:00
Pauli Virtanen
5a00686e3c bluez: minor configuration fixup
api.bluez5.connection-info is not a setting, but must always be enabled.
The bluez-midi servers should also not be enabled by default.
2023-04-17 19:41:28 +03:00
Ashok Sidipotu
5c17747112 policy-utils.lua: remove object managers 2023-04-17 07:48:18 -04:00
Ashok Sidipotu
80554fe1c7 common-utils.lua: remove metadata object managers 2023-04-17 07:48:18 -04:00
George Kiagiadakis
7c2e713c9d m-metadata: remove module-metadata and replace it with a simple lua script 2023-04-17 07:48:18 -04:00
Ashok Sidipotu
de3214d21b default-node: rename select-default-nodes.lua
Consistent across linking and default node scripts.
2023-04-17 07:48:18 -04:00
Ashok Sidipotu
50377f2a70 default-nodes: make the default-config* keys trigger common
This trigger will be available all the time irrespective of whether persistant
option is enable or not.
2023-04-17 07:48:18 -04:00
Ashok Sidipotu
03bdf7d283 find-selected-default-node.lua: add a new default node hook
Hook accords higher priority to the currently selected device over and on top of
the previously selected devices.
2023-04-17 07:48:18 -04:00
Ashok Sidipotu
85db1e371e state-default-nodes: initialize the metadata variable 2023-04-17 07:48:18 -04:00
Ashok Sidipotu
0d73c34c68 common-utils: add a null check for default-nodes query
common-utils is a singleton common resource, it cannot depend on the order in
which the components are loaded.
2023-04-17 07:48:18 -04:00
Ashok Sidipotu
000a869035 apply-default-node.lua: re-instate the "set default node" debug log msg 2023-04-17 07:48:18 -04:00
Ashok Sidipotu
82c8269381 prepare-link.lua: fix unassigned variables 2023-04-17 07:48:18 -04:00
Julian Bouzas
d2123827f7 scripts: use the event stack to handle virtual session items
This removes both the policy-virtual-client.lua and policy-virtual-device.lua
scripts, and creates a new linking/find-virtual-target.lua script to link
clients with virtual session items if one of them can be found. In addition to
this, this patch also ports the policy-virtual-client-links.lua into a new
scripts/rescan-virtual-links.lua to use the event stack. The idea is for the
scripts/link-target.lua to create all links but only activate non virtual links,
and for the scripts/rescan-virtual-links.lua to activate/deactivate virtual
links based on role priorities.
2023-04-17 07:48:18 -04:00
Julian Bouzas
fb855b00cf Rename endpoint concept to virtual session item 2023-04-17 07:48:18 -04:00
Julian Bouzas
360e0b3eaf scripts: use WpConf API to get configuration values
This patch also moves nested configuration objects that are not considered
settings from the wireplumber.settings section to its own configuration
section (eg the rules array, the spa plugin properties, etc...). This allows
those objects to be merged with other same sections defined in other files.
2023-04-17 07:48:18 -04:00
Ashok Sidipotu
4b153ec553 link-target.lua: change into a async hook
link setup is a asynchronous action, async hook serves the purpose well
here.

The code dependent on links will be less error prone with this design.
2023-04-17 07:48:18 -04:00
Ashok Sidipotu
81c468cf23 find-best-routes.lua: add a null check while selecting routes 2023-04-17 07:48:18 -04:00
George Kiagiadakis
153c019343 m-std-event-source: separate rescan events for linking and default-nodes
Call the event "rescan-for-<context>", where <context> is either
"linking" or "default-nodes" and can be expanded in the future.

Add an additional hook in default-nodes to trigger the
rescan-for-default-nodes event when sources and sinks come and go.
2023-04-17 07:48:18 -04:00
George Kiagiadakis
dc196df239 m-std-event-source: fix state names in node-state-changed event
We need to use the enum nicknames ("idle"), not the enum names
("WP_NODE_STATE_IDLE"). This makes suspend-node work again.
2023-04-17 07:48:18 -04:00
George Kiagiadakis
26e47db4b4 scripts: default-nodes: fix mistakes to make default-node selection work 2023-04-17 07:48:18 -04:00
George Kiagiadakis
28548e0933 scripts: move create-item.lua under node/ and modernize it 2023-04-17 07:48:18 -04:00
George Kiagiadakis
258d9f32e1 scripts: rename all hooks to follow a nicer naming scheme
Use the directory name and file name to construct the hook's name,
like a path. This way, when you see a hook name, it is clear where
to find that hook in the source code.
2023-04-17 07:48:18 -04:00
George Kiagiadakis
652a6a6698 scripts: rename directories to follow the new naming scheme
* client: Logic that deals with configuring clients (basically, permissions)
* device: Anyhing that that deals with configuring devices (profiles, routes, ...)
* node: Anything that deals with node objects: configuring nodes, changing
  their state, their properties and also creating new nodes (but NOT linking them)
* linking: All the logic for creating links between nodes (and obviously,
  deciding which links to create)
* monitors: Scripts that deal with hardware subsystems, mainly monitoring
  hardware changes and reflecting them on pipewire
* default-nodes: All the logic for selecting the default sinks and sources
2023-04-17 07:48:18 -04:00
George Kiagiadakis
08a9d39295 events: rename find-target-si-and-link to select-target
And make sure it does not get prefixed with the subject type
2023-04-17 07:48:18 -04:00
George Kiagiadakis
2325178d5c default-nodes: port to a set of scripts with hooks 2023-04-17 07:48:18 -04:00
George Kiagiadakis
d8e461940f scripts: refactor restore-stream into node/state-stream
* Use more hooks and no custom object managers
* Use the settings manager for the config values
* Allow fully disabling the hooks when both restore-props and restore-target
  are disabled in the settings
* Change the format AND the name of the state file; use json directly
  in the values now that we can
2023-04-17 07:48:18 -04:00