-
Notifications
You must be signed in to change notification settings - Fork 20
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
Introduce EbmlParsable
trait to make the EBML parsing more ergonomic
#115
Conversation
* Introduce `EbmlParsable` trait to parse most known EBML types * Rename `ErrorKind` to `ParseError` * Move Element ID from `ParseError` into the `Error` enum
* Remove `ebml_` prefix from parsing functions * Move `complete` combinator into parsing functions * Implement EbmlParsable for Uuid * Rename `skip_void` to `void` (The combinator doesn't really skip the void, it returns it) * Rename `eat_void` to `skip_void` (better description)
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks a lot! The code is much cleaner! Just a question from my side
* float_def inserts a default value for 0-octet or missing Elements * Change some struct fields to non-optional
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Looks good, maybe float_with_default()
might be more descriptive
The only thing I don't think we can handle well is quiet and signalling NaNs. EBML doesn't specify how to interpret the signalling bit, and not all platforms handle it the same. I'll try to give a brief overview of how it works now, because it's a bit confusing. When parsing a Float, there's 3 possible errors that can happen:
Now, with this information, we can define some behaviour for different situations.
Basically, the |
I'd like to double-check if the code now does what I explained above . I'll re-convert the PR after that. |
@robUx4 do you have suggestions regarding NaNs? |
Thinking again about this PR, we can leave FIXMEs, open a new issue, talk there and subsequently create another PR. In this way we don't block this refactor. What do you think @FreezyLemon? Better to separate problems perhaps |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks a lot!
Our floats are using the IEEE.754 format. According to Wikipedia it's properly defined:
There are multiple NaN values, but any of them is OK as EBML values. |
@robUx4 I guess EBML doesn't care about sNaN and qNaN? IEEE754 only has a recommendation regarding the signalling bit for NaNs, not a fast rule. This is because MIPS does it differently than x86 and ARM. I'd imagine EBML doesn't really care about this though? |
We never got this far, no. I think it's too late to add constraints now. We can add recommendations, though. |
Okay, this should be the last time I do major changes to the EBML parsing code.
It has taken a while, but after this I feel good in going over the Matroska specification to fix the obvious issues (default values, optional vs. non-optional values). And then I'd like to fix the remuxer and the info tool.