[SCM] libav/experimental: support forward seeking in non seekable streams

siretart at users.alioth.debian.org siretart at users.alioth.debian.org
Sun Jun 30 15:51:03 UTC 2013


The following commit has been merged in the experimental branch:
commit 398f5d3f1db27393d1b03ad7dd26cb1d82b9448b
Author: Michael Niedermayer <michaelni at gmx.at>
Date:   Tue Sep 26 17:09:03 2006 +0000

    support forward seeking in non seekable streams
    
    Originally committed as revision 6340 to svn://svn.ffmpeg.org/ffmpeg/trunk

diff --git a/libavformat/aviobuf.c b/libavformat/aviobuf.c
index ef72c19..dced0d2 100644
--- a/libavformat/aviobuf.c
+++ b/libavformat/aviobuf.c
@@ -22,6 +22,8 @@
 
 #define IO_BUFFER_SIZE 32768
 
+static void fill_buffer(ByteIOContext *s);
+
 int init_put_byte(ByteIOContext *s,
                   unsigned char *buffer,
                   int buffer_size,
@@ -122,6 +124,11 @@ offset_t url_fseek(ByteIOContext *s, offset_t offset, int whence)
         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)){
+        while(s->pos < offset && !s->eof_reached)
+            fill_buffer(s);
+        s->buf_ptr = s->buf_end + offset - s->pos;
     } else {
 #ifdef CONFIG_MUXERS
         if (s->write_flag) {

-- 
Libav/FFmpeg packaging



More information about the pkg-multimedia-commits mailing list