gst/: Fix event handling.

Original commit message from CVS:
2004-01-30  Ronald Bultje  <rbultje@ronald.bitfreak.net>

* gst-libs/gst/riff/riff-read.c: (gst_riff_peek_head),
(gst_riff_read_seek):
* gst/matroska/ebml-read.c: (gst_ebml_read_element_id),
(gst_ebml_read_seek):
Fix event handling.
This commit is contained in:
Ronald S. Bultje 2004-01-30 12:37:58 +00:00
parent 9718c77293
commit 8032ddd30a
2 changed files with 26 additions and 14 deletions

View file

@ -1,3 +1,11 @@
2004-01-30 Ronald Bultje <rbultje@ronald.bitfreak.net>
* gst-libs/gst/riff/riff-read.c: (gst_riff_peek_head),
(gst_riff_read_seek):
* gst/matroska/ebml-read.c: (gst_ebml_read_element_id),
(gst_ebml_read_seek):
Fix event handling.
2004-01-30 Benjamin Otte <in7y118@public.uni-hamburg.de>
* ext/ffmpeg/gstffmpegcodecmap.c: (gst_ffmpeg_codecid_to_caps):

View file

@ -158,19 +158,19 @@ gst_riff_peek_head (GstRiffRead *riff,
guint8 *data;
/* read */
if (gst_bytestream_peek_bytes (riff->bs, &data, 8) != 8) {
while (gst_bytestream_peek_bytes (riff->bs, &data, 8) != 8) {
GstEvent *event = NULL;
guint32 remaining;
/* Here, we might encounter EOS */
gst_bytestream_get_status (riff->bs, &remaining, &event);
if (event && GST_EVENT_TYPE (event) == GST_EVENT_EOS) {
if (event) {
gst_pad_event_default (riff->sinkpad, event);
} else {
gst_event_unref (event);
GST_ELEMENT_ERROR (riff, RESOURCE, READ, NULL, NULL);
return FALSE;
}
return FALSE;
}
/* parse tag + length (if wanted) */
@ -222,7 +222,7 @@ gst_riff_read_seek (GstRiffRead *riff,
{
guint64 length = gst_bytestream_length (riff->bs);
guint32 remaining;
GstEvent *event;
GstEvent *event = NULL;
guchar *data;
/* hack for AVI files with broken idx1 size chunk markers */
@ -246,17 +246,21 @@ gst_riff_read_seek (GstRiffRead *riff,
/* and now, peek a new byte. This will fail because there's a
* pending event. Then, take the event and return it. */
if (gst_bytestream_peek_bytes (riff->bs, &data, 1))
g_warning ("Unexpected data after seek");
while (!event) {
if (gst_bytestream_peek_bytes (riff->bs, &data, 1)) {
GST_WARNING ("Unexpected data after seek - this means seek failed");
break;
}
/* get the discont event and return */
gst_bytestream_get_status (riff->bs, &remaining, &event);
if (!event || GST_EVENT_TYPE (event) != GST_EVENT_DISCONTINUOUS) {
GST_ELEMENT_ERROR (riff, CORE, EVENT, NULL,
("No discontinuity event after seek"));
if (event)
gst_event_unref (event);
return NULL;
/* get the discont event and return */
gst_bytestream_get_status (riff->bs, &remaining, &event);
if (!event) {
GST_WARNING ("No discontinuity event after seek - seek failed");
break;
} else if (GST_EVENT_TYPE (event) != GST_EVENT_DISCONTINUOUS) {
gst_pad_event_default (riff->sinkpad, event);
event = NULL;
}
}
return event;