add support for stz2, make stsz optional #101
Draft
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.
During checks for the MPEG file format conformance suite, a few files failed for missing
stszboxes.It looks like there are two variations of the failure. One is that there are no sample sizes. The other is where
stz2(Compact Sample Size) is used - see ISO/IEC 14496-12:2022 Section 8.7.3.3.Currently we mark
stszas required. However what is really required is "Exactly one variant shall be present".So the simple approach is just to make
stszoptional. However things will fail in strict mode whenstz2is present, so we really need that.The part I need help on is how to handle the "
stszorstz2is required" case.There are four alternatives I considered:
nested!macro definition likeone_of: [[Stsz, Stz2]]. Then validate the exactly one case in macro code.Stszparsing and encoding handle both theSampleSizeBoxandCompactSampleSizeBoxvariations.At this stage I lean to alternative 3, which is what this PR does. However the macro approach is no-skill (being approximately the skill I have), and involves a bunch of duplicate code. Trying to fix it made it uglier and even less comprehensible. Fixes much appreciated.