[FFmpeg-cvslog] avidec: print informative error messages if seeking fails.

Michael Niedermayer git at videolan.org
Tue Jan 31 00:23:30 CET 2012


ffmpeg | branch: master | Michael Niedermayer <michaelni at gmx.at> | Mon Jan 30 23:52:03 2012 +0100| [b8c16558828e73e933ae73b5888345d50e897dfc] | committer: Michael Niedermayer

avidec: print informative error messages if seeking fails.

Signed-off-by: Michael Niedermayer <michaelni at gmx.at>

> http://git.videolan.org/gitweb.cgi/ffmpeg.git/?a=commit;h=b8c16558828e73e933ae73b5888345d50e897dfc
---

 libavformat/avidec.c |   11 ++++++++++-
 1 files changed, 10 insertions(+), 1 deletions(-)

diff --git a/libavformat/avidec.c b/libavformat/avidec.c
index 93b15bd..704980c 100644
--- a/libavformat/avidec.c
+++ b/libavformat/avidec.c
@@ -1386,7 +1386,14 @@ static int avi_read_seek(AVFormatContext *s, int stream_index, int64_t timestamp
     ast= st->priv_data;
     index= av_index_search_timestamp(st, timestamp * FFMAX(ast->sample_size, 1), flags);
     if(index<0)
+    if (index<0) {
+        if (st->nb_index_entries > 0)
+            av_log(s, AV_LOG_ERROR, "Failed to find timestamp %"PRId64 " in index %"PRId64 " .. %"PRId64 "\n",
+                   timestamp * FFMAX(ast->sample_size, 1),
+                   st->index_entries[0].timestamp,
+                   st->index_entries[st->nb_index_entries - 1].timestamp);
         return -1;
+    }
 
     /* find the position */
     pos = st->index_entries[index].pos;
@@ -1457,8 +1464,10 @@ static int avi_read_seek(AVFormatContext *s, int stream_index, int64_t timestamp
     }
 
     /* do the seek */
-    if (avio_seek(s->pb, pos_min, SEEK_SET) < 0)
+    if (avio_seek(s->pb, pos_min, SEEK_SET) < 0) {
+        av_log(s, AV_LOG_ERROR, "Seek failed\n");
         return -1;
+    }
     avi->stream_index= -1;
     avi->dts_max= INT_MIN;
     return 0;



More information about the ffmpeg-cvslog mailing list