[FFmpeg-devel] [PATCH] movenc: Always write the trun data_offset

Bryan Huh bryan at box.com
Wed Oct 29 00:05:54 CET 2014


The MOV_TRUN_DATA_OFFSET flag was always getting set, so data_offset is
being expected and read. The offset was computed correctly anyway during
fragment-flush. Alternatively, I could have selectively set the flag
only when base-data-offset is defined, but certain players (Chrome)
seem to fail when no data-offset is provided in the trun.
---
 libavformat/movenc.c | 9 ++-------
 1 file changed, 2 insertions(+), 7 deletions(-)

diff --git a/libavformat/movenc.c b/libavformat/movenc.c
index a43752a..923cf92 100644
--- a/libavformat/movenc.c
+++ b/libavformat/movenc.c
@@ -3187,13 +3187,8 @@ static int mov_write_trun_tag(AVIOContext *pb, MOVMuxContext *mov,
     avio_wb24(pb, flags);
 
     avio_wb32(pb, track->entry); /* sample count */
-    if (mov->flags & FF_MOV_FLAG_OMIT_TFHD_OFFSET &&
-        !(mov->flags & FF_MOV_FLAG_SEPARATE_MOOF) &&
-        track->track_id != 1)
-        avio_wb32(pb, 0); /* Later tracks follow immediately after the previous one */
-    else
-        avio_wb32(pb, moof_size + 8 + track->data_offset +
-                      track->cluster[0].pos); /* data offset */
+    avio_wb32(pb, moof_size + 8 + track->data_offset +
+                  track->cluster[0].pos); /* data offset */
     if (flags & MOV_TRUN_FIRST_SAMPLE_FLAGS)
         avio_wb32(pb, get_sample_flags(track, &track->cluster[0]));
 
-- 
1.9.3 (Apple Git-50)



More information about the ffmpeg-devel mailing list