summaryrefslogtreecommitdiff
path: root/libavformat/concatdec.c
diff options
context:
space:
mode:
authorNicolas George <george@nsup.org>2014-03-01 12:13:11 +0100
committerNicolas George <george@nsup.org>2014-03-08 12:38:31 +0100
commit8a670f52a56ba01bdb62b91b020573b217e40fb3 (patch)
tree2888833cd409259ed8e20ca1e969b1aa56f99a35 /libavformat/concatdec.c
parent97e87e09c841701798a27eb4f18e2fb6a612ec88 (diff)
downloadffmpeg-8a670f52a56ba01bdb62b91b020573b217e40fb3.tar.gz
lavf/concatdec: more reliable test for absolute URLs.
ff_make_absolute_url() recognizes the "://" pattern usual in HTTP-like protocols, but consider relative URLs starting with just the protocol name or using the comma syntax for options.
Diffstat (limited to 'libavformat/concatdec.c')
-rw-r--r--libavformat/concatdec.c13
1 files changed, 12 insertions, 1 deletions
diff --git a/libavformat/concatdec.c b/libavformat/concatdec.c
index 979499af0c..99f0b6881f 100644
--- a/libavformat/concatdec.c
+++ b/libavformat/concatdec.c
@@ -85,18 +85,29 @@ static int add_file(AVFormatContext *avf, char *filename, ConcatFile **rfile,
ConcatContext *cat = avf->priv_data;
ConcatFile *file;
char *url = NULL;
- size_t url_len;
+ const char *proto;
+ size_t url_len, proto_len;
int ret;
if (cat->safe > 0 && !safe_filename(filename)) {
av_log(avf, AV_LOG_ERROR, "Unsafe file name '%s'\n", filename);
FAIL(AVERROR(EPERM));
}
+
+ proto = avio_find_protocol_name(filename);
+ proto_len = proto ? strlen(proto) : 0;
+ if (!memcmp(filename, proto, proto_len) &&
+ (filename[proto_len] == ':' || filename[proto_len] == ',')) {
+ url = filename;
+ filename = NULL;
+ } else {
+ /* TODO reindent */
url_len = strlen(avf->filename) + strlen(filename) + 16;
if (!(url = av_malloc(url_len)))
FAIL(AVERROR(ENOMEM));
ff_make_absolute_url(url, url_len, avf->filename, filename);
av_freep(&filename);
+ }
if (cat->nb_files >= *nb_files_alloc) {
size_t n = FFMAX(*nb_files_alloc * 2, 16);