From d49ed2b3f416dd3fed471f5ebc9cbaeabbfe932b Mon Sep 17 00:00:00 2001 From: Julian Bouzas Date: Mon, 15 Jul 2019 11:39:52 -0400 Subject: [PATCH] simple-endpoint: add target property --- modules/module-pipewire/simple-endpoint.c | 16 ++++++++++++++-- 1 file changed, 14 insertions(+), 2 deletions(-) diff --git a/modules/module-pipewire/simple-endpoint.c b/modules/module-pipewire/simple-endpoint.c index fedf06b6..c9549e47 100644 --- a/modules/module-pipewire/simple-endpoint.c +++ b/modules/module-pipewire/simple-endpoint.c @@ -30,6 +30,7 @@ struct _WpPipewireSimpleEndpoint /* properties */ gchar *role; guint64 creation_time; + gchar *target; /* The task to signal the endpoint is initialized */ GTask *init_task; @@ -59,6 +60,7 @@ enum { PROP_GLOBAL_ID, PROP_ROLE, PROP_CREATION_TIME, + PROP_TARGET, }; enum { @@ -267,8 +269,11 @@ on_proxy_node_created(GObject *initable, GAsyncResult *res, gpointer data) if (!self->proxy_node) return; + /* Set the role and target name */ self->role = g_strdup (spa_dict_lookup ( wp_proxy_node_get_info (self->proxy_node)->props, "media.role")); + self->target = g_strdup (spa_dict_lookup ( + wp_proxy_node_get_info (self->proxy_node)->props, "target.name")); /* Emit the ports */ emit_endpoint_ports(self); @@ -401,6 +406,10 @@ simple_endpoint_set_property (GObject * object, guint property_id, g_free (self->role); self->role = g_value_dup_string (value); break; + case PROP_TARGET: + g_free (self->target); + self->target = g_value_dup_string (value); + break; default: G_OBJECT_WARN_INVALID_PROPERTY_ID (object, property_id, pspec); break; @@ -422,6 +431,8 @@ simple_endpoint_get_property (GObject * object, guint property_id, break; case PROP_CREATION_TIME: g_value_set_uint64 (value, self->creation_time); + case PROP_TARGET: + g_value_set_string (value, self->target); break; default: G_OBJECT_WARN_INVALID_PROPERTY_ID (object, property_id, pspec); @@ -544,15 +555,16 @@ simple_endpoint_class_init (WpPipewireSimpleEndpointClass * klass) g_param_spec_uint ("global-id", "global-id", "The global Id this endpoint refers to", 0, G_MAXUINT, 0, G_PARAM_READWRITE | G_PARAM_CONSTRUCT_ONLY | G_PARAM_STATIC_STRINGS)); - g_object_class_install_property (object_class, PROP_ROLE, g_param_spec_string ("role", "role", "The role of the wrapped node", NULL, G_PARAM_READWRITE | G_PARAM_STATIC_STRINGS)); - g_object_class_install_property (object_class, PROP_CREATION_TIME, g_param_spec_uint64 ("creation-time", "creation-time", "The time that this endpoint was created, in monotonic time", 0, G_MAXUINT64, 0, G_PARAM_READABLE | G_PARAM_STATIC_STRINGS)); + g_object_class_install_property (object_class, PROP_TARGET, + g_param_spec_string ("target", "target", "The target of the wrapped node", NULL, + G_PARAM_READWRITE | G_PARAM_STATIC_STRINGS)); } void