Commit Graph

52 Commits

Author SHA1 Message Date
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
5bf40e86cb endpoint: fix compiler warnings 2020-04-14 15:18:44 +03:00
George Kiagiadakis
5d74bceac0 endpoint: implement create_link() 2020-04-11 11:05:26 +03:00
George Kiagiadakis
17d4b46144 endpoint & stream: use wp_session_item_get_associated_proxy_id() 2020-03-31 19:31:54 +03:00
George Kiagiadakis
bb78b6bbc7 doc: remove references to WpImplEndpoint that is now private 2020-03-31 16:11:08 +03:00
George Kiagiadakis
4adf6105ba endpoint: implement FEATURE_STREAMS
This feature enables the caching of WpEndpointStream objects
inside WpEndpoint, making information about streams readily
accessible to the user of an endpoint
2020-03-31 16:11:08 +03:00
George Kiagiadakis
69ea11ca61 endpoint: improve impl 2020-03-31 16:11:08 +03:00
George Kiagiadakis
306f75d321 session-item: implement and use _get_associated_proxy() API 2020-03-31 16:11:08 +03:00
George Kiagiadakis
405e8ba0d5 session-item / endpoint: implement exporting a WpSiEndpoint
* introduces API to export session items
* introduces small changes in the WpSiEndpoint & WpSiStream
  interfaces to make it nicer to work with
* ports WpImplEndpoint to use PW_TYPE_INTERFACE_Endpoint
  to export. Depends on:
  https://gitlab.freedesktop.org/pipewire/pipewire/-/merge_requests/246
  (was merged after 0.3.2)
2020-03-29 15:18:20 +03:00
George Kiagiadakis
d4973363ac lib: add extensive API documentation 2020-02-19 10:43:07 +02:00
George Kiagiadakis
c9cab2cd53 endpoint: refactor into WpEndpoint & WpImplEndpoint 2020-02-12 11:30:21 +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
5c47f1df2c proxy: unify common info/params API in the WpProxy base class 2020-01-22 18:30:44 +02:00
Julian Bouzas
a9ac1fdc06 update to the latest pipewire API 2020-01-13 15:07:08 -05:00
George Kiagiadakis
8b2d8c90a2 endpoint proxy: don't try to set a control value if the proxy is destroyed 2019-12-12 20:09:17 +02:00
George Kiagiadakis
787bd8d576 endpoint: implement get_{name,media_class,direction} 2019-12-11 23:43:13 +02:00
George Kiagiadakis
7b222ebcbd endpoint: export name, media class & direction + finetune the global properties 2019-12-11 19:05:09 +02:00
George Kiagiadakis
a71d433a5e lib: implement WpEndpoint (interface + Proxy + Exported + unit test)
heavily based on the WpSession implementation
2019-12-11 19:05:09 +02:00
George Kiagiadakis
c0455c981d lib: rename WpEndpoint* to WpBaseEndpoint*
to avoid name clashing with the upcoming WpEndpoint interface
that is going to be the common interface of Wp{Proxy,Exported}Endpoint
2019-12-11 19:05:05 +02:00
Julian Bouzas
c8417f8826 endpoint: add get_role API 2019-12-04 16:38:35 -05:00
Julian Bouzas
7bd9f84e6f endpoint: add keep property 2019-12-04 16:38:35 -05:00
Julian Bouzas
d49ffbef1d endpoint: add get_properties API 2019-12-04 16:38:35 -05:00
George Kiagiadakis
4ad4974f27 endpoint-link: ensure we call finalize of the parent class
This was causing a memory corruption and crash because the
simple-endpoint-link was not calling finalize of the endpoint-link
and the GWeakRefs pointing to the endpoints were not uninitialized,
causing g_object_unref later to try to write to them (on free'ed memory)
2019-11-16 11:40:02 +02: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
Julian Bouzas
44bb78fcb7 endpoint: add creation-time property 2019-11-06 12:15:11 +02:00
Julian Bouzas
dcbf823a5a endpoint: add direction property and remove it from subclasses 2019-08-27 10:05:59 -04:00
George Kiagiadakis
1ed004c3c1 policy: implement a basic policy based on role priorities
* Every client has a priority based on its role
* For playback, we allow only a single client to play at a time
* For capture, we allow all clients to capture simultaneously
* Every time the "selected" device changes (either because devices
  are discovered/removed or because the user changed the selection),
  the clients are re-linked to the new "selected" device.
* When a playback client quits and there are others waiting unlinked,
  the highest priority one is linked automatically.
* This also properly fixes re-linking the correct client(s) to the
  correct device(s) when wireplumber exits and restarts.
2019-07-12 19:28:27 +03:00
Julian Bouzas
54721da7c4 Fix doc warnings 2019-07-12 08:20:08 -04:00
Julian Bouzas
27a31498c0 endpoint: add wp_endpoint_unlink API 2019-07-10 11:18:09 -04:00
Julian Bouzas
5d1397cf56 endpoint: destroy the link before removing them from the lists 2019-07-10 11:18:09 -04:00
Julian Bouzas
3cecccd681 endpoint: allow derived classes of endpoint-link to finish async construction 2019-07-10 11:18:09 -04:00
Julian Bouzas
5429d57cb1 endpoint-link: make contruction async 2019-06-28 12:33:00 -04:00
Julian Bouzas
495a74d0e6 endpoint: remove unneeded ref/unref 2019-06-26 12:36:59 -04:00
Julian Bouzas
4333c94531 endpoint: add async initable interface boilerplate 2019-06-24 10:52:02 -04:00
George Kiagiadakis
ca1453febd endpoint: add some useful API for querying info about streams & controls 2019-06-18 17:42:06 +03:00
George Kiagiadakis
e603ed4215 lib: add some debug statements to debug the destruction sequence 2019-06-18 10:33:38 +03:00
George Kiagiadakis
ab73fd6eb0 endpoint: maintain a weak ref to the core since construction time
+ add a method to retrieve the core
+ change the register function to not require the core as a parameter
2019-06-18 09:23:40 +03:00
George Kiagiadakis
45dc9786f4 endpoint: ref the endpoint while unregistering
The core may be the last object holding a reference to the endpoint,
so the unregister call may destroy it.
2019-06-11 12:49:11 +03:00
Julian Bouzas
cad748ae91 endpoint: set core to null after unregistering endpoint and not before 2019-06-06 12:51:05 -04:00
George Kiagiadakis
36bc1795ca Relicense to MIT 2019-05-31 12:13:12 +03:00
Julian Bouzas
dcf749bd40 endpoint: fix bug when linking endpoints 2019-05-30 10:22:04 -04:00
George Kiagiadakis
3aa7d6ce78 lib: remove the session-manager object and register endpoints as globals 2019-05-26 19:21:27 +03:00
George Kiagiadakis
bf60614032 improve debug statements a bit 2019-05-26 12:36:20 +03:00
George Kiagiadakis
940e1e70c0 endpoint: fix clearing the weak ref
g_weak_ref_clear destroys the weak ref, so it will crash
when _finalize() tries to destroy it again
2019-05-25 23:20:54 +03:00
George Kiagiadakis
aa78db35a7 session-manager: add endpoint-added/removed signals 2019-05-25 23:20:33 +03:00
George Kiagiadakis
901593e217 endpoint: improve GVariant format docs 2019-05-25 23:19:28 +03:00
George Kiagiadakis
8e7f84d888 endpoint: add methods to register to the SM and use them in simple-endpoint
This changes the registration point to be the endpoint and not the
session manager, as it seems easier to implement (the implementation
will not need to keep a pointer to the session manager around)
2019-05-24 17:19:58 +03:00
George Kiagiadakis
06db0e414a factory: improve API and hide its implementation (better for introspection) 2019-05-22 13:03:24 +03:00
George Kiagiadakis
1c44476b5e endpoint: add documentation 2019-05-21 18:58:30 +03:00