-
Notifications
You must be signed in to change notification settings - Fork 46
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Non-mandatory elements with default values #310
Comments
Either "mandatory" or "default", but not both.
Also master elements (examples in the text), have mandatory, but no normal elements can be inside. --> "Every mandatory value must have a default value" <-- believed not to be true. |
Case 2 is a bit unsafe, like discussed at Matroska meeting. If a writer do not write this element the Matroska file is invalid. |
It was an element that could contain sub-elements. At least one of those sub-elements must be present, but no specific sub-element is mandatory. |
The description for Targets already says "If empty or not present, then the Tag describes everything in the Segment." so we know what to do if it is "not present" so what's wrong with a proposal to simply say this Element is not actually mandatory? |
Case 2 isn't unsafe, it is a necessity as there are a lot of properties for which no sensible default can ever exist, e.g.
Without those decoding is simply impossible. Saying such files missing such elements are invalid is the only sensible way to go about things. |
A Codec ID is a String in Matroska (not an Integer) as I know, and when a writer not write this element you have no info about the codec for this stream (and additional the Matroska file is invalid ). But a default value for this mandatory element could be "null" or "empty" or simple an empty string "". A reader has now ever a value. And is the default value used, this means there is no info. A reader could parse the stream data to get this info. Same with Video width & height. A default value of 0 (or -1) is also possible and means this info is not available. A reader could search this info again in the stream data. Targets: |
In my opinion this is different cases.
|
I think the descriptions
and
are perfect to avoid misusing of a mandatory element.
I think also this element should not be mandatory but Steve say there is a case where it is necessary. |
Summary of the issues solved/still present.
Some
Deprecated elements that should not be used in any version will be listed separately and their default value has no use. (#487)
Some signature elements should become deprecated (#491)
|
Given the proposed rule in #500 @mbunkus do you use |
Only |
I have just made a surprising observation: The
Language
(TrackLanguage
) element isn't mandatory, although it has a default value (namely "eng") and although most tools (including MKVToolNix and the foundation-source tools and ffmpeg/libavformat) treat it as if this element were mandatory with default value "eng". Given the abundance of files that were created with this interpretation, the specs should be changed to really make the element mandatory.And then I looked a bit deeper into this topic and found that there are 41 non-mandatory elements with default values:
DefaultDuration
). This looks like a violation of the principle of separation of layers (EBML and Matroska) to me; but this is unavoidable now.DisplayWidth/Height: The description here says that the default value only applies if DisplayUnit is 0. But given that these elements are not mandatory, the only way for this default value to apply would be if there were empty DisplayWidth/Height elements present in the file (and if DisplayUnit were 0). But the common tools (mkvmerge, mkclean, ffmpeg) all treat DisplayWidth/Height as mandatory (at least if DisplayUnit == 0). Therefore I think that one should make this element mandatory with its current default value if DisplayUnit == 0. (Yes, this breaks the separation between EBML and Matroska, too.)
The text was updated successfully, but these errors were encountered: