1
0
Fork 0
mirror of https://github.com/alfg/mp4-rust.git synced 2025-04-15 08:14:15 +00:00

reader update

This commit is contained in:
Damitha Gunwardena 2024-12-23 16:11:26 +11:00
parent 7360c5ccb1
commit da7debf434

View file

@ -10,6 +10,7 @@ pub struct Mp4Reader<R> {
reader: R,
pub ftyp: FtypBox,
pub moov: MoovBox,
pub sidx: Option<SidxBox>,
pub moofs: Vec<MoofBox>,
pub emsgs: Vec<EmsgBox>,
@ -23,6 +24,7 @@ impl<R: Read + Seek> Mp4Reader<R> {
let mut ftyp = None;
let mut moov = None;
let mut sidx = None;
let mut moofs = Vec::new();
let mut moof_offsets = Vec::new();
let mut emsgs = Vec::new();
@ -57,6 +59,9 @@ impl<R: Read + Seek> Mp4Reader<R> {
BoxType::MoovBox => {
moov = Some(MoovBox::read_box(&mut reader, s)?);
}
BoxType::SidxBox => {
sidx = Some(SidxBox::read_box(&mut reader, s)?);
}
BoxType::MoofBox => {
let moof_offset = reader.stream_position()? - 8;
let moof = MoofBox::read_box(&mut reader, s)?;
@ -122,6 +127,7 @@ impl<R: Read + Seek> Mp4Reader<R> {
reader,
ftyp: ftyp.unwrap(),
moov: moov.unwrap(),
sidx: sidx,
moofs,
emsgs,
size,
@ -208,6 +214,7 @@ impl<R: Read + Seek> Mp4Reader<R> {
reader,
ftyp: self.ftyp.clone(),
moov: self.moov.clone(),
sidx: self.sidx.clone(),
moofs,
emsgs: Vec::new(),
tracks,