[FFmpeg-cvslog] mp4enc: dont store durations in trun if they are unneeded.

Michael Niedermayer git at videolan.org
Tue Dec 13 03:19:42 CET 2011


ffmpeg | branch: master | Michael Niedermayer <michaelni at gmx.at> | Tue Dec 13 03:02:20 2011 +0100| [1f83f046090cac09b7a3da7f15182d2143bccf87] | committer: Michael Niedermayer

mp4enc: dont store durations in trun if they are unneeded.

Signed-off-by: Michael Niedermayer <michaelni at gmx.at>

> http://git.videolan.org/gitweb.cgi/ffmpeg.git/?a=commit;h=1f83f046090cac09b7a3da7f15182d2143bccf87
---

 libavformat/movenc.c |    6 +++++-
 1 files changed, 5 insertions(+), 1 deletions(-)

diff --git a/libavformat/movenc.c b/libavformat/movenc.c
index de6dafb..31fd05d 100644
--- a/libavformat/movenc.c
+++ b/libavformat/movenc.c
@@ -1447,8 +1447,12 @@ static int mov_write_trun_tag(AVIOContext *pb, MOVTrack *track)
     int tr_flags=0;
     int i;
 
-    tr_flags |= 0x700; //FIXME
+    tr_flags |= 0x600; //FIXME
     for(i=track->cluster_write_index; i<track->entry; i++){
+        int64_t duration = i + 1 == track->entry ?
+                track->trackDuration - track->cluster[i].dts + track->cluster[0].dts : /* readjusting */
+                track->cluster[i+1].dts - track->cluster[i].dts;
+        if(duration         != 1) tr_flags |= 0x100;
         if(track->cluster[i].cts) tr_flags |= 0x800;
     }
 



More information about the ffmpeg-cvslog mailing list