Commit Graph

35 Commits

Author SHA1 Message Date
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
cee5ee7c37 core: add API to get virtual machine type 2022-06-02 12:34:16 -04:00
George Kiagiadakis
57d60c383c core: add wp_core_sync_closure()
A variant of wp_core_sync() that can be used with a GClosure
2021-12-21 20:03:58 +02:00
George Kiagiadakis
b812e912d2 docs: fix C API documentation to work nicely with doxygen & sphinx 2021-05-25 14:19:53 +03:00
Raghavendra
d692f06f0d docs: api: Replace hotdoc specific commands with Doxygen specific commands 2021-05-25 14:19:53 +03:00
George Kiagiadakis
0d072874a1 lib: introduce WpComponentLoader and remove WpModule
The component loader is a more generic and extensible mechanism
of loading components; modules are one type of component...
The idea is to make scripts and config files also be components,
loaded by plugins that inherit WpComponentLoader
2021-02-03 17:16:51 +02:00
George Kiagiadakis
94213310a3 private: further cleanup of private.h, sort out header includes 2020-11-16 10:35:50 +02:00
George Kiagiadakis
083b9ff878 core: wp_core_get_context -> wp_core_get_g_main_context 2020-06-16 12:53:18 +03:00
George Kiagiadakis
7668f4c6c9 core: add methods to work with pw_core_info data and pw_core properties
- pw_core_info has data that represent the remote core
- pw_core properties are the properties of its pw_client,
initially inherited from the pw_context, which can be updated either
when calling pw_context_connect() or later at runtime (the pw_core
calls pw_client_update_properties() on its pw_client)

wp_core_update_properties() is made in such a way so that we can do:
```
clone = wp_core_clone(core);
wp_core_update_properties(clone, ...);
wp_core_connect(clone);
```
and get clone to have different properties than the original core,
while they still share the same pw_context underneath
2020-06-15 17:50:03 +03:00
Julian Bouzas
eb39dec68b core: add wp_core_clone API 2020-06-10 13:29:44 -04:00
George Kiagiadakis
a10ee91bd4 core: add idle & timeout method variants that take a GClosure 2020-05-07 11:10:12 +03:00
Julian Bouzas
620f95b628 core: add source nullable parameter in _idle_add and _timeout_add APIs 2020-02-27 08:39:10 -05:00
Julian Bouzas
5abdc2fb9e core: add wp_core_timeout_add API 2020-02-27 08:37:15 -05:00
George Kiagiadakis
9330208ada proxy/core: refactor object creation
* core no longer exposes create_remote/local_object
* node, device & link have constructor methods
  to enable the create_remote_object functionality
* added WpImplNode to wrap pw_impl_node and allow creating
  "local" node instances
* added WpSpaDevice to wrap spa_device and allow creating
  "local" device instances
* exporting objects in all cases now happens by requesting
  FEATURE_BOUND from the proxy, eliminating the need for WpExported
* replaced WpMonitor by new, simpler code directly in module-monitor
* the proxy type lookup table in WpProxy is gone, we now
  use a field on the class structure of every WpProxy subclass
  and iterate through all the class structures instead; this is
  more flexible and extensible
2020-02-11 11:07:44 +02:00
George Kiagiadakis
f7a0e710a5 lib: remove wp_proxy_sync in favor of wp_core_sync
They are equivalent, there is no real benefit in having both
2020-01-22 18:07:16 +02:00
George Kiagiadakis
efb33ddd1b lib: introduce export macros and hide all private symbols 2020-01-16 18:50:07 +02:00
Julian Bouzas
a9ac1fdc06 update to the latest pipewire API 2020-01-13 15:07:08 -05:00
Julian Bouzas
cf768e9b20 core: remove wp_core_get_pw_remote API 2020-01-13 08:45:26 -05:00
Julian Bouzas
c1bece82f9 core: add wp_core_export_object API 2020-01-13 08:44:35 -05:00
Julian Bouzas
0a690f61a4 core: add wp_core_create_local_object API 2020-01-09 08:49:57 -05:00
George Kiagiadakis
67cb633fb5 core: change idle_add to take a GDestroyNotify as well and return a source id
to make it more usable and compatible with g_idle_add
2019-12-12 20:07:46 +02:00
Julian Bouzas
e04f935952 core: return a boolean in sync API 2019-12-06 08:53:57 -05:00
Julian Bouzas
61227c9da2 core: add sync API 2019-12-04 16:38:35 -05:00
Julian Bouzas
936a9f4d8b core: add wp_core_idle_add API 2019-11-27 13:16:43 -05:00
George Kiagiadakis
e7e5c66853 lib: introduce WpObjectManager
* rework how global objects are stored in the core
* rework how users get notified about global objects
  and proxies of remote global objects

The purpose of this change is to have a class that can manage
objects that are registered in the core or signalled through the
registry. This object can declare interest on certain types
of global objects and only keep & signal those objects that it is
interested in. Additionally, it can prepare proxy features and
asynchronously deliver an 'objects-changed' signal, which is
basically telling us that the list of objects has changed.

This is useful to simplify port proxies management in WpAudioStream.
Now the stream object can declare that it is interested in ports
that have "node.id" == X and the object manager will only maintain
a list of those. Additionally, it will emit the 'objects-changed'
signal when the list of ports is complete, so there is no reason to
do complex operations and core syncs in the WpAudioStream class
in order to figure out when the list of ports is ready.

As a side effect, this also reduces resource management. Now we
don't construct a WpProxy for every global that pipewire reports;
we only construct proxies when there is interest in them!

Another interesting side effect is that we can now register an
object manager at any point in time and get immediately notified
about remote globals that already exist. i.e. when you register
an object manager that is interested in nodes, it will be immediately
notified about all the existing nodes in the graph. This is useful
to avoid race conditions between connecting the signal and objects
beting created in pipewire
2019-11-13 15:49:39 +02:00
George Kiagiadakis
d39307ee70 lib/wp: move internal functions and declarations to a private.h header 2019-11-07 20:44:55 +02:00
George Kiagiadakis
371e4cf9f3 core: allow passing properties to the pw_core and pw_remote constructors 2019-09-07 18:21:17 +03:00
George Kiagiadakis
a63f2bb99b lib/wp: merge both WpRemote & WpRemotePipewire in WpCore
In practice we always create a remote and connect to pipewire.
Any other scenario is invalid, therefore, it is not justified
to be confused with so many classes for such small functionality.
This simplifies a lot the modules code.

Also, this commit exposes the pw_core and pw_remote objects
out of WpCore. This is in practice useful when dealing with low-level
pw and spa factories, which are used in the monitors. Let's not
add API wrappers for everything... Bindings will never use this
functionality anyway, since it depends on low level pipewire C API.
2019-09-07 17:55:46 +03:00
Julian Bouzas
a471a2df13 proxy: remove unneeded core reference 2019-06-18 10:18:21 -04:00
George Kiagiadakis
7b9e8a030e lib: add a new WpRemote base class and move the pw_remote glue into a new WpRemotePipewire
This is a cleaner way to interface with the remote pipewire daemon.
The WpRemote base class can be subclassed also for interfacing
with other daemons (hardware-specific managers, etc)
2019-06-17 20:28:06 +03:00
Julian Bouzas
aa1ce5cdd4 proxy: add API 2019-06-17 10:42:29 -04:00
George Kiagiadakis
25d70c5446 lib: add new WpPolicy class and basic policy management functionality 2019-06-13 14:51:20 +03:00
George Kiagiadakis
36bc1795ca Relicense to MIT 2019-05-31 12:13:12 +03:00
George Kiagiadakis
1b6d9720c8 core: allow having a flat list of globals with the same key
and also implement
* global-added/removed signals
* a foreach function to iterate through globals
* registering modules and factories with the same key
2019-05-26 18:58:19 +03:00
George Kiagiadakis
447c968846 Refactor everything!
After discussing things at the AGL May 2019 F2F meeting
and reflecting on the initial design of WirePlumber,
it became clear that it needed a fresh start.
2019-05-17 13:34:07 +03:00