Commit graph

2173 commits

Author SHA1 Message Date
George Kiagiadakis
7ed188fba3 daemon: use a different GList pointer to iterate the components list
This keeps the original head pointer intact, so that we can effectively
free the list later. If we use the head pointer to iterate, then at the
end we are not freeing anything because the pointer is NULL
2023-04-17 07:48:18 -04:00
George Kiagiadakis
e55e8bb447 object-manager: set self->installed=TRUE before emiting the signal
This avoids recursing into the same signal, in rare cases where a
new object is registered from within the signal handler
2023-04-17 07:48:18 -04:00
George Kiagiadakis
8505e75cd0 daemon: wait for export-core to be connected to continue the transition 2023-04-17 07:48:18 -04:00
George Kiagiadakis
903fab9c3c core: return true from _is_connected() only after receiving the info structure 2023-04-17 07:48:18 -04:00
George Kiagiadakis
f00011d23a daemon: fallthrough to the error case instead of repeating cleanup statements 2023-04-17 07:48:18 -04:00
George Kiagiadakis
13f9f98bc8 daemon: check for media-session before loading any components
We shouldn't start doing anything if another session manager is running,
it will just break the other session manager's state.
2023-04-17 07:48:18 -04:00
George Kiagiadakis
51d5beb36c daemon: remove redundant calls to component_data_free()
The component data pointer in this function is wrapped in g_autoptr,
so this should happen automatically
2023-04-17 07:48:18 -04:00
George Kiagiadakis
0fed249eb9 daemon: exit with WP_EXIT_CONFIG code if a component fails to load
This should be considered a configuration error: the user has
specified some component in the config file that cannot be loaded.
Changing the configuration file should fix it.
2023-04-17 07:48:18 -04:00
George Kiagiadakis
65c94c71fd daemon: check for the correct "file not found" code
When a script fails to load, the lua component loader returns
G_IO_ERROR / G_IO_ERROR_NOT_FOUND.
2023-04-17 07:48:18 -04:00
George Kiagiadakis
8219cc58c1 daemon: remove unused variable 2023-04-17 07:48:18 -04:00
Julian Bouzas
310232b810 meson: install scripts in /usr/share/wireplumber
Since the wireplumber configuration has been moved to /usr/share/pipewire, it
does not makes sense to have a different path for the WIREPLUMBER_CONFIG_DIR
environment variable. Therefore, the WIREPLUMBER_CONFIG_DIR environment variable
has been changed to just be an alias of PIPEWIRE_CONFIG_DIR. Finally, Lua
scripts are now installed under /usr/share/wireplumber/scripts instead of
/usr/share/pipewire/scripts as they are a wireplumber feature only.
2023-04-17 07:48:18 -04:00
Ashok Sidipotu
e7c992e97d default-nodes-tests: use the changed variable in test utils 2023-04-17 07:48:18 -04: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
Torge Matthies
ab6a3393e6 lib/wp: Fix lookup_dirs with WP_LOOKUP_DIR_ENV_DATA or WP_LOOKUP_DIR_ENV_TEST_SRCDIR
Fixes: aa2f7e9f308f ("lib/wp: add a new search folder to locate the Lua Test scripts")
2023-04-17 07:48:18 -04:00
Julian Bouzas
c61d1e4245 component-loader: make wp_core_load_component() API asynchronous
This change completely refactors the way components are loaded in wireplumber:
- The module_init() function must return a GObject now. This object is either
a WpPlugin or a WpSiFactory in the current modules.
- When the component loader initializes a module, it automatically registers
the WpPlugin or WpSiFactory with their respective methods. There is no need
to register the WpPlugin or WpSiFactory in the module now.
- The wp_core_load_component() API has been refactored to be asynchronows. This
allows the component loader to automatically activate WpPlugin objects, and
therefore allows the application to directly get the WpPlugin without having
to find it. This simplifies a lot of things.
- The 'ifexists' and 'nofail' component flags now work even if the respective
WpPlugin could not be activated.
- The code that loads components in main.c has also been simplified a lot,
and the option to load dangling components has also been removed.
2023-04-17 07:48:18 -04:00
Julian Bouzas
ad940b6efc component-loader: remove handling of 'pw_module' components 2023-04-17 07:48:18 -04:00
Julian Bouzas
6259a3a0fa m-lua-scripting: remove handling of 'config/lua' files
Not needed anymore as the configuration is written in JSON now.
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
9a0f8647ac test-utils: align style 2023-04-17 07:48:18 -04:00
Ashok Sidipotu
c7c06351f7 test-utils: add a restartPlugin API 2023-04-17 07:48:18 -04:00
Ashok Sidipotu
c88a569835 default node tests: add initial test
tests the initial metadata setup.
2023-04-17 07:48:18 -04:00
Ashok Sidipotu
0b29286f4f script-tester: add a restart-plugin action signal 2023-04-17 07:48:18 -04:00
Ashok Sidipotu
d4d4e23e9c script-tester: pass the fixture pointer to plugin 2023-04-17 07:48:18 -04:00
Ashok Sidipotu
c9e55e6565 script-tester: run default-node scripts ahead of m-metadata 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
137cbf3f22 wireplumber.conf: hike the priority of default-node scripts
default-node scripts need to run before metadata module as default nodes need to
act when the default metadata is created.
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
9ee0f096ec tests: remove audiotestsrc-play example 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
9004362cda lib: remove WpEndpoint and WpSiEndpoint APIs 2023-04-17 07:48:18 -04:00
Julian Bouzas
d43b55d01e tests: use WpConf for the settings unit tests
Also moves the settings.conf file into settings/wireplumber.conf
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
Julian Bouzas
6c6d5eccf9 main: use WpConf to get wireplumber component dependencies 2023-04-17 07:48:18 -04:00
Julian Bouzas
fdcd280120 m-settings: use WpConf to get the wireplumber settings 2023-04-17 07:48:18 -04:00
Julian Bouzas
a7a7e614db m-lua-scripting: add WpConf Lua API 2023-04-17 07:48:18 -04:00
Julian Bouzas
cb80cb750b conf: add support to override sections and nested objects/arrays 2023-04-17 07:48:18 -04:00
Julian Bouzas
8f66b16673 lib: add WpConf API 2023-04-17 07:48:18 -04:00
George Kiagiadakis
fe3d0b55ac docs: initial design documentation 2023-04-17 07:48:18 -04:00
George Kiagiadakis
3779a92fcc lua: AsyncEventHook: allow hooks to handle transition errors
When in error, attempt to execute a step called "error", if it exists.
This is rarely needed, but it might be useful in some cases to cleanup
some state, rolling back changes, when something fails.
2023-04-17 07:48:18 -04:00
George Kiagiadakis
18377fbf82 transition: don't allow _return_error() to be called recursively 2023-04-17 07:48:18 -04:00
Ashok Sidipotu
6495eb6d21 linking tests: create stream node after device nodes are ready 2023-04-17 07:48:18 -04:00
Ashok Sidipotu
8a6e28f496 test-utils.lua: create stream node with script tester plugin 2023-04-17 07:48:18 -04:00
Ashok Sidipotu
cd7e9b190b script-tester: create a new script tester plugin
script tester plugin with a action signal to create the stream node.
2023-04-17 07:48:18 -04:00