1
0
Fork 0
mirror of https://github.com/alfg/mp4-rust.git synced 2024-06-02 13:39:54 +00:00

read emsgs (#59)

This commit is contained in:
Christopher 2021-07-28 15:57:52 +02:00
parent 1877b15b4f
commit 8a20e61c55
2 changed files with 8 additions and 0 deletions

View file

@ -99,6 +99,7 @@ pub(crate) mod vpcc;
pub use ftyp::FtypBox;
pub use moov::MoovBox;
pub use moof::MoofBox;
pub use emsg::EmsgBox;
pub const HEADER_SIZE: u64 = 8;
// const HEADER_LARGE_SIZE: u64 = 16;

View file

@ -10,6 +10,7 @@ pub struct Mp4Reader<R> {
pub ftyp: FtypBox,
pub moov: MoovBox,
pub moofs: Vec<MoofBox>,
pub emsgs: Vec<EmsgBox>,
tracks: Vec<Mp4Track>,
size: u64,
@ -22,6 +23,7 @@ impl<R: Read + Seek> Mp4Reader<R> {
let mut ftyp = None;
let mut moov = None;
let mut moofs = Vec::new();
let mut emsgs = Vec::new();
let mut current = start;
while current < size {
@ -47,6 +49,10 @@ impl<R: Read + Seek> Mp4Reader<R> {
let moof = MoofBox::read_box(&mut reader, s)?;
moofs.push(moof);
}
BoxType::EmsgBox => {
let emsg = EmsgBox::read_box(&mut reader, s)?;
emsgs.push(emsg);
}
_ => {
// XXX warn!()
skip_box(&mut reader, s)?;
@ -99,6 +105,7 @@ impl<R: Read + Seek> Mp4Reader<R> {
ftyp: ftyp.unwrap(),
moov: moov.unwrap(),
moofs,
emsgs,
size,
tracks,
})