[FFmpeg-devel] [PATCH 3/6] nutdec: Flip the direction for seeking with an index in the failure case.

Michael Niedermayer michaelni at gmx.at
Sun Aug 19 23:39:09 CEST 2012


This is closer to how seeking works without an index

Signed-off-by: Michael Niedermayer <michaelni at gmx.at>
---
 libavformat/nutdec.c |    2 ++
 1 file changed, 2 insertions(+)

diff --git a/libavformat/nutdec.c b/libavformat/nutdec.c
index ba3eb85..3389c79 100644
--- a/libavformat/nutdec.c
+++ b/libavformat/nutdec.c
@@ -951,6 +951,8 @@ static int read_seek(AVFormatContext *s, int stream_index,
     if (st->index_entries) {
         int index = av_index_search_timestamp(st, pts, flags);
         if (index < 0)
+            index = av_index_search_timestamp(st, pts, flags ^ AVSEEK_FLAG_BACKWARD);
+        if (index < 0)
             return -1;
 
         pos2 = st->index_entries[index].pos;
-- 
1.7.9.5



More information about the ffmpeg-devel mailing list