Revert "gstaggregator: pads must inherit from #GstAggregatorPad"

This reverts commit 9774b3775d8483e5697f9196a26c1e5831113bd6.

Pushed by mistake
diff --git a/libs/gst/base/gstaggregator.c b/libs/gst/base/gstaggregator.c
index 3051a17..89778a3 100644
--- a/libs/gst/base/gstaggregator.c
+++ b/libs/gst/base/gstaggregator.c
@@ -61,10 +61,6 @@
  *    flag these buffers with GST_BUFFER_FLAG_GAP and GST_BUFFER_FLAG_DROPPABLE
  *    to ease their identification and subsequent processing.
  *
- *  * Subclasses must use (a subclass of) #GstAggregatorPad for both their
- *    sink and source pads.
- *    See gst_element_class_add_static_pad_template_with_gtype().
- *
  * This class used to live in gst-plugins-bad and was moved to core.
  *
  * Since: 1.14
@@ -465,8 +461,7 @@
   GST_OBJECT_LOCK (self);
   self->priv->send_stream_start = TRUE;
   self->priv->send_segment = TRUE;
-  gst_segment_init (&GST_AGGREGATOR_PAD (self->srcpad)->segment,
-      GST_FORMAT_TIME);
+  gst_segment_init (&self->segment, GST_FORMAT_TIME);
   self->priv->first_buffer = TRUE;
   GST_OBJECT_UNLOCK (self);
 }
@@ -484,8 +479,7 @@
     GST_INFO_OBJECT (self, "pushing stream start");
     /* stream-start (FIXME: create id based on input ids) */
     g_snprintf (s_id, sizeof (s_id), "agg-%08x", g_random_int ());
-    if (!gst_pad_push_event (GST_PAD (self->srcpad),
-            gst_event_new_stream_start (s_id))) {
+    if (!gst_pad_push_event (self->srcpad, gst_event_new_stream_start (s_id))) {
       GST_WARNING_OBJECT (self->srcpad, "Sending stream start event failed");
     }
     self->priv->send_stream_start = FALSE;
@@ -495,7 +489,7 @@
 
     GST_INFO_OBJECT (self, "pushing caps: %" GST_PTR_FORMAT,
         self->priv->srccaps);
-    if (!gst_pad_push_event (GST_PAD (self->srcpad),
+    if (!gst_pad_push_event (self->srcpad,
             gst_event_new_caps (self->priv->srccaps))) {
       GST_WARNING_OBJECT (self->srcpad, "Sending caps event failed");
     }
@@ -505,8 +499,7 @@
 
   GST_OBJECT_LOCK (self);
   if (self->priv->send_segment && !self->priv->flush_seeking) {
-    segment =
-        gst_event_new_segment (&GST_AGGREGATOR_PAD (self->srcpad)->segment);
+    segment = gst_event_new_segment (&self->segment);
 
     if (!self->priv->seqnum)
       /* This code-path is in preparation to be able to run without a source
@@ -1835,8 +1828,8 @@
         &start, &stop_type, &stop);
 
     GST_OBJECT_LOCK (self);
-    gst_segment_do_seek (&GST_AGGREGATOR_PAD (self->srcpad)->segment, rate, fmt,
-        flags, start_type, start, stop_type, stop, NULL);
+    gst_segment_do_seek (&self->segment, rate, fmt, flags, start_type, start,
+        stop_type, stop, NULL);
     self->priv->seqnum = gst_event_get_seqnum (event);
     self->priv->first_buffer = FALSE;
     GST_OBJECT_UNLOCK (self);
@@ -1994,8 +1987,8 @@
     priv->flush_seeking = TRUE;
   }
 
-  gst_segment_do_seek (&GST_AGGREGATOR_PAD (self->srcpad)->segment, rate, fmt,
-      flags, start_type, start, stop_type, stop, NULL);
+  gst_segment_do_seek (&self->segment, rate, fmt, flags, start_type, start,
+      stop_type, stop, NULL);
 
   /* Seeking sets a position */
   self->priv->first_buffer = FALSE;
@@ -2363,11 +2356,10 @@
   self->priv->peer_latency_min = self->priv->sub_latency_min = 0;
   self->priv->peer_latency_max = self->priv->sub_latency_max = 0;
   self->priv->has_peer_latency = FALSE;
+  gst_aggregator_reset_flow_values (self);
 
   self->srcpad = gst_pad_new_from_template (pad_template, "src");
 
-  gst_aggregator_reset_flow_values (self);
-
   gst_pad_set_event_function (self->srcpad,
       GST_DEBUG_FUNCPTR (gst_aggregator_src_pad_event_func));
   gst_pad_set_query_function (self->srcpad,
@@ -2525,7 +2517,6 @@
 
   if (self->priv->first_buffer) {
     GstClockTime start_time;
-    GstAggregatorPad *srcpad = GST_AGGREGATOR_PAD (self->srcpad);
 
     switch (self->priv->start_time_selection) {
       case GST_AGGREGATOR_START_TIME_SELECTION_ZERO:
@@ -2559,10 +2550,10 @@
     }
 
     if (start_time != -1) {
-      if (srcpad->segment.position == -1)
-        srcpad->segment.position = start_time;
+      if (self->segment.position == -1)
+        self->segment.position = start_time;
       else
-        srcpad->segment.position = MIN (start_time, srcpad->segment.position);
+        self->segment.position = MIN (start_time, self->segment.position);
 
       GST_DEBUG_OBJECT (self, "Selecting start time %" GST_TIME_FORMAT,
           GST_TIME_ARGS (start_time));
diff --git a/libs/gst/base/gstaggregator.h b/libs/gst/base/gstaggregator.h
index d191d94..989e51a 100644
--- a/libs/gst/base/gstaggregator.h
+++ b/libs/gst/base/gstaggregator.h
@@ -140,6 +140,9 @@
 
   GstPad                *  srcpad;
 
+  /* Only access with the object lock held */
+  GstSegment               segment;
+
   /*< private >*/
   GstAggregatorPrivate  *  priv;
 
diff --git a/tests/check/libs/aggregator.c b/tests/check/libs/aggregator.c
index 8503a95..53ef378 100644
--- a/tests/check/libs/aggregator.c
+++ b/tests/check/libs/aggregator.c
@@ -152,11 +152,9 @@
       GST_STATIC_PAD_TEMPLATE ("sink_%u", GST_PAD_SINK, GST_PAD_REQUEST,
       GST_STATIC_CAPS_ANY);
 
-  gst_element_class_add_static_pad_template_with_gtype (gstelement_class,
-      &_src_template, GST_TYPE_AGGREGATOR_PAD);
+  gst_element_class_add_static_pad_template (gstelement_class, &_src_template);
 
-  gst_element_class_add_static_pad_template_with_gtype (gstelement_class,
-      &_sink_template, GST_TYPE_AGGREGATOR_PAD);
+  gst_element_class_add_static_pad_template (gstelement_class, &_sink_template);
 
   gst_element_class_set_static_metadata (gstelement_class, "Aggregator",
       "Testing", "Combine N buffers", "Stefan Sauer <ensonic@users.sf.net>");
@@ -169,8 +167,7 @@
 gst_test_aggregator_init (GstTestAggregator * self)
 {
   GstAggregator *agg = GST_AGGREGATOR (self);
-  gst_segment_init (&GST_AGGREGATOR_PAD (agg->srcpad)->segment,
-      GST_FORMAT_TIME);
+  gst_segment_init (&agg->segment, GST_FORMAT_TIME);
   self->timestamp = 0;
   self->gap_expected = FALSE;
 }
@@ -811,8 +808,8 @@
   GST_BUFFER_TIMESTAMP (buf) = 0;
   _chain_data_init (&data2, test.aggregator, buf, NULL);
 
-  gst_segment_init (&GST_AGGREGATOR_PAD (GST_AGGREGATOR (test.
-              aggregator)->srcpad)->segment, GST_FORMAT_TIME);
+  gst_segment_init (&GST_AGGREGATOR (test.aggregator)->segment,
+      GST_FORMAT_TIME);
 
   /* now do a successful flushing seek */
   event = gst_event_new_seek (1, GST_FORMAT_TIME, GST_SEEK_FLAG_FLUSH,