[FFmpeg-cvslog] movenc: Write tfdt atoms

Martin Storsjö git at videolan.org
Tue Oct 14 22:22:40 CEST 2014


ffmpeg | branch: master | Martin Storsjö <martin at martin.st> | Mon Oct  6 23:20:50 2014 +0300| [c2c22c75cf89e2faab34d1ee1d392cfb065439ea] | committer: Martin Storsjö

movenc: Write tfdt atoms

These allow getting the absolute start timestamp of a fragment
without reading preceding timestamps. This fixes sync between
tracks if starting from fragments in different streams that don't
align exactly.

This also is a prerequisite for producing DASH content.

Signed-off-by: Martin Storsjö <martin at martin.st>

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

 libavformat/movenc.c |   13 +++++++++++++
 1 file changed, 13 insertions(+)

diff --git a/libavformat/movenc.c b/libavformat/movenc.c
index d8dc62a..d84ddbe 100644
--- a/libavformat/movenc.c
+++ b/libavformat/movenc.c
@@ -2550,6 +2550,18 @@ static int mov_write_tfrf_tags(AVIOContext *pb, MOVMuxContext *mov,
     return 0;
 }
 
+static int mov_write_tfdt_tag(AVIOContext *pb, MOVTrack *track)
+{
+    int64_t pos = avio_tell(pb);
+
+    avio_wb32(pb, 0); /* size */
+    ffio_wfourcc(pb, "tfdt");
+    avio_w8(pb, 1); /* version */
+    avio_wb24(pb, 0);
+    avio_wb64(pb, track->frag_start);
+    return update_size(pb, pos);
+}
+
 static int mov_write_traf_tag(AVIOContext *pb, MOVMuxContext *mov,
                               MOVTrack *track, int64_t moof_offset,
                               int moof_size)
@@ -2559,6 +2571,7 @@ static int mov_write_traf_tag(AVIOContext *pb, MOVMuxContext *mov,
     ffio_wfourcc(pb, "traf");
 
     mov_write_tfhd_tag(pb, mov, track, moof_offset);
+    mov_write_tfdt_tag(pb, track);
     mov_write_trun_tag(pb, mov, track, moof_size);
     if (mov->mode == MODE_ISM) {
         mov_write_tfxd_tag(pb, track);



More information about the ffmpeg-cvslog mailing list