av_add_index_entry(st, pos, ast->cum_len, 0, (flags&AVIIF_INDEX) ? AVINDEX_KEYFRAME : 0); ast->cum_len += len;
if(len) av_add_index_entry(st, pos, ast->cum_len, 0, (flags&AVIIF_INDEX) ? AVINDEX_KEYFRAME : 0); if(ast->sample_size) ast->cum_len += len / ast->sample_size; else ast->cum_len ++; if(last_pos == pos) avi->non_interleaved= 1; last_pos= pos;
static int avi_read_idx1(AVFormatContext *s, int size){    ByteIOContext *pb = &s->pb;    int nb_index_entries, i;    AVStream *st;    AVIStream *ast;    unsigned int index, tag, flags, pos, len;        nb_index_entries = size / 16;    if (nb_index_entries <= 0)        return -1;    /* read the entries and sort them in each stream component */    for(i = 0; i < nb_index_entries; i++) {        tag = get_le32(pb);        flags = get_le32(pb);        pos = get_le32(pb);        len = get_le32(pb);#if defined(DEBUG_SEEK)        av_log(NULL, AV_LOG_DEBUG, "%d: tag=0x%x flags=0x%x pos=0x%x len=%d/",                i, tag, flags, pos, len);#endif        index = ((tag & 0xff) - '0') * 10;        index += ((tag >> 8) & 0xff) - '0';        if (index >= s->nb_streams)            continue;        st = s->streams[index];        ast = st->priv_data;                if(ast->sample_size)            len /= ast->sample_size;        else            len = 1;#if defined(DEBUG_SEEK)        av_log(NULL, AV_LOG_DEBUG, "%d cum_len=%d\n", len, ast->cum_len);#endif        av_add_index_entry(st, pos, ast->cum_len, 0, (flags&AVIIF_INDEX) ? AVINDEX_KEYFRAME : 0);        ast->cum_len += len;    }    return 0;}