Commit 9593e7e0 authored by bcoudurier's avatar bcoudurier

check only existing streams

git-svn-id: file:///var/local/repositories/ffmpeg/trunk@5521 9553f0bf-9b14-0410-a0b8-cfaf0461ba5b
parent bea92b50
...@@ -993,7 +993,7 @@ static int mov_write_mvhd_tag(ByteIOContext *pb, MOVContext *mov) ...@@ -993,7 +993,7 @@ static int mov_write_mvhd_tag(ByteIOContext *pb, MOVContext *mov)
int64_t maxTrackLenTemp, maxTrackLen = 0; int64_t maxTrackLenTemp, maxTrackLen = 0;
int version; int version;
for (i=0; i<MAX_STREAMS; i++) { for (i=0; i<mov->nb_streams; i++) {
if(mov->tracks[i].entry > 0) { if(mov->tracks[i].entry > 0) {
maxTrackLenTemp = av_rescale_rnd(mov->tracks[i].trackDuration, globalTimescale, mov->tracks[i].timescale, AV_ROUND_UP); maxTrackLenTemp = av_rescale_rnd(mov->tracks[i].trackDuration, globalTimescale, mov->tracks[i].timescale, AV_ROUND_UP);
if(maxTrackLen < maxTrackLenTemp) if(maxTrackLen < maxTrackLenTemp)
...@@ -1183,7 +1183,7 @@ static int mov_write_udta_tag(ByteIOContext *pb, MOVContext* mov, ...@@ -1183,7 +1183,7 @@ static int mov_write_udta_tag(ByteIOContext *pb, MOVContext* mov,
if(mov->mode == MODE_MOV){ // the title field breaks gtkpod with mp4 and my suspicion is that stuff isnt valid in mp4 if(mov->mode == MODE_MOV){ // the title field breaks gtkpod with mp4 and my suspicion is that stuff isnt valid in mp4
/* Requirements */ /* Requirements */
for (i=0; i<MAX_STREAMS; i++) { for (i=0; i<mov->nb_streams; i++) {
if(mov->tracks[i].entry <= 0) continue; if(mov->tracks[i].entry <= 0) continue;
if (mov->tracks[i].enc->codec_id == CODEC_ID_AAC || if (mov->tracks[i].enc->codec_id == CODEC_ID_AAC ||
mov->tracks[i].enc->codec_id == CODEC_ID_MPEG4) { mov->tracks[i].enc->codec_id == CODEC_ID_MPEG4) {
...@@ -1303,7 +1303,7 @@ static int mov_write_moov_tag(ByteIOContext *pb, MOVContext *mov, ...@@ -1303,7 +1303,7 @@ static int mov_write_moov_tag(ByteIOContext *pb, MOVContext *mov,
put_tag(pb, "moov"); put_tag(pb, "moov");
mov->timescale = globalTimescale; mov->timescale = globalTimescale;
for (i=0; i<MAX_STREAMS; i++) { for (i=0; i<mov->nb_streams; i++) {
if(mov->tracks[i].entry <= 0) continue; if(mov->tracks[i].entry <= 0) continue;
if(mov->tracks[i].enc->codec_type == CODEC_TYPE_VIDEO) { if(mov->tracks[i].enc->codec_type == CODEC_TYPE_VIDEO) {
...@@ -1322,7 +1322,7 @@ static int mov_write_moov_tag(ByteIOContext *pb, MOVContext *mov, ...@@ -1322,7 +1322,7 @@ static int mov_write_moov_tag(ByteIOContext *pb, MOVContext *mov,
mov_write_mvhd_tag(pb, mov); mov_write_mvhd_tag(pb, mov);
//mov_write_iods_tag(pb, mov); //mov_write_iods_tag(pb, mov);
for (i=0; i<MAX_STREAMS; i++) { for (i=0; i<mov->nb_streams; i++) {
if(mov->tracks[i].entry > 0) { if(mov->tracks[i].entry > 0) {
mov_write_trak_tag(pb, &(mov->tracks[i])); mov_write_trak_tag(pb, &(mov->tracks[i]));
} }
...@@ -1484,6 +1484,7 @@ static int mov_write_header(AVFormatContext *s) ...@@ -1484,6 +1484,7 @@ static int mov_write_header(AVFormatContext *s)
mov_write_mdat_tag(pb, mov); mov_write_mdat_tag(pb, mov);
mov->time = s->timestamp + 0x7C25B080; //1970 based -> 1904 based mov->time = s->timestamp + 0x7C25B080; //1970 based -> 1904 based
mov->nb_streams = s->nb_streams;
put_flush_packet(pb); put_flush_packet(pb);
...@@ -1606,7 +1607,7 @@ static int mov_write_trailer(AVFormatContext *s) ...@@ -1606,7 +1607,7 @@ static int mov_write_trailer(AVFormatContext *s)
mov_write_moov_tag(pb, mov, s); mov_write_moov_tag(pb, mov, s);
for (i=0; i<MAX_STREAMS; i++) { for (i=0; i<mov->nb_streams; i++) {
av_freep(&mov->tracks[i].cluster); av_freep(&mov->tracks[i].cluster);
if( mov->tracks[i].vosLen ) av_free( mov->tracks[i].vosData ); if( mov->tracks[i].vosLen ) av_free( mov->tracks[i].vosData );
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment