[FFmpeg-devel] [PATCH] lavf/concatdec: more reliable test for absolute URLs.
Nicolas George
george at nsup.org
Sun Mar 2 15:04:38 CET 2014
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.
Signed-off-by: Nicolas George <george at nsup.org>
---
libavformat/concatdec.c | 13 ++++++++++++-
1 file changed, 12 insertions(+), 1 deletion(-)
diff --git a/libavformat/concatdec.c b/libavformat/concatdec.c
index 114245b..c872d34 100644
--- a/libavformat/concatdec.c
+++ b/libavformat/concatdec.c
@@ -88,18 +88,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);
--
1.9.0
More information about the ffmpeg-devel
mailing list