oggmux: send a segment event at the beginning
authorTim-Philipp Müller <tim.muller@collabora.co.uk>
Fri, 21 Sep 2012 14:58:07 +0000 (15:58 +0100)
committerTim-Philipp Müller <tim.muller@collabora.co.uk>
Fri, 21 Sep 2012 14:58:07 +0000 (15:58 +0100)
ext/ogg/gstoggmux.c

index 7fa1413..42f0956 100644 (file)
@@ -210,6 +210,7 @@ gst_ogg_mux_clear (GstOggMux * ogg_mux)
 {
   ogg_mux->pulling = NULL;
   ogg_mux->need_headers = TRUE;
+  ogg_mux->need_start_events = TRUE;
   ogg_mux->delta_pad = NULL;
   ogg_mux->offset = 0;
   ogg_mux->next_ts = 0;
@@ -1913,6 +1914,17 @@ all_pads_eos (GstCollectPads * pads)
   return TRUE;
 }
 
+static void
+gst_ogg_mux_send_start_events (GstOggMux * ogg_mux, GstCollectPads * pads)
+{
+  GstSegment segment;
+
+  gst_segment_init (&segment, GST_FORMAT_BYTES);
+  gst_pad_push_event (ogg_mux->srcpad, gst_event_new_segment (&segment));
+
+  /* we'll send caps later, need to collect all headers first */
+}
+
 /* This function is called when there is data on all pads.
  * 
  * It finds a pad to pull on, this is done by looking at the buffers
@@ -1932,6 +1944,11 @@ gst_ogg_mux_collected (GstCollectPads * pads, GstOggMux * ogg_mux)
 
   GST_LOG_OBJECT (ogg_mux, "collected");
 
+  if (ogg_mux->need_start_events) {
+    gst_ogg_mux_send_start_events (ogg_mux, pads);
+    ogg_mux->need_start_events = FALSE;
+  }
+
   /* queue buffers on all pads; find a buffer with the lowest timestamp */
   best = gst_ogg_mux_queue_pads (ogg_mux, &popped);