Commit Graph

63 Commits

Author SHA1 Message Date
Jason Francis
ed8346e77d docs: Add brief descriptions to all functions
This ensures all of these functions are picked up by g-ir-scanner.
2021-06-02 17:38:34 +00: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
6939d8900a core: use log.level from the pw_context
And don't override PIPEWIRE_DEBUG, unless WIREPLUMBER_DEBUG is set.
This allows pipewire to use log.level as well to set up its logging.

If WIREPLUMBER_DEBUG is set, though, override PIPEWIRE_DEBUG to prevent
log.level from being used.
2021-04-21 19:03:47 +03:00
George Kiagiadakis
7eed2acd76 lib: documentation fixes 2021-03-04 19:10:10 +02:00
George Kiagiadakis
37134df7c8 iterator: make private stuff public, cleanup private.h further
There is no good reason to keep them private
2020-11-15 20:26:15 +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
George Kiagiadakis
0596988945 core: retrieve and store core info
also delay the "connected" signal until info is there
2020-06-15 17:49:21 +03:00
Julian Bouzas
c7982a8317 core: rename context property to g-main-context 2020-06-10 13:29:52 -04:00
Julian Bouzas
eb39dec68b core: add wp_core_clone API 2020-06-10 13:29:44 -04:00
Julian Bouzas
d9ffc1c318 core: finish all pending tasks when core proxy is destroyed 2020-05-19 10:18:51 -04:00
George Kiagiadakis
9b0417cb68 core: remove warning on the error callback
libpipewire already prints this, so we get it duplicated on the log
2020-05-13 19:56:55 +03:00
George Kiagiadakis
8e87bd323c core: fix disconnecting when pipewire quits 2020-05-13 15:20:26 +03:00
George Kiagiadakis
66a0bf6093 lib: implement a wp_init() function 2020-05-11 15:45:09 +03:00
George Kiagiadakis
63397a1ff2 core: debug core sync 2020-05-08 18:18:33 +03:00
George Kiagiadakis
11b99527b5 core: make the properties on wp_core_new to be (transfer full)
This aligns better with the general design of consuming property
objects on constructors, both in PipeWire and WirePlumber APIs
2020-05-08 17:12:31 +03:00
George Kiagiadakis
a10ee91bd4 core: add idle & timeout method variants that take a GClosure 2020-05-07 11:10:12 +03:00
George Kiagiadakis
1faa752cd0 core: trace pw main loop execution 2020-04-24 20:42:27 +03:00
Julian Bouzas
cfbcb5eca3 proxy: use WpSpaPod instead of struct spa_pod in public API 2020-04-21 16:11:05 -04:00
George Kiagiadakis
9ca342f89f debug: update all library code to use the new debug system
+ enable the new log writer on the executables
+ enable structured logging in the tests
2020-04-14 18:31:17 +03:00
George Kiagiadakis
1cc2837562 lib: add proxy & impl class for PW_TYPE_INTERFACE_EndpointStream 2020-03-31 16:11:08 +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
d4973363ac lib: add extensive API documentation 2020-02-19 10:43:07 +02:00
George Kiagiadakis
c46a48d13f registry: hide again the WpCore struct, separate registry and core better 2020-02-17 18:31:03 +02:00
George Kiagiadakis
753e708544 object-manager: refactor to be able to track locally created proxies
There are 3 kinds of WpProxy objects:
 * the ones that are created as a result of binding a global
   from the registry
 * the ones that are created as a result of calling into a remote
   factory (wp_node_new_from_factory, etc...)
 * the ones that are a local implementation of an object
   (WpImplNode, etc...) and are exported

Previously the object manager was only able to track the first kind.
With these changes we can now also have globals associated with
WpProxies that were created earlier (and caused the creation of the global).
This saves some resources and reduces round-trips (in case client
code wants to change properties of an object that is locally
implemented, it shouldn't need to do a round-trip through the server)
2020-02-14 17:12:23 +02:00
George Kiagiadakis
a92e1a64ec global & object-manager: use GType instead of the pipewire type 2020-02-12 14:15:51 +02:00
George Kiagiadakis
c9cab2cd53 endpoint: refactor into WpEndpoint & WpImplEndpoint 2020-02-12 11:30:21 +02:00
George Kiagiadakis
8e50fab112 session: refactor into WpSession & WpImplSession 2020-02-12 11:28:02 +02: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
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
4699946e56 core: remove wp_core_get_pw_core_proxy API 2020-01-10 10:16:15 -05:00
Julian Bouzas
116376a0a6 proxy: add local_object property to handle local objects 2020-01-10 10:16:07 -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
9b255922ff core: remove unnecessary idle callback when connecting 2019-12-06 08:53:51 -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
Bastien Nocera
e8fadbcbda build: Fix build after recent PipeWire header changes
PipeWire headers were recently cleaned up to reduce the number of
included headers. This leads to a number of functions and types not
being included when needed in wireplumber.
2019-11-06 16:18:30 +02:00
George Kiagiadakis
9ab1780594 core & proxy: add some more assertions and debug messages for troubleshooting 2019-10-02 21:20:19 +03:00
George Kiagiadakis
340b52fbee proxy: fix crash that happens when a client exits very quickly after starting
This is very easy to reproduce when the pipewire-alsa integration
is installed and you do 'arecord -l'; the alsa plugin connects and
disconnects again before the proxy is ready.

In this case we have to skip remote-global-added and we also have
to be careful with the references: the global-removed callback is
called earlier, so the core's reference to the proxy is gone and
the GTask is the only thing holding a reference to the proxy.
When we unref the GTask, the proxy is also unrefed, so we have
to keep an additional reference in order to avoid crashing
when accessing the hash table below.
2019-09-17 16:19:13 +03: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