mirror of
https://gitlab.freedesktop.org/gstreamer/gstreamer.git
synced 2025-01-12 02:15:31 +00:00
device: Add pre-conditions
This commit is contained in:
parent
c2583cae90
commit
d76e0be9fd
1 changed files with 17 additions and 0 deletions
|
@ -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);
|
||||
|
|
Loading…
Reference in a new issue