[FFmpeg-cvslog] r22557 - in trunk/libavformat: avio.c avio.h aviobuf.c

michael subversion
Mon Mar 15 23:54:23 CET 2010


Author: michael
Date: Mon Mar 15 23:54:22 2010
New Revision: 22557

Log:
Add AVSEEK_FORCE flag to indicate that the code should attempt to seek
by any means.

Modified:
   trunk/libavformat/avio.c
   trunk/libavformat/avio.h
   trunk/libavformat/aviobuf.c

Modified: trunk/libavformat/avio.c
==============================================================================
--- trunk/libavformat/avio.c	Mon Mar 15 23:49:46 2010	(r22556)
+++ trunk/libavformat/avio.c	Mon Mar 15 23:54:22 2010	(r22557)
@@ -202,7 +202,7 @@ int64_t url_seek(URLContext *h, int64_t 
 
     if (!h->prot->url_seek)
         return AVERROR(EPIPE);
-    ret = h->prot->url_seek(h, pos, whence);
+    ret = h->prot->url_seek(h, pos, whence & ~AVSEEK_FORCE);
     return ret;
 }
 

Modified: trunk/libavformat/avio.h
==============================================================================
--- trunk/libavformat/avio.h	Mon Mar 15 23:49:46 2010	(r22556)
+++ trunk/libavformat/avio.h	Mon Mar 15 23:54:22 2010	(r22557)
@@ -192,6 +192,14 @@ int64_t av_url_read_seek(URLContext *h, 
  */
 #define AVSEEK_SIZE 0x10000
 
+/**
+ * Oring this flag as into the "whence" parameter to a seek function causes it to
+ * seek by any means (like reopening and linear reading) or other normally unreasonble
+ * means that can be extreemly slow.
+ * This may be ignored by the seek code.
+ */
+#define AVSEEK_FORCE 0x20000
+
 typedef struct URLProtocol {
     const char *name;
     int (*url_open)(URLContext *h, const char *url, int flags);

Modified: trunk/libavformat/aviobuf.c
==============================================================================
--- trunk/libavformat/aviobuf.c	Mon Mar 15 23:49:46 2010	(r22556)
+++ trunk/libavformat/aviobuf.c	Mon Mar 15 23:54:22 2010	(r22557)
@@ -150,8 +150,9 @@ int64_t url_fseek(ByteIOContext *s, int6
         offset1 >= 0 && offset1 <= (s->buf_end - s->buffer)) {
         /* can do the seek inside the buffer */
         s->buf_ptr = s->buffer + offset1;
-    } else if(s->is_streamed && !s->write_flag &&
-              offset1 >= 0 && offset1 < (s->buf_end - s->buffer) + (1<<16)){
+    } else if(s->is_streamed && !s->write_flag && offset1 >= 0 &&
+              (   offset1 < (s->buf_end - s->buffer) + (1<<16)
+               || (whence & AVSEEK_FORCE))){
         while(s->pos < offset && !s->eof_reached)
             fill_buffer(s);
         if (s->eof_reached)



More information about the ffmpeg-cvslog mailing list