History

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.

Martin Storsjö committed 12 years ago

Commit c2c22c71 parent eabdc2a1 file · +13 −0Browse files

Unified · Split

libavformat/movenc.c+13−0
@@ -2550,6 +2550,18 @@ static int mov_write_tfrf_tags(AVIOContext *pb, MOVMuxContext *mov, · 2549 unmodified lines
25502550 return 0;
25512551 }
25522552
2553+static int mov_write_tfdt_tag(AVIOContext *pb, MOVTrack *track)
2554+{
2555+ int64_t pos = avio_tell(pb);
2556+
2557+ avio_wb32(pb, 0); /* size */
2558+ ffio_wfourcc(pb, "tfdt");
2559+ avio_w8(pb, 1); /* version */
2560+ avio_wb24(pb, 0);
2561+ avio_wb64(pb, track->frag_start);
2562+ return update_size(pb, pos);
2563+}
2564+
25532565 static int mov_write_traf_tag(AVIOContext *pb, MOVMuxContext *mov,
25542566 MOVTrack *track, int64_t moof_offset,
25552567 int moof_size)
@@ -2559,6 +2571,7 @@ static int mov_write_traf_tag(AVIOContext *pb, MOVMuxContext *mov, · 3 unmodified lines
25592571 ffio_wfourcc(pb, "traf");
25602572
25612573 mov_write_tfhd_tag(pb, mov, track, moof_offset);
2574+ mov_write_tfdt_tag(pb, track);
25622575 mov_write_trun_tag(pb, mov, track, moof_size);
25632576 if (mov->mode == MODE_ISM) {
25642577 mov_write_tfxd_tag(pb, track);

Keyboard shortcuts

General

Show keyboard shortcuts
?
Focus the current search
/

Issues and pull requests

Open filters
f

Issues, pull requests and Inbox

Select next item
j↓
Select previous item
k↑
Open selected item
Enter
Dismiss filters or clear selection
Esc

Repository code

Go to file
t