Commit 2092754e authored by Tim-Philipp Müller's avatar Tim-Philipp Müller 🐠

device: rename "klass" and get_klass() to "device-class" and _get_device_class()

There's some precedent in GstElementFactory, but a
"klass" property just seems weird.
parent 4620048e
......@@ -3344,6 +3344,11 @@ GST_DEVICE_GET_CLASS
GST_IS_DEVICE
GST_IS_DEVICE_CLASS
GST_TYPE_DEVICE
gst_device_create_element
gst_device_get_caps
gst_device_get_display_name
gst_device_get_device_class
gst_device_get_type
</SECTION>
......
......@@ -46,7 +46,7 @@ enum
{
PROP_DISPLAY_NAME = 1,
PROP_CAPS,
PROP_KLASS
PROP_DEVICE_CLASS
};
enum
......@@ -58,7 +58,7 @@ enum
struct _GstDevicePrivate
{
GstCaps *caps;
gchar *klass;
gchar *device_class;
gchar *display_name;
};
......@@ -93,8 +93,8 @@ gst_device_class_init (GstDeviceClass * klass)
g_param_spec_boxed ("caps", "Device Caps",
"The possible caps of a device", GST_TYPE_CAPS,
G_PARAM_STATIC_STRINGS | G_PARAM_READWRITE | G_PARAM_CONSTRUCT_ONLY));
g_object_class_install_property (object_class, PROP_KLASS,
g_param_spec_string ("klass", "Device Class",
g_object_class_install_property (object_class, PROP_DEVICE_CLASS,
g_param_spec_string ("device-class", "Device Class",
"The Class of the device", "",
G_PARAM_STATIC_STRINGS | G_PARAM_READWRITE | G_PARAM_CONSTRUCT_ONLY));
......@@ -117,7 +117,7 @@ gst_device_finalize (GObject * object)
gst_caps_replace (&device->priv->caps, NULL);
g_free (device->priv->display_name);
g_free (device->priv->klass);
g_free (device->priv->device_class);
G_OBJECT_CLASS (gst_device_parent_class)->finalize (object);
}
......@@ -138,8 +138,8 @@ gst_device_get_property (GObject * object, guint prop_id,
if (gstdevice->priv->caps)
g_value_take_boxed (value, gst_device_get_caps (gstdevice));
break;
case PROP_KLASS:
g_value_take_string (value, gst_device_get_klass (gstdevice));
case PROP_DEVICE_CLASS:
g_value_take_string (value, gst_device_get_device_class (gstdevice));
break;
default:
G_OBJECT_WARN_INVALID_PROPERTY_ID (object, prop_id, pspec);
......@@ -163,8 +163,8 @@ gst_device_set_property (GObject * object, guint prop_id,
case PROP_CAPS:
gst_caps_replace (&gstdevice->priv->caps, g_value_get_boxed (value));
break;
case PROP_KLASS:
gstdevice->priv->klass = g_value_dup_string (value);
case PROP_DEVICE_CLASS:
gstdevice->priv->device_class = g_value_dup_string (value);
break;
default:
G_OBJECT_WARN_INVALID_PROPERTY_ID (object, prop_id, pspec);
......@@ -234,7 +234,7 @@ gst_device_get_display_name (GstDevice * device)
}
/**
* gst_device_get_klass:
* gst_device_get_device_class:
* @device: a #GstDevice
*
* Gets the "class" of a device. This is a "/" separated list of
......@@ -246,9 +246,12 @@ gst_device_get_display_name (GstDevice * device)
* Since: 1.4
*/
gchar *
gst_device_get_klass (GstDevice * device)
gst_device_get_device_class (GstDevice * device)
{
return g_strdup (device->priv->klass ? device->priv->klass : "");
if (device->priv->device_class != NULL)
return g_strdup (device->priv->device_class);
else
return g_strdup ("");
}
/**
......@@ -304,11 +307,11 @@ gst_device_has_classesv (GstDevice * device, gchar ** classes)
if (classes[0] == '\0')
continue;
found = strstr (device->priv->klass, classes[0]);
found = strstr (device->priv->device_class, classes[0]);
if (!found)
return FALSE;
if (found != device->priv->klass && *(found - 1) != '/')
if (found != device->priv->device_class && *(found - 1) != '/')
return FALSE;
len = strlen (classes[0]);
......@@ -322,8 +325,8 @@ gst_device_has_classesv (GstDevice * device, gchar ** classes)
/**
* gst_device_has_classes:
* @device: a #GstDevice
* @classes: a "/" separate list of klasses to match, only match if all classes
* are matched
* @classes: a "/" separate list of device classes to match, only match if
* all classes are matched
*
* Check if @device matches all of the given classes
*
......
......@@ -90,7 +90,7 @@ GstElement * gst_device_create_element (GstDevice * device, const gchar * name);
GstCaps * gst_device_get_caps (GstDevice * device);
gchar * gst_device_get_display_name (GstDevice * device);
gchar * gst_device_get_klass (GstDevice * device);
gchar * gst_device_get_device_class (GstDevice * device);
gboolean gst_device_reconfigure_element (GstDevice * device,
GstElement * element);
......
......@@ -410,8 +410,8 @@ EXPORTS
gst_deinit
gst_device_create_element
gst_device_get_caps
gst_device_get_device_class
gst_device_get_display_name
gst_device_get_klass
gst_device_get_type
gst_device_has_classes
gst_device_has_classesv
......
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