From 971b4e361440edbbaba8a8061284611a694a9af4 Mon Sep 17 00:00:00 2001 From: Mark Nauwelaerts Date: Wed, 16 May 2007 12:48:43 +0000 Subject: [PATCH] gst/mpegstream/: Reset last_flow values for the various streams after a flushing seek, otherwise we might aggregate w... Original commit message from CVS: Based on patch by: Mark Nauwelaerts * 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 | 13 +++++++++++ common | 2 +- gst/mpegstream/gstdvddemux.c | 4 ++++ gst/mpegstream/gstmpegdemux.c | 42 +++++++++++++++++++++++++++++++++++ gst/mpegstream/gstmpegdemux.h | 7 ++++-- 5 files changed, 65 insertions(+), 3 deletions(-) diff --git a/ChangeLog b/ChangeLog index 090b56e0cd..cb99f28b12 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,16 @@ +2007-05-16 Tim-Philipp Müller + + Based on patch by: Mark Nauwelaerts + + * 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 * gst/asfdemux/gstasfdemux.c: (gst_asf_demux_reset), diff --git a/common b/common index 61edc2dc7b..b5971d76cc 160000 --- a/common +++ b/common @@ -1 +1 @@ -Subproject commit 61edc2dc7b8eba179d85a6545e46e0d65239e94d +Subproject commit b5971d76ccd216c27e095c02c3a369a9d05cb36d diff --git a/gst/mpegstream/gstdvddemux.c b/gst/mpegstream/gstdvddemux.c index 76f0aca9b8..8a7130c6f4 100644 --- a/gst/mpegstream/gstdvddemux.c +++ b/gst/mpegstream/gstdvddemux.c @@ -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: diff --git a/gst/mpegstream/gstmpegdemux.c b/gst/mpegstream/gstmpegdemux.c index f3b41edaec..0a2e0c3c4a 100644 --- a/gst/mpegstream/gstmpegdemux.c +++ b/gst/mpegstream/gstmpegdemux.c @@ -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) diff --git a/gst/mpegstream/gstmpegdemux.h b/gst/mpegstream/gstmpegdemux.h index cdc77eeee1..c810595786 100644 --- a/gst/mpegstream/gstmpegdemux.h +++ b/gst/mpegstream/gstmpegdemux.h @@ -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