From ef6bdb01be4492972d7e2d137b73be213327cf55 Mon Sep 17 00:00:00 2001 From: Julien Moutte Date: Thu, 29 Jan 2004 22:43:41 +0000 Subject: [PATCH] gst/elements/gstfilesrc.c: Fixing seeking by making FLUSH happen again and even before DISCONT. Original commit message from CVS: 2004-01-29 Julien MOUTTE * gst/elements/gstfilesrc.c: (gst_filesrc_get), (gst_filesrc_uri_handler_init): Fixing seeking by making FLUSH happen again and even before DISCONT. * gst/gstpad.c: (gst_pad_event_default): Remove a unused switch case. * libs/gst/bytestream/bytestream.c: (gst_bytestream_get_next_buf): Fix bytestream so that it's not stopping to fill the bytestream if events different than EOS or DISCONT are received. Instead it process them so that they go downstream. --- ChangeLog | 11 +++++++++++ gst/elements/gstfilesrc.c | 14 ++++++-------- gst/gstpad.c | 1 - libs/gst/bytestream/bytestream.c | 15 +++++++++++++-- plugins/elements/gstfilesrc.c | 14 ++++++-------- 5 files changed, 36 insertions(+), 19 deletions(-) diff --git a/ChangeLog b/ChangeLog index 4ab378f..d117264 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,14 @@ +2004-01-29 Julien MOUTTE + + * gst/elements/gstfilesrc.c: (gst_filesrc_get), + (gst_filesrc_uri_handler_init): Fixing seeking by making FLUSH happen + again and even before DISCONT. + * gst/gstpad.c: (gst_pad_event_default): Remove a unused switch case. + * libs/gst/bytestream/bytestream.c: (gst_bytestream_get_next_buf): Fix + bytestream so that it's not stopping to fill the bytestream if events + different than EOS or DISCONT are received. Instead it process them so + that they go downstream. + 2004-01-29 Thomas Vander Stichele * docs/Makefile.am: diff --git a/gst/elements/gstfilesrc.c b/gst/elements/gstfilesrc.c index d933591..569fa42 100644 --- a/gst/elements/gstfilesrc.c +++ b/gst/elements/gstfilesrc.c @@ -667,6 +667,12 @@ gst_filesrc_get (GstPad *pad) src = GST_FILESRC (gst_pad_get_parent (pad)); g_return_val_if_fail (GST_FLAG_IS_SET (src, GST_FILESRC_OPEN), NULL); + /* check for flush */ + if (src->need_flush) { + src->need_flush = FALSE; + GST_DEBUG_OBJECT (src, "sending flush"); + return GST_DATA (gst_event_new_flush ()); + } /* check for seek */ if (src->seek_happened) { GstEvent *event; @@ -674,15 +680,8 @@ gst_filesrc_get (GstPad *pad) src->seek_happened = FALSE; GST_DEBUG_OBJECT (src, "sending discont"); event = gst_event_new_discontinuous (FALSE, GST_FORMAT_BYTES, src->curoffset, NULL); - src->need_flush = FALSE; return GST_DATA (event); } - /* check for flush */ - if (src->need_flush) { - src->need_flush = FALSE; - GST_DEBUG_OBJECT (src, "sending flush"); - return GST_DATA (gst_event_new_flush ()); - } /* check for EOF */ g_assert (src->curoffset <= src->filelen); @@ -997,4 +996,3 @@ gst_filesrc_uri_handler_init (gpointer g_iface, gpointer iface_data) iface->get_uri = gst_filesrc_uri_get_uri; iface->set_uri = gst_filesrc_uri_set_uri; } - diff --git a/gst/gstpad.c b/gst/gstpad.c index 9b35439..5ea3281 100644 --- a/gst/gstpad.c +++ b/gst/gstpad.c @@ -3527,7 +3527,6 @@ gst_pad_event_default (GstPad *pad, GstEvent *event) } } } - case GST_EVENT_FLUSH: default: return gst_pad_event_default_dispatch (pad, element, event); } diff --git a/libs/gst/bytestream/bytestream.c b/libs/gst/bytestream/bytestream.c index b0a2b72..829727a 100644 --- a/libs/gst/bytestream/bytestream.c +++ b/libs/gst/bytestream/bytestream.c @@ -156,8 +156,19 @@ gst_bytestream_get_next_buf (GstByteStream *bs) return FALSE; if (GST_IS_EVENT (nextbuf)) { - bs->event = GST_EVENT (nextbuf); - return FALSE; + GstEvent *event = GST_EVENT (nextbuf); + switch (GST_EVENT_TYPE (event)) { + case GST_EVENT_EOS: + case GST_EVENT_DISCONTINUOUS: + GST_DEBUG ("get_next_buf: received EOS event."); + bs->event = event; + return FALSE; + default: + GST_DEBUG ("get_next_buf: received event %d, forwarding", + GST_EVENT_TYPE (event)); + gst_pad_event_default (bs->pad, event); + return TRUE; + } } if (GST_BUFFER_TIMESTAMP_IS_VALID (nextbuf)) diff --git a/plugins/elements/gstfilesrc.c b/plugins/elements/gstfilesrc.c index d933591..569fa42 100644 --- a/plugins/elements/gstfilesrc.c +++ b/plugins/elements/gstfilesrc.c @@ -667,6 +667,12 @@ gst_filesrc_get (GstPad *pad) src = GST_FILESRC (gst_pad_get_parent (pad)); g_return_val_if_fail (GST_FLAG_IS_SET (src, GST_FILESRC_OPEN), NULL); + /* check for flush */ + if (src->need_flush) { + src->need_flush = FALSE; + GST_DEBUG_OBJECT (src, "sending flush"); + return GST_DATA (gst_event_new_flush ()); + } /* check for seek */ if (src->seek_happened) { GstEvent *event; @@ -674,15 +680,8 @@ gst_filesrc_get (GstPad *pad) src->seek_happened = FALSE; GST_DEBUG_OBJECT (src, "sending discont"); event = gst_event_new_discontinuous (FALSE, GST_FORMAT_BYTES, src->curoffset, NULL); - src->need_flush = FALSE; return GST_DATA (event); } - /* check for flush */ - if (src->need_flush) { - src->need_flush = FALSE; - GST_DEBUG_OBJECT (src, "sending flush"); - return GST_DATA (gst_event_new_flush ()); - } /* check for EOF */ g_assert (src->curoffset <= src->filelen); @@ -997,4 +996,3 @@ gst_filesrc_uri_handler_init (gpointer g_iface, gpointer iface_data) iface->get_uri = gst_filesrc_uri_get_uri; iface->set_uri = gst_filesrc_uri_set_uri; } - -- 2.7.4