diff options
author | wm4 <wm4@nowhere> | 2013-09-04 14:04:35 +0200 |
---|---|---|
committer | wm4 <wm4@nowhere> | 2013-09-04 16:15:08 +0200 |
commit | efc5ac17bf0a563cc4200252e8d4718731dc9fde (patch) | |
tree | 86eeedc8abf1170b2c91abda2df632a0458e8eb6 /stream | |
parent | dbff29c81d3127d69e97abcf7001f4b798898a81 (diff) | |
download | mpv-efc5ac17bf0a563cc4200252e8d4718731dc9fde.tar.bz2 mpv-efc5ac17bf0a563cc4200252e8d4718731dc9fde.tar.xz |
path: add a common mp_is_url() function
Remove the duplicated code.
Diffstat (limited to 'stream')
-rw-r--r-- | stream/stream.c | 7 |
1 files changed, 3 insertions, 4 deletions
diff --git a/stream/stream.c b/stream/stream.c index 8fde847743..bf84850d75 100644 --- a/stream/stream.c +++ b/stream/stream.c @@ -40,6 +40,7 @@ #include "mpvcore/mp_common.h" #include "mpvcore/bstr.h" #include "mpvcore/mp_msg.h" +#include "mpvcore/path.h" #include "osdep/timer.h" #include "stream.h" #include "demux/demux.h" @@ -250,10 +251,8 @@ static const char *match_proto(const char *url, const char *proto) if (l > 0) { if (strncasecmp(url, proto, l) == 0 && strncmp("://", url + l, 3) == 0) return url + l + 3; - } else { - // pure filenames (including "/path" and "./path") - if (url[0] == '/' || url[0] == '.' || !strstr(url, "://")) - return url; + } else if (!mp_is_url(bstr0(url))) { + return url; // pure filenames } return NULL; } |