1
0
Fork 0
mirror of https://github.com/alfg/mp4-rust.git synced 2024-05-19 16:58:04 +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:
Nathan Fiedler 2020-05-27 18:29:41 -07:00 committed by GitHub
parent f04ebb4b61
commit e875c7da44
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23

View file

@ -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)