diff options
Diffstat (limited to 'gst/avi/gstavidemux.c')
-rw-r--r-- | gst/avi/gstavidemux.c | 16 |
1 files changed, 13 insertions, 3 deletions
diff --git a/gst/avi/gstavidemux.c b/gst/avi/gstavidemux.c index d4aa1d6f..a3a1b5dc 100644 --- a/gst/avi/gstavidemux.c +++ b/gst/avi/gstavidemux.c @@ -2596,10 +2596,11 @@ gst_avi_demux_index_for_time (GstAviDemux * avi, } else { index = avi_stream_convert_time_to_frames_unchecked (stream, time); } - } else { + } else if (stream->strh->type == GST_RIFF_FCC_auds) { /* constant rate stream */ total = avi_stream_convert_time_to_bytes_unchecked (stream, time); - } + } else + return -1; if (index == -1) { GstAviIndexEntry *entry; @@ -2716,7 +2717,8 @@ gst_avi_demux_parse_index (GstAviDemux * avi, GstBuffer * buf) if (stream->strh->type == GST_RIFF_FCC_auds) { /* all audio frames are keyframes */ ENTRY_SET_KEYFRAME (&entry); - } else if (stream->strf.vids->compression == GST_RIFF_DXSB) { + } else if (stream->strh->type == GST_RIFF_FCC_vids && + stream->strf.vids->compression == GST_RIFF_DXSB) { /* all xsub frames are keyframes */ ENTRY_SET_KEYFRAME (&entry); } else { @@ -4124,6 +4126,8 @@ gst_avi_demux_do_seek (GstAviDemux * avi, GstSegment * segment) /* get the entry index for the requested position */ index = gst_avi_demux_index_for_time (avi, stream, seek_time); GST_DEBUG_OBJECT (avi, "Got entry %u", index); + if (index == -1) + return FALSE; /* check if we are already on a keyframe */ if (!ENTRY_IS_KEYFRAME (&stream->index[index])) { @@ -4175,6 +4179,8 @@ gst_avi_demux_do_seek (GstAviDemux * avi, GstSegment * segment) /* get the entry index for the requested position */ index = gst_avi_demux_index_for_time (avi, ostream, seek_time); + if (index == -1) + continue; /* move to previous keyframe */ if (!ENTRY_IS_KEYFRAME (&ostream->index[index])) @@ -4402,6 +4408,8 @@ avi_demux_handle_seek_push (GstAviDemux * avi, GstPad * pad, GstEvent * event) index = gst_avi_demux_index_for_time (avi, stream, cur); GST_DEBUG_OBJECT (avi, "str %u: Found entry %u for %" GST_TIME_FORMAT, str_num, index, GST_TIME_ARGS (cur)); + if (index == -1) + return -1; /* check if we are already on a keyframe */ if (!ENTRY_IS_KEYFRAME (&stream->index[index])) { @@ -4452,6 +4460,8 @@ avi_demux_handle_seek_push (GstAviDemux * avi, GstPad * pad, GstEvent * event) idx = gst_avi_demux_index_for_time (avi, str, cur); GST_DEBUG_OBJECT (avi, "str %u: Found entry %u for %" GST_TIME_FORMAT, n, idx, GST_TIME_ARGS (cur)); + if (idx == -1) + continue; /* check if we are already on a keyframe */ if (!ENTRY_IS_KEYFRAME (&str->index[idx])) { |