Revision 12f1b1fe libavformat/avienc.c

View differences:

libavformat/avienc.c
50 50
    int64_t frames_hdr_strm;
51 51
    int audio_strm_length;
52 52
    int packet_count;
53
    int entry;
53 54

  
54 55
    AVIIndex indexes;
55 56
} AVIStream ;
......
461 462
    char tag[5];
462 463

  
463 464
    if (!url_is_streamed(pb)) {
465
        AVIStream *avist;
464 466
        AVIIentry* ie = 0, *tie;
465
        int entry[MAX_STREAMS];
466 467
        int empty, stream_id = -1;
467 468

  
468 469
        idx_chunk = ff_start_tag(pb, "idx1");
469
        memset(&entry[0], 0, sizeof(entry));
470
        for(i=0; i<s->nb_streams; i++){
471
            avist= s->streams[i]->priv_data;
472
            avist->entry=0;
473
        }
474

  
470 475
        do {
471 476
            empty = 1;
472 477
            for (i=0; i<s->nb_streams; i++) {
473
                AVIStream *avist= s->streams[i]->priv_data;
474
                 if (avist->indexes.entry <= entry[i])
478
                avist= s->streams[i]->priv_data;
479
                 if (avist->indexes.entry <= avist->entry)
475 480
                     continue;
476 481

  
477
                 tie = avi_get_ientry(&avist->indexes, entry[i]);
482
                 tie = avi_get_ientry(&avist->indexes, avist->entry);
478 483
                 if (empty || tie->pos < ie->pos) {
479 484
                     ie = tie;
480 485
                     stream_id = i;
......
482 487
                 empty = 0;
483 488
            }
484 489
            if (!empty) {
490
                avist= s->streams[stream_id]->priv_data;
485 491
                avi_stream2fourcc(&tag[0], stream_id,
486 492
                                  s->streams[stream_id]->codec->codec_type);
487 493
                put_tag(pb, &tag[0]);
488 494
                put_le32(pb, ie->flags);
489 495
                put_le32(pb, ie->pos);
490 496
                put_le32(pb, ie->len);
491
                entry[stream_id]++;
497
                avist->entry++;
492 498
            }
493 499
        } while (!empty);
494 500
        ff_end_tag(pb, idx_chunk);

Also available in: Unified diff