[Ffmpeg-cvslog] CVS: ffmpeg/libavformat movenc.c,1.38,1.39

Michael Niedermayer CVS michael
Sat May 14 21:48:35 CEST 2005


Update of /cvsroot/ffmpeg/ffmpeg/libavformat
In directory mail:/var2/tmp/cvs-serv15904/libavformat

Modified Files:
	movenc.c 
Log Message:
round duration up in mov


Index: movenc.c
===================================================================
RCS file: /cvsroot/ffmpeg/ffmpeg/libavformat/movenc.c,v
retrieving revision 1.38
retrieving revision 1.39
diff -u -d -r1.38 -r1.39
--- movenc.c	30 Apr 2005 21:43:58 -0000	1.38
+++ movenc.c	14 May 2005 19:48:32 -0000	1.39
@@ -715,7 +715,6 @@
 
 static int mov_write_tkhd_tag(ByteIOContext *pb, MOVTrack* track)
 {
-    int64_t maxTrackLenTemp;
     put_be32(pb, 0x5c); /* size (always 0x5c) */
     put_tag(pb, "tkhd");
     put_be32(pb, 0xf); /* version & flags (track enabled) */
@@ -723,8 +722,7 @@
     put_be32(pb, track->time); /* modification time */
     put_be32(pb, track->trackID); /* track-id */
     put_be32(pb, 0); /* reserved */
-    maxTrackLenTemp = ((int64_t)globalTimescale*(int64_t)track->trackDuration)/(int64_t)track->timescale;
-    put_be32(pb, (long)maxTrackLenTemp); /* duration */
+    put_be32(pb, av_rescale_rnd(track->trackDuration, globalTimescale, track->timescale, AV_ROUND_UP)); /* duration */
 
     put_be32(pb, 0); /* reserved */
     put_be32(pb, 0); /* reserved */
@@ -764,7 +762,6 @@
 // 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)
 {
-    int64_t maxTrackLenTemp;
     put_be32(pb, 0x24); /* size  */
     put_tag(pb, "edts");
     put_be32(pb, 0x1c); /* size  */
@@ -772,8 +769,7 @@
     put_be32(pb, 0x0);
     put_be32(pb, 0x1);
 
-    maxTrackLenTemp = ((int64_t)globalTimescale*(int64_t)track->trackDuration)/(int64_t)track->timescale;
-    put_be32(pb, (long)maxTrackLenTemp); /* duration   ... doesn't seem to effect psp */
+    put_be32(pb, av_rescale_rnd(track->trackDuration, globalTimescale, track->timescale, AV_ROUND_UP)); /* duration   ... doesn't seem to effect psp */
 
     put_be32(pb, 0x0);
     put_be32(pb, 0x00010000);
@@ -842,7 +838,7 @@
     put_be32(pb, mov->timescale); /* timescale */
     for (i=0; i<MAX_STREAMS; i++) {
         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)
                 maxTrackLen = maxTrackLenTemp;
             if(maxTrackID < mov->tracks[i].trackID)





More information about the ffmpeg-cvslog mailing list