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.
This commit is contained in:
Tim-Philipp Müller 2014-06-01 16:56:41 +01:00
parent 4620048e01
commit 2092754ed1
4 changed files with 26 additions and 18 deletions

View file

@ -3344,6 +3344,11 @@ GST_DEVICE_GET_CLASS
GST_IS_DEVICE GST_IS_DEVICE
GST_IS_DEVICE_CLASS GST_IS_DEVICE_CLASS
GST_TYPE_DEVICE 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 gst_device_get_type
</SECTION> </SECTION>

View file

@ -46,7 +46,7 @@ enum
{ {
PROP_DISPLAY_NAME = 1, PROP_DISPLAY_NAME = 1,
PROP_CAPS, PROP_CAPS,
PROP_KLASS PROP_DEVICE_CLASS
}; };
enum enum
@ -58,7 +58,7 @@ enum
struct _GstDevicePrivate struct _GstDevicePrivate
{ {
GstCaps *caps; GstCaps *caps;
gchar *klass; gchar *device_class;
gchar *display_name; gchar *display_name;
}; };
@ -93,8 +93,8 @@ gst_device_class_init (GstDeviceClass * klass)
g_param_spec_boxed ("caps", "Device Caps", g_param_spec_boxed ("caps", "Device Caps",
"The possible caps of a device", GST_TYPE_CAPS, "The possible caps of a device", GST_TYPE_CAPS,
G_PARAM_STATIC_STRINGS | G_PARAM_READWRITE | G_PARAM_CONSTRUCT_ONLY)); G_PARAM_STATIC_STRINGS | G_PARAM_READWRITE | G_PARAM_CONSTRUCT_ONLY));
g_object_class_install_property (object_class, PROP_KLASS, g_object_class_install_property (object_class, PROP_DEVICE_CLASS,
g_param_spec_string ("klass", "Device Class", g_param_spec_string ("device-class", "Device Class",
"The Class of the device", "", "The Class of the device", "",
G_PARAM_STATIC_STRINGS | G_PARAM_READWRITE | G_PARAM_CONSTRUCT_ONLY)); 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); gst_caps_replace (&device->priv->caps, NULL);
g_free (device->priv->display_name); 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); 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) if (gstdevice->priv->caps)
g_value_take_boxed (value, gst_device_get_caps (gstdevice)); g_value_take_boxed (value, gst_device_get_caps (gstdevice));
break; break;
case PROP_KLASS: case PROP_DEVICE_CLASS:
g_value_take_string (value, gst_device_get_klass (gstdevice)); g_value_take_string (value, gst_device_get_device_class (gstdevice));
break; break;
default: default:
G_OBJECT_WARN_INVALID_PROPERTY_ID (object, prop_id, pspec); 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: case PROP_CAPS:
gst_caps_replace (&gstdevice->priv->caps, g_value_get_boxed (value)); gst_caps_replace (&gstdevice->priv->caps, g_value_get_boxed (value));
break; break;
case PROP_KLASS: case PROP_DEVICE_CLASS:
gstdevice->priv->klass = g_value_dup_string (value); gstdevice->priv->device_class = g_value_dup_string (value);
break; break;
default: default:
G_OBJECT_WARN_INVALID_PROPERTY_ID (object, prop_id, pspec); 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 * @device: a #GstDevice
* *
* Gets the "class" of a device. This is a "/" separated list of * 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 * Since: 1.4
*/ */
gchar * 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') if (classes[0] == '\0')
continue; continue;
found = strstr (device->priv->klass, classes[0]); found = strstr (device->priv->device_class, classes[0]);
if (!found) if (!found)
return FALSE; return FALSE;
if (found != device->priv->klass && *(found - 1) != '/') if (found != device->priv->device_class && *(found - 1) != '/')
return FALSE; return FALSE;
len = strlen (classes[0]); len = strlen (classes[0]);
@ -322,8 +325,8 @@ gst_device_has_classesv (GstDevice * device, gchar ** classes)
/** /**
* gst_device_has_classes: * gst_device_has_classes:
* @device: a #GstDevice * @device: a #GstDevice
* @classes: a "/" separate list of klasses to match, only match if all classes * @classes: a "/" separate list of device classes to match, only match if
* are matched * all classes are matched
* *
* Check if @device matches all of the given classes * Check if @device matches all of the given classes
* *

View file

@ -90,7 +90,7 @@ GstElement * gst_device_create_element (GstDevice * device, const gchar * name);
GstCaps * gst_device_get_caps (GstDevice * device); GstCaps * gst_device_get_caps (GstDevice * device);
gchar * gst_device_get_display_name (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, gboolean gst_device_reconfigure_element (GstDevice * device,
GstElement * element); GstElement * element);

View file

@ -410,8 +410,8 @@ EXPORTS
gst_deinit gst_deinit
gst_device_create_element gst_device_create_element
gst_device_get_caps gst_device_get_caps
gst_device_get_device_class
gst_device_get_display_name gst_device_get_display_name
gst_device_get_klass
gst_device_get_type gst_device_get_type
gst_device_has_classes gst_device_has_classes
gst_device_has_classesv gst_device_has_classesv