Revert "gst/parse: define pure-parser depending on bison version"
[platform/upstream/gstreamer.git] / gst / gstdevice.c
index 55f5604..64f5ba5 100644 (file)
@@ -21,6 +21,7 @@
 
 /**
  * SECTION:gstdevice
+ * @title: GstDevice
  * @short_description: Object representing a device
  * @see_also: #GstDeviceProvider
  *
@@ -67,7 +68,7 @@ struct _GstDevicePrivate
 
 static guint signals[LAST_SIGNAL];
 
-G_DEFINE_ABSTRACT_TYPE (GstDevice, gst_device, GST_TYPE_OBJECT);
+G_DEFINE_ABSTRACT_TYPE_WITH_PRIVATE (GstDevice, gst_device, GST_TYPE_OBJECT);
 
 static void gst_device_get_property (GObject * object, guint property_id,
     GValue * value, GParamSpec * pspec);
@@ -81,8 +82,6 @@ gst_device_class_init (GstDeviceClass * klass)
 {
   GObjectClass *object_class = G_OBJECT_CLASS (klass);
 
-  g_type_class_add_private (klass, sizeof (GstDevicePrivate));
-
   object_class->get_property = gst_device_get_property;
   object_class->set_property = gst_device_set_property;
   object_class->finalize = gst_device_finalize;
@@ -111,8 +110,7 @@ gst_device_class_init (GstDeviceClass * klass)
 static void
 gst_device_init (GstDevice * device)
 {
-  device->priv = G_TYPE_INSTANCE_GET_PRIVATE (device, GST_TYPE_DEVICE,
-      GstDevicePrivate);
+  device->priv = gst_device_get_instance_private (device);
 }
 
 static void
@@ -195,10 +193,11 @@ gst_device_set_property (GObject * object, guint prop_id,
  * @name: (allow-none): name of new element, or %NULL to automatically
  * create a unique name.
  *
- * Creates the element with all of the required paramaters set to use
+ * Creates the element with all of the required parameters set to use
  * this device.
  *
- * Returns: (transfer full): a new #GstElement configured to use this device
+ * Returns: (transfer floating) (nullable): a new #GstElement configured to use
+ * this device
  *
  * Since: 1.4
  */
@@ -206,13 +205,20 @@ GstElement *
 gst_device_create_element (GstDevice * device, const gchar * name)
 {
   GstDeviceClass *klass = GST_DEVICE_GET_CLASS (device);
+  GstElement *element = NULL;
 
   g_return_val_if_fail (GST_IS_DEVICE (device), NULL);
 
   if (klass->create_element)
-    return klass->create_element (device, name);
-  else
-    return NULL;
+    element = klass->create_element (device, name);
+
+  /* Ensure that the reference is floating. Bindings might have a hard time
+   * making sure that the reference is indeed still floating after returning
+   * here */
+  if (element)
+    g_object_force_floating ((GObject *) element);
+
+  return element;
 }
 
 /**
@@ -221,7 +227,7 @@ gst_device_create_element (GstDevice * device, const gchar * name)
  *
  * Getter for the #GstCaps that this device supports.
  *
- * Returns: The #GstCaps supported by this device. Unref with
+ * Returns: (nullable): The #GstCaps supported by this device. Unref with
  * gst_caps_unref() when done.
  *
  * Since: 1.4
@@ -285,7 +291,7 @@ gst_device_get_device_class (GstDevice * device)
  *
  * Gets the extra properties of a device.
  *
- * Returns: The extra properties or %NULL when there are none.
+ * Returns: (nullable): The extra properties or %NULL when there are none.
  *          Free with gst_structure_free() after use.
  *
  * Since: 1.6