diff --git a/configure b/configure index 63ee46a53b..998ac74e9e 100755 --- a/configure +++ b/configure @@ -3160,21 +3160,14 @@ rtmpte_protocol_suggest="zlib" rtmpts_protocol_select="ffrtmphttp_protocol https_protocol" rtmpts_protocol_suggest="zlib" rtp_protocol_select="udp_protocol" +schannel_conflict="openssl gnutls" sctp_protocol_deps="struct_sctp_event_subscribe struct_msghdr_msg_flags" sctp_protocol_select="network" +securetransport_conflict="openssl gnutls" srtp_protocol_select="rtp_protocol srtp" tcp_protocol_select="network" -tls_gnutls_protocol_conflict="tls_schannel_protocol tls_securetransport_protocol" -tls_gnutls_protocol_deps="gnutls" -tls_gnutls_protocol_select="tcp_protocol" -tls_openssl_protocol_conflict="tls_schannel_protocol tls_securetransport_protocol tls_gnutls_protocol" -tls_openssl_protocol_deps="openssl" -tls_openssl_protocol_select="tcp_protocol" -tls_schannel_protocol_deps="schannel" -tls_schannel_protocol_select="tcp_protocol" -tls_securetransport_protocol_deps="securetransport" -tls_securetransport_protocol_select="tcp_protocol" -tls_protocol_deps_any="tls_schannel_protocol tls_securetransport_protocol tls_gnutls_protocol tls_openssl_protocol" +tls_protocol_deps_any="gnutls openssl schannel securetransport" +tls_protocol_select="tcp_protocol" udp_protocol_select="network" udplite_protocol_select="network" unix_protocol_deps="sys_un_h" @@ -3752,6 +3745,9 @@ map "die_license_disabled nonfree" $HWACCEL_LIBRARY_NONFREE_LIST enabled version3 && { enabled gpl && enable gplv3 || enable lgplv3; } +enabled_all gnutls openssl && + die "GnuTLS and OpenSSL must not be enabled at the same time." + # Disable all the library-specific components if the library itself # is disabled, see AVCODEC_LIST and following _LIST variables. diff --git a/libavformat/Makefile b/libavformat/Makefile index 591a14b978..caebe5b146 100644 --- a/libavformat/Makefile +++ b/libavformat/Makefile @@ -586,10 +586,11 @@ OBJS-$(CONFIG_SRTP_PROTOCOL) += srtpproto.o srtp.o OBJS-$(CONFIG_SUBFILE_PROTOCOL) += subfile.o OBJS-$(CONFIG_TEE_PROTOCOL) += teeproto.o tee_common.o OBJS-$(CONFIG_TCP_PROTOCOL) += tcp.o -OBJS-$(CONFIG_TLS_GNUTLS_PROTOCOL) += tls_gnutls.o tls.o -OBJS-$(CONFIG_TLS_OPENSSL_PROTOCOL) += tls_openssl.o tls.o -OBJS-$(CONFIG_TLS_SCHANNEL_PROTOCOL) += tls_schannel.o tls.o -OBJS-$(CONFIG_TLS_SECURETRANSPORT_PROTOCOL) += tls_securetransport.o tls.o +TLS-OBJS-$(CONFIG_GNUTLS) += tls_gnutls.o +TLS-OBJS-$(CONFIG_OPENSSL) += tls_openssl.o +TLS-OBJS-$(CONFIG_SECURETRANSPORT) += tls_securetransport.o +TLS-OBJS-$(CONFIG_SCHANNEL) += tls_schannel.o +OBJS-$(CONFIG_TLS_PROTOCOL) += tls.o $(TLS-OBJS-yes) OBJS-$(CONFIG_UDP_PROTOCOL) += udp.o OBJS-$(CONFIG_UDPLITE_PROTOCOL) += udp.o OBJS-$(CONFIG_UNIX_PROTOCOL) += unix.o diff --git a/libavformat/network.c b/libavformat/network.c index b3987a4d11..6c3d9def3b 100644 --- a/libavformat/network.c +++ b/libavformat/network.c @@ -29,25 +29,29 @@ int ff_tls_init(void) { -#if CONFIG_TLS_OPENSSL_PROTOCOL +#if CONFIG_TLS_PROTOCOL +#if CONFIG_OPENSSL int ret; if ((ret = ff_openssl_init()) < 0) return ret; #endif -#if CONFIG_TLS_GNUTLS_PROTOCOL +#if CONFIG_GNUTLS ff_gnutls_init(); +#endif #endif return 0; } void ff_tls_deinit(void) { -#if CONFIG_TLS_OPENSSL_PROTOCOL +#if CONFIG_TLS_PROTOCOL +#if CONFIG_OPENSSL ff_openssl_deinit(); #endif -#if CONFIG_TLS_GNUTLS_PROTOCOL +#if CONFIG_GNUTLS ff_gnutls_deinit(); #endif +#endif } int ff_network_inited_globally; diff --git a/libavformat/protocols.c b/libavformat/protocols.c index 8d3555ed52..669d74d5a8 100644 --- a/libavformat/protocols.c +++ b/libavformat/protocols.c @@ -56,10 +56,7 @@ extern const URLProtocol ff_srtp_protocol; extern const URLProtocol ff_subfile_protocol; extern const URLProtocol ff_tee_protocol; extern const URLProtocol ff_tcp_protocol; -extern const URLProtocol ff_tls_gnutls_protocol; -extern const URLProtocol ff_tls_schannel_protocol; -extern const URLProtocol ff_tls_securetransport_protocol; -extern const URLProtocol ff_tls_openssl_protocol; +extern const URLProtocol ff_tls_protocol; extern const URLProtocol ff_udp_protocol; extern const URLProtocol ff_udplite_protocol; extern const URLProtocol ff_unix_protocol; diff --git a/libavformat/tls.h b/libavformat/tls.h index 0326ef7924..9c851bf132 100644 --- a/libavformat/tls.h +++ b/libavformat/tls.h @@ -26,8 +26,6 @@ #include "url.h" #include "libavutil/opt.h" -#define CONFIG_TLS_PROTOCOL (CONFIG_TLS_GNUTLS_PROTOCOL | CONFIG_TLS_OPENSSL_PROTOCOL | CONFIG_TLS_SECURETRANSPORT_PROTOCOL | CONFIG_TLS_SCHANNEL_PROTOCOL) - typedef struct TLSShared { char *ca_file; int verify; diff --git a/libavformat/tls_gnutls.c b/libavformat/tls_gnutls.c index 5ce6c3d448..7adb4eed56 100644 --- a/libavformat/tls_gnutls.c +++ b/libavformat/tls_gnutls.c @@ -260,7 +260,7 @@ static const AVClass tls_class = { .version = LIBAVUTIL_VERSION_INT, }; -const URLProtocol ff_tls_gnutls_protocol = { +const URLProtocol ff_tls_protocol = { .name = "tls", .url_open2 = tls_open, .url_read = tls_read, diff --git a/libavformat/tls_openssl.c b/libavformat/tls_openssl.c index 38af8a21c0..3108a86f41 100644 --- a/libavformat/tls_openssl.c +++ b/libavformat/tls_openssl.c @@ -339,7 +339,7 @@ static const AVClass tls_class = { .version = LIBAVUTIL_VERSION_INT, }; -const URLProtocol ff_tls_openssl_protocol = { +const URLProtocol ff_tls_protocol = { .name = "tls", .url_open2 = tls_open, .url_read = tls_read, diff --git a/libavformat/tls_schannel.c b/libavformat/tls_schannel.c index 9f1c08806f..9a6e0c92e3 100644 --- a/libavformat/tls_schannel.c +++ b/libavformat/tls_schannel.c @@ -595,7 +595,7 @@ static const AVClass tls_class = { .version = LIBAVUTIL_VERSION_INT, }; -const URLProtocol ff_tls_schannel_protocol = { +const URLProtocol ff_tls_protocol = { .name = "tls", .url_open2 = tls_open, .url_read = tls_read, diff --git a/libavformat/tls_securetransport.c b/libavformat/tls_securetransport.c index bc8a32069e..9958931b0c 100644 --- a/libavformat/tls_securetransport.c +++ b/libavformat/tls_securetransport.c @@ -393,7 +393,7 @@ static const AVClass tls_class = { .version = LIBAVUTIL_VERSION_INT, }; -const URLProtocol ff_tls_securetransport_protocol = { +const URLProtocol ff_tls_protocol = { .name = "tls", .url_open2 = tls_open, .url_read = tls_read,