Repository navigation
Fix/mp4 alac and trailing bytes - #124
Merged
Merged
Conversation
Apple Lossless audio is described by an `alac` sample entry instead of `mp4a`. Both use the AudioSampleEntry layout, so the sample rate is read at the same place. The sample rate of ALAC files used to be null.
Some taggers and rippers append bytes that are not a box after `mdat`, for instance a 256-byte `RLTP=...` text trailer. The parser read them as a box of an impossible size and rejected the whole file. A box header that cannot belong to its scope (fewer than 8 bytes left, an all-zero type, a size smaller than its header or past the parent end) now ends that scope: the rest of the parent is skipped and what was read before is kept. A file whose top level breaks before any `moov` box is still rejected. A malformed iTunes freeform `----` box only drops that box. The writer copies such trailing bytes unchanged instead of throwing.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
mp4a(AAC) sample entries, so Apple Lossless files returnedsampleRate: null.alacuses the same layout and is now handled. Checked on the ALAC sample from some m4a files raise exception #74.mdat(e.g. a 256-byteRLTP=…text trailer). The parser read them as an oversized box and rejected the whole file. Invalid box headers now end their scope and keep what was already read, and the writer copies the trailing bytes unchanged. Files that break beforemoovare still rejected.A child box that exceeds its parent is now skipped instead of throwing
MetadataParserException.