From efc5ac17bf0a563cc4200252e8d4718731dc9fde Mon Sep 17 00:00:00 2001 From: wm4 Date: Wed, 4 Sep 2013 14:04:35 +0200 Subject: path: add a common mp_is_url() function Remove the duplicated code. --- stream/stream.c | 7 +++---- 1 file changed, 3 insertions(+), 4 deletions(-) (limited to 'stream') 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; } -- cgit v1.2.3