diff options
author | wm4 <wm4@nowhere> | 2015-08-04 17:04:56 +0200 |
---|---|---|
committer | wm4 <wm4@nowhere> | 2015-08-04 17:51:00 +0200 |
commit | 0b1c3e8de22afc89868ad4aeb2a70738de33288c (patch) | |
tree | 295ef3708999477d8c0af7c2aa7c0d15065682b8 /demux | |
parent | e7897dfb9b0e2d1f9d37ccc7df131b62694603e6 (diff) | |
download | mpv-0b1c3e8de22afc89868ad4aeb2a70738de33288c.tar.bz2 mpv-0b1c3e8de22afc89868ad4aeb2a70738de33288c.tar.xz |
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.
Diffstat (limited to 'demux')
-rw-r--r-- | demux/demux_playlist.c | 5 |
1 files changed, 4 insertions, 1 deletions
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; |