summaryrefslogtreecommitdiff
path: root/libavformat/avio.c
diff options
context:
space:
mode:
authorMartin Storsjö <martin@martin.st>2011-02-28 15:39:36 +0200
committerLuca Barbato <lu_zero@gentoo.org>2011-03-06 23:29:39 +0100
commit8f73c060773156cbf48e153506a38bcb6e2c4c6d (patch)
tree6156acbe07eb155f0c1e02bf9b48df0b8bd1e12e /libavformat/avio.c
parentf3bea9915fdc87c3f5b635fcfe0250a28e2b1a88 (diff)
URLProtocol: Add URL_PROTOCOL_FLAG_NESTED_SCHEME
If this flag is set, the protocol can handle URLs where the scheme is a nested scheme such as applehttp+file: - the protocol can handle any URL where the first segment of the nested scheme belongs to this protocol. Signed-off-by: Luca Barbato <lu_zero@gentoo.org>
Diffstat (limited to 'libavformat/avio.c')
-rw-r--r--libavformat/avio.c9
1 files changed, 8 insertions, 1 deletions
diff --git a/libavformat/avio.c b/libavformat/avio.c
index a19ec37cb1..4ab1b6bd75 100644
--- a/libavformat/avio.c
+++ b/libavformat/avio.c
@@ -175,7 +175,7 @@ int url_open_protocol (URLContext **puc, struct URLProtocol *up,
int url_alloc(URLContext **puc, const char *filename, int flags)
{
URLProtocol *up;
- char proto_str[128];
+ char proto_str[128], proto_nested[128], *ptr;
size_t proto_len = strspn(filename, URL_SCHEME_CHARS);
if (filename[proto_len] != ':' || is_dos_path(filename))
@@ -183,10 +183,17 @@ int url_alloc(URLContext **puc, const char *filename, int flags)
else
av_strlcpy(proto_str, filename, FFMIN(proto_len+1, sizeof(proto_str)));
+ av_strlcpy(proto_nested, proto_str, sizeof(proto_nested));
+ if ((ptr = strchr(proto_nested, '+')))
+ *ptr = '\0';
+
up = first_protocol;
while (up != NULL) {
if (!strcmp(proto_str, up->name))
return url_alloc_for_protocol (puc, up, filename, flags);
+ if (up->flags & URL_PROTOCOL_FLAG_NESTED_SCHEME &&
+ !strcmp(proto_nested, up->name))
+ return url_alloc_for_protocol (puc, up, filename, flags);
up = up->next;
}
*puc = NULL;