[FFmpeg-devel] [PATCH 4/5] mov: cosmetics - move a line to a better position and add a comment

Jean First jeanfirst at gmail.com
Sat Jan 14 14:10:20 CET 2012


mov: cosmetics - move a line to a better position and add a comment

Oana Andreea Stratulat submitted a similar patch to trac, but forgot
to notify the ML about it.

Signed-off-by: Jean First <jeanfirst at gmail.com>
---
 libavformat/mov.c |    5 +++--
 1 files changed, 3 insertions(+), 2 deletions(-)

diff --git a/libavformat/mov.c b/libavformat/mov.c
index df30ed3..708aeb3 100644
--- a/libavformat/mov.c
+++ b/libavformat/mov.c
@@ -791,6 +791,9 @@ static int mov_read_mvhd(MOVContext *c, AVIOContext *pb, MOVAtom atom)
     av_dlog(c->fc, "time scale = %i\n", c->time_scale);
 
     c->duration = (version == 1) ? avio_rb64(pb) : avio_rb32(pb); /* duration */
+    // set the AVCodecContext duration because the duration of individual tracks
+    // may be inaccurate
+    c->fc->duration = av_rescale(c->duration, AV_TIME_BASE, c->time_scale);
     avio_rb32(pb); /* preferred scale */
 
     avio_rb16(pb); /* preferred volume */
@@ -806,8 +809,6 @@ static int mov_read_mvhd(MOVContext *c, AVIOContext *pb, MOVAtom atom)
     avio_rb32(pb); /* selection duration */
     avio_rb32(pb); /* current time */
     avio_rb32(pb); /* next track ID */
-
-    c->fc->duration = av_rescale(c->duration, AV_TIME_BASE, c->time_scale);
     return 0;
 }
 
-- 
1.7.8.3



More information about the ffmpeg-devel mailing list