gst/mpegstream/: Reset last_flow values for the various streams after a flushing...
authorMark Nauwelaerts <manauw@skynet.be>
Wed, 16 May 2007 12:48:43 +0000 (12:48 +0000)
committerTim-Philipp Müller <tim@centricular.net>
Wed, 16 May 2007 12:48:43 +0000 (12:48 +0000)
Original commit message from CVS:
Based on patch by: Mark Nauwelaerts  <manauw skynet be>
* gst/mpegstream/gstdvddemux.c: (gst_dvd_demux_process_event):
* gst/mpegstream/gstmpegdemux.c: (gst_mpeg_demux_class_init),
(gst_mpeg_demux_process_event), (gst_mpeg_streams_reset_last_flow):
* gst/mpegstream/gstmpegdemux.h:
Reset last_flow values for the various streams after a flushing
seek, otherwise we might aggregate wrong flow returns afterwards
that will make upstream pause silently. This should fix seeking
in DVDs and also fix the Thoggen cropping dialog (#438610).

ChangeLog
common
gst/mpegstream/gstdvddemux.c
gst/mpegstream/gstmpegdemux.c
gst/mpegstream/gstmpegdemux.h

index 090b56e..cb99f28 100644 (file)
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,16 @@
+2007-05-16  Tim-Philipp Müller  <tim at centricular dot net>
+
+       Based on patch by: Mark Nauwelaerts  <manauw skynet be>
+
+       * gst/mpegstream/gstdvddemux.c: (gst_dvd_demux_process_event):
+       * gst/mpegstream/gstmpegdemux.c: (gst_mpeg_demux_class_init),
+       (gst_mpeg_demux_process_event), (gst_mpeg_streams_reset_last_flow):
+       * gst/mpegstream/gstmpegdemux.h:
+         Reset last_flow values for the various streams after a flushing
+         seek, otherwise we might aggregate wrong flow returns afterwards
+         that will make upstream pause silently. This should fix seeking
+         in DVDs and also fix the Thoggen cropping dialog (#438610).
+
 2007-05-07  Tim-Philipp Müller  <tim at centricular dot net>
 
        * gst/asfdemux/gstasfdemux.c: (gst_asf_demux_reset),
diff --git a/common b/common
index 61edc2d..b5971d7 160000 (submodule)
--- a/common
+++ b/common
@@ -1 +1 @@
-Subproject commit 61edc2dc7b8eba179d85a6545e46e0d65239e94d
+Subproject commit b5971d76ccd216c27e095c02c3a369a9d05cb36d
index 76f0aca..8a7130c 100644 (file)
@@ -319,6 +319,10 @@ gst_dvd_demux_process_event (GstMPEGParse * mpeg_parse, GstEvent * event)
       dvd_demux->segment_filter = TRUE;
       ret = GST_MPEG_PARSE_CLASS (parent_class)->process_event (mpeg_parse,
           event);
+
+      /* parent class will have reset the other streams */
+      gst_mpeg_streams_reset_last_flow (dvd_demux->subpicture_stream,
+          GST_DVD_DEMUX_NUM_SUBPICTURE_STREAMS);
       break;
     case GST_EVENT_CUSTOM_DOWNSTREAM:
     case GST_EVENT_CUSTOM_DOWNSTREAM_OOB:
index f3b41ed..0a2e0c3 100644 (file)
@@ -92,6 +92,9 @@ GST_BOILERPLATE_FULL (GstMPEGDemux, gst_mpeg_demux, GstMPEGParse,
 
 static void gst_mpeg_demux_class_init (GstMPEGDemuxClass * klass);
 
+static gboolean gst_mpeg_demux_process_event (GstMPEGParse * mpeg_parse,
+    GstEvent * event);
+
 static GstPad *gst_mpeg_demux_new_output_pad (GstMPEGDemux * mpeg_demux,
     const gchar * name, GstPadTemplate * temp);
 static void gst_mpeg_demux_init_stream (GstMPEGDemux * mpeg_demux,
@@ -190,6 +193,7 @@ gst_mpeg_demux_class_init (GstMPEGDemuxClass * klass)
   mpeg_parse_class->parse_packet = gst_mpeg_demux_parse_packet;
   mpeg_parse_class->parse_pes = gst_mpeg_demux_parse_pes;
   mpeg_parse_class->send_buffer = NULL;
+  mpeg_parse_class->process_event = gst_mpeg_demux_process_event;
 
   klass->new_output_pad = gst_mpeg_demux_new_output_pad;
   klass->init_stream = gst_mpeg_demux_init_stream;
@@ -229,6 +233,34 @@ gst_mpeg_demux_init (GstMPEGDemux * mpeg_demux, GstMPEGDemuxClass * klass)
   mpeg_demux->last_pts = -1;
 }
 
+
+static gboolean
+gst_mpeg_demux_process_event (GstMPEGParse * mpeg_parse, GstEvent * event)
+{
+  GstMPEGDemux *demux = GST_MPEG_DEMUX (mpeg_parse);
+  gboolean ret;
+
+  switch (GST_EVENT_TYPE (event)) {
+    case GST_EVENT_FLUSH_STOP:
+      ret = GST_MPEG_PARSE_CLASS (parent_class)->process_event (mpeg_parse,
+          event);
+
+      gst_mpeg_streams_reset_last_flow (demux->video_stream,
+          GST_MPEG_DEMUX_NUM_VIDEO_STREAMS);
+      gst_mpeg_streams_reset_last_flow (demux->audio_stream,
+          GST_MPEG_DEMUX_NUM_AUDIO_STREAMS);
+      gst_mpeg_streams_reset_last_flow (demux->private_stream,
+          GST_MPEG_DEMUX_NUM_PRIVATE_STREAMS);
+      break;
+    default:
+      ret = GST_MPEG_PARSE_CLASS (parent_class)->process_event (mpeg_parse,
+          event);
+      break;
+  }
+
+  return ret;
+}
+
 static gint
 _demux_get_writer_id (GstIndex * index, GstPad * pad)
 {
@@ -1310,6 +1342,16 @@ gst_mpeg_demux_get_index (GstElement * element)
   return mpeg_demux->index;
 }
 
+void
+gst_mpeg_streams_reset_last_flow (GstMPEGStream * streams[], guint num)
+{
+  guint i;
+
+  for (i = 0; i < num; ++i) {
+    if (streams[i] != NULL)
+      streams[i]->last_flow = GST_FLOW_OK;
+  }
+}
 
 gboolean
 gst_mpeg_demux_plugin_init (GstPlugin * plugin)
index cdc77ee..c810595 100644 (file)
@@ -204,9 +204,12 @@ struct _GstMPEGDemuxClass {
                                         GstClockTime last_ts);
 };
 
-GType           gst_mpeg_demux_get_type         (void);
+void            gst_mpeg_streams_reset_last_flow (GstMPEGStream *streams[],
+                                                  guint          num);
 
-gboolean        gst_mpeg_demux_plugin_init      (GstPlugin *plugin);
+GType           gst_mpeg_demux_get_type          (void);
+
+gboolean        gst_mpeg_demux_plugin_init       (GstPlugin *plugin);
 
 G_END_DECLS