From: Wim T. <wt...@us...> - 2002-07-08 19:40:50
|
CVS Root: /cvsroot/gstreamer Module: gst-plugins Changes by: wtay Date: Mon Jul 08 2002 12:40:49 PDT Log message: - properly unref events - slightly better seeking Modified files: gst/avi : gstavidemux.c Links: http://cvs.sf.net/cgi-bin/viewcvs.cgi/gstreamer/gst-plugins/gst/avi/gstavidemux.c.diff?r1=1.36&r2=1.37 ====Begin Diffs==== Index: gstavidemux.c =================================================================== RCS file: /cvsroot/gstreamer/gst-plugins/gst/avi/gstavidemux.c,v retrieving revision 1.36 retrieving revision 1.37 diff -u -d -r1.36 -r1.37 --- gstavidemux.c 4 Jul 2002 16:52:03 -0000 1.36 +++ gstavidemux.c 8 Jul 2002 19:40:37 -0000 1.37 @@ -634,12 +634,14 @@ GstEvent *event; gst_bytestream_get_status (avi_demux->bs, &remaining, &event); + gst_event_unref (event); got_bytes = gst_bytestream_read (avi_demux->bs, &buf, 8); } if (GST_BUFFER_OFFSET (buf) != filepos + offset || GST_BUFFER_SIZE (buf) != 8) { - GST_INFO (GST_CAT_PLUGIN_INFO, "avidemux: could not get index"); + GST_INFO (GST_CAT_PLUGIN_INFO, "avidemux: could not get index, got %lld %d, expected %ld", + GST_BUFFER_OFFSET (buf), GST_BUFFER_SIZE (buf), filepos + offset); goto end; } @@ -957,12 +959,19 @@ GstPad *pad = GST_PAD (pads->data); if (GST_PAD_DIRECTION (pad) == GST_PAD_SRC) { - return gst_avi_demux_handle_src_event (pad, event); + /* we ref the event here as we might have to try again if the event + * failed on this pad */ + gst_event_ref (event); + if (gst_avi_demux_handle_src_event (pad, event)) { + gst_event_unref (event); + return TRUE; + } } pads = g_list_next (pads); } + gst_event_unref (event); return FALSE; } @@ -977,6 +986,7 @@ switch (GST_EVENT_TYPE (event)) { case GST_EVENT_SEEK: + GST_DEBUG (0, "seek format %d, %08x", GST_EVENT_SEEK_FORMAT (event), stream->strh.type); switch (GST_EVENT_SEEK_FORMAT (event)) { case GST_FORMAT_BYTES: case GST_FORMAT_UNITS: @@ -989,8 +999,10 @@ guint64 min_index; /* no seek on audio yet */ - if (stream->strh.type == GST_RIFF_FCC_auds) - return FALSE; + if (stream->strh.type == GST_RIFF_FCC_auds) { + res = FALSE; + goto done; + } flags = GST_RIFF_IF_KEYFRAME; @@ -1007,6 +1019,7 @@ avi_demux->last_seek = seek_entry->ts; } else { + GST_DEBUG (0, "no index entry found for time %lld", desired_offset); res = FALSE; } break; @@ -1020,7 +1033,10 @@ res = FALSE; break; } - + +done: + gst_event_unref (event); + return res; } @@ -1037,6 +1053,7 @@ switch (type) { case GST_EVENT_EOS: + gst_bytestream_flush (avi_demux->bs, remaining); gst_pad_event_default (avi_demux->sinkpad, event); break; case GST_EVENT_FLUSH: @@ -1045,15 +1062,16 @@ case GST_EVENT_DISCONTINUOUS: { gint i; + GstEvent *discont; for (i = 0; i < avi_demux->num_streams; i++) { avi_stream_context *stream = &avi_demux->stream[i]; GST_DEBUG (GST_CAT_EVENT, "sending discont on %d %lld + %lld = %lld", i, avi_demux->last_seek, stream->delay, avi_demux->last_seek + stream->delay); - event = gst_event_new_discontinuous (FALSE, GST_FORMAT_TIME, + discont = gst_event_new_discontinuous (FALSE, GST_FORMAT_TIME, avi_demux->last_seek + stream->delay , NULL); - gst_pad_push (stream->pad, GST_BUFFER (event)); + gst_pad_push (stream->pad, GST_BUFFER (discont)); } break; } @@ -1062,6 +1080,8 @@ break; } + gst_event_unref (event); + return TRUE; } @@ -1164,6 +1184,7 @@ GstEvent *event; gst_bytestream_get_status (avi_demux->bs, &remaining, &event); + gst_event_unref (event); } if (avi_demux->avih.bufsize) gst_bytestream_size_hint (avi_demux->bs, avi_demux->avih.bufsize); |