pub struct MoofData {
pub bytes: Vec<u8>,
pub data_offset_pos: usize,
}Expand description
Full moof blob with the inner trun.data_offset patched up.
Returned by build_moof_video and build_moof_audio. Holds the
final byte vector AND knows where inside it the data_offset field
lives, so callers can either accept the default offset (immediately
after the moof — i.e. mdat starts right after this moof in the file)
OR substitute their own if they’re writing some intervening bytes.
The default data_offset is bytes.len() + 8: full moof size plus
the 8-byte mdat header. That’s the standard “moof immediately
followed by mdat” CMAF layout.
Fields§
§bytes: Vec<u8>§data_offset_pos: usizeByte position WITHIN bytes of the 4-byte big-endian
data_offset field inside trun. Use Self::patch_data_offset
to overwrite it.
Implementations§
Source§impl MoofData
impl MoofData
Sourcepub fn patch_data_offset(&mut self, data_offset: u32)
pub fn patch_data_offset(&mut self, data_offset: u32)
Patch the trun.data_offset field in place. Call once with the
final byte offset from the START of the moof to the START of
the mdat payload (i.e. moof_size + 8 for a no-gap layout).
Sourcepub fn patch_default_no_gap(&mut self)
pub fn patch_default_no_gap(&mut self)
Convenience: patch with the default no-gap offset (moof immediately followed by mdat). Use this in the common case where moof + mdat are written contiguously.