diff --git a/libavformat/hls.c b/libavformat/hls.c index b0f28f6289..65cd12112d 100644 --- a/libavformat/hls.c +++ b/libavformat/hls.c @@ -216,6 +216,7 @@ static int parse_playlist(HLSContext *c, const char *url, char line[MAX_URL_SIZE]; const char *ptr; int close_in = 0; + uint8_t *new_url = NULL; if (!in) { AVDictionary *opts = NULL; @@ -235,6 +236,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; @@ -335,6 +339,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;