Original ffmpeg commit c01d1d4 by Clément Bœsch.
---
 libavformat/http.c | 6 ++++++
 1 file changed, 6 insertions(+)

diff --git a/libavformat/http.c b/libavformat/http.c
index cbccdbf..186d6ba 100644
--- a/libavformat/http.c
+++ b/libavformat/http.c
@@ -50,6 +50,7 @@ typedef struct {
     int line_count;
     int http_code;
     int64_t chunksize;      /**< Used if "Transfer-Encoding: chunked" 
otherwise -1. */
+    char *content_type;
     char *user_agent;
     int64_t off, filesize, req_end_offset;
     int icy_data_read;      ///< how much data was read since last ICY 
metadata packet
@@ -85,6 +86,7 @@ typedef struct {
 static const AVOption options[] = {
 {"chunked_post", "use chunked transfer-encoding for posts", 
OFFSET(chunked_post), AV_OPT_TYPE_INT, {.i64 = 1}, 0, 1, E },
 {"headers", "set custom HTTP headers, can override built in default headers", 
OFFSET(headers), AV_OPT_TYPE_STRING, { 0 }, 0, 0, D|E },
+{"content_type", "force a content type", OFFSET(content_type), 
AV_OPT_TYPE_STRING, { 0 }, 0, 0, D|E },
 {"user-agent", "override User-Agent header", OFFSET(user_agent), 
AV_OPT_TYPE_STRING, {.str = DEFAULT_USER_AGENT}, 0, 0, D },
 {"multiple_requests", "use persistent connections", OFFSET(multiple_requests), 
AV_OPT_TYPE_INT, {.i64 = 0}, 0, 1, D|E },
 {"post_data", "set custom HTTP post data", OFFSET(post_data), 
AV_OPT_TYPE_BINARY, .flags = D|E },
@@ -547,6 +549,10 @@ static int http_connect(URLContext *h, const char *path, 
const char *local_path,
     if (!has_header(s->headers, "\r\nContent-Length: ") && s->post_data)
         len += av_strlcatf(headers + len, sizeof(headers) - len,
                            "Content-Length: %d\r\n", s->post_datalen);
+
+    if (!has_header(s->headers, "\r\nContent-Type: ") && s->content_type)
+        len += av_strlcatf(headers + len, sizeof(headers) - len,
+                           "Content-Type: %s\r\n", s->content_type);
     if (!has_header(s->headers, "\r\nIcy-MetaData: ") && s->icy) {
         len += av_strlcatf(headers + len, sizeof(headers) - len,
                            "Icy-MetaData: %d\r\n", 1);
-- 
1.9.0

_______________________________________________
libav-devel mailing list
[email protected]
https://lists.libav.org/mailman/listinfo/libav-devel

Reply via email to