summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMathieu Duponchelle <mathieu@centricular.com>2018-03-01 01:15:34 +0100
committerMathieu Duponchelle <mathieu@centricular.com>2018-03-01 01:15:34 +0100
commita567cc13a50948a251cdf380e8407f0c18d9fff3 (patch)
tree8e5abe6c7b80e87ec93f3b9dd146dac597be2c3f
parent609adc06095f54c426ae3ad8879510610355c21c (diff)
Revert "gstaggregator: pads must inherit from #GstAggregatorPad"
This reverts commit 9774b3775d8483e5697f9196a26c1e5831113bd6. Pushed by mistake
-rw-r--r--libs/gst/base/gstaggregator.c33
-rw-r--r--libs/gst/base/gstaggregator.h3
-rw-r--r--tests/check/libs/aggregator.c13
3 files changed, 20 insertions, 29 deletions
diff --git a/libs/gst/base/gstaggregator.c b/libs/gst/base/gstaggregator.c
index 3051a1705..89778a3df 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_aggregator_reset_flow_values (GstAggregator * self)
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_aggregator_push_mandatory_events (GstAggregator * self)
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_aggregator_push_mandatory_events (GstAggregator * self)
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_aggregator_push_mandatory_events (GstAggregator * self)
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 @@ gst_aggregator_send_event (GstElement * element, GstEvent * event)
&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 @@ gst_aggregator_do_seek (GstAggregator * self, GstEvent * event)
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 @@ gst_aggregator_init (GstAggregator * self, GstAggregatorClass * klass)
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 @@ gst_aggregator_pad_chain_internal (GstAggregator * self,
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 @@ gst_aggregator_pad_chain_internal (GstAggregator * self,
}
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 d191d940d..989e51a4f 100644
--- a/libs/gst/base/gstaggregator.h
+++ b/libs/gst/base/gstaggregator.h
@@ -140,6 +140,9 @@ struct _GstAggregator
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 8503a95cb..53ef37897 100644
--- a/tests/check/libs/aggregator.c
+++ b/tests/check/libs/aggregator.c
@@ -152,11 +152,9 @@ gst_test_aggregator_class_init (GstTestAggregatorClass * klass)
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 @@ static void
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_START_TEST (test_flushing_seek)
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,