diff options
author | Martin Storsjö <martin@martin.st> | 2011-03-17 12:24:23 +0200 |
---|---|---|
committer | Luca Barbato <lu_zero@gentoo.org> | 2011-03-17 12:28:37 +0100 |
commit | f1f60f5252b0b448adcce0c1c52f3161ee69b9bf (patch) | |
tree | 0a8803e4bd4073efeff698fec9161ab1f1762ee8 /libavformat/applehttpproto.c | |
parent | dc6fdad5dcbf4e796543929ccbce0de1f8535efd (diff) | |
download | ffmpeg-f1f60f5252b0b448adcce0c1c52f3161ee69b9bf.tar.gz |
lavf: Make make_absolute_url a lavf internal function
This is shared by both applehttp demuxer and protocol.
Signed-off-by: Luca Barbato <lu_zero@gentoo.org>
Diffstat (limited to 'libavformat/applehttpproto.c')
-rw-r--r-- | libavformat/applehttpproto.c | 55 |
1 files changed, 2 insertions, 53 deletions
diff --git a/libavformat/applehttpproto.c b/libavformat/applehttpproto.c index 871f2712df..c287c6c614 100644 --- a/libavformat/applehttpproto.c +++ b/libavformat/applehttpproto.c @@ -75,57 +75,6 @@ static int read_chomp_line(AVIOContext *s, char *buf, int maxlen) return len; } -static void make_absolute_url(char *buf, int size, const char *base, - const char *rel) -{ - char *sep; - /* Absolute path, relative to the current server */ - if (base && strstr(base, "://") && rel[0] == '/') { - if (base != buf) - av_strlcpy(buf, base, size); - sep = strstr(buf, "://"); - if (sep) { - sep += 3; - sep = strchr(sep, '/'); - if (sep) - *sep = '\0'; - } - av_strlcat(buf, rel, size); - return; - } - /* If rel actually is an absolute url, just copy it */ - if (!base || strstr(rel, "://") || rel[0] == '/') { - av_strlcpy(buf, rel, size); - return; - } - if (base != buf) - av_strlcpy(buf, base, size); - /* Remove the file name from the base url */ - sep = strrchr(buf, '/'); - if (sep) - sep[1] = '\0'; - else - buf[0] = '\0'; - while (av_strstart(rel, "../", NULL) && sep) { - /* Remove the path delimiter at the end */ - sep[0] = '\0'; - sep = strrchr(buf, '/'); - /* If the next directory name to pop off is "..", break here */ - if (!strcmp(sep ? &sep[1] : buf, "..")) { - /* Readd the slash we just removed */ - av_strlcat(buf, "/", size); - break; - } - /* Cut off the directory name */ - if (sep) - sep[1] = '\0'; - else - buf[0] = '\0'; - rel += 3; - } - av_strlcat(buf, rel, size); -} - static void free_segment_list(AppleHTTPContext *s) { int i; @@ -201,7 +150,7 @@ static int parse_playlist(URLContext *h, const char *url) goto fail; } seg->duration = duration; - make_absolute_url(seg->url, sizeof(seg->url), url, line); + ff_make_absolute_url(seg->url, sizeof(seg->url), url, line); dynarray_add(&s->segments, &s->n_segments, seg); is_segment = 0; } else if (is_variant) { @@ -211,7 +160,7 @@ static int parse_playlist(URLContext *h, const char *url) goto fail; } var->bandwidth = bandwidth; - make_absolute_url(var->url, sizeof(var->url), url, line); + ff_make_absolute_url(var->url, sizeof(var->url), url, line); dynarray_add(&s->variants, &s->n_variants, var); is_variant = 0; } |