# HG changeset patch # User michael # Date 1141227727 0 # Node ID 558381bf97d289cf34c1110a2ad24f9582680d68 # Parent c21f07d85158f379aa264d7e2aada749baac060b support seeking in RenderAvi.avi (audio stream == single huge chunk) diff -r c21f07d85158 -r 558381bf97d2 avidec.c --- a/avidec.c Wed Mar 01 15:21:53 2006 +0000 +++ b/avidec.c Wed Mar 01 15:42:07 2006 +0000 @@ -147,6 +147,31 @@ return 0; } +static void clean_index(AVFormatContext *s){ + int i, j; + + for(i=0; inb_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; jsample_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; }