Remove a warning if https support is disabled.
---
libavformat/http.c | 76 ++++++++++++++++++++++++++++--------------------------
1 file changed, 39 insertions(+), 37 deletions(-)
diff --git a/libavformat/http.c b/libavformat/http.c
index cb800ce..e930f29 100644
--- a/libavformat/http.c
+++ b/libavformat/http.c
@@ -88,43 +88,6 @@ typedef struct {
char *write_method;
} HTTPContext;
-#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", "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 },
-{"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, AV_OPT_FLAG_EXPORT | AV_OPT_FLAG_READONLY },
-{"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_packet", "return current ICY metadata packet",
OFFSET(icy_metadata_packet), AV_OPT_TYPE_STRING, {0}, 0, 0, AV_OPT_FLAG_EXPORT
},
-{"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" },
-{"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 },
-{"write_method", "Method to write to the remote server", OFFSET(write_method),
AV_OPT_TYPE_STRING, { .str = "POST" }, 0, 0, E, },
-{NULL}
-};
-#define HTTP_CLASS(flavor)\
-static const AVClass flavor ## _context_class = {\
- .class_name = #flavor,\
- .item_name = av_default_item_name,\
- .option = options,\
- .version = LIBAVUTIL_VERSION_INT,\
-}
-
-HTTP_CLASS(http);
-HTTP_CLASS(https);
-
static int http_connect(URLContext *h, const char *path, const char
*local_path,
const char *hoststr, const char *auth,
const char *proxyauth, int *new_location);
@@ -957,7 +920,44 @@ http_get_file_handle(URLContext *h)
return ffurl_get_file_handle(s->hd);
}
+#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", "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 },
+{"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, AV_OPT_FLAG_EXPORT | AV_OPT_FLAG_READONLY },
+{"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_packet", "return current ICY metadata packet",
OFFSET(icy_metadata_packet), AV_OPT_TYPE_STRING, {0}, 0, 0, AV_OPT_FLAG_EXPORT
},
+{"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" },
+{"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 },
+{"write_method", "Method to write to the remote server", OFFSET(write_method),
AV_OPT_TYPE_STRING, { .str = "POST" }, 0, 0, E, },
+{NULL}
+};
+
+#define HTTP_CLASS(flavor)\
+static const AVClass flavor ## _context_class = {\
+ .class_name = #flavor,\
+ .item_name = av_default_item_name,\
+ .option = options,\
+ .version = LIBAVUTIL_VERSION_INT,\
+}
+
#if CONFIG_HTTP_PROTOCOL
+HTTP_CLASS(http);
+
URLProtocol ff_http_protocol = {
.name = "http",
.url_open2 = http_open,
@@ -973,6 +973,8 @@ URLProtocol ff_http_protocol = {
};
#endif
#if CONFIG_HTTPS_PROTOCOL
+HTTP_CLASS(https);
+
URLProtocol ff_https_protocol = {
.name = "https",
.url_open2 = http_open,
--
1.9.0
_______________________________________________
libav-devel mailing list
[email protected]
https://lists.libav.org/mailman/listinfo/libav-devel