From 0b1c3e8de22afc89868ad4aeb2a70738de33288c Mon Sep 17 00:00:00 2001 From: wm4 Date: Tue, 4 Aug 2015 17:04:56 +0200 Subject: player: warn against using HLS URLs with --playlist That just makes no sense, but seems to be a somewhat common user error. The detection is not perfect. It's conceivable that EXT-X-... headers are used in normal m3u playlists. After all, HLS playlists are by definition a compatible extension to m3u playlists, as stupid as it sounds. --- demux/demux_playlist.c | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) (limited to 'demux') diff --git a/demux/demux_playlist.c b/demux/demux_playlist.c index ff252bb417..25ad22bddb 100644 --- a/demux/demux_playlist.c +++ b/demux/demux_playlist.c @@ -54,6 +54,7 @@ struct pl_parser { bool add_base; enum demux_check check_level; struct stream *real_stream; + char *format; }; static char *pl_get_line0(struct pl_parser *p) @@ -120,6 +121,8 @@ ok: talloc_free(title); title = bstrto0(NULL, btitle); } + } else if (bstr_startswith0(line, "#EXT-X-")) { + p->format = "hls"; } else if (line.len > 0 && !bstr_startswith0(line, "#")) { char *fn = bstrto0(NULL, line); struct playlist_entry *e = playlist_entry_new(fn); @@ -338,7 +341,7 @@ static int open_file(struct demuxer *demuxer, enum demux_check check) if (p->add_base) playlist_add_base_path(p->pl, mp_dirname(demuxer->filename)); demuxer->playlist = talloc_steal(demuxer, p->pl); - demuxer->filetype = fmt->name; + demuxer->filetype = p->format ? p->format : fmt->name; demuxer->fully_read = true; talloc_free(p); return ok ? 0 : -1; -- cgit v1.2.3