summaryrefslogtreecommitdiff
path: root/libavformat/hls.c
diff options
context:
space:
mode:
authorJun Zhao <barryjzhao@tencent.com>2019-08-08 00:12:16 +0800
committerJun Zhao <barryjzhao@tencent.com>2019-08-08 17:53:32 +0800
commit5e829262a6a6068dfed9d76da4a9635f1f4be391 (patch)
treeb0c4e4da9523f992638f47f8ce8fbbb6afb5f43d /libavformat/hls.c
parentaf3ddd581faf2c3c4748ae589947c662b1a2271e (diff)
lavf/hls: add http_seekable option for HTTP partial requests
Add http_seekable option for HTTP partial requests, when The EXT-X-BYTERANGE tag indicates that a Media Segment is a sub-range of the resource identified by its URI, we can use HTTP partial requests to get the Media Segment. Reviewed-by: Steven Liu <lq@chinaffmpeg.org> Signed-off-by: Jun Zhao <barryjzhao@tencent.com>
Diffstat (limited to 'libavformat/hls.c')
-rw-r--r--libavformat/hls.c9
1 files changed, 7 insertions, 2 deletions
diff --git a/libavformat/hls.c b/libavformat/hls.c
index 052244592c..61b6759ef5 100644
--- a/libavformat/hls.c
+++ b/libavformat/hls.c
@@ -207,6 +207,7 @@ typedef struct HLSContext {
int max_reload;
int http_persistent;
int http_multiple;
+ int http_seekable;
AVIOContext *playlist_pb;
} HLSContext;
@@ -1796,8 +1797,10 @@ static int hls_read_header(AVFormatContext *s)
if ((ret = save_avio_options(s)) < 0)
goto fail;
- /* Some HLS servers don't like being sent the range header */
- av_dict_set(&c->avio_opts, "seekable", "0", 0);
+ /* XXX: Some HLS servers don't like being sent the range header,
+ in this case, need to setting http_seekable = 0 to disable
+ the range header */
+ av_dict_set_int(&c->avio_opts, "seekable", c->http_seekable, 0);
if ((ret = parse_playlist(c, s->url, NULL, s->pb)) < 0)
goto fail;
@@ -2311,6 +2314,8 @@ static const AVOption hls_options[] = {
OFFSET(http_persistent), AV_OPT_TYPE_BOOL, {.i64 = 1}, 0, 1, FLAGS },
{"http_multiple", "Use multiple HTTP connections for fetching segments",
OFFSET(http_multiple), AV_OPT_TYPE_BOOL, {.i64 = -1}, -1, 1, FLAGS},
+ {"http_seekable", "Use HTTP partial requests, 0 = disable, 1 = enable, -1 = auto",
+ OFFSET(http_seekable), AV_OPT_TYPE_BOOL, { .i64 = -1}, -1, 1, FLAGS},
{NULL}
};