diff options
author | Michael Niedermayer <michaelni@gmx.at> | 2014-10-31 02:11:19 +0100 |
---|---|---|
committer | Michael Niedermayer <michaelni@gmx.at> | 2014-10-31 02:23:33 +0100 |
commit | 61f1c96ef1be41fff7848c7ee68564875e411661 (patch) | |
tree | 075119cad66a88349ec458b728f4246130183f0b | |
parent | 8065a0cdbed7c909bdbdd4708368e6096db3752b (diff) | |
parent | 00c67fe1d0bc7c2ce49daac9c80ea39d5a663b73 (diff) | |
download | ffmpeg-61f1c96ef1be41fff7848c7ee68564875e411661.tar.gz |
Merge commit '00c67fe1d0bc7c2ce49daac9c80ea39d5a663b73'
* commit '00c67fe1d0bc7c2ce49daac9c80ea39d5a663b73':
movenc: Write a 0 duration in mdhd and tkhd for an empty initial moov
Merged-by: Michael Niedermayer <michaelni@gmx.at>
-rw-r--r-- | libavformat/movenc.c | 18 | ||||
-rw-r--r-- | tests/ref/fate/sub-movtextenc | 2 |
2 files changed, 13 insertions, 7 deletions
diff --git a/libavformat/movenc.c b/libavformat/movenc.c index 60c3c0e62f..098e2d2681 100644 --- a/libavformat/movenc.c +++ b/libavformat/movenc.c @@ -2032,7 +2032,8 @@ static int mov_write_minf_tag(AVIOContext *pb, MOVTrack *track) return update_size(pb, pos); } -static int mov_write_mdhd_tag(AVIOContext *pb, MOVTrack *track) +static int mov_write_mdhd_tag(AVIOContext *pb, MOVMuxContext *mov, + MOVTrack *track) { int version = track->track_duration < INT32_MAX ? 0 : 1; @@ -2051,8 +2052,10 @@ static int mov_write_mdhd_tag(AVIOContext *pb, MOVTrack *track) avio_wb32(pb, track->time); /* modification time */ } avio_wb32(pb, track->timescale); /* time scale (sample rate for audio) */ - if (!track->entry) + if (!track->entry && mov->mode == MODE_ISM) (version == 1) ? avio_wb64(pb, UINT64_C(0xffffffffffffffff)) : avio_wb32(pb, 0xffffffff); + else if (!track->entry) + (version == 1) ? avio_wb64(pb, 0) : avio_wb32(pb, 0); else (version == 1) ? avio_wb64(pb, track->track_duration) : avio_wb32(pb, track->track_duration); /* duration */ avio_wb16(pb, track->language); /* language */ @@ -2068,12 +2071,13 @@ static int mov_write_mdhd_tag(AVIOContext *pb, MOVTrack *track) return 32; } -static int mov_write_mdia_tag(AVIOContext *pb, MOVTrack *track) +static int mov_write_mdia_tag(AVIOContext *pb, MOVMuxContext *mov, + MOVTrack *track) { int64_t pos = avio_tell(pb); avio_wb32(pb, 0); /* size */ ffio_wfourcc(pb, "mdia"); - mov_write_mdhd_tag(pb, track); + mov_write_mdhd_tag(pb, mov, track); mov_write_hdlr_tag(pb, track); mov_write_minf_tag(pb, track); return update_size(pb, pos); @@ -2134,8 +2138,10 @@ static int mov_write_tkhd_tag(AVIOContext *pb, MOVMuxContext *mov, } avio_wb32(pb, track->track_id); /* track-id */ avio_wb32(pb, 0); /* reserved */ - if (!track->entry) + if (!track->entry && mov->mode == MODE_ISM) (version == 1) ? avio_wb64(pb, UINT64_C(0xffffffffffffffff)) : avio_wb32(pb, 0xffffffff); + else if (!track->entry) + (version == 1) ? avio_wb64(pb, 0) : avio_wb32(pb, 0); else (version == 1) ? avio_wb64(pb, duration) : avio_wb32(pb, duration); @@ -2389,7 +2395,7 @@ static int mov_write_trak_tag(AVIOContext *pb, MOVMuxContext *mov, mov_write_edts_tag(pb, mov, track); // PSP Movies and several other cases require edts box if (track->tref_tag) mov_write_tref_tag(pb, track); - mov_write_mdia_tag(pb, track); + mov_write_mdia_tag(pb, mov, track); if (track->mode == MODE_PSP) mov_write_uuid_tag_psp(pb, track); // PSP Movies require this uuid box if (track->tag == MKTAG('r','t','p',' ')) diff --git a/tests/ref/fate/sub-movtextenc b/tests/ref/fate/sub-movtextenc index 09d92beb34..e74b8f2b35 100644 --- a/tests/ref/fate/sub-movtextenc +++ b/tests/ref/fate/sub-movtextenc @@ -1 +1 @@ -d26e73c420c40a00225060d2e6532df9 +bb762c178bd8c437a9101c748c1ccb4d |