dtls: allow per feature registration

Split plugin into features including
dynamic types which can be indiviually
registered during a static build.

More details here:

https://gitlab.freedesktop.org/gstreamer/gst-build/-/merge_requests/199
https://gitlab.freedesktop.org/gstreamer/gstreamer/-/merge_requests/661

Part-of: <https://gitlab.freedesktop.org/gstreamer/gst-plugins-bad/-/merge_requests/2038>
This commit is contained in:
Stéphane Cerveau 2021-02-17 12:22:07 +01:00 committed by GStreamer Marge Bot
parent 8e1d1325fb
commit a216a1f2cf
8 changed files with 99 additions and 0 deletions

View file

@ -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
{

44
ext/dtls/gstdtlselement.c Normal file
View file

@ -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 <gst/gst.h>
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);
}
}

View file

@ -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 <config.h>
#endif
#include <gst/gst.h>
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__ */

View file

@ -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
{

View file

@ -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
{

View file

@ -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 *);

View file

@ -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
{

View file

@ -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'))