summaryrefslogtreecommitdiffstats
path: root/stream/stream.c
diff options
context:
space:
mode:
authorwm4 <wm4@nowhere>2016-09-08 21:46:48 +0200
committerwm4 <wm4@nowhere>2016-09-08 21:46:48 +0200
commit5e30e7a04125e3c503160a76bbfe9361bff561fd (patch)
tree6aa17c781f70382471e331e4e9754aaf45ebe64b /stream/stream.c
parent35e8b6c1e68ae936ca0aeee4f30732cd13ef9932 (diff)
downloadmpv-5e30e7a04125e3c503160a76bbfe9361bff561fd.tar.bz2
mpv-5e30e7a04125e3c503160a76bbfe9361bff561fd.tar.xz
stream_dvd, stream_dvdnav: remove weird option parsing stuff
Same deal as with stream_bluray. Untested because I don't give a fuck about your shitty DVDs.
Diffstat (limited to 'stream/stream.c')
-rw-r--r--stream/stream.c18
1 files changed, 11 insertions, 7 deletions
diff --git a/stream/stream.c b/stream/stream.c
index 69772f335a..ed7697e9c6 100644
--- a/stream/stream.c
+++ b/stream/stream.c
@@ -207,18 +207,22 @@ static bstr split_next(bstr *s, char end, const char *delim)
// Parse the stream URL, syntax:
// proto:// [<username>@]<hostname>[:<port>][/<filename>]
-// (the proto:// part is already removed from s->path)
+// (the proto:// part is assumed to be already removed from s)
// This code originates from times when http code used this, but now it's
// just relict from other stream implementations reusing this code.
+void mp_parse_legacy_url(bstr s, bstr c[4])
+{
+ c[0] = split_next(&s, '@', "@:/");
+ c[1] = split_next(&s, 0, ":/");
+ c[2] = bstr_eatstart0(&s, ":") ? split_next(&s, 0, "/") : (bstr){0};
+ c[3] = bstr_eatstart0(&s, "/") ? s : (bstr){0};
+}
+
static bool parse_url(struct stream *st, struct m_config *config)
{
- bstr s = bstr0(st->path);
- const char *f_names[4] = {"username", "hostname", "port", "filename"};
bstr f[4];
- f[0] = split_next(&s, '@', "@:/");
- f[1] = split_next(&s, 0, ":/");
- f[2] = bstr_eatstart0(&s, ":") ? split_next(&s, 0, "/") : (bstr){0};
- f[3] = bstr_eatstart0(&s, "/") ? s : (bstr){0};
+ mp_parse_legacy_url(bstr0(st->path), f);
+ const char *f_names[4] = {"username", "hostname", "port", "filename"};
for (int n = 0; n < 4; n++) {
if (f[n].len) {
const char *opt = find_url_opt(st, f_names[n]);