[SCM] libav/experimental: Import post-beta2 patches, drop conflicting patches

siretart at users.alioth.debian.org siretart at users.alioth.debian.org
Sat Mar 15 14:47:56 UTC 2014


The following commit has been merged in the experimental branch:
commit bea39c9387ba13a99ad4bce5146bc40ed0e54057
Author: Reinhard Tartler <siretart at tauware.de>
Date:   Sat Mar 15 14:42:17 2014 +0000

    Import post-beta2 patches, drop conflicting patches

diff --git a/debian/patches/openjpeg.patch b/debian/patches/post-beta2/0001-configure-Support-older-version-of-openjpeg1.patch
similarity index 75%
copy from debian/patches/openjpeg.patch
copy to debian/patches/post-beta2/0001-configure-Support-older-version-of-openjpeg1.patch
index f08bef7..1ae98d9 100644
--- a/debian/patches/openjpeg.patch
+++ b/debian/patches/post-beta2/0001-configure-Support-older-version-of-openjpeg1.patch
@@ -1,17 +1,21 @@
-From aa807425395caa17a85ed2833133278e8bd44a76 Mon Sep 17 00:00:00 2001
+From b920c1d5ad5cfe74c95b0eaec0e69b074ee9b4c1 Mon Sep 17 00:00:00 2001
 From: Luca Barbato <lu_zero at gentoo.org>
 Date: Wed, 12 Mar 2014 09:30:07 +0000
-Subject: [PATCH] configure: Support older version of openjpeg1
+Subject: [PATCH 01/14] configure: Support older version of openjpeg1
 
 It should work best for debian stable and people not installing the .pc
 file.
+
+(cherry picked from commit aa807425395caa17a85ed2833133278e8bd44a76)
 ---
  configure |    3 ++-
  1 file changed, 2 insertions(+), 1 deletion(-)
 
+diff --git a/configure b/configure
+index c6789d5..05acff5 100755
 --- a/configure
 +++ b/configure
-@@ -3938,7 +3938,8 @@ enabled libmp3lame        && require "li
+@@ -3938,7 +3938,8 @@ enabled libmp3lame        && require "libmp3lame >= 3.98.3" lame/lame.h lame_set
  enabled libopencore_amrnb && require libopencore_amrnb opencore-amrnb/interf_dec.h Decoder_Interface_init -lopencore-amrnb
  enabled libopencore_amrwb && require libopencore_amrwb opencore-amrwb/dec_if.h D_IF_init -lopencore-amrwb
  enabled libopencv         && require_pkg_config opencv opencv/cv.h cvCreateImageHeader
@@ -21,3 +25,6 @@ file.
  enabled libopus           && require_pkg_config opus opus_multistream.h opus_multistream_decoder_create
  enabled libpulse          && require_pkg_config libpulse-simple pulse/simple.h pa_simple_new
  enabled librtmp           && require_pkg_config librtmp librtmp/rtmp.h RTMP_Socket
+-- 
+1.7.10.4
+
diff --git a/debian/patches/post-beta2/0002-http-Return-meaningful-error-codes.patch b/debian/patches/post-beta2/0002-http-Return-meaningful-error-codes.patch
new file mode 100644
index 0000000..6a2eb4e
--- /dev/null
+++ b/debian/patches/post-beta2/0002-http-Return-meaningful-error-codes.patch
@@ -0,0 +1,68 @@
+From 00ecce5c8bc00ce6f3f4bb19b681c5e14e259501 Mon Sep 17 00:00:00 2001
+From: Luca Barbato <lu_zero at gentoo.org>
+Date: Mon, 10 Mar 2014 17:17:25 +0100
+Subject: [PATCH 02/14] http: Return meaningful error codes
+
+(cherry picked from commit 55a215ba63d9fa79cd7ee265ee2e777ee86b200c)
+---
+ libavformat/http.c |   12 ++++++------
+ 1 file changed, 6 insertions(+), 6 deletions(-)
+
+diff --git a/libavformat/http.c b/libavformat/http.c
+index 96f56f8..e54e258 100644
+--- a/libavformat/http.c
++++ b/libavformat/http.c
+@@ -264,7 +264,7 @@ static int http_getc(HTTPContext *s)
+         if (len < 0) {
+             return len;
+         } else if (len == 0) {
+-            return -1;
++            return AVERROR_EOF;
+         } else {
+             s->buf_ptr = s->buffer;
+             s->buf_end = s->buffer + len;
+@@ -327,7 +327,7 @@ static int process_line(URLContext *h, char *line, int line_count,
+             end += strspn(end, SPACE_CHARS);
+             av_log(h, AV_LOG_WARNING, "HTTP error %d %s\n",
+                    s->http_code, end);
+-            return -1;
++            return AVERROR(EIO);
+         }
+     } else {
+         while (*p != '\0' && *p != ':')
+@@ -732,13 +732,13 @@ static int64_t http_seek(URLContext *h, int64_t off, int whence)
+     URLContext *old_hd = s->hd;
+     int64_t old_off = s->off;
+     uint8_t old_buf[BUFFER_SIZE];
+-    int old_buf_size;
++    int old_buf_size, ret;
+     AVDictionary *options = NULL;
+ 
+     if (whence == AVSEEK_SIZE)
+         return s->filesize;
+     else if ((s->filesize == -1 && whence == SEEK_END) || h->is_streamed)
+-        return -1;
++        return AVERROR(ENOSYS);
+ 
+     /* we save the old context in case the seek fails */
+     old_buf_size = s->buf_end - s->buf_ptr;
+@@ -752,14 +752,14 @@ static int64_t http_seek(URLContext *h, int64_t off, int whence)
+ 
+     /* if it fails, continue on old connection */
+     av_dict_copy(&options, s->chained_options, 0);
+-    if (http_open_cnx(h, &options) < 0) {
++    if ((ret = http_open_cnx(h, &options)) < 0) {
+         av_dict_free(&options);
+         memcpy(s->buffer, old_buf, old_buf_size);
+         s->buf_ptr = s->buffer;
+         s->buf_end = s->buffer + old_buf_size;
+         s->hd = old_hd;
+         s->off = old_off;
+-        return -1;
++        return ret;
+     }
+     av_dict_free(&options);
+     ffurl_close(old_hd);
+-- 
+1.7.10.4
+
diff --git a/debian/patches/post-beta2/0003-http-Drop-doxy-comments.patch b/debian/patches/post-beta2/0003-http-Drop-doxy-comments.patch
new file mode 100644
index 0000000..c55df2e
--- /dev/null
+++ b/debian/patches/post-beta2/0003-http-Drop-doxy-comments.patch
@@ -0,0 +1,46 @@
+From 738d68de85714608ad1e68fc9eab5dc0bfdda598 Mon Sep 17 00:00:00 2001
+From: Luca Barbato <lu_zero at gentoo.org>
+Date: Mon, 10 Mar 2014 17:53:51 +0100
+Subject: [PATCH 03/14] http: Drop doxy comments
+
+(cherry picked from commit 78b21c1d7177e1d61ad3c9225f67699da089aa7c)
+---
+ libavformat/http.c |   16 +++++++++++-----
+ 1 file changed, 11 insertions(+), 5 deletions(-)
+
+diff --git a/libavformat/http.c b/libavformat/http.c
+index e54e258..ce76f27 100644
+--- a/libavformat/http.c
++++ b/libavformat/http.c
+@@ -49,17 +49,23 @@ typedef struct {
+     unsigned char buffer[BUFFER_SIZE], *buf_ptr, *buf_end;
+     int line_count;
+     int http_code;
+-    int64_t chunksize;      /**< Used if "Transfer-Encoding: chunked" otherwise -1. */
++    /* Used if "Transfer-Encoding: chunked" otherwise -1. */
++    int64_t chunksize;
+     int64_t off, filesize;
+     char *location;
+     HTTPAuthState auth_state;
+     HTTPAuthState proxy_auth_state;
+     char *headers;
+-    int willclose;          /**< Set if the server correctly handles Connection: close and will close the connection after feeding us the content. */
++    /* Set if the server correctly handles Connection: close and will close
++     * the connection after feeding us the content. */
++    int willclose;
+     int chunked_post;
+-    int end_chunked_post;   /**< A flag which indicates if the end of chunked encoding has been sent. */
+-    int end_header;         /**< A flag which indicates we have finished to read POST reply. */
+-    int multiple_requests;  /**< A flag which indicates if we use persistent connections. */
++    /* A flag which indicates if the end of chunked encoding has been sent. */
++    int end_chunked_post;
++    /* A flag which indicates we have finished to read POST reply. */
++    int end_header;
++    /* A flag which indicates if we use persistent connections. */
++    int multiple_requests;
+     uint8_t *post_data;
+     int post_datalen;
+ #if CONFIG_ZLIB
+-- 
+1.7.10.4
+
diff --git a/debian/patches/post-beta2/0004-http-K-R-formatting-cosmetics.patch b/debian/patches/post-beta2/0004-http-K-R-formatting-cosmetics.patch
new file mode 100644
index 0000000..a163497
--- /dev/null
+++ b/debian/patches/post-beta2/0004-http-K-R-formatting-cosmetics.patch
@@ -0,0 +1,82 @@
+From f1de93dec302cc860c718e89656f184510b2d239 Mon Sep 17 00:00:00 2001
+From: Luca Barbato <lu_zero at gentoo.org>
+Date: Mon, 10 Mar 2014 18:02:09 +0100
+Subject: [PATCH 04/14] http: K&R formatting cosmetics
+
+(cherry picked from commit 7a2fddb4480121712df560cf619c1c3566cae3ff)
+---
+ libavformat/http.c |   32 +++++++++++++++++---------------
+ 1 file changed, 17 insertions(+), 15 deletions(-)
+
+diff --git a/libavformat/http.c b/libavformat/http.c
+index ce76f27..ba0cf57 100644
+--- a/libavformat/http.c
++++ b/libavformat/http.c
+@@ -327,12 +327,11 @@ static int process_line(URLContext *h, char *line, int line_count,
+ 
+         /* error codes are 4xx and 5xx, but regard 401 as a success, so we
+          * don't abort until all headers have been parsed. */
+-        if (s->http_code >= 400 && s->http_code < 600 && (s->http_code != 401
+-            || s->auth_state.auth_type != HTTP_AUTH_NONE) &&
++        if (s->http_code >= 400 && s->http_code < 600 &&
++            (s->http_code != 401 || s->auth_state.auth_type != HTTP_AUTH_NONE) &&
+             (s->http_code != 407 || s->proxy_auth_state.auth_type != HTTP_AUTH_NONE)) {
+             end += strspn(end, SPACE_CHARS);
+-            av_log(h, AV_LOG_WARNING, "HTTP error %d %s\n",
+-                   s->http_code, end);
++            av_log(h, AV_LOG_WARNING, "HTTP error %d %s\n", s->http_code, end);
+             return AVERROR(EIO);
+         }
+     } else {
+@@ -356,34 +355,37 @@ static int process_line(URLContext *h, char *line, int line_count,
+             av_free(s->location);
+             s->location = new_loc;
+             *new_location = 1;
+-        } else if (!av_strcasecmp (tag, "Content-Length") && s->filesize == -1) {
++        } else if (!av_strcasecmp(tag, "Content-Length") && s->filesize == -1) {
+             s->filesize = strtoll(p, NULL, 10);
+-        } else if (!av_strcasecmp (tag, "Content-Range")) {
++        } else if (!av_strcasecmp(tag, "Content-Range")) {
+             /* "bytes $from-$to/$document_size" */
+             const char *slash;
+-            if (!strncmp (p, "bytes ", 6)) {
++            if (!strncmp(p, "bytes ", 6)) {
+                 p += 6;
+                 s->off = strtoll(p, NULL, 10);
+                 if ((slash = strchr(p, '/')) && strlen(slash) > 0)
+                     s->filesize = strtoll(slash+1, NULL, 10);
+             }
+             h->is_streamed = 0; /* we _can_ in fact seek */
+-        } else if (!av_strcasecmp(tag, "Accept-Ranges") && !strncmp(p, "bytes", 5)) {
++        } else if (!av_strcasecmp(tag, "Accept-Ranges") &&
++                   !strncmp(p, "bytes", 5)) {
+             h->is_streamed = 0;
+-        } else if (!av_strcasecmp (tag, "Transfer-Encoding") && !av_strncasecmp(p, "chunked", 7)) {
++        } else if (!av_strcasecmp(tag, "Transfer-Encoding") &&
++                   !av_strncasecmp(p, "chunked", 7)) {
+             s->filesize = -1;
+             s->chunksize = 0;
+-        } else if (!av_strcasecmp (tag, "WWW-Authenticate")) {
++        } else if (!av_strcasecmp(tag, "WWW-Authenticate")) {
+             ff_http_auth_handle_header(&s->auth_state, tag, p);
+-        } else if (!av_strcasecmp (tag, "Authentication-Info")) {
++        } else if (!av_strcasecmp(tag, "Authentication-Info")) {
+             ff_http_auth_handle_header(&s->auth_state, tag, p);
+-        } else if (!av_strcasecmp (tag, "Proxy-Authenticate")) {
++        } else if (!av_strcasecmp(tag, "Proxy-Authenticate")) {
+             ff_http_auth_handle_header(&s->proxy_auth_state, tag, p);
+-        } else if (!av_strcasecmp (tag, "Connection")) {
++        } else if (!av_strcasecmp(tag, "Connection")) {
+             if (!strcmp(p, "close"))
+                 s->willclose = 1;
+-        } else if (!av_strcasecmp (tag, "Content-Encoding")) {
+-            if (!av_strncasecmp(p, "gzip", 4) || !av_strncasecmp(p, "deflate", 7)) {
++        } else if (!av_strcasecmp(tag, "Content-Encoding")) {
++            if (!av_strncasecmp(p, "gzip", 4) ||
++                !av_strncasecmp(p, "deflate", 7)) {
+ #if CONFIG_ZLIB
+                 s->compressed = 1;
+                 inflateEnd(&s->inflate_stream);
+-- 
+1.7.10.4
+
diff --git a/debian/patches/post-beta2/0005-http-Refactor-process_line.patch b/debian/patches/post-beta2/0005-http-Refactor-process_line.patch
new file mode 100644
index 0000000..67cd894
--- /dev/null
+++ b/debian/patches/post-beta2/0005-http-Refactor-process_line.patch
@@ -0,0 +1,190 @@
+From 25d14b716aef43bf9e82f1d67a364e5922332f47 Mon Sep 17 00:00:00 2001
+From: Luca Barbato <lu_zero at gentoo.org>
+Date: Mon, 10 Mar 2014 20:16:50 +0100
+Subject: [PATCH 05/14] http: Refactor process_line
+
+(cherry picked from commit 4ff99ab3d7d5576e99e6b8a411b4a44500ed88fa)
+---
+ libavformat/http.c |  136 ++++++++++++++++++++++++++++++++--------------------
+ 1 file changed, 85 insertions(+), 51 deletions(-)
+
+diff --git a/libavformat/http.c b/libavformat/http.c
+index ba0cf57..161bb6b 100644
+--- a/libavformat/http.c
++++ b/libavformat/http.c
+@@ -303,11 +303,89 @@ static int http_get_line(HTTPContext *s, char *line, int line_size)
+     }
+ }
+ 
++static int check_http_code(URLContext *h, int http_code, const char *end)
++{
++    HTTPContext *s = h->priv_data;
++    /* error codes are 4xx and 5xx, but regard 401 as a success, so we
++     * don't abort until all headers have been parsed. */
++    if (http_code >= 400 && http_code < 600 &&
++        (http_code != 401 || s->auth_state.auth_type != HTTP_AUTH_NONE) &&
++        (http_code != 407 || s->proxy_auth_state.auth_type != HTTP_AUTH_NONE)) {
++        end += strspn(end, SPACE_CHARS);
++        av_log(h, AV_LOG_WARNING, "HTTP error %d %s\n", http_code, end);
++        return AVERROR(EIO);
++    }
++    return 0;
++}
++
++static int parse_location(HTTPContext *s, const char *p)
++{
++    char redirected_location[MAX_URL_SIZE], *new_loc;
++    ff_make_absolute_url(redirected_location, sizeof(redirected_location),
++                         s->location, p);
++    new_loc = av_strdup(redirected_location);
++    if (!new_loc)
++        return AVERROR(ENOMEM);
++    av_free(s->location);
++    s->location = new_loc;
++    return 0;
++}
++
++/* "bytes $from-$to/$document_size" */
++static void parse_content_range(URLContext *h, char *p)
++{
++    HTTPContext *s = h->priv_data;
++    const char *slash;
++
++    if (!strncmp(p, "bytes ", 6)) {
++        p += 6;
++        s->off = strtoll(p, NULL, 10);
++        if ((slash = strchr(p, '/')) && strlen(slash) > 0)
++            s->filesize = strtoll(slash+1, NULL, 10);
++    }
++    h->is_streamed = 0; /* we _can_ in fact seek */
++}
++
++static int parse_content_encoding(URLContext *h, char *p)
++{
++    HTTPContext *s = h->priv_data;
++
++    if (!av_strncasecmp(p, "gzip", 4) ||
++        !av_strncasecmp(p, "deflate", 7)) {
++#if CONFIG_ZLIB
++        s->compressed = 1;
++        inflateEnd(&s->inflate_stream);
++        if (inflateInit2(&s->inflate_stream, 32 + 15) != Z_OK) {
++            av_log(h, AV_LOG_WARNING, "Error during zlib initialisation: %s\n",
++                   s->inflate_stream.msg);
++            return AVERROR(ENOSYS);
++        }
++        if (zlibCompileFlags() & (1 << 17)) {
++            av_log(h, AV_LOG_WARNING,
++                   "Your zlib was compiled without gzip support.\n");
++            return AVERROR(ENOSYS);
++        }
++#else
++        av_log(h, AV_LOG_WARNING,
++               "Compressed (%s) content, need zlib with gzip support\n", p);
++        return AVERROR(ENOSYS);
++#endif
++    } else if (!av_strncasecmp(p, "identity", 8)) {
++        // The normal, no-encoding case (although servers shouldn't include
++        // the header at all if this is the case).
++    } else {
++        av_log(h, AV_LOG_WARNING, "Unknown content coding: %s\n", p);
++        return AVERROR(ENOSYS);
++    }
++    return 0;
++}
++
+ static int process_line(URLContext *h, char *line, int line_count,
+                         int *new_location)
+ {
+     HTTPContext *s = h->priv_data;
+     char *tag, *p, *end;
++    int ret;
+ 
+     /* end of header */
+     if (line[0] == '\0') {
+@@ -325,15 +403,8 @@ static int process_line(URLContext *h, char *line, int line_count,
+ 
+         av_dlog(NULL, "http_code=%d\n", s->http_code);
+ 
+-        /* error codes are 4xx and 5xx, but regard 401 as a success, so we
+-         * don't abort until all headers have been parsed. */
+-        if (s->http_code >= 400 && s->http_code < 600 &&
+-            (s->http_code != 401 || s->auth_state.auth_type != HTTP_AUTH_NONE) &&
+-            (s->http_code != 407 || s->proxy_auth_state.auth_type != HTTP_AUTH_NONE)) {
+-            end += strspn(end, SPACE_CHARS);
+-            av_log(h, AV_LOG_WARNING, "HTTP error %d %s\n", s->http_code, end);
+-            return AVERROR(EIO);
+-        }
++        if ((ret = check_http_code(h, s->http_code, end)) < 0)
++            return ret;
+     } else {
+         while (*p != '\0' && *p != ':')
+             p++;
+@@ -346,27 +417,13 @@ static int process_line(URLContext *h, char *line, int line_count,
+         while (av_isspace(*p))
+             p++;
+         if (!av_strcasecmp(tag, "Location")) {
+-            char redirected_location[MAX_URL_SIZE], *new_loc;
+-            ff_make_absolute_url(redirected_location, sizeof(redirected_location),
+-                                 s->location, p);
+-            new_loc = av_strdup(redirected_location);
+-            if (!new_loc)
+-                return AVERROR(ENOMEM);
+-            av_free(s->location);
+-            s->location = new_loc;
++            if ((ret = parse_location(s, p)) < 0)
++                return ret;
+             *new_location = 1;
+         } else if (!av_strcasecmp(tag, "Content-Length") && s->filesize == -1) {
+             s->filesize = strtoll(p, NULL, 10);
+         } else if (!av_strcasecmp(tag, "Content-Range")) {
+-            /* "bytes $from-$to/$document_size" */
+-            const char *slash;
+-            if (!strncmp(p, "bytes ", 6)) {
+-                p += 6;
+-                s->off = strtoll(p, NULL, 10);
+-                if ((slash = strchr(p, '/')) && strlen(slash) > 0)
+-                    s->filesize = strtoll(slash+1, NULL, 10);
+-            }
+-            h->is_streamed = 0; /* we _can_ in fact seek */
++            parse_content_range(h, p);
+         } else if (!av_strcasecmp(tag, "Accept-Ranges") &&
+                    !strncmp(p, "bytes", 5)) {
+             h->is_streamed = 0;
+@@ -384,31 +441,8 @@ static int process_line(URLContext *h, char *line, int line_count,
+             if (!strcmp(p, "close"))
+                 s->willclose = 1;
+         } else if (!av_strcasecmp(tag, "Content-Encoding")) {
+-            if (!av_strncasecmp(p, "gzip", 4) ||
+-                !av_strncasecmp(p, "deflate", 7)) {
+-#if CONFIG_ZLIB
+-                s->compressed = 1;
+-                inflateEnd(&s->inflate_stream);
+-                if (inflateInit2(&s->inflate_stream, 32 + 15) != Z_OK) {
+-                    av_log(h, AV_LOG_WARNING, "Error during zlib initialisation: %s\n",
+-                           s->inflate_stream.msg);
+-                    return AVERROR(ENOSYS);
+-                }
+-                if (zlibCompileFlags() & (1 << 17)) {
+-                    av_log(h, AV_LOG_WARNING, "Your zlib was compiled without gzip support.\n");
+-                    return AVERROR(ENOSYS);
+-                }
+-#else
+-                av_log(h, AV_LOG_WARNING, "Compressed (%s) content, need zlib with gzip support\n", p);
+-                return AVERROR(ENOSYS);
+-#endif
+-            } else if (!av_strncasecmp(p, "identity", 8)) {
+-                // The normal, no-encoding case (although servers shouldn't include
+-                // the header at all if this is the case).
+-            } else {
+-                av_log(h, AV_LOG_WARNING, "Unknown content coding: %s\n", p);
+-                return AVERROR(ENOSYS);
+-            }
++            if ((ret = parse_content_encoding(h, p)) < 0)
++                return ret;
+         }
+     }
+     return 1;
+-- 
+1.7.10.4
+
diff --git a/debian/patches/post-beta2/0006-http-Add-support-reading-ICY-metadata.patch b/debian/patches/post-beta2/0006-http-Add-support-reading-ICY-metadata.patch
new file mode 100644
index 0000000..41501fd
--- /dev/null
+++ b/debian/patches/post-beta2/0006-http-Add-support-reading-ICY-metadata.patch
@@ -0,0 +1,222 @@
+From e2811c2ede428a20aec3630bef4378f2927fb306 Mon Sep 17 00:00:00 2001
+From: Luca Barbato <lu_zero at gentoo.org>
+Date: Mon, 10 Mar 2014 21:11:35 +0100
+Subject: [PATCH 06/14] http: Add support reading ICY metadata
+
+Export the metadata as a icy_metadata_packet avoption.
+Based on the work of wm4 and Alessandro Ghedini.
+
+Bug-Id: https://bugs.debian.org/739936
+
+Signed-off-by: Luca Barbato <lu_zero at gentoo.org>
+(cherry picked from commit 8075c3d8bb1f6aade0cc7c5c40db9bc1bcd84cab)
+---
+ doc/protocols.texi |   20 ++++++++++
+ libavformat/http.c |  104 +++++++++++++++++++++++++++++++++++++++++++++++++++-
+ 2 files changed, 123 insertions(+), 1 deletion(-)
+
+diff --git a/doc/protocols.texi b/doc/protocols.texi
+index 1a9f575..5d7a1a6 100644
+--- a/doc/protocols.texi
++++ b/doc/protocols.texi
+@@ -89,6 +89,26 @@ m3u8 files.
+ 
+ HTTP (Hyper Text Transfer Protocol).
+ 
++This protocol accepts the following options:
++
++ at table @option
++ at item icy
++If set to 1 request ICY (SHOUTcast) metadata from the server. If the server
++supports this, the metadata has to be retrieved by the application by reading
++the @option{icy_metadata_headers} and @option{icy_metadata_packet} options.
++The default is 0.
++
++ at item icy_metadata_headers
++If the server supports ICY metadata, this contains the ICY-specific HTTP reply
++headers, separated by newline characters.
++
++ at item icy_metadata_packet
++If the server supports ICY metadata, and @option{icy} was set to 1, this
++contains the last non-empty metadata packet sent by the server. It should be
++polled in regular intervals by applications interested in mid-stream metadata
++updates.
++ at end table
++
+ @section mmst
+ 
+ MMS (Microsoft Media Server) protocol over TCP.
+diff --git a/libavformat/http.c b/libavformat/http.c
+index 161bb6b..565cdbd 100644
+--- a/libavformat/http.c
++++ b/libavformat/http.c
+@@ -68,6 +68,13 @@ typedef struct {
+     int multiple_requests;
+     uint8_t *post_data;
+     int post_datalen;
++    int icy;
++    /* how much data was read since the last ICY metadata packet */
++    int icy_data_read;
++    /* after how many bytes of read data a new metadata packet will be found */
++    int icy_metaint;
++    char *icy_metadata_headers;
++    char *icy_metadata_packet;
+ #if CONFIG_ZLIB
+     int compressed;
+     z_stream inflate_stream;
+@@ -85,6 +92,9 @@ static const AVOption options[] = {
+ {"headers", "custom HTTP headers, can override built in default headers", OFFSET(headers), AV_OPT_TYPE_STRING, { 0 }, 0, 0, D|E },
+ {"multiple_requests", "use persistent connections", OFFSET(multiple_requests), AV_OPT_TYPE_INT, {.i64 = 0}, 0, 1, D|E },
+ {"post_data", "custom HTTP post data", OFFSET(post_data), AV_OPT_TYPE_BINARY, .flags = D|E },
++{"icy", "request ICY metadata", OFFSET(icy), AV_OPT_TYPE_INT, {.i64 = 0}, 0, 1, D },
++{"icy_metadata_headers", "return ICY metadata headers", OFFSET(icy_metadata_headers), AV_OPT_TYPE_STRING, {0}, 0, 0, 0 },
++{"icy_metadata_packet", "return current ICY metadata packet", OFFSET(icy_metadata_packet), AV_OPT_TYPE_STRING, {0}, 0, 0, 0 },
+ {"auth_type", "HTTP authentication type", OFFSET(auth_state.auth_type), AV_OPT_TYPE_INT, {.i64 = HTTP_AUTH_NONE}, HTTP_AUTH_NONE, HTTP_AUTH_BASIC, D|E, "auth_type" },
+ {"none", "No auth method set, autodetect", 0, AV_OPT_TYPE_CONST, {.i64 = HTTP_AUTH_NONE}, 0, 0, D|E, "auth_type" },
+ {"basic", "HTTP basic authentication", 0, AV_OPT_TYPE_CONST, {.i64 = HTTP_AUTH_BASIC}, 0, 0, D|E, "auth_type" },
+@@ -225,6 +235,7 @@ int ff_http_do_new_request(URLContext *h, const char *uri)
+     int ret;
+ 
+     s->off = 0;
++    s->icy_data_read = 0;
+     av_free(s->location);
+     s->location = av_strdup(uri);
+     if (!s->location)
+@@ -380,6 +391,23 @@ static int parse_content_encoding(URLContext *h, char *p)
+     return 0;
+ }
+ 
++// Concat all Icy- header lines
++static int parse_icy(HTTPContext *s, const char *tag, const char *p)
++{
++    int len = 4 + strlen(p) + strlen(tag);
++    int ret;
++
++    if (s->icy_metadata_headers)
++        len += strlen(s->icy_metadata_headers);
++
++    if ((ret = av_reallocp(&s->icy_metadata_headers, len)) < 0)
++        return ret;
++
++    av_strlcatf(s->icy_metadata_headers, len, "%s: %s\n", tag, p);
++
++    return 0;
++}
++
+ static int process_line(URLContext *h, char *line, int line_count,
+                         int *new_location)
+ {
+@@ -440,6 +468,11 @@ static int process_line(URLContext *h, char *line, int line_count,
+         } else if (!av_strcasecmp(tag, "Connection")) {
+             if (!strcmp(p, "close"))
+                 s->willclose = 1;
++        } else if (!av_strcasecmp (tag, "Icy-MetaInt")) {
++            s->icy_metaint = strtoll(p, NULL, 10);
++        } else if (!av_strncasecmp(tag, "Icy-", 4)) {
++            if ((ret = parse_icy(s, tag, p)) < 0)
++                return ret;
+         } else if (!av_strcasecmp(tag, "Content-Encoding")) {
+             if ((ret = parse_content_encoding(h, p)) < 0)
+                 return ret;
+@@ -552,6 +585,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\nIcy-MetaData: ") && s->icy) {
++        len += av_strlcatf(headers + len, sizeof(headers) - len,
++                           "Icy-MetaData: %d\r\n", 1);
++    }
+ 
+     /* now add in custom headers */
+     if (s->headers)
+@@ -585,6 +622,7 @@ static int http_connect(URLContext *h, const char *path, const char *local_path,
+     s->buf_end = s->buffer;
+     s->line_count = 0;
+     s->off = 0;
++    s->icy_data_read = 0;
+     s->filesize = -1;
+     s->willclose = 0;
+     s->end_chunked_post = 0;
+@@ -662,7 +700,7 @@ static int http_buf_read_compressed(URLContext *h, uint8_t *buf, int size)
+ }
+ #endif
+ 
+-static int http_read(URLContext *h, uint8_t *buf, int size)
++static int http_read_stream(URLContext *h, uint8_t *buf, int size)
+ {
+     HTTPContext *s = h->priv_data;
+     int err, new_location;
+@@ -704,6 +742,70 @@ static int http_read(URLContext *h, uint8_t *buf, int size)
+     return http_buf_read(h, buf, size);
+ }
+ 
++static int http_read_stream_all(URLContext *h, uint8_t *buf, int size)
++{
++    int pos = 0;
++    while (pos < size) {
++        int len = http_read_stream(h, buf + pos, size - pos);
++        if (len < 0)
++            return len;
++        pos += len;
++    }
++    return pos;
++}
++
++static int store_icy(URLContext *h, int size)
++{
++    HTTPContext *s = h->priv_data;
++    /* until next metadata packet */
++    int remaining = s->icy_metaint - s->icy_data_read;
++
++    if (remaining < 0)
++        return AVERROR_INVALIDDATA;
++
++    if (!remaining) {
++        // The metadata packet is variable sized. It has a 1 byte header
++        // which sets the length of the packet (divided by 16). If it's 0,
++        // the metadata doesn't change. After the packet, icy_metaint bytes
++        // of normal data follow.
++        uint8_t ch;
++        int len = http_read_stream_all(h, &ch, 1);
++        if (len < 0)
++            return len;
++        if (ch > 0) {
++            char data[255 * 16 + 1];
++            int ret;
++            len = ch * 16;
++            ret = http_read_stream_all(h, data, len);
++            if (ret < 0)
++                return ret;
++            data[len + 1] = 0;
++            if ((ret = av_opt_set(s, "icy_metadata_packet", data, 0)) < 0)
++                return ret;
++        }
++        s->icy_data_read = 0;
++        remaining = s->icy_metaint;
++    }
++
++    return FFMIN(size, remaining);
++}
++
++static int http_read(URLContext *h, uint8_t *buf, int size)
++{
++    HTTPContext *s = h->priv_data;
++
++    if (s->icy_metaint > 0) {
++        size = store_icy(h, size);
++        if (size < 0)
++            return size;
++    }
++
++    size = http_read_stream(h, buf, size);
++    if (size > 0)
++        s->icy_data_read += size;
++    return size;
++}
++
+ /* used only when posting data */
+ static int http_write(URLContext *h, const uint8_t *buf, int size)
+ {
+-- 
+1.7.10.4
+
diff --git a/debian/patches/post-beta2/0007-http-Export-Content-Type-information.patch b/debian/patches/post-beta2/0007-http-Export-Content-Type-information.patch
new file mode 100644
index 0000000..fbf4502
--- /dev/null
+++ b/debian/patches/post-beta2/0007-http-Export-Content-Type-information.patch
@@ -0,0 +1,61 @@
+From 40de74d0eb8c1898e2184a1484fe246aed5b295d Mon Sep 17 00:00:00 2001
+From: Michael Niedermayer <michaelni at gmx.at>
+Date: Thu, 6 Mar 2014 18:39:58 +0100
+Subject: [PATCH 07/14] http: Export Content-Type information
+
+Bug-Id: https://bugs.debian.org/740421
+
+Signed-off-by: Luca Barbato <lu_zero at gentoo.org>
+(cherry picked from commit e58c85b0686892960042232e51c77168b264838a)
+---
+ doc/protocols.texi |    3 +++
+ libavformat/http.c |    5 +++++
+ 2 files changed, 8 insertions(+)
+
+diff --git a/doc/protocols.texi b/doc/protocols.texi
+index 5d7a1a6..b16234b 100644
+--- a/doc/protocols.texi
++++ b/doc/protocols.texi
+@@ -92,6 +92,9 @@ HTTP (Hyper Text Transfer Protocol).
+ This protocol accepts the following options:
+ 
+ @table @option
++ at item mime_type
++Export the MIME type.
++
+ @item icy
+ If set to 1 request ICY (SHOUTcast) metadata from the server. If the server
+ supports this, the metadata has to be retrieved by the application by reading
+diff --git a/libavformat/http.c b/libavformat/http.c
+index 565cdbd..fcee847 100644
+--- a/libavformat/http.c
++++ b/libavformat/http.c
+@@ -56,6 +56,7 @@ typedef struct {
+     HTTPAuthState auth_state;
+     HTTPAuthState proxy_auth_state;
+     char *headers;
++    char *mime_type;
+     /* Set if the server correctly handles Connection: close and will close
+      * the connection after feeding us the content. */
+     int willclose;
+@@ -92,6 +93,7 @@ static const AVOption options[] = {
+ {"headers", "custom HTTP headers, can override built in default headers", OFFSET(headers), AV_OPT_TYPE_STRING, { 0 }, 0, 0, D|E },
+ {"multiple_requests", "use persistent connections", OFFSET(multiple_requests), AV_OPT_TYPE_INT, {.i64 = 0}, 0, 1, D|E },
+ {"post_data", "custom HTTP post data", OFFSET(post_data), AV_OPT_TYPE_BINARY, .flags = D|E },
++{"mime_type", "export the MIME type", OFFSET(mime_type), AV_OPT_TYPE_STRING, {0}, 0, 0, 0  },
+ {"icy", "request ICY metadata", OFFSET(icy), AV_OPT_TYPE_INT, {.i64 = 0}, 0, 1, D },
+ {"icy_metadata_headers", "return ICY metadata headers", OFFSET(icy_metadata_headers), AV_OPT_TYPE_STRING, {0}, 0, 0, 0 },
+ {"icy_metadata_packet", "return current ICY metadata packet", OFFSET(icy_metadata_packet), AV_OPT_TYPE_STRING, {0}, 0, 0, 0 },
+@@ -468,6 +470,9 @@ static int process_line(URLContext *h, char *line, int line_count,
+         } else if (!av_strcasecmp(tag, "Connection")) {
+             if (!strcmp(p, "close"))
+                 s->willclose = 1;
++        } else if (!av_strcasecmp (tag, "Content-Type")) {
++            av_free(s->mime_type);
++            s->mime_type = av_strdup(p);
+         } else if (!av_strcasecmp (tag, "Icy-MetaInt")) {
+             s->icy_metaint = strtoll(p, NULL, 10);
+         } else if (!av_strncasecmp(tag, "Icy-", 4)) {
+-- 
+1.7.10.4
+
diff --git a/debian/patches/post-beta2/0008-http-Support-setting-custom-User-Agent.patch b/debian/patches/post-beta2/0008-http-Support-setting-custom-User-Agent.patch
new file mode 100644
index 0000000..b05006d
--- /dev/null
+++ b/debian/patches/post-beta2/0008-http-Support-setting-custom-User-Agent.patch
@@ -0,0 +1,69 @@
+From 09dca5106698871920328ae8041d1437ce3cff43 Mon Sep 17 00:00:00 2001
+From: =?UTF-8?q?Cl=C3=A9ment=20B=C5=93sch?= <u at pkh.me>
+Date: Thu, 6 Mar 2014 18:39:59 +0100
+Subject: [PATCH 08/14] http: Support setting custom User-Agent
+
+Contextually make the default User-Agent use the common
+"Name/Version" pattern.
+
+Signed-off-by: Luca Barbato <lu_zero at gentoo.org>
+(cherry picked from commit ddfc98906373d1f17f6205cedd14c68d7a75995f)
+---
+ doc/protocols.texi |    4 ++++
+ libavformat/http.c |    8 ++++++--
+ 2 files changed, 10 insertions(+), 2 deletions(-)
+
+diff --git a/doc/protocols.texi b/doc/protocols.texi
+index b16234b..fa14a8c 100644
+--- a/doc/protocols.texi
++++ b/doc/protocols.texi
+@@ -92,6 +92,10 @@ HTTP (Hyper Text Transfer Protocol).
+ This protocol accepts the following options:
+ 
+ @table @option
++ at item user_agent
++Override the User-Agent header. If not specified a string of the form
++"Lavf/<version>" will be used.
++
+ @item mime_type
+ Export the MIME type.
+ 
+diff --git a/libavformat/http.c b/libavformat/http.c
+index fcee847..a2fd439 100644
+--- a/libavformat/http.c
++++ b/libavformat/http.c
+@@ -57,6 +57,7 @@ typedef struct {
+     HTTPAuthState proxy_auth_state;
+     char *headers;
+     char *mime_type;
++    char *user_agent;
+     /* Set if the server correctly handles Connection: close and will close
+      * the connection after feeding us the content. */
+     int willclose;
+@@ -88,9 +89,12 @@ typedef struct {
+ #define OFFSET(x) offsetof(HTTPContext, x)
+ #define D AV_OPT_FLAG_DECODING_PARAM
+ #define E AV_OPT_FLAG_ENCODING_PARAM
++#define DEFAULT_USER_AGENT "Lavf/" AV_STRINGIFY(LIBAVFORMAT_VERSION)
+ 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", "custom HTTP headers, can override built in default headers", OFFSET(headers), 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 },
++{"user-agent", "override User-Agent header, for compatibility with ffmpeg", 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", "custom HTTP post data", OFFSET(post_data), AV_OPT_TYPE_BINARY, .flags = D|E },
+ {"mime_type", "export the MIME type", OFFSET(mime_type), AV_OPT_TYPE_STRING, {0}, 0, 0, 0  },
+@@ -562,8 +566,8 @@ static int http_connect(URLContext *h, const char *path, const char *local_path,
+ 
+     /* set default headers if needed */
+     if (!has_header(s->headers, "\r\nUser-Agent: "))
+-       len += av_strlcatf(headers + len, sizeof(headers) - len,
+-                          "User-Agent: %s\r\n", LIBAVFORMAT_IDENT);
++        len += av_strlcatf(headers + len, sizeof(headers) - len,
++                           "User-Agent: %s\r\n", s->user_agent);
+     if (!has_header(s->headers, "\r\nAccept: "))
+         len += av_strlcpy(headers + len, "Accept: */*\r\n",
+                           sizeof(headers) - len);
+-- 
+1.7.10.4
+
diff --git a/debian/patches/post-beta2/0009-http-Add-support-for-selecting-a-request-range.patch b/debian/patches/post-beta2/0009-http-Add-support-for-selecting-a-request-range.patch
new file mode 100644
index 0000000..8ea321d
--- /dev/null
+++ b/debian/patches/post-beta2/0009-http-Add-support-for-selecting-a-request-range.patch
@@ -0,0 +1,80 @@
+From 991e6fa35b4ad2df389ba7e1c2c58d064e295c76 Mon Sep 17 00:00:00 2001
+From: Anssi Hannula <anssi.hannula at iki.fi>
+Date: Thu, 6 Mar 2014 18:40:00 +0100
+Subject: [PATCH 09/14] http: Add support for selecting a request range
+MIME-Version: 1.0
+Content-Type: text/plain; charset=UTF-8
+Content-Transfer-Encoding: 8bit
+
+Comment from Reimar Döffinger included as pro memoria.
+
+Signed-off-by: Luca Barbato <lu_zero at gentoo.org>
+(cherry picked from commit 2ec33d27127251bbc45e1f88e60691ad59cf2319)
+---
+ doc/protocols.texi |    6 ++++++
+ libavformat/http.c |   17 ++++++++++++++---
+ 2 files changed, 20 insertions(+), 3 deletions(-)
+
+diff --git a/doc/protocols.texi b/doc/protocols.texi
+index fa14a8c..406a431 100644
+--- a/doc/protocols.texi
++++ b/doc/protocols.texi
+@@ -114,6 +114,12 @@ If the server supports ICY metadata, and @option{icy} was set to 1, this
+ contains the last non-empty metadata packet sent by the server. It should be
+ polled in regular intervals by applications interested in mid-stream metadata
+ updates.
++
++ at item offset
++Set initial byte offset.
++
++ at item end_offset
++Try to limit the request to bytes preceding this offset.
+ @end table
+ 
+ @section mmst
+diff --git a/libavformat/http.c b/libavformat/http.c
+index a2fd439..54910a9 100644
+--- a/libavformat/http.c
++++ b/libavformat/http.c
+@@ -51,7 +51,7 @@ typedef struct {
+     int http_code;
+     /* Used if "Transfer-Encoding: chunked" otherwise -1. */
+     int64_t chunksize;
+-    int64_t off, filesize;
++    int64_t off, end_off, filesize;
+     char *location;
+     HTTPAuthState auth_state;
+     HTTPAuthState proxy_auth_state;
+@@ -106,6 +106,8 @@ static const AVOption options[] = {
+ {"basic", "HTTP basic authentication", 0, AV_OPT_TYPE_CONST, {.i64 = HTTP_AUTH_BASIC}, 0, 0, D|E, "auth_type" },
+ {"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(end_off), AV_OPT_TYPE_INT64, {.i64 = 0}, 0, INT64_MAX, D },
+ {NULL}
+ };
+ #define HTTP_CLASS(flavor)\
+@@ -571,9 +573,18 @@ static int http_connect(URLContext *h, const char *path, const char *local_path,
+     if (!has_header(s->headers, "\r\nAccept: "))
+         len += av_strlcpy(headers + len, "Accept: */*\r\n",
+                           sizeof(headers) - len);
+-    if (!has_header(s->headers, "\r\nRange: ") && !post)
++    // 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) {
+         len += av_strlcatf(headers + len, sizeof(headers) - len,
+-                           "Range: bytes=%"PRId64"-\r\n", s->off);
++                           "Range: bytes=%"PRId64"-", s->off);
++        if (s->end_off)
++            len += av_strlcatf(headers + len, sizeof(headers) - len,
++                               "%"PRId64, s->end_off - 1);
++        len += av_strlcpy(headers + len, "\r\n",
++                          sizeof(headers) - len);
++    }
+     if (send_expect_100 && !has_header(s->headers, "\r\nExpect: "))
+         len += av_strlcatf(headers + len, sizeof(headers) - len,
+                            "Expect: 100-continue\r\n");
+-- 
+1.7.10.4
+
diff --git a/debian/patches/post-beta2/0010-http-Always-allow-no-op-seek.patch b/debian/patches/post-beta2/0010-http-Always-allow-no-op-seek.patch
new file mode 100644
index 0000000..eeb088d
--- /dev/null
+++ b/debian/patches/post-beta2/0010-http-Always-allow-no-op-seek.patch
@@ -0,0 +1,30 @@
+From f859fed03d5d039430baea03a0ef35cfd6ac4abd Mon Sep 17 00:00:00 2001
+From: Anssi Hannula <anssi.hannula at iki.fi>
+Date: Thu, 6 Mar 2014 18:40:01 +0100
+Subject: [PATCH 10/14] http: Always allow no-op seek
+
+This also allows checking stream position as per ffurl_seek() doxy.
+
+Signed-off-by: Luca Barbato <lu_zero at gentoo.org>
+(cherry picked from commit ab76d9f628ad46e1d3bbf26c5bf1f87083f239ab)
+---
+ libavformat/http.c |    3 +++
+ 1 file changed, 3 insertions(+)
+
+diff --git a/libavformat/http.c b/libavformat/http.c
+index 54910a9..2656595 100644
+--- a/libavformat/http.c
++++ b/libavformat/http.c
+@@ -901,6 +901,9 @@ static int64_t http_seek(URLContext *h, int64_t off, int whence)
+ 
+     if (whence == AVSEEK_SIZE)
+         return s->filesize;
++    else if ((whence == SEEK_CUR && off == 0) ||
++             (whence == SEEK_SET && off == s->off))
++        return s->off;
+     else if ((s->filesize == -1 && whence == SEEK_END) || h->is_streamed)
+         return AVERROR(ENOSYS);
+ 
+-- 
+1.7.10.4
+
diff --git a/debian/patches/post-beta2/0011-http-Improve-options-descriptions.patch b/debian/patches/post-beta2/0011-http-Improve-options-descriptions.patch
new file mode 100644
index 0000000..8d23a3f
--- /dev/null
+++ b/debian/patches/post-beta2/0011-http-Improve-options-descriptions.patch
@@ -0,0 +1,62 @@
+From 82a3e469c6584e6d9e56a3fc38eb001d0650defa Mon Sep 17 00:00:00 2001
+From: Reinhard Tartler <siretart at tauware.de>
+Date: Sat, 15 Mar 2014 09:51:57 -0400
+Subject: [PATCH 11/14] http: Improve options descriptions
+
+Add documentation where missing.
+
+Signed-off-by: Luca Barbato <lu_zero at gentoo.org>
+(cherry picked from commit fe568b3d27ca2c5cca3878b2a7a3a968e605aec4)
+
+Conflicts:
+	libavformat/http.c
+---
+ doc/protocols.texi |   13 +++++++++++++
+ libavformat/http.c |    4 ++--
+ 2 files changed, 15 insertions(+), 2 deletions(-)
+
+diff --git a/doc/protocols.texi b/doc/protocols.texi
+index 406a431..597693a 100644
+--- a/doc/protocols.texi
++++ b/doc/protocols.texi
+@@ -92,6 +92,19 @@ HTTP (Hyper Text Transfer Protocol).
+ This protocol accepts the following options:
+ 
+ @table @option
++ at item chunked_post
++If set to 1 use chunked Transfer-Encoding for posts, default is 1.
++
++ at item headers
++Set custom HTTP headers, can override built in default headers. The
++value must be a string encoding the headers.
++
++ at item multiple_requests
++Use persistent connections if set to 1, default is 0.
++
++ at item post_data
++Set custom HTTP post data.
++
+ @item user_agent
+ Override the User-Agent header. If not specified a string of the form
+ "Lavf/<version>" will be used.
+diff --git a/libavformat/http.c b/libavformat/http.c
+index 2656595..b008581 100644
+--- a/libavformat/http.c
++++ b/libavformat/http.c
+@@ -92,11 +92,11 @@ typedef struct {
+ #define DEFAULT_USER_AGENT "Lavf/" AV_STRINGIFY(LIBAVFORMAT_VERSION)
+ 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", "custom HTTP headers, can override built in default headers", OFFSET(headers), AV_OPT_TYPE_STRING, { 0 }, 0, 0, D|E },
++{"headers", "set custom HTTP headers, can override built in default headers", OFFSET(headers), 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 },
+ {"user-agent", "override User-Agent header, for compatibility with ffmpeg", 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", "custom HTTP post data", OFFSET(post_data), AV_OPT_TYPE_BINARY, .flags = D|E },
++{"post_data", "set custom HTTP post data", OFFSET(post_data), AV_OPT_TYPE_BINARY, .flags = D|E },
+ {"mime_type", "export the MIME type", OFFSET(mime_type), AV_OPT_TYPE_STRING, {0}, 0, 0, 0  },
+ {"icy", "request ICY metadata", OFFSET(icy), AV_OPT_TYPE_INT, {.i64 = 0}, 0, 1, D },
+ {"icy_metadata_headers", "return ICY metadata headers", OFFSET(icy_metadata_headers), AV_OPT_TYPE_STRING, {0}, 0, 0, 0 },
+-- 
+1.7.10.4
+
diff --git a/debian/patches/post-beta2/0012-http-Allow-setting-a-Content-Type-for-POST-requests.patch b/debian/patches/post-beta2/0012-http-Allow-setting-a-Content-Type-for-POST-requests.patch
new file mode 100644
index 0000000..d1a9207
--- /dev/null
+++ b/debian/patches/post-beta2/0012-http-Allow-setting-a-Content-Type-for-POST-requests.patch
@@ -0,0 +1,60 @@
+From cd874cf8e69f1b31986fd978577994b45efa3d5c Mon Sep 17 00:00:00 2001
+From: =?UTF-8?q?Cl=C3=A9ment=20B=C5=93sch?= <u at pkh.me>
+Date: Thu, 6 Mar 2014 18:40:03 +0100
+Subject: [PATCH 12/14] http: Allow setting a Content-Type for POST requests
+
+Signed-off-by: Luca Barbato <lu_zero at gentoo.org>
+(cherry picked from commit 2572d07c1f0abd9e2bf3ed20dbe35c58f1dd6ac4)
+---
+ doc/protocols.texi |    3 +++
+ libavformat/http.c |    6 ++++++
+ 2 files changed, 9 insertions(+)
+
+diff --git a/doc/protocols.texi b/doc/protocols.texi
+index 597693a..1501dab 100644
+--- a/doc/protocols.texi
++++ b/doc/protocols.texi
+@@ -95,6 +95,9 @@ This protocol accepts the following options:
+ @item chunked_post
+ If set to 1 use chunked Transfer-Encoding for posts, default is 1.
+ 
++ at item content_type
++Set a specific content type for the POST messages.
++
+ @item headers
+ Set custom HTTP headers, can override built in default headers. The
+ value must be a string encoding the headers.
+diff --git a/libavformat/http.c b/libavformat/http.c
+index b008581..7e3af5a 100644
+--- a/libavformat/http.c
++++ b/libavformat/http.c
+@@ -58,6 +58,7 @@ typedef struct {
+     char *headers;
+     char *mime_type;
+     char *user_agent;
++    char *content_type;
+     /* Set if the server correctly handles Connection: close and will close
+      * the connection after feeding us the content. */
+     int willclose;
+@@ -93,6 +94,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", "set a specific content type for the POST messages", 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 },
+ {"user-agent", "override User-Agent header, for compatibility with ffmpeg", 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 },
+@@ -605,6 +607,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.7.10.4
+
diff --git a/debian/patches/post-beta2/0013-http-Declare-more-parameters-as-const-where-possible.patch b/debian/patches/post-beta2/0013-http-Declare-more-parameters-as-const-where-possible.patch
new file mode 100644
index 0000000..0c1ab66
--- /dev/null
+++ b/debian/patches/post-beta2/0013-http-Declare-more-parameters-as-const-where-possible.patch
@@ -0,0 +1,39 @@
+From 10379d50be18325a07ef297bd2120d85a58ec78b Mon Sep 17 00:00:00 2001
+From: =?UTF-8?q?Martin=20Storsj=C3=B6?= <martin at martin.st>
+Date: Wed, 12 Mar 2014 09:40:05 +0200
+Subject: [PATCH 13/14] http: Declare more parameters as const where possible
+MIME-Version: 1.0
+Content-Type: text/plain; charset=UTF-8
+Content-Transfer-Encoding: 8bit
+
+Signed-off-by: Martin Storsjö <martin at martin.st>
+(cherry picked from commit e77a2ea9505863e50bf013706f66bf8b7325e524)
+---
+ libavformat/http.c |    4 ++--
+ 1 file changed, 2 insertions(+), 2 deletions(-)
+
+diff --git a/libavformat/http.c b/libavformat/http.c
+index 7e3af5a..c553d8e 100644
+--- a/libavformat/http.c
++++ b/libavformat/http.c
+@@ -353,7 +353,7 @@ static int parse_location(HTTPContext *s, const char *p)
+ }
+ 
+ /* "bytes $from-$to/$document_size" */
+-static void parse_content_range(URLContext *h, char *p)
++static void parse_content_range(URLContext *h, const char *p)
+ {
+     HTTPContext *s = h->priv_data;
+     const char *slash;
+@@ -367,7 +367,7 @@ static void parse_content_range(URLContext *h, char *p)
+     h->is_streamed = 0; /* we _can_ in fact seek */
+ }
+ 
+-static int parse_content_encoding(URLContext *h, char *p)
++static int parse_content_encoding(URLContext *h, const char *p)
+ {
+     HTTPContext *s = h->priv_data;
+ 
+-- 
+1.7.10.4
+
diff --git a/debian/patches/post-beta2/0014-http-Properly-initialize-icy-headers-string.patch b/debian/patches/post-beta2/0014-http-Properly-initialize-icy-headers-string.patch
new file mode 100644
index 0000000..acd2e6d
--- /dev/null
+++ b/debian/patches/post-beta2/0014-http-Properly-initialize-icy-headers-string.patch
@@ -0,0 +1,46 @@
+From b5210f4eae30df587815b5f005f219aa723591d3 Mon Sep 17 00:00:00 2001
+From: Alessandro Ghedini <alessandro at ghedini.me>
+Date: Wed, 12 Mar 2014 16:28:22 +0100
+Subject: [PATCH 14/14] http: Properly initialize icy headers string
+
+The icy_metadata_headers string never gets initialized, so,
+during the first call to av_strlcatf() in parse_icy(),
+strlen() will be called on a pointer to uninitialized memory.
+At best this causes some garbage data to be left at the
+start of the string.
+
+By initializing icy_metadata_headers to the empty string, the
+first call to strlen() will always return 0, so that data is
+appended from the start of the string.
+
+Signed-off-by: Luca Barbato <lu_zero at gentoo.org>
+(cherry picked from commit 6998a9f4c4e069f515c50614179f4cfc7d0184f5)
+---
+ libavformat/http.c |    4 ++++
+ 1 file changed, 4 insertions(+)
+
+diff --git a/libavformat/http.c b/libavformat/http.c
+index c553d8e..0169f5f 100644
+--- a/libavformat/http.c
++++ b/libavformat/http.c
+@@ -405,6 +405,7 @@ static int parse_content_encoding(URLContext *h, const char *p)
+ static int parse_icy(HTTPContext *s, const char *tag, const char *p)
+ {
+     int len = 4 + strlen(p) + strlen(tag);
++    int is_first = !s->icy_metadata_headers;
+     int ret;
+ 
+     if (s->icy_metadata_headers)
+@@ -413,6 +414,9 @@ static int parse_icy(HTTPContext *s, const char *tag, const char *p)
+     if ((ret = av_reallocp(&s->icy_metadata_headers, len)) < 0)
+         return ret;
+ 
++    if (is_first)
++        *s->icy_metadata_headers = '\0';
++
+     av_strlcatf(s->icy_metadata_headers, len, "%s: %s\n", tag, p);
+ 
+     return 0;
+-- 
+1.7.10.4
+
diff --git a/debian/patches/series b/debian/patches/series
index fd167ab..f2c0bda 100644
--- a/debian/patches/series
+++ b/debian/patches/series
@@ -1,3 +1,15 @@
 03-disable-configuration-warnings.patch
-spelling-errors.patch
-openjpeg.patch
+post-beta2/0001-configure-Support-older-version-of-openjpeg1.patch
+post-beta2/0002-http-Return-meaningful-error-codes.patch
+post-beta2/0003-http-Drop-doxy-comments.patch
+post-beta2/0004-http-K-R-formatting-cosmetics.patch
+post-beta2/0005-http-Refactor-process_line.patch
+post-beta2/0006-http-Add-support-reading-ICY-metadata.patch
+post-beta2/0007-http-Export-Content-Type-information.patch
+post-beta2/0008-http-Support-setting-custom-User-Agent.patch
+post-beta2/0009-http-Add-support-for-selecting-a-request-range.patch
+post-beta2/0010-http-Always-allow-no-op-seek.patch
+post-beta2/0011-http-Improve-options-descriptions.patch
+post-beta2/0012-http-Allow-setting-a-Content-Type-for-POST-requests.patch
+post-beta2/0013-http-Declare-more-parameters-as-const-where-possible.patch
+post-beta2/0014-http-Properly-initialize-icy-headers-string.patch

-- 
Libav/FFmpeg packaging



More information about the pkg-multimedia-commits mailing list