Commit graph

29 commits

Author SHA1 Message Date
Rutger Schoorstra 5109753b96 #EXT-X-TARGETDURATION:<s> is supposed to be a decimal-integer
https://datatracker.ietf.org/doc/html/rfc8216#section-4.3.3.1
2024-01-26 18:55:39 +01:00
Vadim Getmanshchuk f6af8acbfe ran rustfmt 2023-12-04 21:25:16 +02:00
Vadim Getmanshchuk 46622345d1 added test 2023-12-04 21:25:16 +02:00
Vadim Getmanshchuk d8e0283ddb allowing empty comments 2023-12-04 21:25:16 +02:00
clitic ae31a2741f Parse #EXT-X-MAP BYTERANGE attr from quoted string 2023-04-12 10:39:44 +03:00
Sebastian Dröge 015b05f26c Fix some minor clippy warnings 2022-12-02 10:46:10 +02:00
Vadim Getmanshchuk b0a9fe2625 When a manifest is incomplete or damaged, the contains_master_tag may go into infinite loop if is_master_playlist_tag_line detection hasn't had a chance to succeed.
Clippy recommendation is implemented to use `.is_none()` instead of comparing to literal `Option::None`.
Test added
2022-12-02 10:18:40 +02:00
Sebastian Dröge bd7cce75e9 Parse PROGRAM-DATE-TIME and DATERANGE start/end as proper datetimes instead of strings 2022-07-21 10:34:57 +03:00
Vadim Getmanshchuk 7247e02ee5 Use more specific types for playlist fields and improve parsing/writing
Added
* DateRange struct and implementations
* Parsing DateRange (wasn't parsed due to a typo)
* fn daterange() to parse DateRange
* `write_some_other_attributes` macro
* resolved `FIXME required unless None` for method and iv

Changed / fixed:
* trim_matches() potentially too greedy, replaced with strip_suffix/prefix
* removed a bunch of "Unnecessary qualification", eg `fmt::` for `Display`
* changed `fn extmap()` to use `QuotedOrUnquoted` and `other_attributes`
* `fmt` for `QuotedOrUnquoted` are now printing quoted strings in `"`
* `bool_default_false` macro renamed to `is_yes`
* qualified error message for `quoted_string_parse` and `unquoted_string_parse`
* `other_attributes` now `Option<>`
* `ClosedCaptionGroupId::Other(s)` variant processing added to `write_to`
* `HDCPLevel::Other(s)` variant processing added to `fmt`
* `AlternativeMediaType::Other(s)` variant processing added to `fmt`
* `InstreamId::Other(s)` variant processing added to `fmt`
* `MediaPlaylistType::Other(s)` variant processing added to `fmt`
* `KeyMethod::Other(s)` variant processing added to `fmt`
* included `DateRange` to tests
* included `other_attributes` to tests

Minor:
Typos corrections
rustfmt applied
2022-07-21 10:34:57 +03:00
Sebastian Dröge 6559e45b49 Store VariantStream attributes in more specific types and validate them 2022-07-21 10:34:57 +03:00
Sebastian Dröge 0789098d7d Add some convenience API to QuotedOrUnquoted 2022-07-21 10:34:57 +03:00
Vadim Getmanshchuk d941541be8 EXT-X-VERSION tag may be absent 2022-04-17 01:08:07 -07:00
Vadim Getmanshchuk ac0f881eef * added QuotedOrUnquoted enum
* implemented `Default`, `From`, `Display` traits
* updated `VariantStream`, `AlternativeMedia`, `SessionData`, `Key`, `Start` emums
* updated `from_hashmap` methods for each enum
* fixed tests
2022-04-15 23:06:40 -07:00
Sebastian Dröge 44aa097c90 Use u64 instead of i32 for byte ranges and sequence numbers
Fixes https://github.com/rutgersc/m3u8-rs/issues/39
2022-01-07 12:47:40 +02:00
Sebastian Dröge 2fae1d8f20 Don't bother parsing as a playlist or detecting if it's a master/media playlist if it doesn't start with #EXTM3U 2021-11-19 11:29:46 +02:00
Sebastian Dröge 2432846064 Move the crate docs to the root of the crate so they actually show up
And also fix all the broken links while we're at it.
2021-11-18 15:04:17 +02:00
Sebastian Dröge 3edf5d1c0f Fix various minor clippy warnings 2021-11-18 14:54:46 +02:00
Sebastian Dröge 336f11e1ba Remove useless fn main() from documentation examples 2021-11-18 14:52:03 +02:00
Sebastian Dröge a5d8358379 Make most internal parser functions private
And move parser internals tests into a test submodule of the parser.

Also add actual assertions to various tests so they test something.
2021-11-18 14:50:14 +02:00
Sebastian Dröge 5500166f74 Fix confusing #[path] usage and re-exports in lib.rs
This has effectively the same behaviour now with fewer lines, less
confusion and fewer compiler warnings about unused code.
2021-11-17 19:32:57 +02:00
Sebastian Dröge 65c295ee02 Require each M3U8 playlist to start with the #EXTM3U8 tag
The RFC requires this to be the very first line of every master/media
playlist, and without this we would be parsing arbitrary text files as
playlist without erroring out.

See https://datatracker.ietf.org/doc/html/rfc8216#section-4.3.1.1

Fixes https://github.com/rutgersc/m3u8-rs/issues/27
2021-11-17 19:14:58 +02:00
Sebastian Dröge a44c2a1a72 Run parser through cargo fmt
Now that we don't use the nom macros anymore this works properly.
2021-11-17 16:00:25 +02:00
Sebastian Dröge 0ed0ce51f8 Migrate to Rust 2018
Cleans up some noise.
2021-11-17 16:00:23 +02:00
Sebastian Dröge 81398f86cd Port to nom 7
Fixes https://github.com/rutgersc/m3u8-rs/issues/35
2021-11-17 16:00:08 +02:00
Rafael Caricio 3d5599fa28
Apply clippy suggestions 2021-10-18 11:48:30 +02:00
Rafael Caricio 39aab3a2ac
Apply cargo fmt 2021-10-18 11:41:28 +02:00
Rafael Caricio dc352301a3
Allow unknown tags at the master playlist level 2021-10-14 21:21:03 +02:00
Rafael Caricio c1ff2b3730
Support parsing of unknown tags on segments 2021-10-12 23:06:47 +02:00
Rutger Schoorstra dc576c8e3c Add parser as default feature 2021-04-24 18:43:57 +02:00