From 987291d0427518ec85b8113bb1d91dfdc2ef6149 Mon Sep 17 00:00:00 2001 From: wm4 Date: Sun, 12 Nov 2017 15:51:48 +0100 Subject: demux_playlist: support .url files Requested. Not tested due to lack of real samples. Fixes #5107. --- demux/demux_playlist.c | 18 +++++++++++++++--- 1 file changed, 15 insertions(+), 3 deletions(-) (limited to 'demux') diff --git a/demux/demux_playlist.c b/demux/demux_playlist.c index dd7bc35a70..3a65ada451 100644 --- a/demux/demux_playlist.c +++ b/demux/demux_playlist.c @@ -177,12 +177,13 @@ static int parse_ref_init(struct pl_parser *p) return 0; } -static int parse_pls(struct pl_parser *p) +static int parse_ini_thing(struct pl_parser *p, const char *header, + const char *entry) { bstr line = {0}; while (!line.len && !pl_eof(p)) line = bstr_strip(pl_get_line(p)); - if (bstrcasecmp0(line, "[playlist]") != 0) + if (bstrcasecmp0(line, header) != 0) return -1; if (p->probing) return 0; @@ -190,7 +191,7 @@ static int parse_pls(struct pl_parser *p) line = bstr_strip(pl_get_line(p)); bstr key, value; if (bstr_split_tok(line, "=", &key, &value) && - bstr_case_startswith(key, bstr0("File"))) + bstr_case_startswith(key, bstr0(entry))) { value = bstr_strip(value); if (bstr_startswith0(value, "\"") && bstr_endswith0(value, "\"")) @@ -201,6 +202,16 @@ static int parse_pls(struct pl_parser *p) return 0; } +static int parse_pls(struct pl_parser *p) +{ + return parse_ini_thing(p, "[playlist]", "File"); +} + +static int parse_url(struct pl_parser *p) +{ + return parse_ini_thing(p, "[InternetShortcut]", "URL"); +} + static int parse_txt(struct pl_parser *p) { if (!p->force) @@ -319,6 +330,7 @@ static const struct pl_format formats[] = { {"ini", parse_ref_init}, {"pls", parse_pls, MIME_TYPES("audio/x-scpls")}, + {"url", parse_url}, {"txt", parse_txt}, }; -- cgit v1.2.3