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

Rework segment.key as segment.keys, a list of keys #313

Open
wants to merge 7 commits into
base: master
Choose a base branch
from

Commits on Mar 9, 2023

  1. Rework segment.key as segment.keys, a list of keys

    This closes globocom#283 as it now follows RFC and keeps all preceding keys for the segment.
    
    - `m3u8_obj.keys` still has the same behaviour.
    - `m3u8_obj.segments[0].key` is now removed.
    - `m3u8_obj.segments[0].keys` is added in it's place, which will now always be a list.
    - The list will always be present, it will never be `None` anymore, and if the segment explicitly has no DRM by specifying an EXT-X-KEY of METHOD=NONE then it will be a list with that key.
    - It does not check if there's a METHOD=NONE with other conflicting EXT-X-KEY information.
    - It still follows the same behaviour of not duplicating the EXT-X-KEY information on future segments when dumping.
    
    Do note that it only clears the list of Keys when it reaches an EXT-X-DISCONTINUITY, or it has reached a ts segment.
    
    The copy() statement is used because it clears after the segment is appended to `data`, yet the .clear() to `current_keys` follows in the appended `segment` unless we copy that data in memory prior.
    
    I don't think there's a need for `.by_key()` or `m3u8_obj.keys` anymore, but I've made sure those still work as intended in case there's a different reason those exist.
    rlaphoenix committed Mar 9, 2023
    Configuration menu
    Copy the full SHA
    e58e878 View commit details
    Browse the repository at this point in the history

Commits on Mar 26, 2023

  1. Configuration menu
    Copy the full SHA
    7102383 View commit details
    Browse the repository at this point in the history
  2. Update model.py

    rlaphoenix committed Mar 26, 2023
    Configuration menu
    Copy the full SHA
    cb0f245 View commit details
    Browse the repository at this point in the history
  3. Re-implement Segment.key, having the last key within keys

    This keeps compatibility and fixes a lot of the existing tests. However, new tests should likely be implemented for testing HLS playlists with multiple preceeding keys.
    rlaphoenix committed Mar 26, 2023
    Configuration menu
    Copy the full SHA
    69fa67e View commit details
    Browse the repository at this point in the history
  4. Configuration menu
    Copy the full SHA
    36dbc84 View commit details
    Browse the repository at this point in the history
  5. Add key argument to Segment

    This is because the segment may be constructed with both `key` and `keyobject` due to `Segment(..., **segment)` being done. Even though we do not use the `key` argument, we must define it.
    rlaphoenix committed Mar 26, 2023
    Configuration menu
    Copy the full SHA
    fb266d0 View commit details
    Browse the repository at this point in the history
  6. Fix model test, test_segment_attribute_with_multiple_keys

    This code assumes that the key carries forward to the next segments, which even before my changes I don't believe it would. Either way it definitely doesn't now, and this would be correct behaviour.
    rlaphoenix committed Mar 26, 2023
    Configuration menu
    Copy the full SHA
    dcadc0e View commit details
    Browse the repository at this point in the history