mirror of
https://gitlab.freedesktop.org/gstreamer/gstreamer.git
synced 2025-01-26 00:58:12 +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);
|
GstDeviceClass *klass = GST_DEVICE_GET_CLASS (device);
|
||||||
|
|
||||||
|
g_return_val_if_fail (GST_IS_DEVICE (device), NULL);
|
||||||
|
|
||||||
if (klass->create_element)
|
if (klass->create_element)
|
||||||
return klass->create_element (device, name);
|
return klass->create_element (device, name);
|
||||||
else
|
else
|
||||||
|
@ -210,6 +212,8 @@ gst_device_create_element (GstDevice * device, const gchar * name)
|
||||||
GstCaps *
|
GstCaps *
|
||||||
gst_device_get_caps (GstDevice * device)
|
gst_device_get_caps (GstDevice * device)
|
||||||
{
|
{
|
||||||
|
g_return_val_if_fail (GST_IS_DEVICE (device), NULL);
|
||||||
|
|
||||||
if (device->priv->caps)
|
if (device->priv->caps)
|
||||||
return gst_caps_ref (device->priv->caps);
|
return gst_caps_ref (device->priv->caps);
|
||||||
else
|
else
|
||||||
|
@ -229,6 +233,8 @@ gst_device_get_caps (GstDevice * device)
|
||||||
gchar *
|
gchar *
|
||||||
gst_device_get_display_name (GstDevice * device)
|
gst_device_get_display_name (GstDevice * device)
|
||||||
{
|
{
|
||||||
|
g_return_val_if_fail (GST_IS_DEVICE (device), NULL);
|
||||||
|
|
||||||
return
|
return
|
||||||
g_strdup (device->priv->display_name ? device->priv->display_name : "");
|
g_strdup (device->priv->display_name ? device->priv->display_name : "");
|
||||||
}
|
}
|
||||||
|
@ -248,6 +254,8 @@ gst_device_get_display_name (GstDevice * device)
|
||||||
gchar *
|
gchar *
|
||||||
gst_device_get_device_class (GstDevice * device)
|
gst_device_get_device_class (GstDevice * device)
|
||||||
{
|
{
|
||||||
|
g_return_val_if_fail (GST_IS_DEVICE (device), NULL);
|
||||||
|
|
||||||
if (device->priv->device_class != NULL)
|
if (device->priv->device_class != NULL)
|
||||||
return g_strdup (device->priv->device_class);
|
return g_strdup (device->priv->device_class);
|
||||||
else
|
else
|
||||||
|
@ -276,6 +284,8 @@ gst_device_reconfigure_element (GstDevice * device, GstElement * element)
|
||||||
{
|
{
|
||||||
GstDeviceClass *klass = GST_DEVICE_GET_CLASS (device);
|
GstDeviceClass *klass = GST_DEVICE_GET_CLASS (device);
|
||||||
|
|
||||||
|
g_return_val_if_fail (GST_IS_DEVICE (device), FALSE);
|
||||||
|
|
||||||
if (klass->reconfigure_element)
|
if (klass->reconfigure_element)
|
||||||
return klass->reconfigure_element (device, element);
|
return klass->reconfigure_element (device, element);
|
||||||
else
|
else
|
||||||
|
@ -299,6 +309,8 @@ gst_device_has_classesv (GstDevice * device, gchar ** classes)
|
||||||
{
|
{
|
||||||
g_return_val_if_fail (GST_IS_DEVICE (device), FALSE);
|
g_return_val_if_fail (GST_IS_DEVICE (device), FALSE);
|
||||||
|
|
||||||
|
if (!classes)
|
||||||
|
return TRUE;
|
||||||
|
|
||||||
for (; classes[0]; classes++) {
|
for (; classes[0]; classes++) {
|
||||||
const gchar *found;
|
const gchar *found;
|
||||||
|
@ -340,6 +352,11 @@ gst_device_has_classes (GstDevice * device, const gchar * classes)
|
||||||
gchar **classesv;
|
gchar **classesv;
|
||||||
gboolean res;
|
gboolean res;
|
||||||
|
|
||||||
|
g_return_val_if_fail (GST_IS_DEVICE (device), FALSE);
|
||||||
|
|
||||||
|
if (!classes)
|
||||||
|
return TRUE;
|
||||||
|
|
||||||
classesv = g_strsplit (classes, "/", 0);
|
classesv = g_strsplit (classes, "/", 0);
|
||||||
|
|
||||||
res = gst_device_has_classesv (device, classesv);
|
res = gst_device_has_classesv (device, classesv);
|
||||||
|
|
Loading…
Reference in a new issue