summaryrefslogtreecommitdiffstats
path: root/gst-libs
diff options
context:
space:
mode:
authorRonald S. Bultje <rbultje@ronald.bitfreak.net>2004-01-30 12:37:58 +0000
committerRonald S. Bultje <rbultje@ronald.bitfreak.net>2004-01-30 12:37:58 +0000
commit8032ddd30a60666e26324c132869760bdd0bcee2 (patch)
tree004495b710e540267ef10c859cb8192c16577468 /gst-libs
parent9718c77293e83d8569aa5efd4ab4abb913723585 (diff)
downloadgst-plugins-bad-8032ddd30a60666e26324c132869760bdd0bcee2.tar.gz
gst-plugins-bad-8032ddd30a60666e26324c132869760bdd0bcee2.tar.bz2
gst-plugins-bad-8032ddd30a60666e26324c132869760bdd0bcee2.zip
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.
Diffstat (limited to 'gst-libs')
-rw-r--r--gst-libs/gst/riff/riff-read.c32
1 files changed, 18 insertions, 14 deletions
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;