On Tue, 26 May 2015, wm4 wrote:

Move the OpenSSL and GnuTLS implementations to their own files. Other
than the connection code (including options) and some boilerplate, no
code is actually shared.
---
configure                 |   4 +-
libavformat/Makefile      |   3 +-
libavformat/allformats.c  |   3 +-
libavformat/rtspdec.c     |   1 +
libavformat/tls.c         | 375 ++--------------------------------------------
libavformat/tls.h         |  54 +++++++
libavformat/tls_gnutls.c  | 228 ++++++++++++++++++++++++++++
libavformat/tls_openssl.c | 233 ++++++++++++++++++++++++++++
8 files changed, 537 insertions(+), 364 deletions(-)
create mode 100644 libavformat/tls.h
create mode 100644 libavformat/tls_gnutls.c
create mode 100644 libavformat/tls_openssl.c

diff --git a/configure b/configure
index 5bcc2df..d5c2e98 100755
--- a/configure
+++ b/configure
@@ -2185,7 +2185,9 @@ sctp_protocol_deps="struct_sctp_event_subscribe"
sctp_protocol_select="network"
srtp_protocol_select="rtp_protocol"
tcp_protocol_select="network"
-tls_protocol_deps_any="openssl gnutls"
+tls_gnutls_protocol_deps="gnutls"
+tls_openssl_protocol_deps="openssl !tls_gnutls_protocol"
+tls_protocol_deps_any="tls_gnutls_protocol tls_openssl_protocol"

Note to self or other reviewrs: I was about to comment to say that this line is redundant, but it isn't - there are other protocols in configure that depend on "tls_protocol", that don't care which implementation that provides it.

tls_protocol_select="tcp_protocol"
udp_protocol_select="network"
unix_protocol_deps="sys_un_h"
diff --git a/libavformat/Makefile b/libavformat/Makefile
index 73b9f63..dc4cfea 100644
--- a/libavformat/Makefile
+++ b/libavformat/Makefile
@@ -400,7 +400,8 @@ OBJS-$(CONFIG_RTP_PROTOCOL)              += rtpproto.o
OBJS-$(CONFIG_SCTP_PROTOCOL)             += sctp.o
OBJS-$(CONFIG_SRTP_PROTOCOL)             += srtpproto.o srtp.o
OBJS-$(CONFIG_TCP_PROTOCOL)              += tcp.o
-OBJS-$(CONFIG_TLS_PROTOCOL)              += tls.o
+OBJS-$(CONFIG_TLS_GNUTLS_PROTOCOL)       += tls_gnutls.o tls.o
+OBJS-$(CONFIG_TLS_OPENSSL_PROTOCOL)      += tls_openssl.o tls.o
OBJS-$(CONFIG_UDP_PROTOCOL)              += udp.o
OBJS-$(CONFIG_UNIX_PROTOCOL)             += unix.o

diff --git a/libavformat/allformats.c b/libavformat/allformats.c
index f4be81a..ff296cb 100644
--- a/libavformat/allformats.c
+++ b/libavformat/allformats.c
@@ -291,7 +291,8 @@ void av_register_all(void)
    REGISTER_PROTOCOL(SCTP,             sctp);
    REGISTER_PROTOCOL(SRTP,             srtp);
    REGISTER_PROTOCOL(TCP,              tcp);
-    REGISTER_PROTOCOL(TLS,              tls);
+    REGISTER_PROTOCOL(TLS_GNUTLS,       tls_gnutls);
+    REGISTER_PROTOCOL(TLS_OPENSSL,      tls_openssl);
    REGISTER_PROTOCOL(UDP,              udp);
    REGISTER_PROTOCOL(UNIX,             unix);

diff --git a/libavformat/rtspdec.c b/libavformat/rtspdec.c
index 4b4ae9c..6c92c69 100644
--- a/libavformat/rtspdec.c
+++ b/libavformat/rtspdec.c
@@ -32,6 +32,7 @@
#include "rtpproto.h"
#include "rtsp.h"
#include "rdt.h"
+#include "tls.h"
#include "url.h"

Note to readers: This is required to provide the CONFIG_TLS_PROTOCOL define that shows whether any of the implementations is available.

diff --git a/libavformat/tls.h b/libavformat/tls.h
new file mode 100644
index 0000000..602ffd0
--- /dev/null
+++ b/libavformat/tls.h
@@ -0,0 +1,54 @@
+/*
+ * TLS/SSL Protocol
+ * Copyright (c) 2011 Martin Storsjo
+ *
+ * This file is part of Libav.
+ *
+ * Libav is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public
+ * License as published by the Free Software Foundation; either
+ * version 2.1 of the License, or (at your option) any later version.
+ *
+ * Libav is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with Libav; if not, write to the Free Software
+ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
+ */
+
+#ifndef AVFORMAT_TLS_COMMON_H
+#define AVFORMAT_TLS_COMMON_H

This doesn't match the filename - fixed locally.

The rest of this looks good to me - I'll push tomorrow or something unless there are objections.

// Martin
_______________________________________________
libav-devel mailing list
[email protected]
https://lists.libav.org/mailman/listinfo/libav-devel

Reply via email to