use crate::windows::detection::mp4::BOX_HEADER_SIZE;
use crate::windows::detection::mp4::Mp4Box;
#[derive(Debug)]
pub(crate) struct MetaBox {
pub(crate) version: u8,
pub(crate) flags: u32,
pub(crate) children: Vec<Mp4Box>,
}
impl MetaBox {
pub(crate) fn parse(data: &[u8], offset: usize) -> Option<Self> {
if data.len() < 4 {
return None;
}
let version = data[0];
let flags = (u32::from(data[1]) << 16) | (u32::from(data[2]) << 8) | u32::from(data[3]);
let children = Mp4Box::parse_all(&data[4..], offset + BOX_HEADER_SIZE + 4)?;
Some(Self {
version,
flags,
children,
})
}
}