Commit graph

48 commits

Author SHA1 Message Date
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 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 7e62854e20 Use unwrap_or_default() instead of unwrap_or_else(Default::default) 2021-11-18 14:52:38 +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 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 dc576c8e3c Add parser as default feature 2021-04-24 18:43:57 +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
Jan Schmidt 978e6a7e58 Handle blank lines when checking for master playlist tags.
Fix a bug where a blank line in a master playlist before the first
master playlist tag will make the parser think it's a media playlist.

Fixes #17
2021-03-17 06:41:35 +11: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
Rutger Schoorstra 100a57078a Fix failed test on CLRF 2020-03-07 10:23:06 +01:00
Rutger Schoorstra 13405a09eb Upgraded docs to Nom 5 2020-03-07 10:23:06 +01: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 4ed378772b
added forgotten use for map 2020-03-04 20:12:50 -08:00
Vadim Getmanshchuk 350109e29a
map cleanup, leftovers 2020-02-26 22:57:05 -08:00
Vadim Getmanshchuk f7587aa264
cleanup, fn map renamed
Local `fn map` -> `fn extmap` that allows to use map from Nom directly, without `nom::combinator::`
2020-02-26 22:52:20 -08:00
Vadim Getmanshchuk e4e1717b0a
Back ported 1.0.6 release 2020-02-26 17:17:13 -08:00
Vadim Getmanshchuk b9d377bfa4
Upgraded macros to Nom 5
Changes:

IResult::Done - IResult::Ok
chain! -> do_parse!
   slightly different syntax with `?` ->  opt!
digit -> digit1
space? -> space0
multispace? -> multispace0
many0!() -> many0!(complete!())
take_until_either! -> is_not!
take_until_and_consume! -> take_until! + take!(1)
take_until_either_and_consume! -> is_not! + take!(1)
2020-02-26 17:05:14 -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
Vadim Getmanshchuk 22571a3404
A stub on updating nom to 5.1.0 version 2020-02-12 12:04:20 -08:00
vagetman 279fefef72
A comma added before the URI for fn write_to 2020-02-11 12:43:06 -08:00
Gurinder Singh ccf25fefcf Fixed a bug where #EXT-X-MEDIA-SEQUENCE tag was being interpreted as #EXT-X-MEDIA 2019-03-08 11:22:34 +05:30
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 7583aaccba Fix doc tests 2017-02-17 17:22:09 +01:00
Rutger e3d0cb8cff Added example of how to create & write a playlist 2017-02-17 15:16:08 +01:00
Rutger c336b89981 Added feature: writing playlists back to file 2017-02-17 14:50:50 +01:00
Rutger 6286cddc04 Remove unwrap from version tag 2017-02-16 11:17:02 +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