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  <julien@moutte.net>

* 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.
This commit is contained in:
Julien Moutte 2004-01-29 22:43:41 +00:00
parent 55b67f084d
commit ef6bdb01be
5 changed files with 36 additions and 19 deletions

View file

@ -1,3 +1,14 @@
2004-01-29 Julien MOUTTE <julien@moutte.net>
* 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 <thomas at apestaart dot org> 2004-01-29 Thomas Vander Stichele <thomas at apestaart dot org>
* docs/Makefile.am: * docs/Makefile.am:

View file

@ -667,6 +667,12 @@ gst_filesrc_get (GstPad *pad)
src = GST_FILESRC (gst_pad_get_parent (pad)); src = GST_FILESRC (gst_pad_get_parent (pad));
g_return_val_if_fail (GST_FLAG_IS_SET (src, GST_FILESRC_OPEN), NULL); 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 */ /* check for seek */
if (src->seek_happened) { if (src->seek_happened) {
GstEvent *event; GstEvent *event;
@ -674,15 +680,8 @@ gst_filesrc_get (GstPad *pad)
src->seek_happened = FALSE; src->seek_happened = FALSE;
GST_DEBUG_OBJECT (src, "sending discont"); GST_DEBUG_OBJECT (src, "sending discont");
event = gst_event_new_discontinuous (FALSE, GST_FORMAT_BYTES, src->curoffset, NULL); event = gst_event_new_discontinuous (FALSE, GST_FORMAT_BYTES, src->curoffset, NULL);
src->need_flush = FALSE;
return GST_DATA (event); 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 */ /* check for EOF */
g_assert (src->curoffset <= src->filelen); 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->get_uri = gst_filesrc_uri_get_uri;
iface->set_uri = gst_filesrc_uri_set_uri; iface->set_uri = gst_filesrc_uri_set_uri;
} }

View file

@ -3527,7 +3527,6 @@ gst_pad_event_default (GstPad *pad, GstEvent *event)
} }
} }
} }
case GST_EVENT_FLUSH:
default: default:
return gst_pad_event_default_dispatch (pad, element, event); return gst_pad_event_default_dispatch (pad, element, event);
} }

View file

@ -156,8 +156,19 @@ gst_bytestream_get_next_buf (GstByteStream *bs)
return FALSE; return FALSE;
if (GST_IS_EVENT (nextbuf)) { if (GST_IS_EVENT (nextbuf)) {
bs->event = GST_EVENT (nextbuf); GstEvent *event = GST_EVENT (nextbuf);
return FALSE; 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)) if (GST_BUFFER_TIMESTAMP_IS_VALID (nextbuf))

View file

@ -667,6 +667,12 @@ gst_filesrc_get (GstPad *pad)
src = GST_FILESRC (gst_pad_get_parent (pad)); src = GST_FILESRC (gst_pad_get_parent (pad));
g_return_val_if_fail (GST_FLAG_IS_SET (src, GST_FILESRC_OPEN), NULL); 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 */ /* check for seek */
if (src->seek_happened) { if (src->seek_happened) {
GstEvent *event; GstEvent *event;
@ -674,15 +680,8 @@ gst_filesrc_get (GstPad *pad)
src->seek_happened = FALSE; src->seek_happened = FALSE;
GST_DEBUG_OBJECT (src, "sending discont"); GST_DEBUG_OBJECT (src, "sending discont");
event = gst_event_new_discontinuous (FALSE, GST_FORMAT_BYTES, src->curoffset, NULL); event = gst_event_new_discontinuous (FALSE, GST_FORMAT_BYTES, src->curoffset, NULL);
src->need_flush = FALSE;
return GST_DATA (event); 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 */ /* check for EOF */
g_assert (src->curoffset <= src->filelen); 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->get_uri = gst_filesrc_uri_get_uri;
iface->set_uri = gst_filesrc_uri_set_uri; iface->set_uri = gst_filesrc_uri_set_uri;
} }