From 33c03c4d0a33a9b39209a9ca528b007dda61560c Mon Sep 17 00:00:00 2001 From: wm4 Date: Mon, 26 Aug 2013 23:34:07 +0200 Subject: demux_playlist: port ini reference playlist parser Port it from playlist_parser.c to demux_playlist.c. Also, change the m3u parser to drop whitespace from the trailing part of the line (will make it work properly with windows line endings). (I hoped that this would make MMS URIs with http instead of mmsh prefixes work, but it doesn't. Instead, it leads to a playlist loop. So solving this issue would require a change in ffmpeg, probably.) --- demux/demux_playlist.c | 19 ++++++++++++++++++- 1 file changed, 18 insertions(+), 1 deletion(-) (limited to 'demux/demux_playlist.c') 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) -- cgit v1.2.3