diff options
author | Michael Niedermayer <michaelni@gmx.at> | 2011-03-17 16:53:58 +0100 |
---|---|---|
committer | Michael Niedermayer <michaelni@gmx.at> | 2011-03-17 17:22:52 +0100 |
commit | 0fecf2642b9d909820683647c70031a954f5e58d (patch) | |
tree | 36ca02de9fa27a049829fb589517223d2d0ce5f5 /libavformat/applehttp.c | |
parent | e309fdc7018a1027d187ec27fb1d69a41a4ee167 (diff) | |
parent | f1f60f5252b0b448adcce0c1c52f3161ee69b9bf (diff) | |
download | ffmpeg-0fecf2642b9d909820683647c70031a954f5e58d.tar.gz |
Merge remote-tracking branch 'newdev/master'
Conflicts:
Changelog
doc/APIchanges
doc/optimization.txt
libavformat/avio.h
Merged-by: Michael Niedermayer <michaelni@gmx.at>
Diffstat (limited to 'libavformat/applehttp.c')
-rw-r--r-- | libavformat/applehttp.c | 57 |
1 files changed, 3 insertions, 54 deletions
diff --git a/libavformat/applehttp.c b/libavformat/applehttp.c index 231abab87c..324494ad74 100644 --- a/libavformat/applehttp.c +++ b/libavformat/applehttp.c @@ -86,57 +86,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(struct variant *var) { int i; @@ -183,7 +132,7 @@ static struct variant *new_variant(AppleHTTPContext *c, int bandwidth, return NULL; reset_packet(&var->pkt); var->bandwidth = bandwidth; - make_absolute_url(var->url, sizeof(var->url), base, url); + ff_make_absolute_url(var->url, sizeof(var->url), base, url); dynarray_add(&c->variants, &c->n_variants, var); return var; } @@ -274,7 +223,7 @@ static int parse_playlist(AppleHTTPContext *c, 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(&var->segments, &var->n_segments, seg); is_segment = 0; } @@ -519,7 +468,7 @@ reload: c->max_start_seq - c->cur_seq_no); c->cur_seq_no = c->max_start_seq; } - /* If more segments exit, open the next one */ + /* If more segments exist, open the next one */ if (c->cur_seq_no < c->min_end_seq) goto start; /* We've reached the end of the playlists - return eof if this is a |