mirror of
https://github.com/mpv-player/mpv
synced 2025-03-19 09:57:34 +00:00
demux_playlist: remove len restriction on headerless m3u
Discovered by @christoph-heinrich in IRC.
09c701b797
added a fallback for headerless
m3u files. However, it requires that the bstr len be greater than 10.
This means that a m3u playlist with a single entry with a very short
filename (such as "test.flac") will not be recognized as a playlist
since the amount of data is too small. The reason for this restriction
is unexplained and really shouldn't matter given that the important
thing mpv should be doing is checking if the data is text. Instead,
loosen the check so that it only needs to be 2 or greater. This covers a
single byte filename and a line terminator.
This commit is contained in:
parent
9d7638a6f2
commit
17eb928775
@ -207,7 +207,7 @@ static int parse_m3u(struct pl_parser *p)
|
|||||||
char probe[PROBE_SIZE];
|
char probe[PROBE_SIZE];
|
||||||
int len = stream_read_peek(p->real_stream, probe, sizeof(probe));
|
int len = stream_read_peek(p->real_stream, probe, sizeof(probe));
|
||||||
bstr data = {probe, len};
|
bstr data = {probe, len};
|
||||||
if (ext && data.len > 10 && maybe_text(data)) {
|
if (ext && data.len >= 2 && maybe_text(data)) {
|
||||||
const char *exts[] = {"m3u", "m3u8", NULL};
|
const char *exts[] = {"m3u", "m3u8", NULL};
|
||||||
for (int n = 0; exts[n]; n++) {
|
for (int n = 0; exts[n]; n++) {
|
||||||
if (strcasecmp(ext, exts[n]) == 0)
|
if (strcasecmp(ext, exts[n]) == 0)
|
||||||
|
Loading…
Reference in New Issue
Block a user