endpoint: add GObject properties to access the name, media-class & direction
This commit is contained in:
@@ -39,6 +39,13 @@
|
|||||||
|
|
||||||
/* WpEndpoint */
|
/* WpEndpoint */
|
||||||
|
|
||||||
|
enum {
|
||||||
|
PROP_0,
|
||||||
|
PROP_NAME,
|
||||||
|
PROP_MEDIA_CLASS,
|
||||||
|
PROP_DIRECTION,
|
||||||
|
};
|
||||||
|
|
||||||
enum {
|
enum {
|
||||||
SIGNAL_STREAMS_CHANGED,
|
SIGNAL_STREAMS_CHANGED,
|
||||||
N_SIGNALS,
|
N_SIGNALS,
|
||||||
@@ -77,6 +84,29 @@ wp_endpoint_finalize (GObject * object)
|
|||||||
G_OBJECT_CLASS (wp_endpoint_parent_class)->finalize (object);
|
G_OBJECT_CLASS (wp_endpoint_parent_class)->finalize (object);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
static void
|
||||||
|
wp_endpoint_get_gobj_property (GObject * object, guint property_id,
|
||||||
|
GValue * value, GParamSpec * pspec)
|
||||||
|
{
|
||||||
|
WpEndpoint *self = WP_ENDPOINT (object);
|
||||||
|
WpEndpointPrivate *priv = wp_endpoint_get_instance_private (self);
|
||||||
|
|
||||||
|
switch (property_id) {
|
||||||
|
case PROP_NAME:
|
||||||
|
g_value_set_string (value, priv->info ? priv->info->name : NULL);
|
||||||
|
break;
|
||||||
|
case PROP_MEDIA_CLASS:
|
||||||
|
g_value_set_string (value, priv->info ? priv->info->media_class : NULL);
|
||||||
|
break;
|
||||||
|
case PROP_DIRECTION:
|
||||||
|
g_value_set_enum (value, priv->info ? priv->info->direction : 0);
|
||||||
|
break;
|
||||||
|
default:
|
||||||
|
G_OBJECT_WARN_INVALID_PROPERTY_ID (object, property_id, pspec);
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
static void
|
static void
|
||||||
wp_endpoint_on_streams_om_installed (WpObjectManager *streams_om,
|
wp_endpoint_on_streams_om_installed (WpObjectManager *streams_om,
|
||||||
WpEndpoint * self)
|
WpEndpoint * self)
|
||||||
@@ -270,6 +300,7 @@ wp_endpoint_class_init (WpEndpointClass * klass)
|
|||||||
WpProxyClass *proxy_class = (WpProxyClass *) klass;
|
WpProxyClass *proxy_class = (WpProxyClass *) klass;
|
||||||
|
|
||||||
object_class->finalize = wp_endpoint_finalize;
|
object_class->finalize = wp_endpoint_finalize;
|
||||||
|
object_class->get_property = wp_endpoint_get_gobj_property;
|
||||||
|
|
||||||
proxy_class->pw_iface_type = PW_TYPE_INTERFACE_Endpoint;
|
proxy_class->pw_iface_type = PW_TYPE_INTERFACE_Endpoint;
|
||||||
proxy_class->pw_iface_version = PW_VERSION_ENDPOINT;
|
proxy_class->pw_iface_version = PW_VERSION_ENDPOINT;
|
||||||
@@ -295,6 +326,33 @@ wp_endpoint_class_init (WpEndpointClass * klass)
|
|||||||
signals[SIGNAL_STREAMS_CHANGED] = g_signal_new (
|
signals[SIGNAL_STREAMS_CHANGED] = g_signal_new (
|
||||||
"streams-changed", G_TYPE_FROM_CLASS (klass),
|
"streams-changed", G_TYPE_FROM_CLASS (klass),
|
||||||
G_SIGNAL_RUN_LAST, 0, NULL, NULL, NULL, G_TYPE_NONE, 0);
|
G_SIGNAL_RUN_LAST, 0, NULL, NULL, NULL, G_TYPE_NONE, 0);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* WpEndpoint:name:
|
||||||
|
*
|
||||||
|
* The name of the endpoint
|
||||||
|
*/
|
||||||
|
g_object_class_install_property (object_class, PROP_NAME,
|
||||||
|
g_param_spec_string ("name", "name", "name", NULL,
|
||||||
|
G_PARAM_READABLE | G_PARAM_STATIC_STRINGS));
|
||||||
|
|
||||||
|
/**
|
||||||
|
* WpEndpoint:media-class:
|
||||||
|
*
|
||||||
|
* The media class of the endpoint (ex. "Audio/Sink")
|
||||||
|
*/
|
||||||
|
g_object_class_install_property (object_class, PROP_MEDIA_CLASS,
|
||||||
|
g_param_spec_string ("media-class", "media-class", "media-class", NULL,
|
||||||
|
G_PARAM_READABLE | G_PARAM_STATIC_STRINGS));
|
||||||
|
|
||||||
|
/**
|
||||||
|
* WpEndpoint:direction:
|
||||||
|
*
|
||||||
|
* The direction of the endpoint
|
||||||
|
*/
|
||||||
|
g_object_class_install_property (object_class, PROP_DIRECTION,
|
||||||
|
g_param_spec_enum ("direction", "direction", "direction",
|
||||||
|
WP_TYPE_DIRECTION, 0, G_PARAM_READABLE | G_PARAM_STATIC_STRINGS));
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
Reference in New Issue
Block a user