[FFmpeg-cvslog] cache: Fallback to using the cache size for AVSEEK_SIZE if the underlaying protocol has nothing better .

Michael Niedermayer git at videolan.org
Sun Oct 16 17:21:23 CEST 2011


ffmpeg | branch: master | Michael Niedermayer <michaelni at gmx.at> | Sun Oct 16 16:54:27 2011 +0200| [02b651a7e39844edd573a9d057ec87a0160bef8d] | committer: Michael Niedermayer

cache: Fallback to using the cache size for AVSEEK_SIZE if the underlaying protocol has nothing better.

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

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

 libavformat/cache.c |    9 ++++++++-
 1 files changed, 8 insertions(+), 1 deletions(-)

diff --git a/libavformat/cache.c b/libavformat/cache.c
index bbc8592..c08250b 100644
--- a/libavformat/cache.c
+++ b/libavformat/cache.c
@@ -95,7 +95,14 @@ static int64_t cache_seek(URLContext *h, int64_t pos, int whence)
     Context *c= h->priv_data;
 
     if (whence == AVSEEK_SIZE) {
-        return ffurl_seek(c->inner, pos, whence);
+        pos= ffurl_seek(c->inner, pos, whence);
+        if(pos <= 0){
+            pos= ffurl_seek(c->inner, -1, SEEK_END);
+            ffurl_seek(c->inner, c->end, SEEK_SET);
+            if(pos <= 0)
+                return c->end;
+        }
+        return pos;
     }
 
     pos= lseek(c->fd, pos, whence);



More information about the ffmpeg-cvslog mailing list