diff --git a/ext/dtls/gstdtlsdec.c b/ext/dtls/gstdtlsdec.c index 7b370e26bd..f96dd753e9 100644 --- a/ext/dtls/gstdtlsdec.c +++ b/ext/dtls/gstdtlsdec.c @@ -27,6 +27,7 @@ #include "config.h" #endif +#include "gstdtlselements.h" #include "gstdtlsdec.h" #include "gstdtlscertificate.h" @@ -48,6 +49,8 @@ GST_DEBUG_CATEGORY_STATIC (gst_dtls_dec_debug); #define gst_dtls_dec_parent_class parent_class G_DEFINE_TYPE_WITH_CODE (GstDtlsDec, gst_dtls_dec, GST_TYPE_ELEMENT, GST_DEBUG_CATEGORY_INIT (gst_dtls_dec_debug, "dtlsdec", 0, "DTLS Decoder")); +GST_ELEMENT_REGISTER_DEFINE_WITH_CODE (dtlsdec, "dtlsdec", GST_RANK_NONE, + GST_TYPE_DTLS_DEC, dtls_element_init (plugin)); enum { diff --git a/ext/dtls/gstdtlselement.c b/ext/dtls/gstdtlselement.c new file mode 100644 index 0000000000..6945339f92 --- /dev/null +++ b/ext/dtls/gstdtlselement.c @@ -0,0 +1,44 @@ +/* + * Copyright (c) 2014, Ericsson AB. All rights reserved. + * + * Redistribution and use in source and binary forms, with or without modification, + * are permitted provided that the following conditions are met: + * + * 1. Redistributions of source code must retain the above copyright notice, this + * list of conditions and the following disclaimer. + * + * 2. Redistributions in binary form must reproduce the above copyright notice, this + * list of conditions and the following disclaimer in the documentation and/or other + * materials provided with the distribution. + * + * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND + * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED + * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. + * IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, + * INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT + * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR + * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, + * WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) + * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY + * OF SUCH DAMAGE. + */ + +#ifdef HAVE_CONFIG_H +#include "config.h" +#endif + +#include "gstdtlselements.h" +#include "gstdtlsconnection.h" + + +#include + +void +dtls_element_init (GstPlugin * plugin) +{ + static gsize res = FALSE; + if (g_once_init_enter (&res)) { + gst_type_mark_as_plugin_api (GST_DTLS_TYPE_CONNECTION_STATE, 0); + g_once_init_leave (&res, TRUE); + } +} diff --git a/ext/dtls/gstdtlselements.h b/ext/dtls/gstdtlselements.h new file mode 100644 index 0000000000..50d03284d6 --- /dev/null +++ b/ext/dtls/gstdtlselements.h @@ -0,0 +1,38 @@ +/* GStreamer + * Copyright (C) <2020> The Gstreamer Contributors. + * + * This library is free software; you can redistribute it and/or + * modify it under the terms of the GNU Library General Public + * License as published by the Free Software Foundation; either + * version 2 of the License, or (at your option) any later version. + * + * This library 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 + * Library General Public License for more details. + * + * You should have received a copy of the GNU Library General Public + * License along with this library; if not, write to the + * Free Software Foundation, Inc., 51 Franklin St, Fifth Floor, + * Boston, MA 02110-1301, USA. + */ + + +#ifndef __GST_DTLS_ELEMENTS_H__ +#define __GST_DTLS_ELEMENTS_H__ + +#ifdef HAVE_CONFIG_H +#include +#endif + +#include + +void dtls_element_init (GstPlugin * plugin); + +GST_ELEMENT_REGISTER_DECLARE (dtlsdec); +GST_ELEMENT_REGISTER_DECLARE (dtlsenc); +GST_ELEMENT_REGISTER_DECLARE (dtlssrtpdec); +GST_ELEMENT_REGISTER_DECLARE (dtlssrtpdemux); +GST_ELEMENT_REGISTER_DECLARE (dtlssrtpenc); + +#endif /* __GST_DTLS_ELEMENT_H__ */ diff --git a/ext/dtls/gstdtlsenc.c b/ext/dtls/gstdtlsenc.c index e64ee4d6c4..09015f1b74 100644 --- a/ext/dtls/gstdtlsenc.c +++ b/ext/dtls/gstdtlsenc.c @@ -27,6 +27,7 @@ #include "config.h" #endif +#include "gstdtlselements.h" #include "gstdtlsenc.h" #include "gstdtlsdec.h" @@ -48,6 +49,8 @@ GST_DEBUG_CATEGORY_STATIC (gst_dtls_enc_debug); #define gst_dtls_enc_parent_class parent_class G_DEFINE_TYPE_WITH_CODE (GstDtlsEnc, gst_dtls_enc, GST_TYPE_ELEMENT, GST_DEBUG_CATEGORY_INIT (gst_dtls_enc_debug, "dtlsenc", 0, "DTLS Encoder")); +GST_ELEMENT_REGISTER_DEFINE_WITH_CODE (dtlsenc, "dtlsenc", GST_RANK_NONE, + GST_TYPE_DTLS_ENC, dtls_element_init (plugin)); enum { diff --git a/ext/dtls/gstdtlssrtpdec.c b/ext/dtls/gstdtlssrtpdec.c index 8db69ba088..37121cd2bc 100644 --- a/ext/dtls/gstdtlssrtpdec.c +++ b/ext/dtls/gstdtlssrtpdec.c @@ -27,6 +27,7 @@ #include "config.h" #endif +#include "gstdtlselements.h" #include "gstdtlssrtpdec.h" #include "gstdtlsconnection.h" @@ -62,6 +63,8 @@ GST_DEBUG_CATEGORY_STATIC (gst_dtls_srtp_dec_debug); G_DEFINE_TYPE_WITH_CODE (GstDtlsSrtpDec, gst_dtls_srtp_dec, GST_TYPE_DTLS_SRTP_BIN, GST_DEBUG_CATEGORY_INIT (gst_dtls_srtp_dec_debug, "dtlssrtpdec", 0, "DTLS Decoder")); +GST_ELEMENT_REGISTER_DEFINE_WITH_CODE (dtlssrtpdec, "dtlssrtpdec", + GST_RANK_NONE, GST_TYPE_DTLS_SRTP_DEC, dtls_element_init (plugin)); enum { diff --git a/ext/dtls/gstdtlssrtpdemux.c b/ext/dtls/gstdtlssrtpdemux.c index ab1ef70826..ca7985be14 100644 --- a/ext/dtls/gstdtlssrtpdemux.c +++ b/ext/dtls/gstdtlssrtpdemux.c @@ -27,6 +27,7 @@ #include "config.h" #endif +#include "gstdtlselements.h" #include "gstdtlssrtpdemux.h" #define PACKET_IS_DTLS(b) (b > 0x13 && b < 0x40) @@ -59,6 +60,9 @@ GST_DEBUG_CATEGORY_STATIC (gst_gst_dtls_srtp_demux_debug); G_DEFINE_TYPE_WITH_CODE (GstDtlsSrtpDemux, gst_dtls_srtp_demux, GST_TYPE_ELEMENT, GST_DEBUG_CATEGORY_INIT (gst_gst_dtls_srtp_demux_debug, "dtlssrtpdemux", 0, "DTLS SRTP Demultiplexer")); +GST_ELEMENT_REGISTER_DEFINE_WITH_CODE (dtlssrtpdemux, "dtlssrtpdemux", + GST_RANK_NONE, GST_TYPE_DTLS_SRTP_DEMUX, dtls_element_init (plugin)); + static GstFlowReturn sink_chain (GstPad *, GstObject * self, GstBuffer *); diff --git a/ext/dtls/gstdtlssrtpenc.c b/ext/dtls/gstdtlssrtpenc.c index 11f5198cb8..603d374546 100644 --- a/ext/dtls/gstdtlssrtpenc.c +++ b/ext/dtls/gstdtlssrtpenc.c @@ -27,6 +27,7 @@ #include "config.h" #endif +#include "gstdtlselements.h" #include "gstdtlssrtpenc.h" #include "gstdtlsconnection.h" @@ -64,6 +65,8 @@ GST_DEBUG_CATEGORY_STATIC (gst_dtls_srtp_enc_debug); G_DEFINE_TYPE_WITH_CODE (GstDtlsSrtpEnc, gst_dtls_srtp_enc, GST_TYPE_DTLS_SRTP_BIN, GST_DEBUG_CATEGORY_INIT (gst_dtls_srtp_enc_debug, "dtlssrtpenc", 0, "DTLS Decoder")); +GST_ELEMENT_REGISTER_DEFINE_WITH_CODE (dtlssrtpenc, "dtlssrtpenc", + GST_RANK_NONE, GST_TYPE_DTLS_SRTP_ENC, dtls_element_init (plugin)); enum { diff --git a/ext/dtls/meson.build b/ext/dtls/meson.build index 74babae17d..99c2ffe133 100644 --- a/ext/dtls/meson.build +++ b/ext/dtls/meson.build @@ -9,6 +9,7 @@ dtls_sources = [ 'gstdtlssrtpdemux.c', 'gstdtlssrtpenc.c', 'plugin.c', + 'gstdtlselement.c', ] openssl_dep = dependency('openssl', version : '>= 1.0.1', required : get_option('dtls'))