aboutsummaryrefslogtreecommitdiffhomepage
path: root/demux
diff options
context:
space:
mode:
authorGravatar wm4 <wm4@nowhere>2017-11-12 15:51:48 +0100
committerGravatar wm4 <wm4@nowhere>2017-11-12 15:51:48 +0100
commit987291d0427518ec85b8113bb1d91dfdc2ef6149 (patch)
treecb2c8e71c2a07f2a1579df73fb3dc86a1cb6cc40 /demux
parente2d0e0c6cb6a91d60fbeff643d0ac4e7a14173e4 (diff)
demux_playlist: support .url files
Requested. Not tested due to lack of real samples. Fixes #5107.
Diffstat (limited to 'demux')
-rw-r--r--demux/demux_playlist.c18
1 files changed, 15 insertions, 3 deletions
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},
};