Commit graph

33 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
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
Vadim Getmanshchuk d941541be8 EXT-X-VERSION tag may be absent 2022-04-17 01:08:07 -07:00
Sebastian Dröge 51fcb70113 Re-export all types from the crate root and remove the playlist sub-module
There's not much else in this crate and having it behind another module
decreases visibility.
2021-11-18 15:00:01 +02:00
Sebastian Dröge 3edf5d1c0f Fix various minor clippy warnings 2021-11-18 14:54:46 +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 4e6ac58d0c Add tests for parsing non-playlist text and binary data
These should fail to parse (and not panic), but previously the
non-playlist text succeeded.
2021-11-17 19:22:28 +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 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 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
rutgersc 302ff22f31
Merge pull request #21 from rutgersc/fix/alternatives
Move alternatives to MasterPlaylist
2021-04-20 18:47:33 +02:00
Rutger Schoorstra 087c47bddd Fix consume_line not returning line when line doesn't end with a newline 2021-04-18 11:59:31 +02:00
Rutger Schoorstra 57d60ba438 Move alternatives to MasterPlaylist 2021-04-16 21:20:30 +02:00
rutgersc e2822e4521
Merge pull request #11 from vagetman/vagetman-nom-5.1.0
Upgraded macros to Nom 5
2020-07-01 16:43:30 +02:00
Rutger Schoorstra 100a57078a Fix failed test on CLRF 2020-03-07 10:23:06 +01:00
Rutger Schoorstra ab9c554eb4 Upgraded tests to Nom 5 2020-03-07 10:23:06 +01:00
Rutger Schoorstra 31e78801f9 CODECS should be optional
https://developer.apple.com/documentation/http_live_streaming/example_playlists_for_http_live_streaming/creating_a_master_playlist
> While the CODECS parameter is optional, every EXT-X-STREAM-INF tag should include the attribute.
2020-02-15 16:02:45 +01:00
Rutger Schoorstra 03ec1a4544 Added quick parse roundtrip test 2020-02-15 16:01:30 +01:00
Rutger Schoorstra b2150f26e5 Remove unneeded macro_use 2020-02-15 16:00:10 +01:00
Philippe Normand b5b950150f Make tests run on non-windows machines
Hardcoding the windows path separator isn't a good idea for portability :)
2017-11-11 13:02:04 +01:00
Rutger c336b89981 Added feature: writing playlists back to file 2017-02-17 14:50:50 +01:00
Rutger d7c452fe78 Fixed a bug where the parser fails when the playlist does not end with a newline. 2016-09-10 13:22:13 +02:00
Rutger 41ce460d90 Version 1.0.0 2016-06-03 20:56:45 +02:00