aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorMichael Niedermayer <michaelni@gmx.at>2014-03-12 04:12:04 +0100
committerMichael Niedermayer <michaelni@gmx.at>2014-03-12 04:12:30 +0100
commit76a939d0e58c256d5a340c8a7776eba2c83ff6d2 (patch)
tree94b6d5640d0de41f57ab01cd71247a230543c3bd
parentf36da16ede525fb4925ad3ec863f131bc6743540 (diff)
parent2ec33d27127251bbc45e1f88e60691ad59cf2319 (diff)
downloadffmpeg-76a939d0e58c256d5a340c8a7776eba2c83ff6d2.tar.gz
Merge commit '2ec33d27127251bbc45e1f88e60691ad59cf2319'
* commit '2ec33d27127251bbc45e1f88e60691ad59cf2319': http: Add support for selecting a request range Conflicts: doc/protocols.texi libavformat/http.c See: d52882faef368264f9fe5a595274ec84d3446132 Merged-by: Michael Niedermayer <michaelni@gmx.at>
-rw-r--r--doc/protocols.texi6
-rw-r--r--libavformat/http.c10
2 files changed, 11 insertions, 5 deletions
diff --git a/doc/protocols.texi b/doc/protocols.texi
index f66f77d27e..90745c584d 100644
--- a/doc/protocols.texi
+++ b/doc/protocols.texi
@@ -271,6 +271,12 @@ updates.
Set the cookies to be sent in future requests. The format of each cookie is the
same as the value of a Set-Cookie HTTP response field. Multiple cookies can be
delimited by a newline character.
+
+@item offset
+Set initial byte offset.
+
+@item end_offset
+Try to limit the request to bytes preceding this offset.
@end table
@subsection HTTP Cookies
diff --git a/libavformat/http.c b/libavformat/http.c
index c301e45a01..aa4618b606 100644
--- a/libavformat/http.c
+++ b/libavformat/http.c
@@ -52,7 +52,7 @@ typedef struct {
/* Used if "Transfer-Encoding: chunked" otherwise -1. */
int64_t chunksize;
char *content_type;
- int64_t off, filesize, req_end_offset;
+ int64_t off, end_off, filesize;
char *location;
HTTPAuthState auth_state;
HTTPAuthState proxy_auth_state;
@@ -115,7 +115,7 @@ static const AVOption options[] = {
{"send_expect_100", "Force sending an Expect: 100-continue header for POST", OFFSET(send_expect_100), AV_OPT_TYPE_INT, {.i64 = 0}, 0, 1, E },
{"location", "The actual location of the data received", OFFSET(location), AV_OPT_TYPE_STRING, { 0 }, 0, 0, D|E },
{"offset", "initial byte offset", OFFSET(off), AV_OPT_TYPE_INT64, {.i64 = 0}, 0, INT64_MAX, D },
-{"end_offset", "try to limit the request to bytes preceding this offset", OFFSET(req_end_offset), AV_OPT_TYPE_INT64, {.i64 = 0}, 0, INT64_MAX, D },
+{"end_offset", "try to limit the request to bytes preceding this offset", OFFSET(end_off), AV_OPT_TYPE_INT64, {.i64 = 0}, 0, INT64_MAX, D },
{NULL}
};
#define HTTP_CLASS(flavor)\
@@ -707,12 +707,12 @@ static int http_connect(URLContext *h, const char *path, const char *local_path,
// Note: we send this on purpose even when s->off is 0 when we're probing,
// since it allows us to detect more reliably if a (non-conforming)
// server supports seeking by analysing the reply headers.
- if (!has_header(s->headers, "\r\nRange: ") && !post && (s->off > 0 || s->req_end_offset || s->seekable == -1)) {
+ if (!has_header(s->headers, "\r\nRange: ") && !post && (s->off > 0 || s->end_off || s->seekable == -1)) {
len += av_strlcatf(headers + len, sizeof(headers) - len,
"Range: bytes=%"PRId64"-", s->off);
- if (s->req_end_offset)
+ if (s->end_off)
len += av_strlcatf(headers + len, sizeof(headers) - len,
- "%"PRId64, s->req_end_offset - 1);
+ "%"PRId64, s->end_off - 1);
len += av_strlcpy(headers + len, "\r\n",
sizeof(headers) - len);
}