mirror of
https://github.com/rutgersc/m3u8-rs.git
synced 2024-12-23 06:56:29 +00:00
Don't bother parsing as a playlist or detecting if it's a master/media playlist if it doesn't start with #EXTM3U
This commit is contained in:
parent
53e9439660
commit
2fae1d8f20
1 changed files with 3 additions and 0 deletions
|
@ -42,6 +42,8 @@ use std::string;
|
|||
/// }
|
||||
/// ```
|
||||
pub fn parse_playlist(input: &[u8]) -> IResult<&[u8], Playlist> {
|
||||
m3u_tag(input)?;
|
||||
|
||||
match is_master_playlist(input) {
|
||||
true => map(parse_master_playlist, Playlist::MasterPlaylist)(input),
|
||||
false => map(parse_media_playlist, Playlist::MediaPlaylist)(input),
|
||||
|
@ -135,6 +137,7 @@ pub fn is_master_playlist(input: &[u8]) -> bool {
|
|||
/// - Some(true, tagstring): Line contains a master playlist tag
|
||||
/// - Some(false, tagstring): Line contains a media playlist tag
|
||||
fn contains_master_tag(input: &[u8]) -> Option<(bool, String)> {
|
||||
let (input, _) = m3u_tag(input).ok()?;
|
||||
let mut is_master_opt = None;
|
||||
let mut current_input: &[u8] = input;
|
||||
|
||||
|
|
Loading…
Reference in a new issue