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.
This commit is contained in:
George Kiagiadakis
2020-06-09 19:30:50 +03:00
parent 74eee35e6f
commit 7a486f1f7c
4 changed files with 55 additions and 50 deletions

View File

@@ -51,15 +51,15 @@ static void
wp_config_static_objects_context_create_node (WpConfigStaticObjectsContext *self,
const struct WpParserNodeData *node_data)
{
g_autoptr (WpProxy) node = NULL;
g_autoptr (GObject) node = NULL;
g_autoptr (WpCore) core = wp_plugin_get_core (WP_PLUGIN (self));
g_return_if_fail (core);
/* Create the node */
node = node_data->n.local ?
(WpProxy *) wp_impl_node_new_from_pw_factory (core, node_data->n.factory,
(GObject *) wp_impl_node_new_from_pw_factory (core, node_data->n.factory,
wp_properties_ref (node_data->n.props)) :
(WpProxy *) wp_node_new_from_factory (core, node_data->n.factory,
(GObject *) wp_node_new_from_factory (core, node_data->n.factory,
wp_properties_ref (node_data->n.props));
if (!node) {
wp_warning_object (self, "failed to create node");
@@ -67,8 +67,14 @@ wp_config_static_objects_context_create_node (WpConfigStaticObjectsContext *self
}
/* export */
wp_proxy_augment (node, WP_PROXY_FEATURES_STANDARD, NULL, on_object_created,
self);
if (WP_IS_IMPL_NODE (node)) {
wp_impl_node_export (WP_IMPL_NODE (node));
g_ptr_array_add (self->static_objects, g_object_ref (node));
g_signal_emit (self, signals[SIGNAL_OBJECT_CREATED], 0, node);
} else {
wp_proxy_augment (WP_PROXY (node), WP_PROXY_FEATURES_STANDARD, NULL,
on_object_created, self);
}
}
static void