Commit d49ed2b3 authored by Julian Bouzas's avatar Julian Bouzas

simple-endpoint: add target property

parent 96d940e9
......@@ -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
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment