Commit d76e0be9 authored by Olivier Crête's avatar Olivier Crête 👻

device: Add pre-conditions

parent c2583cae
......@@ -190,6 +190,8 @@ gst_device_create_element (GstDevice * device, const gchar * name)
{
GstDeviceClass *klass = GST_DEVICE_GET_CLASS (device);
g_return_val_if_fail (GST_IS_DEVICE (device), NULL);
if (klass->create_element)
return klass->create_element (device, name);
else
......@@ -210,6 +212,8 @@ gst_device_create_element (GstDevice * device, const gchar * name)
GstCaps *
gst_device_get_caps (GstDevice * device)
{
g_return_val_if_fail (GST_IS_DEVICE (device), NULL);
if (device->priv->caps)
return gst_caps_ref (device->priv->caps);
else
......@@ -229,6 +233,8 @@ gst_device_get_caps (GstDevice * device)
gchar *
gst_device_get_display_name (GstDevice * device)
{
g_return_val_if_fail (GST_IS_DEVICE (device), NULL);
return
g_strdup (device->priv->display_name ? device->priv->display_name : "");
}
......@@ -248,6 +254,8 @@ gst_device_get_display_name (GstDevice * device)
gchar *
gst_device_get_device_class (GstDevice * device)
{
g_return_val_if_fail (GST_IS_DEVICE (device), NULL);
if (device->priv->device_class != NULL)
return g_strdup (device->priv->device_class);
else
......@@ -276,6 +284,8 @@ gst_device_reconfigure_element (GstDevice * device, GstElement * element)
{
GstDeviceClass *klass = GST_DEVICE_GET_CLASS (device);
g_return_val_if_fail (GST_IS_DEVICE (device), FALSE);
if (klass->reconfigure_element)
return klass->reconfigure_element (device, element);
else
......@@ -299,6 +309,8 @@ gst_device_has_classesv (GstDevice * device, gchar ** classes)
{
g_return_val_if_fail (GST_IS_DEVICE (device), FALSE);
if (!classes)
return TRUE;
for (; classes[0]; classes++) {
const gchar *found;
......@@ -340,6 +352,11 @@ gst_device_has_classes (GstDevice * device, const gchar * classes)
gchar **classesv;
gboolean res;
g_return_val_if_fail (GST_IS_DEVICE (device), FALSE);
if (!classes)
return TRUE;
classesv = g_strsplit (classes, "/", 0);
res = gst_device_has_classesv (device, 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