Skip to content

Commit

Permalink
feat: add support for more tags from rfc (#3)
Browse files Browse the repository at this point in the history
* feat: Implement support for more RFC 8216 tags

Expanded support for RFC 8216 compliant tags in the playlist builder. Additional tags such as 'ExtXKey', 'ExtXMap', 'ExtXProgramDateTime', and others were added. Error handling for invalid formats for numerous fields were integrated, ensuring robustness. We verified compliance by validating every tag according to their respective rules.

* chore: Improve several aspects of the m3u8 module

Enhancements have been made to the m3u8 module. The target_duration function now accepts a u64 value instead of a u32, expanding possible duration values. We've also added `#[allow(clippy::too_many_arguments)]` to bypass Clippy's warnings for the media and stream_inf function. Also, more meaningful error messages have been added and the code is now streamlined for improved tag extraction. For validation.rs, we replaced the u32 data type with the u64 in InvalidTargetDuration to match the change in builder.rs.

* chore: Refactor tests and update M3U8 playlist parsing code

This commit refactors test cases and updates revisions in the M3U8 playlist parsing code. Changes include an update in version numbers from 3 to 7, and adjustments in parsing and building logic. Commented out explanations for the playlist builder were also removed. The changes were necessary to keep the tests consistent with the updates in the parsing logic.

* feat: Add ExtXPlaylistType support in M3U8 tags and builder

This commit introduces the `ExtXPlaylistType` tag to the M3U8 playlist parser, which provides mutability information about the playlist. It also updates the builder to support adding this tag, and includes a new Makefile for testing and linting with cargo.

* chore: Refactor to use string references in builder methods

This commit changes builder methods to use string references (`&str`) instead of `String` for several fields. This improves performance by avoiding unnecessary allocations and simplifies the function signatures. Corresponding test adjustments have also been made to reflect these changes.

* chore: Add `Clone` to `Tag` and refactor `PlaylistBuilder`

Implemented the `Clone` trait for `Tag` and refactored `PlaylistBuilder` to use `Rc<RefCell<Vec<Tag>>>` for better state management. Additionally, added `cargo fmt` to the `check` target in the `Makefile` to enforce consistent code formatting.

* chore: Remove InvalidMediaSequence error handling.

Invalid media sequence number error handling has been deemed unnecessary and thus removed from validation.rs and playlist/mod.rs. Other existing validation errors remain unaffected.

* Refactor ExtInf to include URI

Revised the structure of the `ExtInf` tag to encapsulate the URI directly within it, removing the need for separate `Uri` tags. This change simplifies the tag structure and ensures better cohesion by combining related data into a single tag.

* Add regex dependency and remove EXT-X-DATE_RANGE tags

Added regex as a new dependency in Cargo.toml. Removed EXT-X-DATE-RANGE support and related tests from the codebase. Updated Playlist parsing to process lines more efficiently using regex.
  • Loading branch information
includeamin authored Nov 5, 2024
1 parent 5887a82 commit 46d2b89
Show file tree
Hide file tree
Showing 8 changed files with 1,273 additions and 591 deletions.
47 changes: 47 additions & 0 deletions Cargo.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

1 change: 1 addition & 0 deletions Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -10,3 +10,4 @@ repository = "https://github.com/includeamin/m3u8-parser"
readme = "README.md"

[dependencies]
regex = "1.11.1"
4 changes: 4 additions & 0 deletions Makefile
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
check:
cargo fmt
cargo test
cargo clippy --fix --allow-dirty --allow-staged
Loading

0 comments on commit 46d2b89

Please sign in to comment.