diff options
-rw-r--r-- | ChangeLog | 8 | ||||
-rw-r--r-- | gst-libs/gst/riff/riff-read.c | 32 |
2 files changed, 26 insertions, 14 deletions
@@ -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): diff --git a/gst-libs/gst/riff/riff-read.c b/gst-libs/gst/riff/riff-read.c index 4948db38..0bf986f9 100644 --- a/gst-libs/gst/riff/riff-read.c +++ b/gst-libs/gst/riff/riff-read.c @@ -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; |