[MOVED FROM BAD 32/57] gst/flv/: Close the currently playing segment from the streami...
authorSebastian Dröge <slomo@circular-chaos.org>
Mon, 27 Oct 2008 09:10:54 +0000 (09:10 +0000)
committerSebastian Dröge <sebastian.droege@collabora.co.uk>
Tue, 12 May 2009 19:20:57 +0000 (21:20 +0200)
Original commit message from CVS:
* gst/flv/gstflvdemux.c: (gst_flv_demux_cleanup),
(gst_flv_demux_handle_seek_pull), (gst_flv_demux_dispose):
* gst/flv/gstflvdemux.h:
* gst/flv/gstflvparse.c: (gst_flv_parse_tag_audio),
(gst_flv_parse_tag_video):
Close the currently playing segment from the streaming thread
instead of the thread where the seek event is handled.

gst/flv/gstflvdemux.c
gst/flv/gstflvdemux.h
gst/flv/gstflvparse.c

index df01858781a206d81e22c1dbc52bbe28660c27d7..028dded8e7d0340144e1ec81f659c3df94e4dcfc 100644 (file)
@@ -112,6 +112,11 @@ gst_flv_demux_cleanup (GstFLVDemux * demux)
     demux->new_seg_event = NULL;
   }
 
+  if (demux->close_seg_event) {
+    gst_event_unref (demux->close_seg_event);
+    demux->close_seg_event = NULL;
+  }
+
   gst_adapter_clear (demux->adapter);
 
   if (demux->audio_codec_data) {
@@ -774,14 +779,18 @@ gst_flv_demux_handle_seek_pull (GstFLVDemux * demux, GstEvent * event)
     GST_DEBUG_OBJECT (demux, "closing running segment %" GST_SEGMENT_FORMAT,
         demux->segment);
 
-    /* Close the current segment for a linear playback, FIXME, queue for
-     * streaming thread. */
+    if (G_UNLIKELY (demux->close_seg_event)) {
+      gst_event_unref (demux->close_seg_event);
+      demux->close_seg_event = NULL;
+    }
+
+    /* Close the current segment for a linear playback */
     if (demux->segment->rate >= 0) {
       /* for forward playback, we played from start to last_stop */
-      gst_pad_event_default (demux->sinkpad, gst_event_new_new_segment (TRUE,
-              demux->segment->rate, demux->segment->format,
-              demux->segment->start, demux->segment->last_stop,
-              demux->segment->time));
+      demux->close_seg_event = gst_event_new_new_segment (TRUE,
+          demux->segment->rate, demux->segment->format,
+          demux->segment->start, demux->segment->last_stop,
+          demux->segment->time);
     } else {
       gint64 stop;
 
@@ -789,9 +798,9 @@ gst_flv_demux_handle_seek_pull (GstFLVDemux * demux, GstEvent * event)
         stop = demux->segment->duration;
 
       /* for reverse playback, we played from stop to last_stop. */
-      gst_pad_event_default (demux->sinkpad, gst_event_new_new_segment (TRUE,
-              demux->segment->rate, demux->segment->format,
-              demux->segment->last_stop, stop, demux->segment->last_stop));
+      demux->close_seg_event = gst_event_new_new_segment (TRUE,
+          demux->segment->rate, demux->segment->format,
+          demux->segment->last_stop, stop, demux->segment->last_stop);
     }
   }
 
@@ -1139,6 +1148,11 @@ gst_flv_demux_dispose (GObject * object)
     demux->new_seg_event = NULL;
   }
 
+  if (demux->close_seg_event) {
+    gst_event_unref (demux->close_seg_event);
+    demux->close_seg_event = NULL;
+  }
+
   if (demux->audio_codec_data) {
     gst_buffer_unref (demux->audio_codec_data);
     demux->audio_codec_data = NULL;
index 989584c414fa21962a33b5c3211786dc159f244c..210db2fd5f0b8dd6bb76a9437c4baedd53c53af0 100644 (file)
@@ -67,6 +67,7 @@ struct _GstFLVDemux
 
   GstSegment *segment;
 
+  GstEvent *close_seg_event;
   GstEvent *new_seg_event;
 
   GstTagList *taglist;
index 16c83ec3114459831827da2c4f389250d349d693..b68edd684d69c96560cd7bc1988a7d82106bb7bd 100644 (file)
@@ -699,6 +699,10 @@ gst_flv_parse_tag_audio (GstFLVDemux * demux, const guint8 * data,
 
   /* Do we need a newsegment event ? */
   if (G_UNLIKELY (demux->audio_need_segment)) {
+    if (demux->close_seg_event)
+      gst_pad_push_event (demux->audio_pad,
+          gst_event_ref (demux->close_seg_event));
+
     if (!demux->new_seg_event) {
       GST_DEBUG_OBJECT (demux, "pushing newsegment from %"
           GST_TIME_FORMAT " to %" GST_TIME_FORMAT,
@@ -1007,6 +1011,10 @@ gst_flv_parse_tag_video (GstFLVDemux * demux, const guint8 * data,
 
   /* Do we need a newsegment event ? */
   if (G_UNLIKELY (demux->video_need_segment)) {
+    if (demux->close_seg_event)
+      gst_pad_push_event (demux->video_pad,
+          gst_event_ref (demux->close_seg_event));
+
     if (!demux->new_seg_event) {
       GST_DEBUG_OBJECT (demux, "pushing newsegment from %"
           GST_TIME_FORMAT " to %" GST_TIME_FORMAT,