mirror of https://git.ffmpeg.org/ffmpeg.git
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@martin.st>
This commit is contained in:
parent
eabdc2a830
commit
c2c22c75cf
|
@ -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);
|
||||
|
|
Loading…
Reference in New Issue