diff options
author | Youness Alaoui <youness.alaoui@collabora.co.uk> | 2011-08-26 22:44:08 +0000 |
---|---|---|
committer | Sebastian Dröge <sebastian.droege@collabora.co.uk> | 2011-08-30 16:17:47 +0200 |
commit | 59c61209cf87f547386f90422f31f66605ca67b1 (patch) | |
tree | 20d6f7e1f5daaa46f8fe8320662cc123c7d9773a | |
parent | cb30cd242ca5084df9eaee2154bb80a740c4a7ed (diff) |
tsdemux: Need to flush all streams when we receive a flush-start
-rw-r--r-- | gst/mpegtsdemux/mpegtsbase.c | 13 | ||||
-rw-r--r-- | gst/mpegtsdemux/mpegtsbase.h | 3 | ||||
-rw-r--r-- | gst/mpegtsdemux/tsdemux.c | 15 |
3 files changed, 28 insertions, 3 deletions
diff --git a/gst/mpegtsdemux/mpegtsbase.c b/gst/mpegtsdemux/mpegtsbase.c index e76677855..5542abf02 100644 --- a/gst/mpegtsdemux/mpegtsbase.c +++ b/gst/mpegtsdemux/mpegtsbase.c @@ -1154,6 +1154,18 @@ gst_mpegts_base_handle_eos (MpegTSBase * base) return TRUE; } +static inline void +mpegts_base_flush (MpegTSBase * base) +{ + MpegTSBaseClass *klass = GST_MPEGTS_BASE_GET_CLASS (base); + + /* Call implementation */ + if (G_UNLIKELY (klass->flush == NULL)) + GST_WARNING_OBJECT (base, "Class doesn't have a 'flush' implementation !"); + else + klass->flush (base); +} + static gboolean mpegts_base_sink_event (GstPad * pad, GstEvent * event) { @@ -1191,6 +1203,7 @@ mpegts_base_sink_event (GstPad * pad, GstEvent * event) break; case GST_EVENT_FLUSH_START: mpegts_packetizer_flush (base->packetizer); + mpegts_base_flush (base); res = GST_MPEGTS_BASE_GET_CLASS (base)->push_event (base, event); gst_event_unref (event); break; diff --git a/gst/mpegtsdemux/mpegtsbase.h b/gst/mpegtsdemux/mpegtsbase.h index 1513898ec..cce4e0fd7 100644 --- a/gst/mpegtsdemux/mpegtsbase.h +++ b/gst/mpegtsdemux/mpegtsbase.h @@ -162,6 +162,9 @@ struct _MpegTSBaseClass { /* seek is called to wait for seeking */ GstFlowReturn (*seek) (MpegTSBase * base, GstEvent * event, guint16 pid); + /* flush all streams */ + void (*flush) (MpegTSBase * base); + /* signals */ void (*pat_info) (GstStructure *pat); void (*pmt_info) (GstStructure *pmt); diff --git a/gst/mpegtsdemux/tsdemux.c b/gst/mpegtsdemux/tsdemux.c index f7dc5cc6b..3a327a5cd 100644 --- a/gst/mpegtsdemux/tsdemux.c +++ b/gst/mpegtsdemux/tsdemux.c @@ -188,6 +188,7 @@ static void gst_ts_demux_reset (MpegTSBase * base); static GstFlowReturn gst_ts_demux_push (MpegTSBase * base, MpegTSPacketizerPacket * packet, MpegTSPacketizerSection * section); +static void gst_ts_demux_flush (MpegTSBase * base); static void gst_ts_demux_stream_added (MpegTSBase * base, MpegTSBaseStream * stream, MpegTSBaseProgram * program); @@ -282,6 +283,7 @@ gst_ts_demux_class_init (GstTSDemuxClass * klass) ts_class->stream_removed = gst_ts_demux_stream_removed; ts_class->find_timestamps = GST_DEBUG_FUNCPTR (find_timestamps); ts_class->seek = GST_DEBUG_FUNCPTR (gst_ts_demux_do_seek); + ts_class->flush = GST_DEBUG_FUNCPTR (gst_ts_demux_flush); } static void @@ -882,9 +884,7 @@ gst_ts_demux_srcpad_event (GstPad * pad, GstEvent * event) switch (GST_EVENT_TYPE (event)) { case GST_EVENT_SEEK: res = mpegts_base_handle_seek_event ((MpegTSBase *) demux, pad, event); - if (res) - demux->need_newsegment = TRUE; - else + if (!res) GST_WARNING ("seeking failed"); gst_event_unref (event); break; @@ -2278,6 +2278,15 @@ gst_ts_demux_handle_packet (GstTSDemux * demux, TSDemuxStream * stream, return res; } +static void +gst_ts_demux_flush (MpegTSBase * base) +{ + GstTSDemux *demux = GST_TS_DEMUX_CAST (base); + + demux->need_newsegment = TRUE; + gst_ts_demux_flush_streams (demux); +} + static GstFlowReturn gst_ts_demux_push (MpegTSBase * base, MpegTSPacketizerPacket * packet, MpegTSPacketizerSection * section) |