qtmux: Handle time information value > UINT32_MAX

If any duration in timescale is larger than UINT32_MAX, use version 1
atom, otherwise file header will be constructed with truncated values.

Part-of: <https://gitlab.freedesktop.org/gstreamer/gstreamer/-/merge_requests/6843>
This commit is contained in:
Seungha Yang 2024-05-14 19:14:13 +09:00 committed by GStreamer Marge Bot
parent c1b1c849f2
commit 05f9eadcaf

View file

@ -3352,10 +3352,15 @@ atom_trak_update_duration (AtomTRAK * trak, guint64 moov_timescale)
{
trak->mdia.mdhd.time_info.duration =
atom_stts_get_total_duration (&trak->mdia.minf.stbl.stts);
if (trak->mdia.mdhd.time_info.duration > G_MAXUINT32)
trak->mdia.mdhd.header.version = 1;
if (trak->mdia.mdhd.time_info.timescale != 0) {
trak->tkhd.duration =
gst_util_uint64_scale_round (trak->mdia.mdhd.time_info.duration,
moov_timescale, trak->mdia.mdhd.time_info.timescale);
if (trak->tkhd.duration > G_MAXUINT32)
trak->tkhd.header.version = 1;
} else {
trak->tkhd.duration = 0;
}
@ -3434,6 +3439,10 @@ atom_moov_update_duration (AtomMOOV * moov)
}
moov->mvhd.time_info.duration = duration;
moov->mvex.mehd.fragment_duration = duration;
if (duration > G_MAXUINT32) {
moov->mvhd.header.version = 1;
moov->mvex.mehd.header.version = 1;
}
}
void