mirror of
https://github.com/alfg/mp4-rust.git
synced 2025-01-09 19:45:25 +00:00
Skip over unknown boxes (#4)
* Skip over unknown boxes If the box size is non-zero, skip over it and continue reading. Otherwise if the box size is zero, exit the loop. * Add comment clarifying the box skipping
This commit is contained in:
parent
f04ebb4b61
commit
e875c7da44
1 changed files with 9 additions and 1 deletions
10
src/lib.rs
10
src/lib.rs
|
@ -83,7 +83,15 @@ fn read_boxes(f: File) -> Result<BMFF> {
|
|||
BoxType::MoofBox => {
|
||||
start = (size as u32 - HEADER_SIZE) as u64;
|
||||
}
|
||||
_ => break
|
||||
_ => {
|
||||
// Skip over unsupported boxes, but stop if the size is zero,
|
||||
// meaning the last box has been reached.
|
||||
if size == 0 {
|
||||
break;
|
||||
} else {
|
||||
start = (size as u32 - HEADER_SIZE) as u64;
|
||||
}
|
||||
}
|
||||
};
|
||||
}
|
||||
Ok(bmff)
|
||||
|
|
Loading…
Reference in a new issue