Browse Source

http: Export Content-Type information

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

Signed-off-by: Luca Barbato <lu_zero@gentoo.org>
tags/n2.3
Michael Niedermayer Luca Barbato 11 years ago
parent
commit
e58c85b068
2 changed files with 8 additions and 0 deletions
  1. +3
    -0
      doc/protocols.texi
  2. +5
    -0
      libavformat/http.c

+ 3
- 0
doc/protocols.texi View File

@@ -92,6 +92,9 @@ HTTP (Hyper Text Transfer Protocol).
This protocol accepts the following options: This protocol accepts the following options:


@table @option @table @option
@item mime_type
Export the MIME type.

@item icy @item icy
If set to 1 request ICY (SHOUTcast) metadata from the server. If the server 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 supports this, the metadata has to be retrieved by the application by reading


+ 5
- 0
libavformat/http.c View File

@@ -56,6 +56,7 @@ typedef struct {
HTTPAuthState auth_state; HTTPAuthState auth_state;
HTTPAuthState proxy_auth_state; HTTPAuthState proxy_auth_state;
char *headers; char *headers;
char *mime_type;
/* Set if the server correctly handles Connection: close and will close /* Set if the server correctly handles Connection: close and will close
* the connection after feeding us the content. */ * the connection after feeding us the content. */
int willclose; 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 }, {"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 }, {"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", "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, AV_OPT_FLAG_EXPORT | AV_OPT_FLAG_READONLY },
{"icy", "request ICY metadata", OFFSET(icy), AV_OPT_TYPE_INT, {.i64 = 0}, 0, 1, D }, {"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, AV_OPT_FLAG_EXPORT }, {"icy_metadata_headers", "return ICY metadata headers", OFFSET(icy_metadata_headers), AV_OPT_TYPE_STRING, {0}, 0, 0, AV_OPT_FLAG_EXPORT },
{"icy_metadata_packet", "return current ICY metadata packet", OFFSET(icy_metadata_packet), AV_OPT_TYPE_STRING, {0}, 0, 0, AV_OPT_FLAG_EXPORT }, {"icy_metadata_packet", "return current ICY metadata packet", OFFSET(icy_metadata_packet), AV_OPT_TYPE_STRING, {0}, 0, 0, AV_OPT_FLAG_EXPORT },
@@ -468,6 +470,9 @@ static int process_line(URLContext *h, char *line, int line_count,
} else if (!av_strcasecmp(tag, "Connection")) { } else if (!av_strcasecmp(tag, "Connection")) {
if (!strcmp(p, "close")) if (!strcmp(p, "close"))
s->willclose = 1; 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")) { } else if (!av_strcasecmp (tag, "Icy-MetaInt")) {
s->icy_metaint = strtoll(p, NULL, 10); s->icy_metaint = strtoll(p, NULL, 10);
} else if (!av_strncasecmp(tag, "Icy-", 4)) { } else if (!av_strncasecmp(tag, "Icy-", 4)) {


Loading…
Cancel
Save