Commit graph

376 commits

Author SHA1 Message Date
George Kiagiadakis
ea0b96073f spa-pod: make the wrap functions public, remove private.h and sort out the rest 2020-11-16 11:01:18 +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
c2221915c9 session-item: move wp_session_item_set_parent() to the public header 2020-11-16 10:34:58 +02:00
George Kiagiadakis
eca28d7b04 defs: add a new WP_PRIVATE_API function annotation
This is to mark private functions that are exposed in public headers.
These functions will not be exported from the library and will
generate a warning when client code is trying to use them.
2020-11-16 10:28:56 +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
91472c51e9 lib: move WpImplEndpoint* header parts to private/impl-endpoint.h 2020-11-15 20:26:15 +02:00
George Kiagiadakis
956cc83bfa object-manager: recursively store requested features on children
Now we have a deeper hierarchy, so requesting the features on WP_TYPE_PROXY
wouldn't properly request the features on WP_TYPE_NODE
2020-11-15 20:26:15 +02:00
George Kiagiadakis
403bb0643a impl-endpoint{,-stream}: disable FEATURE_PROPS temporarily 2020-11-14 13:23:20 +02:00
George Kiagiadakis
2f3f5f8e66 lib: refactor WpProxy
This is an attempt to unclutter the API of WpProxy and
split functionality into smaller pieces, making it easier
to work with.

In this new class layout, we have the following classes:

- WpObject: base class for everything; handles activating
|           and deactivating "features"
|- WpProxy: base class for anything that wraps a pw_proxy;
 |          handles events from pw_proxy and nothing more
 |- WpGlobalProxy: handles integration with the registry

All the other classes derive from WpGlobalProxy. The reason
for separating WpGlobalProxy from WpProxy, though, is that
classes such as WpImplNode / WpSpaDevice can also derive from
WpProxy now, without interfacing with the registry.

All objects that come with an "info" structure and have properties
and/or params also implement the WpPipewireObject interface. This
provides the API to query properties and get/set params. Essentially,
this is implemented by all classes except WpMetadata (pw_metadata
does not have info)

This interface is implemented on each object separately, using
a private "mixin", which is a set of vfunc implementations and helper
functions (and macros) to facilitate the implementation of this interface.

A notable difference to the old WpProxy is that now features can be
deactivated, so it is possible to enable something and later disable
it again.

This commit disables modules, tests, tools, etc, to avoid growing the
patch more, while ensuring that the project compiles.
2020-11-13 19:54:48 +02:00
George Kiagiadakis
4dec10396a lib: add new proxy-interfaces: interfaces for the refactored WpProxy class 2020-11-13 19:54:48 +02:00
George Kiagiadakis
6b40451657 lib/private: move the registry & global APIs to a separate header 2020-11-13 19:54:48 +02:00
George Kiagiadakis
36538a54b6 lib: add new WpObject base class
A base class for objects that can have optional
features enabled and disabled. The intention is to make
this the superclass of WpProxy.

Instead of following the augment() pattern of WpProxy,
this one follows the more advanced transition pattern
that has been previously implemented in WpSessionItem.
2020-11-13 19:54:48 +02:00
Julian Bouzas
bc17aaa397 plugin: add name property 2020-10-22 08:40:27 -04:00
George Kiagiadakis
268b7dd0a9 transition: stop and return error if cancelled by the GCancellable 2020-10-22 13:27:29 +03:00
Julian Bouzas
ffd43f397b device: set parent type to GObject in WpSpaDevice structure 2020-10-15 12:04:05 -04:00
George Kiagiadakis
fb8d4b1b1f metadata: remove WP_METADATA_FEATURES_STANDARD and fix copyright years 2020-08-31 16:22:11 +03:00
George Kiagiadakis
3f160b552c metadata: improve implementation
* Implement the proxy properly with info caching, methods, etc
* Get rid of useless variables and includes
2020-08-31 16:14:47 +03:00
George Kiagiadakis
3e65325519 metadata: fix more coding style issues 2020-07-31 17:46:09 +03:00
raghu447
65b4562fa0 Implement PW_TYPE_INTERFACE_Metadata 2020-07-30 21:30:14 +05:30
George Kiagiadakis
a3870581fb spa-device / m-monitor: fix pw_proxy leaks reported by pw_core
1. device export proxies must be destroyed manually since they are
   not associated with the WpRegistry
2. the monitors should not disconnect before all WpSpaDevice objects
   are destroyed; remove the manual disconnect call and let GObject
   ref counting do its job (the core will disconnect when its last ref
   count is dropped after the last monitor plugin is destroyed)
2020-06-29 13:05:44 +03:00
George Kiagiadakis
697226f306 session-bin: call parent's reset() in reset()
otherwise the parent never un-exports or de-activates itself
and we leak a bunch of stuff
2020-06-18 19:28:03 +03:00
George Kiagiadakis
d471ba3d9c object-interest: don't use G_GNUC_FALLTRHOUGH
it requires GLib 2.60 and it's not worth it
2020-06-16 19:18:20 +03:00
George Kiagiadakis
1563eeeae6 object-interest: initialize GValue passed to g_object_get_property
g_object_get_property did not support uninitialized GValues prior
to GLib 2.60, and it's not worth requiring 2.60 for this reason

Fixes #11
2020-06-16 19:16:04 +03:00
Julian Bouzas
322094565f properties: all properties from other must be included in self for the match to be valid 2020-06-16 12:56:04 +03: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
George Kiagiadakis
0d1fcd48a1 properties: add wp_properties_unref_and_take_pw_properties()
a method to take the internal pw_properties without copying
2020-06-15 17:22:47 +03:00
George Kiagiadakis
c72d126374 properties: const-ify the pw_properties in _new_wrap()
and do not allow writing to wrapped pw_properties,
since they are const now
2020-06-15 17:20:10 +03:00
George Kiagiadakis
b70cbca84e spa-device: store the constructor properties and use them for export + object-info
the spa object undereath doesn't do that and we lose a bunch of
properties otherwise
2020-06-15 11:10:39 +03:00
Julian Bouzas
382b550d26 spa-device: don't destroy the task until the proxy is bound when exporting 2020-06-12 15:04:36 -04:00
George Kiagiadakis
8a0abd4fb8 spa-device: subclass from GObject 2020-06-11 15:05:20 +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
George Kiagiadakis
8d77793a2a improve some debug logs 2020-06-10 12:53:22 +03:00
George Kiagiadakis
7a486f1f7c impl-node: subclass from GObject
By mistake, WpImplNode was developed by keeping in mind that the proxy
returned by pw_core_export() is a PW_TYPE_INTERFACE_Node, but this
is not true. It's actually a ClientNode...

Unfortunately, making WpImplNode work as if it was a WpNode is
not so easy, especially when it comes to handling params, which
need to be queried syncrhonously on the underlying spa_node.

So, instead of fixing WpImplNode to work as a WpNode, we choose to
disconnect them. This way, WpImplNode will not be used as a proxy
in the registry and the registry will normally create WpNode proxies
instead, making round-trips through the server to change node params.
2020-06-10 11:12:11 +03:00
Julian Bouzas
be8629fbec spa-pod: keep a reference of the pod in the ierator 2020-06-04 09:48:43 -04:00
Julian Bouzas
9728418b6d spa-pod: remove const-ness from API 2020-06-04 09:48:43 -04:00
Julian Bouzas
1e2dcb44ca spa-pod: set the type to regular when creating int spa pod 2020-06-04 09:48:43 -04:00
Julian Bouzas
671d748b4b spa-pod: remove _wrap_copy APIs from the private header 2020-06-04 09:48:43 -04:00
Julian Bouzas
3a93190ec9 lib: fix const compile warnings by using the wp_spa_pod_new_wrap_const API 2020-06-04 09:48:43 -04:00
Julian Bouzas
e63ca28b3a spa-pod: add _new_wrap_const APIs 2020-06-04 09:48:43 -04:00
Julian Bouzas
b9acfcb237 spa-pod: rename spa pod _new_regular_wrap APIs to just _new_warp 2020-06-04 09:48:43 -04:00
George Kiagiadakis
71d12fe12a debug: add doc comments 2020-06-03 21:40:01 +03:00
George Kiagiadakis
f7d816f5d2 debug: print proxy bound IDs on objects, if they are bound proxies 2020-06-03 21:28:14 +03:00
George Kiagiadakis
1bae4a6a41 proxy: use a core sync to know when Props have been enumerated
This is necessary to finish augmenting nodes that advertise
PropInfo & Props in their param info but they don't actually have
any properties, so there is no param event emitted
(ex. the jack device nodes)

Because the sync is synchronous with the calls over the protocol,
the callback is ensured to be called after all the param events
have been emitted
2020-06-03 20:28:43 +03:00
George Kiagiadakis
a3cf986188 proxy: fix recursion crash in _set_feature_ready 2020-06-02 19:21:04 +03:00
George Kiagiadakis
e1e6411e19 proxy: when requesting Props, only try to enum them if the proxy supports them
otherwise we get stuck waiting for the param event
and we get warnings on the debug log
2020-06-02 19:09:18 +03:00
George Kiagiadakis
8627fdf1a0 proxy: fix crash when _augment_error() is called recursively from within itself 2020-06-02 18:37:42 +03:00
George Kiagiadakis
c8b11fad42 lib: add a version header 2020-06-02 18:26:40 +03:00