Skip to content
Snippets Groups Projects
Commit 0ad0c9fb authored by Julian Bouzas's avatar Julian Bouzas
Browse files

base-endpoint: add _get_priority API

parent 0552e7da
No related branches found
No related tags found
No related merge requests found
......@@ -96,6 +96,7 @@ struct _WpBaseEndpointPrivate
gchar media_class[40];
guint direction;
guint64 creation_time;
guint priority;
GPtrArray *streams;
GPtrArray *controls;
GPtrArray *links;
......@@ -109,6 +110,7 @@ enum {
PROP_MEDIA_CLASS,
PROP_DIRECTION,
PROP_CREATION_TIME,
PROP_PRIORITY,
};
enum {
......@@ -223,6 +225,9 @@ wp_base_endpoint_set_property (GObject * object, guint property_id,
case PROP_CREATION_TIME:
priv->creation_time = g_value_get_uint64(value);
break;
case PROP_PRIORITY:
priv->priority = g_value_get_uint(value);
break;
default:
G_OBJECT_WARN_INVALID_PROPERTY_ID (object, property_id, pspec);
break;
......@@ -252,6 +257,9 @@ wp_base_endpoint_get_property (GObject * object, guint property_id, GValue * val
case PROP_CREATION_TIME:
g_value_set_uint64 (value, priv->creation_time);
break;
case PROP_PRIORITY:
g_value_set_uint (value, priv->priority);
break;
default:
G_OBJECT_WARN_INVALID_PROPERTY_ID (object, property_id, pspec);
break;
......@@ -318,6 +326,14 @@ wp_base_endpoint_class_init (WpBaseEndpointClass * klass)
"The time that this endpoint was created, in monotonic time",
0, G_MAXUINT64, 0, G_PARAM_READABLE | G_PARAM_STATIC_STRINGS));
/**
* WpBaseEndpoint::direction:
* The priority of the endpoint:
*/
g_object_class_install_property (object_class, PROP_PRIORITY,
g_param_spec_uint ("priority", "priority",
"The priority of the endpoint", 0, G_MAXUINT, 0,
G_PARAM_READWRITE | G_PARAM_CONSTRUCT_ONLY | G_PARAM_STATIC_STRINGS));
}
/**
......@@ -451,6 +467,17 @@ wp_base_endpoint_get_creation_time (WpBaseEndpoint * self)
return priv->creation_time;
}
guint32
wp_base_endpoint_get_priority (WpBaseEndpoint * self)
{
WpBaseEndpointPrivate *priv;
g_return_val_if_fail (WP_IS_BASE_ENDPOINT (self), -1);
priv = wp_base_endpoint_get_instance_private (self);
return priv->priority;
}
WpProperties *
wp_base_endpoint_get_properties (WpBaseEndpoint * self)
{
......
......@@ -54,6 +54,7 @@ const gchar * wp_base_endpoint_get_name (WpBaseEndpoint * self);
const gchar * wp_base_endpoint_get_media_class (WpBaseEndpoint * self);
guint wp_base_endpoint_get_direction (WpBaseEndpoint * self);
guint64 wp_base_endpoint_get_creation_time (WpBaseEndpoint * self);
guint32 wp_base_endpoint_get_priority (WpBaseEndpoint * self);
WpProperties * wp_base_endpoint_get_properties (WpBaseEndpoint * self);
const char * wp_base_endpoint_get_role (WpBaseEndpoint * self);
......
......@@ -141,6 +141,8 @@ on_node_added (WpObjectManager *om, WpProxy *proxy, gpointer d)
"media-class", g_variant_new_string (media_class));
g_variant_builder_add (&b, "{sv}",
"direction", g_variant_new_uint32 (endpoint_data->e.direction));
g_variant_builder_add (&b, "{sv}",
"priority", g_variant_new_uint32 (endpoint_data->e.priority));
g_variant_builder_add (&b, "{sv}",
"proxy-node", g_variant_new_uint64 ((guint64) proxy));
if (streams_variant)
......
......@@ -495,7 +495,7 @@ audio_softdsp_endpoint_factory (WpFactory * factory, GType type, GVariant * prop
{
g_autoptr (WpCore) core = NULL;
const gchar *name, *media_class;
guint direction;
guint direction, priority;
guint64 node;
g_autoptr (GVariant) streams = NULL;
......@@ -513,6 +513,8 @@ audio_softdsp_endpoint_factory (WpFactory * factory, GType type, GVariant * prop
return;
if (!g_variant_lookup (properties, "direction", "u", &direction))
return;
if (!g_variant_lookup (properties, "priority", "u", &priority))
return;
if (!g_variant_lookup (properties, "proxy-node", "t", &node))
return;
streams = g_variant_lookup_value (properties, "streams",
......@@ -525,6 +527,7 @@ audio_softdsp_endpoint_factory (WpFactory * factory, GType type, GVariant * prop
"name", name,
"media-class", media_class,
"direction", direction,
"priority", priority,
"proxy-node", (gpointer) node,
"streams", streams,
NULL);
......
......@@ -209,7 +209,7 @@ wp_endpoint_audiotestsrc_factory (WpFactory * factory, GType type,
{
g_autoptr (WpCore) core = NULL;
const gchar *name, *media_class;
guint direction;
guint direction, priority;
guint64 node;
g_autoptr (GVariant) streams = NULL;
......@@ -222,6 +222,8 @@ wp_endpoint_audiotestsrc_factory (WpFactory * factory, GType type,
return;
if (!g_variant_lookup (properties, "direction", "u", &direction))
return;
if (!g_variant_lookup (properties, "priority", "u", &priority))
return;
if (!g_variant_lookup (properties, "proxy-node", "t", &node))
return;
streams = g_variant_lookup_value (properties, "streams",
......@@ -233,6 +235,7 @@ wp_endpoint_audiotestsrc_factory (WpFactory * factory, GType type,
"name", name,
"media-class", media_class,
"direction", direction,
"priority", priority,
"proxy-node", (gpointer) node,
"streams", streams,
NULL);
......
......@@ -224,6 +224,7 @@ wp_fake_endpoint_new_async (WpCore *core, const char *name,
"name", name,
"media-class", media_class,
"direction", direction,
"priority", 0,
"properties", props,
"role", role,
"streams", streams,
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment