Recomputes stco/co64 chunk-offset tables after boxes have moved, and the
faststart/1 rearrangement built on top of it.
Assumes mdat payloads are byte-identical to what was parsed (this is box
relocation, not sample editing). Each mdat carries its current basis position
via source_offset/source_size, so a chunk offset is remapped by the uniform
byte delta of the mdat it points into. After remapping, each mdat's
source_offset is updated to its new position, which makes the operation
idempotent and lets repeated edit→fix cycles compose.
Summary
Functions
Move moov to immediately after any leading ftyp (and before mdat), then fix
chunk offsets. Returns the tree unchanged if it has no moov or no mdat.
Return boxes with every stco/co64 table corrected for the current
arrangement. Promotes stco→co64 (latched, never demoted) when an offset
reaches the :co64_threshold (default 4294967295), iterating layout to a
fixpoint. Raises if an mdat was synthesized or resized, or if a chunk offset
maps into no mdat.
Functions
Move moov to immediately after any leading ftyp (and before mdat), then fix
chunk offsets. Returns the tree unchanged if it has no moov or no mdat.
Return boxes with every stco/co64 table corrected for the current
arrangement. Promotes stco→co64 (latched, never demoted) when an offset
reaches the :co64_threshold (default 4294967295), iterating layout to a
fixpoint. Raises if an mdat was synthesized or resized, or if a chunk offset
maps into no mdat.
Options:
:co64_threshold— promote a table toco64when any offset exceeds this value. Defaults to 2^32 − 1; lower it only in tests to exercise promotion without a multi-gigabyte file.