comparison avienc.c @ 5598:cf1aeb986fd2 libavformat

Remove last MAX_STREAMS from avienc.c
author michael
date Thu, 28 Jan 2010 03:37:22 +0000
parents d7c68046a431
children 5f128b4359e7
comparison
equal deleted inserted replaced
5597:d7c68046a431 5598:cf1aeb986fd2
48 48
49 typedef struct { 49 typedef struct {
50 int64_t frames_hdr_strm; 50 int64_t frames_hdr_strm;
51 int audio_strm_length; 51 int audio_strm_length;
52 int packet_count; 52 int packet_count;
53 int entry;
53 54
54 AVIIndex indexes; 55 AVIIndex indexes;
55 } AVIStream ; 56 } AVIStream ;
56 57
57 static inline AVIIentry* avi_get_ientry(AVIIndex* idx, int ent_id) 58 static inline AVIIentry* avi_get_ientry(AVIIndex* idx, int ent_id)
459 int64_t idx_chunk; 460 int64_t idx_chunk;
460 int i; 461 int i;
461 char tag[5]; 462 char tag[5];
462 463
463 if (!url_is_streamed(pb)) { 464 if (!url_is_streamed(pb)) {
465 AVIStream *avist;
464 AVIIentry* ie = 0, *tie; 466 AVIIentry* ie = 0, *tie;
465 int entry[MAX_STREAMS];
466 int empty, stream_id = -1; 467 int empty, stream_id = -1;
467 468
468 idx_chunk = ff_start_tag(pb, "idx1"); 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 do { 475 do {
471 empty = 1; 476 empty = 1;
472 for (i=0; i<s->nb_streams; i++) { 477 for (i=0; i<s->nb_streams; i++) {
473 AVIStream *avist= s->streams[i]->priv_data; 478 avist= s->streams[i]->priv_data;
474 if (avist->indexes.entry <= entry[i]) 479 if (avist->indexes.entry <= avist->entry)
475 continue; 480 continue;
476 481
477 tie = avi_get_ientry(&avist->indexes, entry[i]); 482 tie = avi_get_ientry(&avist->indexes, avist->entry);
478 if (empty || tie->pos < ie->pos) { 483 if (empty || tie->pos < ie->pos) {
479 ie = tie; 484 ie = tie;
480 stream_id = i; 485 stream_id = i;
481 } 486 }
482 empty = 0; 487 empty = 0;
483 } 488 }
484 if (!empty) { 489 if (!empty) {
490 avist= s->streams[stream_id]->priv_data;
485 avi_stream2fourcc(&tag[0], stream_id, 491 avi_stream2fourcc(&tag[0], stream_id,
486 s->streams[stream_id]->codec->codec_type); 492 s->streams[stream_id]->codec->codec_type);
487 put_tag(pb, &tag[0]); 493 put_tag(pb, &tag[0]);
488 put_le32(pb, ie->flags); 494 put_le32(pb, ie->flags);
489 put_le32(pb, ie->pos); 495 put_le32(pb, ie->pos);
490 put_le32(pb, ie->len); 496 put_le32(pb, ie->len);
491 entry[stream_id]++; 497 avist->entry++;
492 } 498 }
493 } while (!empty); 499 } while (!empty);
494 ff_end_tag(pb, idx_chunk); 500 ff_end_tag(pb, idx_chunk);
495 501
496 avi_write_counters(s, avi->riff_id); 502 avi_write_counters(s, avi->riff_id);