gst/mpegstream/: Recreate pads on new-media (#160730).
authorRonald S. Bultje <rbultje@ronald.bitfreak.net>
Wed, 5 Jan 2005 17:03:27 +0000 (17:03 +0000)
committerRonald S. Bultje <rbultje@ronald.bitfreak.net>
Wed, 5 Jan 2005 17:03:27 +0000 (17:03 +0000)
Original commit message from CVS:
Reviewed by:  Ronald S. Bultje  <rbultje@ronald.bitfreak.net>
* gst/mpegstream/gstdvddemux.c: (gst_dvd_demux_class_init),
(gst_dvd_demux_handle_discont):
* gst/mpegstream/gstmpegdemux.c: (gst_mpeg_demux_class_init),
(gst_mpeg_demux_handle_discont):
Recreate pads on new-media (#160730).
* gst/mpegstream/gstmpegparse.c: (gst_mpeg_parse_new_pad):
Send discont even if manager changes timestamps (#161929).

ChangeLog
gst/mpegstream/gstdvddemux.c
gst/mpegstream/gstmpegdemux.c
gst/mpegstream/gstmpegparse.c

index 8ff67529a24f7217d13da724f2c910178f74448f..e7d7158c7a1074e42b1bfe20bdc97ab34bcd6c77 100644 (file)
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,15 @@
+2005-01-05  Martin Eikermann  <meiker@upb.de>
+
+       Reviewed by:  Ronald S. Bultje  <rbultje@ronald.bitfreak.net>
+
+       * gst/mpegstream/gstdvddemux.c: (gst_dvd_demux_class_init),
+       (gst_dvd_demux_handle_discont):
+       * gst/mpegstream/gstmpegdemux.c: (gst_mpeg_demux_class_init),
+       (gst_mpeg_demux_handle_discont):
+         Recreate pads on new-media (#160730).
+       * gst/mpegstream/gstmpegparse.c: (gst_mpeg_parse_new_pad):
+         Send discont even if manager changes timestamps (#161929).
+
 2005-01-05  Sebastien Cote  <sc5@hermes.usherb.ca>
 
        Reviewed by:  Ronald S. Bultje  <rbultje@ronald.bitfreak.net>
index aee0edd1711ae53946f10145a83f7453210b6733..b152886cb2b8315aa73e11b861f5b734cfad7c05 100644 (file)
@@ -131,6 +131,8 @@ static void gst_dvd_demux_send_data (GstMPEGParse * mpeg_parse,
 
 static void gst_dvd_demux_send_discont
     (GstMPEGParse * mpeg_parse, GstClockTime time);
+static void gst_dvd_demux_handle_discont
+    (GstMPEGParse * mpeg_parse, GstEvent * event);
 static gboolean gst_dvd_demux_handle_dvd_event
     (GstDVDDemux * dvd_demux, GstEvent * event);
 
@@ -159,6 +161,9 @@ static void gst_dvd_demux_set_cur_audio
 static void gst_dvd_demux_set_cur_subpicture
     (GstDVDDemux * dvd_demux, gint stream_nr);
 
+static void gst_dvd_demux_reset (GstDVDDemux * dvd_demux);
+
+
 static GstElementStateReturn gst_dvd_demux_change_state (GstElement * element);
 
 static GstMPEGDemuxClass *parent_class = NULL;
@@ -247,6 +252,7 @@ gst_dvd_demux_class_init (GstDVDDemuxClass * klass)
   gstelement_class->change_state = gst_dvd_demux_change_state;
 
   mpeg_parse_class->send_discont = gst_dvd_demux_send_discont;
+  mpeg_parse_class->handle_discont = gst_dvd_demux_handle_discont;
 
   mpeg_demux_class->get_audio_stream = gst_dvd_demux_get_audio_stream;
   mpeg_demux_class->get_video_stream = gst_dvd_demux_get_video_stream;
@@ -478,6 +484,20 @@ gst_dvd_demux_send_discont (GstMPEGParse * mpeg_parse, GstClockTime time)
   }
 }
 
+static void
+gst_dvd_demux_handle_discont (GstMPEGParse * mpeg_parse, GstEvent * event)
+{
+  GstDVDDemux *dvd_demux = GST_DVD_DEMUX (mpeg_parse);
+
+  if (GST_EVENT_DISCONT_NEW_MEDIA (event)) {
+    gst_dvd_demux_reset (dvd_demux);
+  }
+
+  /* before we reset let parent handle and forward discont */
+  if (GST_MPEG_PARSE_CLASS (parent_class)->handle_discont != NULL)
+    GST_MPEG_PARSE_CLASS (parent_class)->handle_discont (mpeg_parse, event);
+}
+
 static GstMPEGStream *
 gst_dvd_demux_get_video_stream (GstMPEGDemux * mpeg_demux,
     guint8 stream_nr, gint type, const gpointer info)
index 3e4978de6f81da19189853624dad90e3266a8675..ac48cb45f90a17a09a3f3224f33cc06a15ad859d 100644 (file)
@@ -93,6 +93,9 @@ static void gst_mpeg_demux_send_data (GstMPEGParse * mpeg_parse,
     GstData * data, GstClockTime time);
 static void gst_mpeg_demux_send_discont (GstMPEGParse * mpeg_parse,
     GstClockTime time);
+static void gst_mpeg_demux_handle_discont (GstMPEGParse * mpeg_parse,
+    GstEvent * event);
+
 
 static GstPad *gst_mpeg_demux_new_output_pad (GstMPEGDemux * mpeg_demux,
     const gchar * name, GstPadTemplate * temp);
@@ -130,6 +133,8 @@ static gboolean normal_seek (GstPad * pad, GstEvent * event, gint64 * offset);
 
 static gboolean gst_mpeg_demux_handle_src_event (GstPad * pad,
     GstEvent * event);
+static void gst_mpeg_demux_reset (GstMPEGDemux * mpeg_demux);
+
 
 static GstElementStateReturn gst_mpeg_demux_change_state (GstElement * element);
 
@@ -207,6 +212,7 @@ gst_mpeg_demux_class_init (GstMPEGDemuxClass * klass)
   mpeg_parse_class->parse_pes = gst_mpeg_demux_parse_pes;
   mpeg_parse_class->send_data = gst_mpeg_demux_send_data;
   mpeg_parse_class->send_discont = gst_mpeg_demux_send_discont;
+  mpeg_parse_class->handle_discont = gst_mpeg_demux_handle_discont;
 
   klass->new_output_pad = gst_mpeg_demux_new_output_pad;
   klass->init_stream = gst_mpeg_demux_init_stream;
@@ -301,6 +307,19 @@ gst_mpeg_demux_send_discont (GstMPEGParse * mpeg_parse, GstClockTime time)
   }
 }
 
+static void
+gst_mpeg_demux_handle_discont (GstMPEGParse * mpeg_parse, GstEvent * event)
+{
+  GstMPEGDemux *mpeg_demux = GST_MPEG_DEMUX (mpeg_parse);
+
+  if (GST_EVENT_DISCONT_NEW_MEDIA (event)) {
+    gst_mpeg_demux_reset (mpeg_demux);
+  }
+
+  if (parent_class->handle_discont != NULL)
+    parent_class->handle_discont (mpeg_parse, event);
+}
+
 static gint
 _demux_get_writer_id (GstIndex * index, GstPad * pad)
 {
index bdfa529a3f18ce85b924980b6de4159f74c0459b..19cdf54e26ee6bcca1ecad0333b95ee04c597952 100644 (file)
@@ -363,7 +363,7 @@ gst_mpeg_parse_new_pad (GstElement * element, GstPad * pad)
    * time. This is required because MPEG allows any sort of order of
    * packets, including setting base time before defining streams or
    * even adding streams halfway a stream. */
-  if (!mpeg_parse->scr_pending && !mpeg_parse->do_adjust) {
+  if (!mpeg_parse->scr_pending) {
     GstEvent *event = gst_event_new_discontinuous (FALSE,
         GST_FORMAT_TIME,
         (guint64) MPEGTIME_TO_GSTTIME (mpeg_parse->current_scr +