Commit graph

44 commits

Author SHA1 Message Date
Anton Eicher e3b6390186 EXTINF tags need to be in floating-point format to work with AWS Elemental MediaConvert
AWS Elemental MediaConvert rejects playlists with EXTINF tags that are not in floating point format. When m3u8 MediaSegment self.duration is an exact number without trailing decimals, writeln cuts off the decimal places and prints it like an integer.

This change adds support for fixed length floating point numbers.
2024-02-14 16:29:47 +02:00
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
clitic a1970192ff Write BYTERANGE inside quotes 2023-04-12 10:39:44 +03:00
mmason e7a6cf943c allow millisecond accuracy for EXT-X-PROGRAM-DATE-TIME 2023-04-11 18:05:54 +03:00
Sebastian Dröge 015b05f26c Fix some minor clippy warnings 2022-12-02 10:46:10 +02:00
Sebastian Dröge e41c47a8f8 Map unknown strings to already existing Other variants of enums
Fixes https://github.com/rutgersc/m3u8-rs/issues/52
2022-09-12 10:12:44 +03:00
Vadim Getmanshchuk d2881fef08 Improve #EXT-X-INDEPENDENT-SEGMENTS placement
While it can be anywhere in the playlist as it applies to, this one usually is at the top of the manifest, right after the VERSION tag.
2022-07-21 10:34:57 +03: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 b692ac0808 Remove additional newline after "#EXTM3U" added in previous commit
Co-authored-by: Vadim Getmanshchuk <vagetman@users.noreply.github.com>
2022-04-19 18:20:32 +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
Vadim Getmanshchuk 5c842fd9f6 minor cargo clippy suggestions 2022-04-08 16:31:37 -07:00
Vadim Getmanshchuk 2f92e3ae8c #EXT-X-ENDLIST is moved to be the last part of the media manifest. Theoretically it can appear anywhere in manifest, so the current placement is not breaking the standard, but not usually is what found in the wild and I believe will help with readability. As any placement is possible, the placement at the end is completely legal. 2022-04-08 16:27:04 -07:00
Vadim Getmanshchuk 3c8368f9a3 A fix for CLOSED-CAPTIONS=NONE case and a few minor fixes
The PR includes 
* a hotfix for issue #44. I'm not entirely sure and it's possible to
* `#EXT-X-ENDLIST` is moved to be the last part of the media manifest. Theoretically it can appear anywhere in manifest, so the current placement is not breaking the standard, but not usually is what found in the wild and I believe will help with readability. As any placement is possible, the placement at the end is completely legal.  
* minor `cargo clippy` suggestions
2022-04-08 16:23:27 -07:00
rutgersc 39b52a1d4b
Merge pull request #42 from sdroege/u64-instead-of-i32
Use `u64` instead of `i32` for byte ranges and sequence numbers
2022-02-19 13:38:06 +01:00
rutgersc bc8ccf0f5d
Merge pull request #41 from sdroege/derive-more-traits
Derive some more traits for the public types where it makes sense
2022-02-19 13:37:41 +01: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 1bfad5df01 Derive some more traits for the public types where it makes sense
This makes them easier to use.
2022-01-07 12:44:56 +02:00
Sebastian Dröge cca02b239d The TYPE attribute uses CLOSED-CAPTIONS and not CLOSEDCAPTIONS
See https://datatracker.ietf.org/doc/html/draft-pantos-hls-rfc8216bis-10#section-4.4.6.1
2022-01-05 19:11:42 +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 7e62854e20 Use unwrap_or_default() instead of unwrap_or_else(Default::default) 2021-11-18 14:52:38 +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 677027e22c
Update readme with new attribute 2021-10-14 21:35:35 +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 c3ef5bc16e Split code into parser/types 2021-04-24 18:39:25 +02:00
Jan Schmidt 05669cab68 Support multiple session data and key tags.
Collect Vecs of session_data and session_key tags to
allow for multiples of each. Doesn't do any validation
as to disallowed duplicated values.

Fixes #20
2021-04-25 00:44:08 +10:00
Jan Schmidt 870ca830d3 SessionData: Must have either VALUE or URI, but not both.
If SessionData has a value, don't write the URI and vice-versa.

As per https://tools.ietf.org/html/rfc8216#section-4.3.4.4
EXT-X-SESSION-DATA must have one or the other, not both.
2021-04-25 00:44:08 +10:00
Jan Schmidt 5fe3fc309c Add HDCP-LEVEL and CHANNELS fields.
Add support for parsing / generating HDCP-LEVEL in a VariantStream
and CHANNELS in AlternativeMedia. The fields were added after
draft-pantos-http-live-streaming-19.txt and brings things up to date
with RFC 8216.
2021-04-21 13:44:17 +10:00
Rafael Caricio 3e74f7787f Expose unknown tags 2021-04-20 19:29:04 +02:00
Rutger Schoorstra 57d60ba438 Move alternatives to MasterPlaylist 2021-04-16 21:20:30 +02:00
Vadim Getmanshchuk 7a882e5df0
fixed warning: unused std::result::Result
```
warning: unused `std::result::Result` that must be used
```

I forgot `?` for the error propagation
2020-03-21 21:23:03 -07:00
Vadim Getmanshchuk b810687652
fixed issue with #EXTINF without titles
in #EXTINF tag, when comma `,` after segment duration immediately follows by `\n` the `title` is not getting populated and is not printed with `writeln!`

The problem is created by the nom 5 conversion, where `take_until_either_and_consume!` macro was replaced with `is_not!` + `take!(1)`. However, in case when `opt!(take_until_either_and_consume!` is used, everything gets way too hairy. I couldn't to expressed that in a fairly elegant manner and instead fixed the data presentation, when a new manifest is produced. While storing `\n` in a form of `title` is a nice hack, I'm also convinced this is a better approach to data handling.
2020-03-06 21:52:22 -08:00
Vadim Getmanshchuk e4e1717b0a
Back ported 1.0.6 release 2020-02-26 17:17:13 -08:00
Vadim Getmanshchuk fc9f45dd18
Fix tag duplication
The fix is addressing duplication for #EXT-X-KEY and #EXT-X-MAP tags in a media manifest produced
2020-02-26 16:21:06 -08:00
Rogier 'DocWilco' Mulhuijzen 67eebd17a0 Done is now Ok, map works a little different 2020-02-12 14:38:47 -08:00
vagetman 279fefef72
A comma added before the URI for fn write_to 2020-02-11 12:43:06 -08:00
Gurinder Singh 759809b2b4 Implemented Clone on all structs 2018-11-26 07:13:42 +05:30
Rutger 6032301143 Delete println! 2017-04-19 09:05:13 +02:00
Rutger c336b89981 Added feature: writing playlists back to file 2017-02-17 14:50:50 +01:00
Rutger 41ce460d90 Version 1.0.0 2016-06-03 20:56:45 +02:00