aggregator: hook up to docs
[platform/upstream/gstreamer.git] / libs / gst / base / gstaggregator.c
index 33bdc39..fd92811 100644 (file)
@@ -22,8 +22,8 @@
 /**
  * SECTION: gstaggregator
  * @title: GstAggregator
- * @short_description: manages a set of pads with the purpose of
- * aggregating their buffers.
+ * @short_description: Base class for mixers and muxers, manages a set of input
+ *     pads and aggregates their streams
  * @see_also: gstcollectpads for historical reasons.
  *
  * Manages a set of pads with the purpose of aggregating their buffers.
  *    flag these buffers with GST_BUFFER_FLAG_GAP and GST_BUFFER_FLAG_DROPPABLE
  *    to ease their identification and subsequent processing.
  *
+ * This class used to live in gst-plugins-bad and was moved to core.
+ *
+ * Since: 1.14
+ */
+
+/**
+ * SECTION: gstaggregatorpad
+ * @title: GstAggregatorPad
+ * @short_description: #GstPad subclass for pads managed by #GstAggregator
+ * @see_also: gstcollectpads for historical reasons.
+ *
+ * Pads managed by a #GstAggregor subclass.
+ *
+ * This class used to live in gst-plugins-bad and was moved to core.
+ *
+ * Since: 1.14
  */
 
 #ifdef HAVE_CONFIG_H
@@ -356,87 +372,6 @@ enum
 static GstFlowReturn gst_aggregator_pad_chain_internal (GstAggregator * self,
     GstAggregatorPad * aggpad, GstBuffer * buffer, gboolean head);
 
-/**
- * gst_aggregator_iterate_sinkpads:
- * @self: The #GstAggregator
- * @func: (scope call): The function to call.
- * @user_data: (closure): The data to pass to @func.
- *
- * Iterate the sinkpads of aggregator to call a function on them.
- *
- * This method guarantees that @func will be called only once for each
- * sink pad.
- *
- * Returns: %FALSE if there are no sinkpads or if @func returned %FALSE
- */
-gboolean
-gst_aggregator_iterate_sinkpads (GstAggregator * self,
-    GstAggregatorPadForeachFunc func, gpointer user_data)
-{
-  gboolean result = FALSE;
-  GstIterator *iter;
-  gboolean done = FALSE;
-  GValue item = { 0, };
-  GList *seen_pads = NULL;
-
-  iter = gst_element_iterate_sink_pads (GST_ELEMENT (self));
-
-  if (!iter)
-    goto no_iter;
-
-  while (!done) {
-    switch (gst_iterator_next (iter, &item)) {
-      case GST_ITERATOR_OK:
-      {
-        GstAggregatorPad *pad;
-
-        pad = g_value_get_object (&item);
-
-        /* if already pushed, skip. FIXME, find something faster to tag pads */
-        if (pad == NULL || g_list_find (seen_pads, pad)) {
-          g_value_reset (&item);
-          break;
-        }
-
-        GST_LOG_OBJECT (pad, "calling function %s on pad",
-            GST_DEBUG_FUNCPTR_NAME (func));
-
-        result = func (self, pad, user_data);
-
-        done = !result;
-
-        seen_pads = g_list_prepend (seen_pads, pad);
-
-        g_value_reset (&item);
-        break;
-      }
-      case GST_ITERATOR_RESYNC:
-        gst_iterator_resync (iter);
-        break;
-      case GST_ITERATOR_ERROR:
-        GST_ERROR_OBJECT (self,
-            "Could not iterate over internally linked pads");
-        done = TRUE;
-        break;
-      case GST_ITERATOR_DONE:
-        done = TRUE;
-        break;
-    }
-  }
-  g_value_unset (&item);
-  gst_iterator_free (iter);
-
-  if (seen_pads == NULL) {
-    GST_DEBUG_OBJECT (self, "No pad seen");
-    return FALSE;
-  }
-
-  g_list_free (seen_pads);
-
-no_iter:
-  return result;
-}
-
 static gboolean
 gst_aggregator_pad_queue_is_empty (GstAggregatorPad * pad)
 {
@@ -1645,6 +1580,9 @@ gst_aggregator_default_create_new_pad (GstAggregator * self,
   GstAggregatorPrivate *priv = self->priv;
   gint serial = 0;
   gchar *name = NULL;
+  GType pad_type =
+      GST_PAD_TEMPLATE_GTYPE (templ) ==
+      G_TYPE_NONE ? GST_TYPE_AGGREGATOR_PAD : GST_PAD_TEMPLATE_GTYPE (templ);
 
   if (templ->direction != GST_PAD_SINK)
     goto not_sink;
@@ -1665,7 +1603,7 @@ gst_aggregator_default_create_new_pad (GstAggregator * self,
   }
 
   name = g_strdup_printf ("sink_%u", serial);
-  agg_pad = g_object_new (GST_AGGREGATOR_GET_CLASS (self)->sinkpads_type,
+  agg_pad = g_object_new (pad_type,
       "name", name, "direction", GST_PAD_SINK, "template", templ, NULL);
   g_free (name);
 
@@ -2305,8 +2243,6 @@ gst_aggregator_class_init (GstAggregatorClass * klass)
   GST_DEBUG_CATEGORY_INIT (aggregator_debug, "aggregator",
       GST_DEBUG_FG_MAGENTA, "GstAggregator");
 
-  klass->sinkpads_type = GST_TYPE_AGGREGATOR_PAD;
-
   klass->sink_event = gst_aggregator_default_sink_event;
   klass->sink_query = gst_aggregator_default_sink_query;
 
@@ -2958,6 +2894,12 @@ gst_aggregator_pad_get_buffer (GstAggregatorPad * pad)
   return buffer;
 }
 
+/**
+ * gst_aggregator_pad_is_eos:
+ * @pad: an aggregator pad
+ *
+ * Returns: %TRUE if the pad is EOS, otherwise %FALSE.
+ */
 gboolean
 gst_aggregator_pad_is_eos (GstAggregatorPad * pad)
 {