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)
http: Return meaningful error codes

(cherry picked from commit 55a215ba63d9fa79cd7ee265ee2e777ee86b200c)
http: Drop doxy comments

(cherry picked from commit 78b21c1d7177e1d61ad3c9225f67699da089aa7c)
http: K&R formatting cosmetics

(cherry picked from commit 7a2fddb4480121712df560cf619c1c3566cae3ff)
http: Refactor process_line

(cherry picked from commit 4ff99ab3d7d5576e99e6b8a411b4a44500ed88fa)
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@gentoo.org>
(cherry picked from commit 8075c3d8bb1f6aade0cc7c5c40db9bc1bcd84cab)
http: Export Content-Type information

Bug-Id: https://bugs.debian.org/740421

Signed-off-by: Luca Barbato <lu_zero@gentoo.org>
(cherry picked from commit e58c85b0686892960042232e51c77168b264838a)
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@gentoo.org>
(cherry picked from commit ddfc98906373d1f17f6205cedd14c68d7a75995f)
http: Add support for selecting a request range

Comment from Reimar Döffinger included as pro memoria.

Signed-off-by: Luca Barbato <lu_zero@gentoo.org>
(cherry picked from commit 2ec33d27127251bbc45e1f88e60691ad59cf2319)
http: Always allow no-op seek

This also allows checking stream position as per ffurl_seek() doxy.

Signed-off-by: Luca Barbato <lu_zero@gentoo.org>
(cherry picked from commit ab76d9f628ad46e1d3bbf26c5bf1f87083f239ab)
http: Improve options descriptions

Add documentation where missing.

Signed-off-by: Luca Barbato <lu_zero@gentoo.org>
(cherry picked from commit fe568b3d27ca2c5cca3878b2a7a3a968e605aec4)

Conflicts:
	libavformat/http.c
http: Allow setting a Content-Type for POST requests

Signed-off-by: Luca Barbato <lu_zero@gentoo.org>
(cherry picked from commit 2572d07c1f0abd9e2bf3ed20dbe35c58f1dd6ac4)
http: Declare more parameters as const where possible

Signed-off-by: Martin Storsjö <martin@martin.st>
(cherry picked from commit e77a2ea9505863e50bf013706f66bf8b7325e524)
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@gentoo.org>
(cherry picked from commit 6998a9f4c4e069f515c50614179f4cfc7d0184f5)
Merge commit 'b920c1d' into release/2.2

* commit 'b920c1d':
  configure: Support older version of openjpeg1

Conflicts:
	configure

Not merged as the problematic pkg config code wasnt merged

Merged-by: Michael Niedermayer <michaelni@gmx.at>
Merge commit '00ecce5' into release/2.2

* commit '00ecce5':
  http: Return meaningful error codes

Merged-by: Michael Niedermayer <michaelni@gmx.at>
Merge commit '738d68d' into release/2.2

* commit '738d68d':
  http: Drop doxy comments

Conflicts:
	libavformat/http.c

Merged-by: Michael Niedermayer <michaelni@gmx.at>
http: handle ICY in presence of chunked transfer encoding

Some http servers send an ICY stream in combination with chunked
transfer encoding. This case was handled incorrectly by the ICY code:
instead of handling chunked encoding before anything ICY related, both
were mixed.

Fix this by separating the ICY code from normal http reading. Move the
normal http reading to a new function http_read_stream(), while
http_read() handles ICY on top of http_read_stream().

The server identified itself as: cloudflare-nginx

Signed-off-by: Michael Niedermayer <michaelni@gmx.at>
(cherry picked from commit 636273d3d4a8c42f51832e8bf83e566e875916bf)

Signed-off-by: Michael Niedermayer <michaelni@gmx.at>
(cherry picked from commit 67f67a3748a038d880ed8a642184d2e3c76e29bb)

Signed-off-by: Michael Niedermayer <michaelni@gmx.at>
Merge commit 'f1de93dec302cc860c718e89656f184510b2d239' into release/2.2

* commit 'f1de93dec302cc860c718e89656f184510b2d239':
  http: K&R formatting cosmetics

Conflicts:
	libavformat/http.c

Merged-by: Michael Niedermayer <michaelni@gmx.at>
Merge commit '25d14b716aef43bf9e82f1d67a364e5922332f47' into release/2.2

* commit '25d14b716aef43bf9e82f1d67a364e5922332f47':
  http: Refactor process_line

Conflicts:
	libavformat/http.c

Merged-by: Michael Niedermayer <michaelni@gmx.at>