movenc: Calculate fps for tmcd without intermediate step.
authorMichael Niedermayer <michaelni@gmx.at>
Thu, 17 Jan 2013 17:51:49 +0000 (18:51 +0100)
committerMichael Niedermayer <michaelni@gmx.at>
Thu, 24 Jan 2013 17:57:12 +0000 (18:57 +0100)
Fixes part of Ticket2045

Signed-off-by: Michael Niedermayer <michaelni@gmx.at>
libavformat/movenc.c

index f08aa7e..d9b002e 100644 (file)
@@ -1147,7 +1147,7 @@ static int mov_write_tmcd_tag(AVIOContext *pb, MOVTrack *track)
 {
     int64_t pos = avio_tell(pb);
     int frame_duration = av_rescale(track->timescale, track->enc->time_base.num, track->enc->time_base.den);
-    int nb_frames = (track->timescale + frame_duration/2) / frame_duration;
+    int nb_frames = 1.0/av_q2d(track->enc->time_base) + 0.5;
 
     avio_wb32(pb, 0); /* size */
     ffio_wfourcc(pb, "tmcd");               /* Data format */