[FFmpeg-cvslog] hls: Check whether the AVIOContext contains a new redirected URL

Martin Storsjö git at videolan.org
Fri Nov 22 18:15:49 CET 2013


ffmpeg | branch: master | Martin Storsjö <martin at martin.st> | Thu Nov 21 11:31:53 2013 +0200| [8c929098141ebc94ad3f303521c520bb3dc6d8f6] | committer: Martin Storsjö

hls: Check whether the AVIOContext contains a new redirected URL

This allows both the main playlist itself as well as the variant
playlists to handle redirects combined with relative URLs.

Signed-off-by: Martin Storsjö <martin at martin.st>

> http://git.videolan.org/gitweb.cgi/ffmpeg.git/?a=commit;h=8c929098141ebc94ad3f303521c520bb3dc6d8f6
---

 libavformat/hls.c |    5 +++++
 1 file changed, 5 insertions(+)

diff --git a/libavformat/hls.c b/libavformat/hls.c
index ea16f8a..14fdf8f 100644
--- a/libavformat/hls.c
+++ b/libavformat/hls.c
@@ -211,6 +211,7 @@ static int parse_playlist(HLSContext *c, const char *url,
     char line[1024];
     const char *ptr;
     int close_in = 0;
+    uint8_t *new_url = NULL;
 
     if (!in) {
         close_in = 1;
@@ -219,6 +220,9 @@ static int parse_playlist(HLSContext *c, const char *url,
             return ret;
     }
 
+    if (av_opt_get(in, "location", AV_OPT_SEARCH_CHILDREN, &new_url) >= 0)
+        url = new_url;
+
     read_chomp_line(in, line, sizeof(line));
     if (strcmp(line, "#EXTM3U")) {
         ret = AVERROR_INVALIDDATA;
@@ -319,6 +323,7 @@ static int parse_playlist(HLSContext *c, const char *url,
         var->last_load_time = av_gettime();
 
 fail:
+    av_free(new_url);
     if (close_in)
         avio_close(in);
     return ret;



More information about the ffmpeg-cvslog mailing list