tee: Check for the removed pad flag also in the slow pushing path
[platform/upstream/gstreamer.git] / gst / gstobject.c
index 32a406d..3aa20c4 100644 (file)
@@ -278,6 +278,9 @@ gst_object_unref (gpointer object)
  * the floating flag while leaving the reference count unchanged. If the object
  * is not floating, then this call adds a new normal reference increasing the
  * reference count by one.
+ *
+ * For more background on "floating references" please see the #GObject
+ * documentation.
  */
 gpointer
 gst_object_ref_sink (gpointer object)
@@ -293,6 +296,30 @@ gst_object_ref_sink (gpointer object)
 }
 
 /**
+ * gst_clear_object: (skip)
+ * @object_ptr: a pointer to a #GstObject reference
+ *
+ * Clears a reference to a #GstObject.
+ *
+ * @object_ptr must not be %NULL.
+ *
+ * If the reference is %NULL then this function does nothing.
+ * Otherwise, the reference count of the object is decreased using
+ * gst_object_unref() and the pointer is set to %NULL.
+ *
+ * A macro is also included that allows this function to be used without
+ * pointer casts.
+ *
+ * Since: 1.16
+ **/
+#undef gst_clear_object
+void
+gst_clear_object (GstObject ** object_ptr)
+{
+  g_clear_pointer (object_ptr, gst_object_unref);
+}
+
+/**
  * gst_object_replace:
  * @oldobj: (inout) (transfer full) (nullable): pointer to a place of
  *     a #GstObject to replace
@@ -650,7 +677,7 @@ gst_object_get_name (GstObject * object)
 
 /**
  * gst_object_set_parent:
- * @object: a #GstObject
+ * @object: (transfer floating): a #GstObject
  * @parent: new parent of object
  *
  * Sets the parent of @object to @parent. The object's reference count will
@@ -693,6 +720,8 @@ had_parent:
   {
     GST_CAT_DEBUG_OBJECT (GST_CAT_REFCOUNTING, object,
         "set parent failed, object already had a parent");
+    gst_object_ref_sink (object);
+    gst_object_unref (object);
     GST_OBJECT_UNLOCK (object);
     return FALSE;
   }
@@ -1200,12 +1229,13 @@ gst_object_set_control_binding_disabled (GstObject * object,
 /**
  * gst_object_add_control_binding:
  * @object: the controller object
- * @binding: (transfer full): the #GstControlBinding that should be used
+ * @binding: (transfer floating): the #GstControlBinding that should be used
  *
  * Attach the #GstControlBinding to the object. If there already was a
  * #GstControlBinding for this property it will be replaced.
  *
- * The @object will take ownership of the @binding.
+ * The object's reference count will be incremented, and any floating
+ * reference will be removed (see gst_object_ref_sink())
  *
  * Returns: %FALSE if the given @binding has not been setup for this object or
  * has been setup for a non suitable property, %TRUE otherwise.
@@ -1326,7 +1356,7 @@ gst_object_get_value (GstObject * object, const gchar * property_name,
 }
 
 /**
- * gst_object_get_value_array:
+ * gst_object_get_value_array: (skip)
  * @object: the object that has controlled properties
  * @property_name: the name of the property to get
  * @timestamp: the time that should be processed
@@ -1377,7 +1407,7 @@ gst_object_get_value_array (GstObject * object, const gchar * property_name,
  * @timestamp: the time that should be processed
  * @interval: the time spacing between subsequent values
  * @n_values: the number of values
- * @values: array to put control-values in
+ * @values: (array length=n_values): array to put control-values in
  *
  * Gets a number of #GValues for the given controlled property starting at the
  * requested time. The array @values need to hold enough space for @n_values of
@@ -1418,7 +1448,7 @@ gst_object_get_g_value_array (GstObject * object, const gchar * property_name,
  *
  * Obtain the control-rate for this @object. Audio processing #GstElement
  * objects will use this rate to sub-divide their processing loop and call
- * gst_object_sync_values() inbetween. The length of the processing segment
+ * gst_object_sync_values() in between. The length of the processing segment
  * should be up to @control-rate nanoseconds.
  *
  * If the @object is not under property control, this will return
@@ -1444,7 +1474,7 @@ gst_object_get_control_rate (GstObject * object)
  *
  * Change the control-rate for this @object. Audio processing #GstElement
  * objects will use this rate to sub-divide their processing loop and call
- * gst_object_sync_values() inbetween. The length of the processing segment
+ * gst_object_sync_values() in between. The length of the processing segment
  * should be up to @control-rate nanoseconds.
  *
  * The control-rate should not change if the element is in %GST_STATE_PAUSED or