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@martin.st>
This commit is contained in:
parent
be4edda673
commit
8c92909814
@ -211,6 +211,7 @@ static int parse_playlist(HLSContext *c, const char *url,
|
|||||||
char line[1024];
|
char line[1024];
|
||||||
const char *ptr;
|
const char *ptr;
|
||||||
int close_in = 0;
|
int close_in = 0;
|
||||||
|
uint8_t *new_url = NULL;
|
||||||
|
|
||||||
if (!in) {
|
if (!in) {
|
||||||
close_in = 1;
|
close_in = 1;
|
||||||
@ -219,6 +220,9 @@ static int parse_playlist(HLSContext *c, const char *url,
|
|||||||
return ret;
|
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));
|
read_chomp_line(in, line, sizeof(line));
|
||||||
if (strcmp(line, "#EXTM3U")) {
|
if (strcmp(line, "#EXTM3U")) {
|
||||||
ret = AVERROR_INVALIDDATA;
|
ret = AVERROR_INVALIDDATA;
|
||||||
@ -319,6 +323,7 @@ static int parse_playlist(HLSContext *c, const char *url,
|
|||||||
var->last_load_time = av_gettime();
|
var->last_load_time = av_gettime();
|
||||||
|
|
||||||
fail:
|
fail:
|
||||||
|
av_free(new_url);
|
||||||
if (close_in)
|
if (close_in)
|
||||||
avio_close(in);
|
avio_close(in);
|
||||||
return ret;
|
return ret;
|
||||||
|
Loading…
x
Reference in New Issue
Block a user