aboutsummaryrefslogtreecommitdiffstats
path: root/libavformat
diff options
context:
space:
mode:
authorMartin Storsjö <martin@martin.st>2011-02-06 00:20:26 +0200
committerMartin Storsjö <martin@martin.st>2011-11-05 12:09:36 +0200
commit183baeadca74f4087b58dc5a94a649473f28470c (patch)
tree977ef0316f92d57e870194291ab61a581a8898d0 /libavformat
parent558d192d23bf76a476c0d84d212611e529c64529 (diff)
downloadffmpeg-183baeadca74f4087b58dc5a94a649473f28470c.tar.gz
avformat: Add the https protocol
Signed-off-by: Martin Storsjö <martin@martin.st>
Diffstat (limited to 'libavformat')
-rw-r--r--libavformat/Makefile1
-rw-r--r--libavformat/allformats.c1
-rw-r--r--libavformat/http.c29
-rw-r--r--libavformat/version.h2
4 files changed, 28 insertions, 5 deletions
diff --git a/libavformat/Makefile b/libavformat/Makefile
index 5da01aa60b..54bc8a1645 100644
--- a/libavformat/Makefile
+++ b/libavformat/Makefile
@@ -322,6 +322,7 @@ OBJS-$(CONFIG_CRYPTO_PROTOCOL) += crypto.o
OBJS-$(CONFIG_FILE_PROTOCOL) += file.o
OBJS-$(CONFIG_GOPHER_PROTOCOL) += gopher.o
OBJS-$(CONFIG_HTTP_PROTOCOL) += http.o httpauth.o
+OBJS-$(CONFIG_HTTPS_PROTOCOL) += http.o httpauth.o
OBJS-$(CONFIG_MMSH_PROTOCOL) += mmsh.o mms.o asf.o
OBJS-$(CONFIG_MMST_PROTOCOL) += mmst.o mms.o asf.o
OBJS-$(CONFIG_MD5_PROTOCOL) += md5proto.o
diff --git a/libavformat/allformats.c b/libavformat/allformats.c
index d078a154dc..01900e8a73 100644
--- a/libavformat/allformats.c
+++ b/libavformat/allformats.c
@@ -241,6 +241,7 @@ void av_register_all(void)
REGISTER_PROTOCOL (FILE, file);
REGISTER_PROTOCOL (GOPHER, gopher);
REGISTER_PROTOCOL (HTTP, http);
+ REGISTER_PROTOCOL (HTTPS, https);
REGISTER_PROTOCOL (MMSH, mmsh);
REGISTER_PROTOCOL (MMST, mmst);
REGISTER_PROTOCOL (MD5, md5);
diff --git a/libavformat/http.c b/libavformat/http.c
index 1db9e82cc4..0030bc7dc1 100644
--- a/libavformat/http.c
+++ b/libavformat/http.c
@@ -92,8 +92,8 @@ void ff_http_init_auth_state(URLContext *dest, const URLContext *src)
/* return non zero if error */
static int http_open_cnx(URLContext *h)
{
- const char *path, *proxy_path;
- char hostname[1024], hoststr[1024];
+ const char *path, *proxy_path, *lower_proto = "tcp";
+ char hostname[1024], hoststr[1024], proto[10];
char auth[1024];
char path1[1024];
char buf[1024];
@@ -109,7 +109,8 @@ static int http_open_cnx(URLContext *h)
/* fill the dest addr */
redo:
/* needed in any case to build the host string */
- av_url_split(NULL, 0, auth, sizeof(auth), hostname, sizeof(hostname), &port,
+ av_url_split(proto, sizeof(proto), auth, sizeof(auth),
+ hostname, sizeof(hostname), &port,
path1, sizeof(path1), s->location);
ff_url_join(hoststr, sizeof(hoststr), NULL, NULL, hostname, port, NULL);
@@ -123,10 +124,15 @@ static int http_open_cnx(URLContext *h)
else
path = path1;
}
+ if (!strcmp(proto, "https")) {
+ lower_proto = "tls";
+ if (port < 0)
+ port = 443;
+ }
if (port < 0)
port = 80;
- ff_url_join(buf, sizeof(buf), "tcp", NULL, hostname, port, NULL);
+ ff_url_join(buf, sizeof(buf), lower_proto, NULL, hostname, port, NULL);
err = ffurl_open(&hd, buf, AVIO_FLAG_READ_WRITE);
if (err < 0)
goto fail;
@@ -509,6 +515,7 @@ http_get_file_handle(URLContext *h)
return ffurl_get_file_handle(s->hd);
}
+#if CONFIG_HTTP_PROTOCOL
URLProtocol ff_http_protocol = {
.name = "http",
.url_open = http_open,
@@ -520,3 +527,17 @@ URLProtocol ff_http_protocol = {
.priv_data_size = sizeof(HTTPContext),
.priv_data_class = &httpcontext_class,
};
+#endif
+#if CONFIG_HTTPS_PROTOCOL
+URLProtocol ff_https_protocol = {
+ .name = "https",
+ .url_open = http_open,
+ .url_read = http_read,
+ .url_write = http_write,
+ .url_seek = http_seek,
+ .url_close = http_close,
+ .url_get_file_handle = http_get_file_handle,
+ .priv_data_size = sizeof(HTTPContext),
+ .priv_data_class = &httpcontext_class,
+};
+#endif
diff --git a/libavformat/version.h b/libavformat/version.h
index 2b1ef9530c..c7b07783c9 100644
--- a/libavformat/version.h
+++ b/libavformat/version.h
@@ -24,7 +24,7 @@
#include "libavutil/avutil.h"
#define LIBAVFORMAT_VERSION_MAJOR 53
-#define LIBAVFORMAT_VERSION_MINOR 11
+#define LIBAVFORMAT_VERSION_MINOR 12
#define LIBAVFORMAT_VERSION_MICRO 0
#define LIBAVFORMAT_VERSION_INT AV_VERSION_INT(LIBAVFORMAT_VERSION_MAJOR, \