[Ffmpeg-cvslog] CVS: ffmpeg/libavformat avidec.c,1.84,1.85

Michael Niedermayer CVS michael
Wed Mar 1 16:42:09 CET 2006


Update of /cvsroot/ffmpeg/ffmpeg/libavformat
In directory mail:/var2/tmp/cvs-serv14128

Modified Files:
	avidec.c 
Log Message:
support seeking in RenderAvi.avi (audio stream == single huge chunk)


Index: avidec.c
===================================================================
RCS file: /cvsroot/ffmpeg/ffmpeg/libavformat/avidec.c,v
retrieving revision 1.84
retrieving revision 1.85
diff -u -d -r1.84 -r1.85
--- avidec.c	1 Mar 2006 15:21:53 -0000	1.84
+++ avidec.c	1 Mar 2006 15:42:07 -0000	1.85
@@ -147,6 +147,31 @@
     return 0;
 }
 
+static void clean_index(AVFormatContext *s){
+    int i, j;
+
+    for(i=0; i<s->nb_streams; i++){
+        AVStream *st = s->streams[i];
+        AVIStream *ast = st->priv_data;
+        int n= st->nb_index_entries;
+        int max= ast->sample_size;
+        int64_t pos, size, ts;
+
+        if(n != 1 || ast->sample_size==0)
+            continue;
+
+        while(max < 1024) max+=max;
+
+        pos= st->index_entries[0].pos;
+        size= st->index_entries[0].size;
+        ts= st->index_entries[0].timestamp;
+
+        for(j=0; j<size; j+=max){
+            av_add_index_entry(st, pos+j, ts + j/ast->sample_size, FFMIN(max, size-j), 0, AVINDEX_KEYFRAME);
+        }
+    }
+}
+
 static int avi_read_header(AVFormatContext *s, AVFormatParameters *ap)
 {
     AVIContext *avi = s->priv_data;
@@ -419,6 +444,8 @@
         avi_load_index(s);
     avi->index_loaded = 1;
     avi->non_interleaved |= guess_ni_flag(s);
+    if(avi->non_interleaved)
+        clean_index(s);
 
     return 0;
 }





More information about the ffmpeg-cvslog mailing list