From a62ed3b153f13cdf24ffa511c8600394dbf94247 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Sebastian=20Dr=C3=B6ge?= Date: Mon, 11 May 2009 18:15:22 +0200 Subject: [PATCH] avidemux: Use the first entry for a given stream if the first entry is after the seek position --- gst/avi/gstavidemux.c | 17 +++++++++++++---- 1 file changed, 13 insertions(+), 4 deletions(-) diff --git a/gst/avi/gstavidemux.c b/gst/avi/gstavidemux.c index 7f17f25e38..6c81ee14c0 100644 --- a/gst/avi/gstavidemux.c +++ b/gst/avi/gstavidemux.c @@ -362,10 +362,19 @@ gst_avi_demux_index_entry_for_time (GstAviDemux * avi, (GCompareDataFunc) gst_avi_demux_index_entry_search, GST_SEARCH_MODE_BEFORE, &time, NULL); - n = (entry - avi->index_entries) / sizeof (gst_avi_index_entry); - while (entry->stream_nr != stream_nr && n > 0) { - n--; - entry = &avi->index_entries[n]; + if (entry == NULL) { + entry = &avi->index_entries[0]; + n = 0; + while (entry->stream_nr != stream_nr && n < avi->index_size - 1) { + n++; + entry = &avi->index_entries[n]; + } + } else if (entry->stream_nr != stream_nr) { + n = (entry - avi->index_entries) / sizeof (gst_avi_index_entry); + while (entry->stream_nr != stream_nr && n > 0) { + n--; + entry = &avi->index_entries[n]; + } } GST_LOG_OBJECT (avi,