diff options
author | Hendrik Leppkes <h.leppkes@gmail.com> | 2016-03-14 11:38:20 +0100 |
---|---|---|
committer | Hendrik Leppkes <h.leppkes@gmail.com> | 2016-03-16 10:31:36 +0100 |
commit | 0d4b8a2c163bd4f7e4ce579c139edd621c7832bf (patch) | |
tree | 297510c395d5515b46e5f9d9fcf562ffe528452c /libavformat | |
parent | fa3eecf9ab6e20c1c74554fc2eb8b8e4245935b4 (diff) | |
download | ffmpeg-0d4b8a2c163bd4f7e4ce579c139edd621c7832bf.tar.gz |
hls: read protocol options through the AVIOContext
This reverts commit 9f9ed79d4cb40e5d9093899f8a79086ff23da844.
The hlsopts member was never set anywhere and always NULL, furthermore
the HLS demuxer needs to retrieve the proper options from the underlying
http protocol (cookies, user-agent, etc), so a dummy context won't help.
Instead, use the AVIOContext directly to access the options.
Diffstat (limited to 'libavformat')
-rw-r--r-- | libavformat/avio_internal.h | 5 | ||||
-rw-r--r-- | libavformat/aviobuf.c | 4 | ||||
-rw-r--r-- | libavformat/hls.c | 8 |
3 files changed, 7 insertions, 10 deletions
diff --git a/libavformat/avio_internal.h b/libavformat/avio_internal.h index ba9bd4e2a4..3867be6e97 100644 --- a/libavformat/avio_internal.h +++ b/libavformat/avio_internal.h @@ -24,11 +24,6 @@ #include "libavutil/log.h" -typedef struct AVIOInternal { - URLContext *h; - void *hlsopts; -} AVIOInternal; - extern const AVClass ff_avio_class; int ffio_init_context(AVIOContext *s, diff --git a/libavformat/aviobuf.c b/libavformat/aviobuf.c index 00f7c5a180..f2f03f639f 100644 --- a/libavformat/aviobuf.c +++ b/libavformat/aviobuf.c @@ -42,6 +42,10 @@ */ #define SHORT_SEEK_THRESHOLD 4096 +typedef struct AVIOInternal { + URLContext *h; +} AVIOInternal; + static void *ff_avio_child_next(void *obj, void *prev) { AVIOContext *s = obj; diff --git a/libavformat/hls.c b/libavformat/hls.c index 61ab5c8435..714d1e0e9a 100644 --- a/libavformat/hls.c +++ b/libavformat/hls.c @@ -584,7 +584,7 @@ static int ensure_playlist(HLSContext *c, struct playlist **pls, const char *url static void update_options(char **dest, const char *name, void *src) { av_freep(dest); - av_opt_get(src, name, 0, (uint8_t**)dest); + av_opt_get(src, name, AV_OPT_SEARCH_CHILDREN, (uint8_t**)dest); if (*dest && !strlen(*dest)) av_freep(dest); } @@ -614,8 +614,7 @@ static int open_url(AVFormatContext *s, AVIOContext **pb, const char *url, ret = s->io_open(s, pb, url, AVIO_FLAG_READ, &tmp); if (ret >= 0) { // update cookies on http response with setcookies. - AVIOInternal *internal = (s->flags & AVFMT_FLAG_CUSTOM_IO) ? NULL : s->pb->opaque; - void *u = internal ? internal->hlsopts : NULL; + void *u = (s->flags & AVFMT_FLAG_CUSTOM_IO) ? NULL : s->pb; update_options(&c->cookies, "cookies", u); av_dict_set(&opts, "cookies", c->cookies, 0); } @@ -1497,8 +1496,7 @@ static int nested_io_open(AVFormatContext *s, AVIOContext **pb, const char *url, static int hls_read_header(AVFormatContext *s) { - AVIOInternal *internal = (s->flags & AVFMT_FLAG_CUSTOM_IO) ? NULL : s->pb->opaque; - void *u = internal ? internal->hlsopts : NULL; + void *u = (s->flags & AVFMT_FLAG_CUSTOM_IO) ? NULL : s->pb; HLSContext *c = s->priv_data; int ret = 0, i, j, stream_offset = 0; |