summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--demux/demux_playlist.c19
-rw-r--r--mpvcore/playlist_parser.c36
2 files changed, 18 insertions, 37 deletions
diff --git a/demux/demux_playlist.c b/demux/demux_playlist.c
index b924140497..dc623f1433 100644
--- a/demux/demux_playlist.c
+++ b/demux/demux_playlist.c
@@ -69,7 +69,7 @@ static int parse_m3u(struct pl_parser *p)
if (p->probing)
return 0;
while (!pl_eof(p)) {
- line = bstr_lstrip(pl_get_line(p));
+ line = bstr_strip(pl_get_line(p));
if (line.len == 0 || bstr_startswith0(line, "#"))
continue;
pl_add(p, line);
@@ -77,6 +77,22 @@ static int parse_m3u(struct pl_parser *p)
return 0;
}
+static int parse_ref_init(struct pl_parser *p)
+{
+ bstr line = bstr_strip(pl_get_line(p));
+ if (!bstr_equals0(line, "[Reference]"))
+ return -1;
+ while (!pl_eof(p)) {
+ line = bstr_strip(pl_get_line(p));
+ if (bstr_case_startswith(line, bstr0("Ref"))) {
+ bstr_split_tok(line, "=", &(bstr){0}, &line);
+ if (line.len)
+ pl_add(p, line);
+ }
+ }
+ return 0;
+}
+
struct pl_format {
const char *name;
int (*parse)(struct pl_parser *p);
@@ -84,6 +100,7 @@ struct pl_format {
static const struct pl_format formats[] = {
{"m3u", parse_m3u},
+ {"ini", parse_ref_init},
};
static const struct pl_format *probe_pl(struct pl_parser *p, bool force)
diff --git a/mpvcore/playlist_parser.c b/mpvcore/playlist_parser.c
index 920a004c50..0b3be14716 100644
--- a/mpvcore/playlist_parser.c
+++ b/mpvcore/playlist_parser.c
@@ -376,41 +376,6 @@ static bool parse_pls(play_tree_parser_t* p) {
return true;
}
-/*
- Reference Ini-Format: Each entry is assumed a reference
- */
-static bool parse_ref_ini(play_tree_parser_t* p) {
- char *line,*v;
-
- mp_msg(MSGT_PLAYTREE,MSGL_V,"Trying reference-ini playlist...\n");
- if (!(line = play_tree_parser_get_line(p)))
- return NULL;
- strstrip(line);
- if(strcasecmp(line,"[Reference]"))
- return NULL;
- mp_msg(MSGT_PLAYTREE,MSGL_V,"Detected reference-ini playlist format\n");
- play_tree_parser_stop_keeping(p);
- line = play_tree_parser_get_line(p);
- if(!line)
- return NULL;
- while(line) {
- strstrip(line);
- if(strncasecmp(line,"Ref",3) == 0) {
- v = pls_entry_get_value(line+3);
- if(!v)
- mp_msg(MSGT_PLAYTREE,MSGL_ERR,"No value in entry %s\n",line);
- else
- {
- mp_msg(MSGT_PLAYTREE,MSGL_DBG2,"Adding entry %s\n",v);
- playlist_add_file(p->pl, v);
- }
- }
- line = play_tree_parser_get_line(p);
- }
-
- return true;
-}
-
static bool parse_smil(play_tree_parser_t* p) {
int entrymode=0;
char* line,source[512],*pos,*s_start,*s_end,*src_line;
@@ -693,7 +658,6 @@ typedef bool (*parser_fn)(play_tree_parser_t *);
static const parser_fn pl_parsers[] = {
parse_asx,
parse_pls,
- parse_ref_ini,
parse_smil,
parse_nsc,
parse_textplain