diff options
author | wm4 <wm4@nowhere> | 2013-08-26 23:34:07 +0200 |
---|---|---|
committer | wm4 <wm4@nowhere> | 2013-08-28 23:08:10 +0200 |
commit | 33c03c4d0a33a9b39209a9ca528b007dda61560c (patch) | |
tree | 0a0e306ffff0a4933df36d5d97d96d625c4b0386 /demux | |
parent | 792844f8732b294b6badd8d80c29aa03cf6f3ca1 (diff) | |
download | mpv-33c03c4d0a33a9b39209a9ca528b007dda61560c.tar.bz2 mpv-33c03c4d0a33a9b39209a9ca528b007dda61560c.tar.xz |
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.)
Diffstat (limited to 'demux')
-rw-r--r-- | demux/demux_playlist.c | 19 |
1 files changed, 18 insertions, 1 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) |