Skip to content
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

Implement EBML date element #128

Merged
merged 2 commits into from
Apr 24, 2023
Merged

Conversation

FreezyLemon
Copy link
Contributor

This creates a newtype for EBML dates which is a thin wrapper around an i64 with some special handling for parsing and serialization. Technically, there is an optimization to be done here (see the FIXME), but that should be a pretty rare case.

@codecov-commenter
Copy link

codecov-commenter commented Apr 21, 2023

Codecov Report

Patch coverage: 35.71% and project coverage change: -0.02 ⚠️

Comparison is base (537ddd4) 45.42% compared to head (72f60b9) 45.40%.

❗ Current head 72f60b9 differs from pull request most recent head c39743d. Consider uploading reports for the commit c39743d to get more accurate results

📣 This organization is not using Codecov’s GitHub App Integration. We recommend you install it so Codecov can continue to function properly for your repositories. Learn more

Additional details and impacted files
@@            Coverage Diff             @@
##           master     #128      +/-   ##
==========================================
- Coverage   45.42%   45.40%   -0.02%     
==========================================
  Files          14       14              
  Lines        2699     2711      +12     
==========================================
+ Hits         1226     1231       +5     
- Misses       1473     1480       +7     
Impacted Files Coverage Δ
src/ebml/error.rs 48.14% <ø> (ø)
src/elements.rs 30.58% <0.00%> (ø)
src/serializer/ebml.rs 80.22% <0.00%> (-0.73%) ⬇️
src/serializer/elements.rs 13.12% <0.00%> (-0.06%) ⬇️
src/ebml/parse.rs 90.90% <83.33%> (-0.31%) ⬇️

Help us with your feedback. Take ten seconds to tell us how you rate us. Have a feature suggestion? Share it here.

☔ View full report in Codecov by Sentry.
📢 Do you have feedback about the report comment? Let us know in this issue.

Copy link
Member

@lu-zero lu-zero left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It is surely an improvement, when a 0-sized date is used btw?

@Luni-4
Copy link
Member

Luni-4 commented Apr 22, 2023

@FreezyLemon

Is it possible to create a specific data item to manage zero-sized date?

Something like:

  1. Parse field
  2. If it is a zero-sized date, use ZeroSized data item with its own methods, otherwise use Date struct

I don't know if it's feasible though

@FreezyLemon
Copy link
Contributor Author

FreezyLemon commented Apr 24, 2023

@lu-zero A zero-sized Date Element will fall back to the default value, or the equivalent of 0 if no default exists (which means the date 2001-01-01T00:00:00.000000000 UTC).

But Matroska only has one Date Element in the spec currently. And that one has no default value. So at the moment, the only way to sensibly use a zero-sized Date Element in Matroska would be representing the exact date 2001-01-01 at midnight. I think that should be pretty rare.

@Luni-4 Sure, that sounds very possible. Should that be included in this PR?

@Luni-4
Copy link
Member

Luni-4 commented Apr 24, 2023

@FreezyLemon we can add that in a later PR in my opinion

@Luni-4 Luni-4 merged commit 29f3d6a into rust-av:master Apr 24, 2023
@FreezyLemon FreezyLemon deleted the impl-ebml-date branch April 24, 2023 23:40
@Luni-4
Copy link
Member

Luni-4 commented Apr 26, 2023

@FreezyLemon Can we open a new issue for the FIXME? In this way we don't forget about that, thanks!

@FreezyLemon
Copy link
Contributor Author

@Luni-4 Sure, see #132

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

4 participants