Commit graph

130 commits

Author SHA1 Message Date
George Kiagiadakis
c7cb193588 core: introduce the notion of provided features on components
Each component can optionally "provide" a feature, which is basically
a string that describes the feature (ex. "support.dbus"). If the
component loads successfully, the feature is marked as provided and
can be tested for its presence with wp_core_test_feature()
2023-06-20 12:39:29 +03:00
George Kiagiadakis
add310d9eb dbus: refactor WpDBus into a plugin called dbus-connection
Now that we have proper module load order, we can have this shared
dbus connection in a module instead of the library. The module has
to be loaded before any other modules that need it, obviously.
2023-06-20 12:39:29 +03:00
George Kiagiadakis
55fc845098 component-loader: make wp_core_load_component_finish() return a boolean
There is no reason to return the component object... all components
are supposed to be long-lived objects that are referenced by the
registry and there is API to find them. The caller is only interested
in the success or failure of the operation.
2023-05-28 21:07:15 +03:00
George Kiagiadakis
7fdbf7ff50 component-loader: activate & register objects through a common code path
Do this in wp_core_load_component() and let the component loaders worry
only about creating the object.

Also run the main loop in tests while loading components, to ensure
that the async operation finishes before continuing execution. GTask
makes sure to make the operation async always, by emitting the callback
from an idle GSource.
2023-05-26 21:22:48 +03:00
George Kiagiadakis
843e7ef4dd component-loader: pass core and cancellable parameters in load()
Regarding the core parameter, the case used to be that WpComponentLoader
was a WpPlugin, so it had a reference to the core internally, but since
this is no longer a requirement, we need to pass this explicitly
2023-05-26 13:04:10 +03: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
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
9004362cda lib: remove WpEndpoint and WpSiEndpoint APIs 2023-04-17 07:48:18 -04:00
George Kiagiadakis
43ef01cf89 tests: stop using fake{sink,src} to avoid skipping tests
fakesink/fakesrc are not installed by default with pipewire;
use audiotestsrc and null-sink instead, which are always available
2022-12-06 12:01:34 +02:00
George Kiagiadakis
5622805178 meson: rename dbus option to dbus-tests
This does not prevent the building of code that needs dbus,
it only prevents building and running tests that need dbus-daemon
to be installed.
2022-10-18 15:54:55 +03:00
Haelwenn (lanodan) Monnier
bfd70aff29 tests: Make dbus-based tests depend on dbus option 2022-10-18 09:49:17 +00:00
Julian Bouzas
46e7c5c144 m-reserve-device: use WpDbus API 2022-06-02 12:34:16 -04:00
Wim Taymans
f46a801edb tests: use GNU_SOURCE for compiling tests as well
So that strtod_l is found.
2022-03-21 12:01:00 +01:00
Wim Taymans
7d4369c1af tests: don't leak fd in test 2022-01-21 09:45:29 +01:00
Julian Bouzas
72b3be9e83 m-si-audio-endpoint: use an internal audio adapter session item
Avoids code duplication with si-audio-adapter.
2021-10-21 14:03:10 -04:00
Julian Bouzas
6624eaaf3e m-si-audio-adapter: remove unused audio utilities 2021-10-20 07:41:21 +00:00
George Kiagiadakis
03f14105cf si-audio-adapter: find the device format early and store format-specific flags
* find out if the node supports iec958 or dsd
* use spa_pod_fixate() to get the default format of the node, like p-m-s does
* use _enum_formats_sync() to utilize the param cache, assuming that the node
  always has all features enabled (which is always the case when coming from
  an ObjectManager that was defined in Lua)
* simplify the activation / deactivation procedure
* configure nodes with unpositioned channels early, as if they were devices
2021-10-12 20:00:10 +03:00
George Kiagiadakis
e76c67c45c policy: refactor/improve policy-node & session items to fix linking to monitors
* populate most session item properties from create-item.lua to keep
  things more compact and readable
* use a standard naming scheme for the session item properties
* use session item properties instead of node properties in policy-node.lua
* improve policy-node's performance by converting the properties dictionary
  less times for each session item
* refactor some policy logic and make things slighly more readable
* change the accepted values for 'context' in wp_si_linkable_get_ports();
  use "input" and "output" to keep things clear, because the previous use
  of NULL and "reverse" were implying that a node has only one "standard"
  direction, but this is complicated for sinks w/ monitors and duplex nodes
* allow using monitors (which are Audio/Sink nodes in fact) as sources
* treat Audio/Duplex nodes as sinks, like p-m-s does
* respect the "stream.capture.sink" property of streams

Fixes #66
2021-10-08 00:26:41 +03:00
George Kiagiadakis
e6f2dc17ff tests: file-monitor: also remove the 'foo' file at the end of the test 2021-08-19 10:44:31 +03:00
Julian Bouzas
907a67fcb1 modules: add new API module to monitor files 2021-08-10 11:50:51 +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
70197f498c tests: fix coverity scan side effect in assertion issues 2021-06-25 08:50:08 -04:00
George Kiagiadakis
c24db9f353 tests: add pipewire env variables when running tests, tidy up common_env
Related to pipewire!767
2021-06-18 19:34:25 +03:00
George Kiagiadakis
b6a5750595 Revert "tests: enable G_SLICE=debug-blocks in all tests"
This breaks the valgrind test setup, as this G_SLICE overrides
G_SLICE=always-malloc from valgrind_env

This reverts commit a0d0069f18.
2021-06-10 14:52:30 +03:00
George Kiagiadakis
a0d0069f18 tests: enable G_SLICE=debug-blocks in all tests
This can catch allocation mistakes in the g_slice allocator
2021-06-09 12:21:56 +03:00
George Kiagiadakis
82c054f1bd meson: use environment() objects to define env for tests
it's just a nicer syntax
2021-06-09 12:03:14 +03:00
Julian Bouzas
0f01c8b6da tests: si-standard-link: remove unneeded core syncs 2021-06-08 13:23:44 -04:00
George Kiagiadakis
ae99e50182 tests: si-audio-adapter: test is.device property 2021-05-27 17:01:55 +03:00
George Kiagiadakis
b5ad7b3996 tests: si-standard-link: fix racy test
- use si-audio-adapter, to keep the original test's spirit
  of linking two terminal nodes, not two intermediate ones
- setup null sink to be a virtual device sink with 2 channels
  and the audiotestsrc to be a stream, so that it is also configured
  to have 2 channels via si-standard-link's logic
- don't use a second client core, as it introduces races;
  we don't need that anymore because we don't export endpoint-links
2021-05-27 16:55:26 +03:00
Julian Bouzas
265abd444b tests: enable si-standard-link test and port it to new API 2021-05-24 11:07:56 -04:00
George Kiagiadakis
ac9e1e89c4 wp: remove WpSession and WpEndpointLink
We have ended up not using them, so let's not carry them
in the ABI of 0.4

We can always revert that, but let's first decide how
these objects should be used
2021-05-21 19:57:31 +03:00
Julian Bouzas
05aba22c5a si-audio-adapter: remove unneeded 'preferred.n.channels' property 2021-05-12 10:36:24 -04:00
Julian Bouzas
888667d784 modules: remove role and priority properties from si-audio-adapter and si-node 2021-05-11 10:56:50 -04:00
Julian Bouzas
d68636f9b3 si-interfaces: rename WpSiPortInfo to WpSiLinkable 2021-05-11 10:56:44 -04:00
Julian Bouzas
5c781db216 m-audio-endpoint: remove target property
Links between endpoints and device nodes are done externally in LUA
2021-04-09 14:19:25 -04:00
Julian Bouzas
b2c9084413 modules: remove unneeded si-audio-convert module 2021-04-08 14:07:05 -04:00
Julian Bouzas
d38092a35c m-si-audio-endpoint: fix port configuration and target linking 2021-04-08 14:07:05 -04:00
Julian Bouzas
471f84c735 m-si-audio-endpoint: make target property optional
Allows using the endpoint even if a target is not set.
2021-04-08 14:07:01 -04:00
Julian Bouzas
bce0b79980 tests: si-standard-link: sync core before finishing
Makes sure core has finished any pending task before finishing the test.
2021-04-08 11:04:21 -04:00
Julian Bouzas
fb1daa0bf2 modules: use dots instead of dashes for session item properties
Keeps consistency with PipeWire
2021-04-02 11:22:22 -04:00
Julian Bouzas
b7e347d92c modules: remove endpoint impl on si-node, si-audio-convert and si-audio-adapter 2021-03-26 16:16:02 -04:00
Julian Bouzas
59cb837075 tests: si-standard-link: use new si-audio-endpoint 2021-03-26 16:16:02 -04:00
Julian Bouzas
325522ae51 modules: add si-audio-endpoint session item 2021-03-26 16:16:02 -04:00
Julian Bouzas
d71cace24f m-si-convert: rename to si-audio-convert
Because it is only meant to be used with audio nodes
2021-03-18 15:00:22 -04:00
Julian Bouzas
340213272e m-si-adapter: rename to si-audio-adapter
Because it is only meant to be used with audio nodes
2021-03-18 14:47:22 -04:00
Julian Bouzas
120aab04ae session-item: refactor and inherit from WpObject
This adds WP_SESSION_ITEM_FEATURE_ACTIVE and WP_SESSION_ITEM_FEATURE_EXPORTED
features, so _activate and _export APIs have been removed. Modules and unit
tests have also been updated.
2021-03-18 14:30:05 -04:00
Julian Bouzas
39ef6df7ce m-si-adapter: rename algorithms to audio-utils 2021-03-18 12:10:37 -04:00
Julian Bouzas
b10a5b6b49 m-si-simple-node-endpoint: rename to si-node 2021-03-18 12:10:37 -04:00
Julian Bouzas
12b2c00d0b lib: remove WpEndpointStream API
Add all that goes with it.
2021-03-18 12:10:37 -04:00