Commit Graph

24 Commits

Author SHA1 Message Date
George Kiagiadakis
ca8d100b3f meson: temporarily add check to conditionally enable the fade functionality
and in case it's missing, also #define some things to make compilation work,
since this is only available in a pipewire branch right now
2020-02-28 13:25:35 +02:00
Julian Bouzas
b1d03cd637 stream: add wp_audio_stream_begin_fade API 2020-02-27 08:39:15 -05:00
Julian Bouzas
eaea2156cb stream: create an audio-fade-source control node if there is a control port 2020-02-27 08:37:15 -05:00
Julian Bouzas
16cdac6dd6 convert/adapter: enable control port if input direction 2020-02-27 08:37:15 -05:00
Julian Bouzas
2439cab55f convert: use factory name SPA macro 2020-02-27 08:37:15 -05: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
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
c671b0faca lib: drop the proxy- prefix from client, device, link, port & node 2020-01-22 19:46:17 +02:00
George Kiagiadakis
5c47f1df2c proxy: unify common info/params API in the WpProxy base class 2020-01-22 18:30: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
George Kiagiadakis
8e40b18fb1 softdsp-endpoint: implement volume controls via the exported endpoint
and drop the WpBaseEndpoint controls entirely
2019-12-12 01:37:48 +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
e8dad1a4f2 stream: clear proxy when finalizing 2019-12-10 19:34:30 -05:00
George Kiagiadakis
6f358e9a3a adapter: select a reasonable device format instead of letting pipewire choose its own 2019-11-18 11:02:03 +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
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
Julian Bouzas
b94cc897ac stream: get the node id from the info struct when preparing link 2019-11-06 12:18:17 +02:00
George Kiagiadakis
9e7a5a4c30 softdsp/convert: append the stream name on the new "object.path" key 2019-10-07 16:57:06 +03:00
George Kiagiadakis
2e0e144f70 softdsp-endpoint/stream: remove the port proxies when they are removed on the server
When the audioconvert starts, it emits 2 ports, but when we set the PortConfig,
it removes them and re-creates them. Previously, the stream class would not
remove the old port proxies from the list and therefore they existed twice.

It is also necessary here to store the proxies earlier, when they are added,
instead of when they are augmented, so that we can ensure they are removed.
Previously we would hit an issue where:
 - port proxy is added, augmented
 - augment completes but the GTask wants to complete asynchronously:
   it stores a ref on the proxy and adds an idle source
 - server removes the proxy, we delete it from the core's list
 - the GTask now calls the augment callback, which stores the (removed)
   proxy on the stream's port_proxies list...
2019-10-02 21:33:34 +03:00
George Kiagiadakis
f360aed978 sofdsp-endpoint: run audioconvert in merge+split mode and use a new linking algorithm
Running audioconvert in merge+split mode is the only way to make this work with
the adapter, since the adapter does not support passing multiple channels on
a single port right now, and if it does at some point, it will be without a
mixing node on the port, which means we will not be able to mix multiple
audioconvert nodes on the same adapter. In the future we need to consider
writing a lighter volume node with multiple channels support to replace
audioconvert.

The new linking algorithm now takes into account the channel positions and makes
sure to link the correct channels together. Also, it avoids passing the port
proxies inside the GVariants, thus making the algorithm a bit more generic
and easier to unit test.
2019-10-02 21:27:44 +03:00
Julian Bouzas
b9ad90f68c softdsp-endpoint: use the same number of channels in the converters as the sink/source node 2019-09-25 12:05:56 +02:00
Julian Bouzas
26fb89cb16 modules: move softdsp-endpoint inside module-pipewire 2019-09-25 10:25:49 +02:00