From f0e4bd3b5cf0250341344f887bfa3db45a8bded7 Mon Sep 17 00:00:00 2001 From: Wim Taymans Date: Sat, 2 Feb 2002 13:24:25 +0000 Subject: [PATCH] Make filesrc respond to seek Original commit message from CVS: Make filesrc respond to seek --- gst/elements/gstfilesrc.c | 14 ++++++++++++-- gst/elements/gstfilesrc.h | 1 + plugins/elements/gstfilesrc.c | 14 ++++++++++++-- plugins/elements/gstfilesrc.h | 1 + 4 files changed, 26 insertions(+), 4 deletions(-) diff --git a/gst/elements/gstfilesrc.c b/gst/elements/gstfilesrc.c index ab19264..c29b0c1 100644 --- a/gst/elements/gstfilesrc.c +++ b/gst/elements/gstfilesrc.c @@ -439,13 +439,18 @@ gst_filesrc_get (GstPad *pad) /* check for seek */ if (src->seek_happened) { src->seek_happened = FALSE; - return GST_BUFFER (gst_event_new(GST_EVENT_DISCONTINUOUS)); + return GST_BUFFER (gst_event_new (GST_EVENT_DISCONTINUOUS)); + } + /* check for flush */ + if (src->need_flush) { + src->need_flush = FALSE; + return GST_BUFFER (gst_event_new_flush ()); } /* check for EOF */ if (src->curoffset == src->filelen) { gst_element_set_eos (GST_ELEMENT (src)); - return GST_BUFFER (gst_event_new(GST_EVENT_EOS)); + return GST_BUFFER (gst_event_new (GST_EVENT_EOS)); } /* calculate end pointers so we don't have to do so repeatedly later */ @@ -650,8 +655,13 @@ gst_filesrc_srcpad_event (GstPad *pad, GstEvent *event) break; } src->seek_happened = TRUE; + src->need_flush = GST_EVENT_SEEK_FLUSH(event); gst_event_free (event); /* push a discontinuous event? */ + break; + case GST_EVENT_FLUSH: + src->need_flush = TRUE; + break; default: return FALSE; break; diff --git a/gst/elements/gstfilesrc.h b/gst/elements/gstfilesrc.h index b5081ea..8a9420e 100644 --- a/gst/elements/gstfilesrc.h +++ b/gst/elements/gstfilesrc.h @@ -74,6 +74,7 @@ struct _GstFileSrc { GMutex *map_regions_lock; gboolean seek_happened; + gboolean need_flush; }; struct _GstFileSrcClass { diff --git a/plugins/elements/gstfilesrc.c b/plugins/elements/gstfilesrc.c index ab19264..c29b0c1 100644 --- a/plugins/elements/gstfilesrc.c +++ b/plugins/elements/gstfilesrc.c @@ -439,13 +439,18 @@ gst_filesrc_get (GstPad *pad) /* check for seek */ if (src->seek_happened) { src->seek_happened = FALSE; - return GST_BUFFER (gst_event_new(GST_EVENT_DISCONTINUOUS)); + return GST_BUFFER (gst_event_new (GST_EVENT_DISCONTINUOUS)); + } + /* check for flush */ + if (src->need_flush) { + src->need_flush = FALSE; + return GST_BUFFER (gst_event_new_flush ()); } /* check for EOF */ if (src->curoffset == src->filelen) { gst_element_set_eos (GST_ELEMENT (src)); - return GST_BUFFER (gst_event_new(GST_EVENT_EOS)); + return GST_BUFFER (gst_event_new (GST_EVENT_EOS)); } /* calculate end pointers so we don't have to do so repeatedly later */ @@ -650,8 +655,13 @@ gst_filesrc_srcpad_event (GstPad *pad, GstEvent *event) break; } src->seek_happened = TRUE; + src->need_flush = GST_EVENT_SEEK_FLUSH(event); gst_event_free (event); /* push a discontinuous event? */ + break; + case GST_EVENT_FLUSH: + src->need_flush = TRUE; + break; default: return FALSE; break; diff --git a/plugins/elements/gstfilesrc.h b/plugins/elements/gstfilesrc.h index b5081ea..8a9420e 100644 --- a/plugins/elements/gstfilesrc.h +++ b/plugins/elements/gstfilesrc.h @@ -74,6 +74,7 @@ struct _GstFileSrc { GMutex *map_regions_lock; gboolean seek_happened; + gboolean need_flush; }; struct _GstFileSrcClass { -- 2.7.4