summaryrefslogtreecommitdiffstats
path: root/gst/liveadder
diff options
context:
space:
mode:
authorOlivier Crete <olivier.crete@collabora.co.uk>2008-03-31 18:44:21 +0000
committerEdward Hervey <bilboed@bilboed.com>2009-02-17 19:29:03 +0100
commit59d6b57d52a836967c0904284f4fea2cd63d31d8 (patch)
treea656b61f57bc7715817b092733c9dad8814ab8bf /gst/liveadder
parentffa0065ab30eef7c314606d02bfd09c7e72d97ea (diff)
downloadgst-plugins-bad-59d6b57d52a836967c0904284f4fea2cd63d31d8.tar.gz
gst-plugins-bad-59d6b57d52a836967c0904284f4fea2cd63d31d8.tar.bz2
gst-plugins-bad-59d6b57d52a836967c0904284f4fea2cd63d31d8.zip
[MOVED FROM GST-P-FARSIGHT] Push out a simple newsegment event
20080331184421-3e2dc-69544b5b03ae3bb8c1e3f967974fd250d04056b5.gz
Diffstat (limited to 'gst/liveadder')
-rw-r--r--gst/liveadder/liveadder.c24
-rw-r--r--gst/liveadder/liveadder.h2
2 files changed, 26 insertions, 0 deletions
diff --git a/gst/liveadder/liveadder.c b/gst/liveadder/liveadder.c
index 1cbf6ad7..808fdca8 100644
--- a/gst/liveadder/liveadder.c
+++ b/gst/liveadder/liveadder.c
@@ -547,6 +547,9 @@ gst_live_adder_sink_event (GstPad * pad, GstEvent * event)
case GST_EVENT_FLUSH_STOP:
ret = gst_pad_push_event (adder->srcpad, event);
ret = gst_live_adder_src_activate_push (adder->srcpad, TRUE);
+ GST_OBJECT_LOCK (adder);
+ adder->segment_pending = TRUE;
+ GST_OBJECT_UNLOCK (adder);
break;
case GST_EVENT_EOS:
{
@@ -927,6 +930,7 @@ gst_live_adder_loop (gpointer data)
GstClockReturn ret;
GstBuffer *buffer = NULL;
GstFlowReturn result;
+ GstEvent *newseg_event = NULL;
GST_OBJECT_LOCK (adder);
@@ -1016,8 +1020,27 @@ gst_live_adder_loop (gpointer data)
adder->next_timestamp = GST_BUFFER_TIMESTAMP (buffer) +
GST_BUFFER_DURATION (buffer);
+ if (adder->segment_pending)
+ {
+ /*
+ * We should probably loop through all of the sinks that have a segment
+ * and take the min of the starts and the max of the stops
+ * and convert them to running times and use these are start/stop.
+ * And so something smart about the positions with seeks that I dont
+ * understand yet.
+ */
+ newseg_event = gst_event_new_new_segment_full (FALSE, 1.0,
+ 1.0, GST_FORMAT_TIME, GST_BUFFER_TIMESTAMP (buffer), -1,
+ 0);
+
+ adder->segment_pending = FALSE;
+ }
+
GST_OBJECT_UNLOCK (adder);
+ if (newseg_event)
+ gst_pad_push_event (adder->srcpad, newseg_event);
+
result = gst_pad_push (adder->srcpad, buffer);
if (result != GST_FLOW_OK)
goto pause;
@@ -1188,6 +1211,7 @@ gst_live_adder_change_state (GstElement * element, GstStateChange transition)
case GST_STATE_CHANGE_READY_TO_PAUSED:
{
GST_OBJECT_LOCK (adder);
+ adder->segment_pending = TRUE;
adder->peer_latency = 0;
adder->next_timestamp = GST_CLOCK_TIME_NONE;
g_list_foreach (adder->sinkpads, reset_pad_private, adder);
diff --git a/gst/liveadder/liveadder.h b/gst/liveadder/liveadder.h
index 3cb36841..0ad93e54 100644
--- a/gst/liveadder/liveadder.h
+++ b/gst/liveadder/liveadder.h
@@ -90,6 +90,8 @@ struct _GstLiveAdder {
GstClockTime latency_ms;
GstClockTime peer_latency;
+
+ gboolean segment_pending;
};
struct _GstLiveAdderClass {