-
Notifications
You must be signed in to change notification settings - Fork 45
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
Default values of FlagOriginal, FlagCommentary etc. #449
Comments
Hmmmmm, the intent on these flags was that they'd be interpreted as "not indicated" on any file where no track has a given flag set, but I can see how it'd be useful to more explicitly mark a track as not having one of them (though that wouldn't be possible to expose in e.g. libavformat, where these flags already exist as simple container-generic booleans and no matroska track has them). |
These elements don't have In this case the default value is useful to avoid writing the value (saving 1 octet per element). Like |
Traditionally we use the absence of an element that has no default value to indicate that the property isn't known/indicated/doesn't apply. For example:
The limitations of certain API designs should not really be a concern for file format design, I think.
Then having default values for those elements doesn't make any sense at all and only confuses. It also clashes with the fact that we have a lot of elements for which there is a default value but which are not mandatory. For example:
Now you're contradicting yourself. First you say that a reader cannot assume a value if the element isn't present, and next you say that you can save space by not writing the element and assuming the value. I see two possible solutions:
I vastly prefer 2 as 1 is really confusing, especially for elements that are supposed to be used as flags. If a software uses an API that only signals "yes" or "unknown" via implementation-defined values 1 and 0, those should simply be mapped to "write element with value 1" and "do not write element" respectively. |
I agree. |
I think @robUx4 meant that the "default value" of one of these elements isn't meant to represent "value if the element is not present", but instead to represent "value if the element is present, but has zero size". If this is the case, I think it needs to be documented more clearly in the spec notes. |
Ugh, right, I hadn't thought of that possibility. Thanks. That's one corner of the EBML specs I regularly forget about, unfortunately. As do others, it seems. Taking that into account means that there isn't actually a bug. The elements can be absent, and the semantic meaning is "no information is known about this property", even though the elements do have default values — which only come into play if the elements are present and have a size of 0. |
In other elements such as FieldOrder and some of the Colour ones, 0 indicates false, 1 as true, and 2 as unknown with the default as 2. |
Thanks for the reminder that having a default value does not imply being mandatory. There is no bug, sorry for the noise. I'll close this. |
|
OK, I now understand why I was confused earlier: the RFC changed semantics wrt. to default values. Prior to the RFC all elements with defaults values were treated the same way. With the RFC non-mandaotry are treated differently than they were before. See the issue I filed for details. |
The elements recently added in #447 (namely
FlagOriginal
,FlagCommentary
,FlagHearingImpaired
,FlagVisualImpaired
andFlagTextDescriptions
) all have a default value of zero. This means that all tracks not having any of these flags (i.e. any track in any Matroska file ever made before this) is now marked as dubbed, as not a commentary, as unsuitable for the hearing impaired, as unsuitable for the visually impaired and as not containing textual descriptions of video content. This changes the semantics of all these files (often in unintended ways) which obviously mustn't happen.I see two ways to fix this: Remove the default values or set them to something that means "not indicated". Which way is the preferred one?
The text was updated successfully, but these errors were encountered: