Commit c2c22c75 authored by Martin Storsjö's avatar 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: 's avatarMartin Storsjö <martin@martin.st>
parent eabdc2a8
......@@ -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);
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment