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.
Unified · Split
| @@ -2550,6 +2550,18 @@ static int mov_write_tfrf_tags(AVIOContext *pb, MOVMuxContext *mov, · 2549 unmodified lines | |||
| 2550 | return 0; | 2550 | return 0; |
| 2551 | } | 2551 | } |
| 2552 | 2552 | ||
| 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 | |||
| 2553 | static int mov_write_traf_tag(AVIOContext *pb, MOVMuxContext *mov, | 2565 | static int mov_write_traf_tag(AVIOContext *pb, MOVMuxContext *mov, |
| 2554 | MOVTrack *track, int64_t moof_offset, | 2566 | MOVTrack *track, int64_t moof_offset, |
| 2555 | int moof_size) | 2567 | int moof_size) |
| @@ -2559,6 +2571,7 @@ static int mov_write_traf_tag(AVIOContext *pb, MOVMuxContext *mov, · 3 unmodified lines | |||
| 2559 | ffio_wfourcc(pb, "traf"); | 2571 | ffio_wfourcc(pb, "traf"); |
| 2560 | 2572 | ||
| 2561 | mov_write_tfhd_tag(pb, mov, track, moof_offset); | 2573 | mov_write_tfhd_tag(pb, mov, track, moof_offset); |
| 2574 | mov_write_tfdt_tag(pb, track); | ||
| 2562 | mov_write_trun_tag(pb, mov, track, moof_size); | 2575 | mov_write_trun_tag(pb, mov, track, moof_size); |
| 2563 | if (mov->mode == MODE_ISM) { | 2576 | if (mov->mode == MODE_ISM) { |
| 2564 | mov_write_tfxd_tag(pb, track); | 2577 | mov_write_tfxd_tag(pb, track); |