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

Create declarative macro for EBML Elements #125

Merged
merged 11 commits into from
Apr 21, 2023

Commits on Apr 20, 2023

  1. Add demuxing test

    FreezyLemon committed Apr 20, 2023
    Configuration menu
    Copy the full SHA
    1d9cb9e View commit details
    Browse the repository at this point in the history
  2. Turn ebml::Error from enum into a struct

    This makes the Element ID a fixed part of the Error.
    The ID can probably be turned into an `Option<NonZeroU32>`
    at some point, but that feels like a low priority.
    FreezyLemon committed Apr 20, 2023
    Configuration menu
    Copy the full SHA
    0416a83 View commit details
    Browse the repository at this point in the history
  3. Configuration menu
    Copy the full SHA
    25ab442 View commit details
    Browse the repository at this point in the history
  4. Improve ebml_generic

    - Refactor ebml_generic for better readability
    - Add lifetime parameter to EbmlParsable
      This allows implementing the trait for borrowed types
      like &[u8] (binary_ref).
    - Add `fn has_crc() -> bool` to trait EbmlParsable
      Also adds CRC-32 capabilities to ebml_generic, making it
      functionally equivalent to the master helper function when
      has_crc returns true.
    - Rename ebml_generic to ebml_element
      It can now handle most EBML Elements without issue, so
      the new name is more descriptive.
    FreezyLemon committed Apr 20, 2023
    Configuration menu
    Copy the full SHA
    4d903c5 View commit details
    Browse the repository at this point in the history
  5. Implement macros for Master Elements

    **This breaks compilation for elements.rs**, because
    matroska_permutation was changed (again) and it's not
    worth fixing this when the macros can soon be used instead.
    
    The macro `impl_ebml_master` will
    1. create a pub struct definition with the given field names/types
       and any meta (like #[derive] blocks) and
    2. implement EbmlParsable for the aforementioned struct. This
       implementation will set the has_crc() to true (to use the new
       ebml_element feature) and create a try_parse definition based
       on matroska_permutation. It will auto-"unwrap" the parser results
       and handle any parsing errors. It also handles Option<T> and Vec<T>.
    FreezyLemon committed Apr 20, 2023
    Configuration menu
    Copy the full SHA
    03e90af View commit details
    Browse the repository at this point in the history
  6. Implement Permutation<O> for standalone Parser

    There's no such thing as "single-element tuples", so the
    macro-implemented `impl Permutation` blocks don't work for
    singular Parser functions. So, here's a manual implementation.
    FreezyLemon committed Apr 20, 2023
    Configuration menu
    Copy the full SHA
    120562c View commit details
    Browse the repository at this point in the history
  7. Use impl_ebml_master macro for elements.rs

    - Use impl_ebml_master to define all Matroska Master Elements
    - Change sub_element helper to make it similar to ebml_element,
      but still work in the SegmentElement context.
    - Adapt segment_element fn to the sub_element changes.
    - Add note to fix what used to be correct Float Element handling
      (used to be float_or)
    - Small fix in the macro (lifetime-related)
    - Comment out/remove the unimplemented Elements Chapters, Tags,
      Attachments and Cues (should be added back later)
    - Edit serializer/muxer/demuxer stuff so it works again after the changes
    FreezyLemon committed Apr 20, 2023
    Configuration menu
    Copy the full SHA
    5b7ff08 View commit details
    Browse the repository at this point in the history
  8. Fix matroska_info

    FreezyLemon committed Apr 20, 2023
    Configuration menu
    Copy the full SHA
    78ff4bb View commit details
    Browse the repository at this point in the history
  9. Remove unused helpers

    FreezyLemon committed Apr 20, 2023
    Configuration menu
    Copy the full SHA
    910dec6 View commit details
    Browse the repository at this point in the history

Commits on Apr 21, 2023

  1. Make EBML macros pub(crate)

    They were pub before (and in the crate root).
    FreezyLemon committed Apr 21, 2023
    Configuration menu
    Copy the full SHA
    ff43008 View commit details
    Browse the repository at this point in the history
  2. Configuration menu
    Copy the full SHA
    11c4039 View commit details
    Browse the repository at this point in the history