MP4: unify container box parsing and expand container box support#515
Open
klirktag wants to merge 1 commit intoWerWolv:masterfrom
Open
MP4: unify container box parsing and expand container box support#515klirktag wants to merge 1 commit intoWerWolv:masterfrom
klirktag wants to merge 1 commit intoWerWolv:masterfrom
Conversation
fde0e31 to
e23e932
Compare
e23e932 to
1d9e731
Compare
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.
Background
MP4 files cosists of a tree of boxes. That means there are two different kinds of boxes:
Container boxesandLeaf boxes. The Leaf boxes are the boxes that contains data, and the Container boxes contains other boxes. Allcontainer boxesin the MP4 files works exactly the same way, they just have different content. Before this PR all the container boxes had it's own duplicated implementation for each container box nameWhat this PR does
After this PR, all the container boxes are defined in an array called
CONTAINER_BOX_TYPESThis array is used to check against to detect container boxes, and then all the contianer boxes uses exactly the same parser code.
This PR greatly simplifies the code by providing the same feature of parsing container boxes, but with much less code. Also adding new container boxes is much easier now
Additional container boxes
Since it is now much easier to support new container boxes then before, it also adds support for many new container boxes that are in the ISO/MP4 standard. This is done easily by just adding them to the
CONTAINER_BOX_TYPESarrayNew boxes supported that was not supported before this PR:
mvex, moof, traf, mfra - fragmented MP4
udta, meta, ilst - metadata
meco - additional metadata
tref, trgr - track references/grouping
sinf, schi, ipro - content protection
iprp, ipco, iref, grpl - item properties/references (HEIF)
clip, matt - QuickTime legacy
strk, strd - sub track