gst: Don't pass miniobjects to GST_DEBUG_OBJECT() and similar macros
[platform/upstream/gstreamer.git] / gst / gstchildproxy.c
index 1cd4116..22c5d1a 100644 (file)
@@ -21,6 +21,7 @@
 
 /**
  * SECTION:gstchildproxy
+ * @title: GstChildProxy
  * @short_description: Interface for multi child elements.
  * @see_also: #GstBin
  *
@@ -108,18 +109,24 @@ gst_child_proxy_default_get_child_by_name (GstChildProxy * parent,
  * together with gst_object_get_name(). If the interface is to be used with
  * #GObjects, this methods needs to be overridden.
  *
- * Returns: (transfer full): the child object or %NULL if not found. Unref
- *     after usage.
+ * Returns: (transfer full) (nullable): the child object or %NULL if
+ *     not found. Unref after usage.
  *
  * MT safe.
  */
 GObject *
 gst_child_proxy_get_child_by_name (GstChildProxy * parent, const gchar * name)
 {
+  GstChildProxyInterface *iface;
+
   g_return_val_if_fail (GST_IS_CHILD_PROXY (parent), 0);
 
-  return (GST_CHILD_PROXY_GET_INTERFACE (parent)->get_child_by_name (parent,
-          name));
+  iface = GST_CHILD_PROXY_GET_INTERFACE (parent);
+
+  if (iface->get_child_by_name != NULL)
+    return iface->get_child_by_name (parent, name);
+
+  return NULL;
 }
 
 /**
@@ -129,18 +136,24 @@ gst_child_proxy_get_child_by_name (GstChildProxy * parent, const gchar * name)
  *
  * Fetches a child by its number.
  *
- * Returns: (transfer full): the child object or %NULL if not found (index
- *     too high). Unref after usage.
+ * Returns: (transfer full) (nullable): the child object or %NULL if
+ *     not found (index too high). Unref after usage.
  *
  * MT safe.
  */
 GObject *
 gst_child_proxy_get_child_by_index (GstChildProxy * parent, guint index)
 {
+  GstChildProxyInterface *iface;
+
   g_return_val_if_fail (GST_IS_CHILD_PROXY (parent), NULL);
 
-  return (GST_CHILD_PROXY_GET_INTERFACE (parent)->get_child_by_index (parent,
-          index));
+  iface = GST_CHILD_PROXY_GET_INTERFACE (parent);
+
+  if (iface->get_child_by_index != NULL)
+    return iface->get_child_by_index (parent, index);
+
+  return NULL;
 }
 
 /**
@@ -156,9 +169,16 @@ gst_child_proxy_get_child_by_index (GstChildProxy * parent, guint index)
 guint
 gst_child_proxy_get_children_count (GstChildProxy * parent)
 {
+  GstChildProxyInterface *iface;
+
   g_return_val_if_fail (GST_IS_CHILD_PROXY (parent), 0);
 
-  return (GST_CHILD_PROXY_GET_INTERFACE (parent)->get_children_count (parent));
+  iface = GST_CHILD_PROXY_GET_INTERFACE (parent);
+
+  if (iface->get_children_count != NULL)
+    return iface->get_children_count (parent);
+
+  return 0;
 }
 
 /**
@@ -174,7 +194,7 @@ gst_child_proxy_get_children_count (GstChildProxy * parent)
  *
  * MT safe.
  *
- * Returns: TRUE if @target and @pspec could be found. FALSE otherwise. In that
+ * Returns: %TRUE if @target and @pspec could be found. %FALSE otherwise. In that
  * case the values for @pspec and @target are not modified. Unref @target after
  * usage. For plain GObjects @target is the same as @object.
  */
@@ -189,7 +209,7 @@ gst_child_proxy_lookup (GstChildProxy * object, const gchar * name,
   g_return_val_if_fail (GST_IS_CHILD_PROXY (object), FALSE);
   g_return_val_if_fail (name != NULL, FALSE);
 
-  obj = g_object_ref (object);
+  obj = G_OBJECT (g_object_ref (object));
 
   current = names = g_strsplit (name, "::", -1);
   /* find the owner of the property */
@@ -274,7 +294,7 @@ not_found:
  * gst_child_proxy_get_valist:
  * @object: the object to query
  * @first_property_name: name of the first property to get
- * @var_args: return location for the first property, followed optionally by more name/return location pairs, followed by NULL
+ * @var_args: return location for the first property, followed optionally by more name/return location pairs, followed by %NULL
  *
  * Gets properties of the parent object and its children.
  */
@@ -328,7 +348,7 @@ cant_copy:
  * gst_child_proxy_get:
  * @object: the parent object
  * @first_property_name: name of the first property to get
- * @...: return location for the first property, followed optionally by more name/return location pairs, followed by NULL
+ * @...: return location for the first property, followed optionally by more name/return location pairs, followed by %NULL
  *
  * Gets properties of the parent object and its children.
  */
@@ -383,7 +403,7 @@ not_found:
  * gst_child_proxy_set_valist:
  * @object: the parent object
  * @first_property_name: name of the first property to set
- * @var_args: value for the first property, followed optionally by more name/value pairs, followed by NULL
+ * @var_args: value for the first property, followed optionally by more name/value pairs, followed by %NULL
  *
  * Sets properties of the parent object and its children.
  */
@@ -432,6 +452,7 @@ cant_copy:
         (GST_IS_OBJECT (object) ? GST_OBJECT_NAME (object) : ""), error);
     g_value_unset (&value);
     g_object_unref (target);
+    g_free (error);
     return;
   }
 }
@@ -440,7 +461,7 @@ cant_copy:
  * gst_child_proxy_set:
  * @object: the parent object
  * @first_property_name: name of the first property to set
- * @...: value for the first property, followed optionally by more name/value pairs, followed by NULL
+ * @...: value for the first property, followed optionally by more name/value pairs, followed by %NULL
  *
  * Sets properties of the parent object and its children.
  */