Commit ceca49bc authored by michael's avatar michael

round duration up in mov


git-svn-id: file:///var/local/repositories/ffmpeg/trunk@4242 9553f0bf-9b14-0410-a0b8-cfaf0461ba5b
parent 080f95dc
...@@ -715,7 +715,6 @@ static int mov_write_mdia_tag(ByteIOContext *pb, MOVTrack* track) ...@@ -715,7 +715,6 @@ static int mov_write_mdia_tag(ByteIOContext *pb, MOVTrack* track)
static int mov_write_tkhd_tag(ByteIOContext *pb, MOVTrack* track) static int mov_write_tkhd_tag(ByteIOContext *pb, MOVTrack* track)
{ {
int64_t maxTrackLenTemp;
put_be32(pb, 0x5c); /* size (always 0x5c) */ put_be32(pb, 0x5c); /* size (always 0x5c) */
put_tag(pb, "tkhd"); put_tag(pb, "tkhd");
put_be32(pb, 0xf); /* version & flags (track enabled) */ put_be32(pb, 0xf); /* version & flags (track enabled) */
...@@ -723,8 +722,7 @@ static int mov_write_tkhd_tag(ByteIOContext *pb, MOVTrack* track) ...@@ -723,8 +722,7 @@ static int mov_write_tkhd_tag(ByteIOContext *pb, MOVTrack* track)
put_be32(pb, track->time); /* modification time */ put_be32(pb, track->time); /* modification time */
put_be32(pb, track->trackID); /* track-id */ put_be32(pb, track->trackID); /* track-id */
put_be32(pb, 0); /* reserved */ put_be32(pb, 0); /* reserved */
maxTrackLenTemp = ((int64_t)globalTimescale*(int64_t)track->trackDuration)/(int64_t)track->timescale; put_be32(pb, av_rescale_rnd(track->trackDuration, globalTimescale, track->timescale, AV_ROUND_UP)); /* duration */
put_be32(pb, (long)maxTrackLenTemp); /* duration */
put_be32(pb, 0); /* reserved */ put_be32(pb, 0); /* reserved */
put_be32(pb, 0); /* reserved */ put_be32(pb, 0); /* reserved */
...@@ -764,7 +762,6 @@ static int mov_write_tkhd_tag(ByteIOContext *pb, MOVTrack* track) ...@@ -764,7 +762,6 @@ static int mov_write_tkhd_tag(ByteIOContext *pb, MOVTrack* track)
// This box seems important for the psp playback ... without it the movie seems to hang // This box seems important for the psp playback ... without it the movie seems to hang
static int mov_write_edts_tag(ByteIOContext *pb, MOVTrack *track) static int mov_write_edts_tag(ByteIOContext *pb, MOVTrack *track)
{ {
int64_t maxTrackLenTemp;
put_be32(pb, 0x24); /* size */ put_be32(pb, 0x24); /* size */
put_tag(pb, "edts"); put_tag(pb, "edts");
put_be32(pb, 0x1c); /* size */ put_be32(pb, 0x1c); /* size */
...@@ -772,8 +769,7 @@ static int mov_write_edts_tag(ByteIOContext *pb, MOVTrack *track) ...@@ -772,8 +769,7 @@ static int mov_write_edts_tag(ByteIOContext *pb, MOVTrack *track)
put_be32(pb, 0x0); put_be32(pb, 0x0);
put_be32(pb, 0x1); put_be32(pb, 0x1);
maxTrackLenTemp = ((int64_t)globalTimescale*(int64_t)track->trackDuration)/(int64_t)track->timescale; put_be32(pb, av_rescale_rnd(track->trackDuration, globalTimescale, track->timescale, AV_ROUND_UP)); /* duration ... doesn't seem to effect psp */
put_be32(pb, (long)maxTrackLenTemp); /* duration ... doesn't seem to effect psp */
put_be32(pb, 0x0); put_be32(pb, 0x0);
put_be32(pb, 0x00010000); put_be32(pb, 0x00010000);
...@@ -842,7 +838,7 @@ static int mov_write_mvhd_tag(ByteIOContext *pb, MOVContext *mov) ...@@ -842,7 +838,7 @@ static int mov_write_mvhd_tag(ByteIOContext *pb, MOVContext *mov)
put_be32(pb, mov->timescale); /* timescale */ put_be32(pb, mov->timescale); /* timescale */
for (i=0; i<MAX_STREAMS; i++) { for (i=0; i<MAX_STREAMS; i++) {
if(mov->tracks[i].entry > 0) { if(mov->tracks[i].entry > 0) {
maxTrackLenTemp = ((int64_t)globalTimescale*(int64_t)mov->tracks[i].trackDuration)/(int64_t)mov->tracks[i].timescale; maxTrackLenTemp = av_rescale_rnd(mov->tracks[i].trackDuration, globalTimescale, mov->tracks[i].timescale, AV_ROUND_UP);
if(maxTrackLen < maxTrackLenTemp) if(maxTrackLen < maxTrackLenTemp)
maxTrackLen = maxTrackLenTemp; maxTrackLen = maxTrackLenTemp;
if(maxTrackID < mov->tracks[i].trackID) if(maxTrackID < mov->tracks[i].trackID)
......
...@@ -19,7 +19,7 @@ ffmpeg regression test ...@@ -19,7 +19,7 @@ ffmpeg regression test
794934a02582f8dfc85d1856514cf37c *./data/b-libav.flv 794934a02582f8dfc85d1856514cf37c *./data/b-libav.flv
339325 ./data/b-libav.flv 339325 ./data/b-libav.flv
./data/b-libav.flv CRC=7b9076f8 ./data/b-libav.flv CRC=7b9076f8
a2b938a9f14030d2f4bd4e32d98e9b0a *./data/b-libav.mov 55d26d5f682f75fa57a5c126056c4c31 *./data/b-libav.mov
369865 ./data/b-libav.mov 369865 ./data/b-libav.mov
./data/b-libav.mov CRC=48f5a90d ./data/b-libav.mov CRC=48f5a90d
f34e560f8f0f2c603cf0cb3e7eeb031b *./data/b-libav.nut f34e560f8f0f2c603cf0cb3e7eeb031b *./data/b-libav.nut
......
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