diff options
author | Michael Niedermayer <michael@niedermayer.cc> | 2016-01-30 02:17:51 +0100 |
---|---|---|
committer | Michael Niedermayer <michael@niedermayer.cc> | 2016-02-02 04:16:50 +0100 |
commit | fe3fed0b143ef6bf2d9b65ce05d55aba4224429e (patch) | |
tree | 45ead8f324a1e5190ea4905cb574325a3d9196bd /libavformat/hls.c | |
parent | 1dba8371d93cf1c83bcd5c432d921905206a60f3 (diff) |
Update demuxers and protocols for protocol whitelist support
Reviewed-by: Andreas Cadhalpun <andreas.cadhalpun@googlemail.com>
Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
Diffstat (limited to 'libavformat/hls.c')
-rw-r--r-- | libavformat/hls.c | 16 |
1 files changed, 13 insertions, 3 deletions
diff --git a/libavformat/hls.c b/libavformat/hls.c index 2d8e6c0a6a..e23eaf1657 100644 --- a/libavformat/hls.c +++ b/libavformat/hls.c @@ -180,6 +180,7 @@ struct variant { typedef struct HLSContext { AVClass *class; + AVFormatContext *avfmt; int n_variants; struct variant **variants; int n_playlists; @@ -589,6 +590,14 @@ static int url_connect(struct playlist *pls, AVDictionary *opts, AVDictionary *o av_dict_copy(&tmp, opts, 0); av_dict_copy(&tmp, opts2, 0); + if (pls->parent->protocol_whitelist) { + pls->input->protocol_whitelist = av_strdup(pls->parent->protocol_whitelist); + if (!pls->input->protocol_whitelist) { + av_dict_free(&tmp); + return AVERROR(ENOMEM); + } + } + if ((ret = ffurl_connect(pls->input, &tmp)) < 0) { ffurl_close(pls->input); pls->input = NULL; @@ -626,7 +635,7 @@ static int open_url(HLSContext *c, URLContext **uc, const char *url, AVDictionar av_dict_copy(&tmp, c->avio_opts, 0); av_dict_copy(&tmp, opts, 0); - ret = ffurl_open(uc, url, AVIO_FLAG_READ, c->interrupt_callback, &tmp); + ret = ffurl_open_whitelist(uc, url, AVIO_FLAG_READ, c->interrupt_callback, &tmp, c->avfmt->protocol_whitelist); if( ret >= 0) { // update cookies on http response with setcookies. URLContext *u = *uc; @@ -671,8 +680,8 @@ static int parse_playlist(HLSContext *c, const char *url, av_dict_set(&opts, "headers", c->headers, 0); av_dict_set(&opts, "http_proxy", c->http_proxy, 0); - ret = avio_open2(&in, url, AVIO_FLAG_READ, - c->interrupt_callback, &opts); + ret = ffio_open_whitelist(&in, url, AVIO_FLAG_READ, + c->interrupt_callback, &opts, c->avfmt->protocol_whitelist); av_dict_free(&opts); if (ret < 0) return ret; @@ -1509,6 +1518,7 @@ static int hls_read_header(AVFormatContext *s) HLSContext *c = s->priv_data; int ret = 0, i, j, stream_offset = 0; + c->avfmt = s; c->interrupt_callback = &s->interrupt_callback; c->strict_std_compliance = s->strict_std_compliance; |