rtsp: 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-good/-/merge_requests/876>
This commit is contained in:
Stéphane Cerveau 2021-02-16 14:35:51 +01:00
parent d16e991bf4
commit cd8c3a2e53
6 changed files with 90 additions and 18 deletions

View file

@ -56,6 +56,7 @@
#include <gst/rtp/gstrtcpbuffer.h>
#endif
#include "gstrtspelements.h"
#include "gstrtpdec.h"
#include <stdio.h>
@ -196,6 +197,8 @@ static guint gst_rtp_dec_signals[LAST_SIGNAL] = { 0 };
#define gst_rtp_dec_parent_class parent_class
G_DEFINE_TYPE (GstRTPDec, gst_rtp_dec, GST_TYPE_ELEMENT);
GST_ELEMENT_REGISTER_DEFINE_WITH_CODE (rtpdec, "rtpdec", GST_RANK_NONE,
GST_TYPE_RTP_DEC, rtsp_element_init (plugin));
static void
gst_rtp_dec_class_init (GstRTPDecClass * g_class)

View file

@ -45,26 +45,17 @@
#include "config.h"
#endif
#include "gst/gst-i18n-plugin.h"
#include "gstrtpdec.h"
#include "gstrtspsrc.h"
#include "gstrtspelements.h"
static gboolean
plugin_init (GstPlugin * plugin)
{
#ifdef ENABLE_NLS
bindtextdomain (GETTEXT_PACKAGE, LOCALEDIR);
bind_textdomain_codeset (GETTEXT_PACKAGE, "UTF-8");
#endif /* ENABLE_NLS */
gboolean ret = FALSE;
if (!gst_element_register (plugin, "rtspsrc", GST_RANK_NONE,
GST_TYPE_RTSPSRC))
return FALSE;
if (!gst_element_register (plugin, "rtpdec", GST_RANK_NONE, GST_TYPE_RTP_DEC))
return FALSE;
ret |= GST_ELEMENT_REGISTER (rtspsrc, plugin);
ret |= GST_ELEMENT_REGISTER (rtpdec, plugin);
return TRUE;
return ret;
}
GST_PLUGIN_DEFINE (GST_VERSION_MAJOR,

65
gst/rtsp/gstrtspelement.c Normal file
View file

@ -0,0 +1,65 @@
/* GStreamer
* Copyright (C) <1999> Erik Walthinsen <omega@cse.ogi.edu>
* <2006> Wim Taymans <wim@fluendo.com>
* Copyright (C) 2020 Huawei Technologies Co., Ltd.
* @Author: Stéphane Cerveau <stephane.cerveau@collabora.com>
*
* 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.
*/
/*
* Unless otherwise indicated, Source Code is licensed under MIT license.
* See further explanation attached in License Statement (distributed in the file
* LICENSE).
*
* Permission is hereby granted, free of charge, to any person obtaining a copy of
* this software and associated documentation files (the "Software"), to deal in
* the Software without restriction, including without limitation the rights to
* use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies
* of the Software, and to permit persons to whom the Software is furnished to do
* so, subject to the following conditions:
*
* The above copyright notice and this permission notice shall be included in all
* copies or substantial portions of the Software.
*
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
* AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
* OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
* SOFTWARE.
*/
#ifdef HAVE_CONFIG_H
#include "config.h"
#endif
#include "gst/gst-i18n-plugin.h"
#include "gstrtspelements.h"
void
rtsp_element_init (GstPlugin * plugin)
{
static gsize res = FALSE;
if (g_once_init_enter (&res)) {
#ifdef ENABLE_NLS
bindtextdomain (GETTEXT_PACKAGE, LOCALEDIR);
bind_textdomain_codeset (GETTEXT_PACKAGE, "UTF-8");
#endif /* ENABLE_NLS */
g_once_init_leave (&res, TRUE);
}
}

View file

@ -41,13 +41,22 @@
* SOFTWARE.
*/
#ifndef __GST_RTSP_H__
#define __GST_RTSP_H__
#ifndef __GST_RTSP_ELEMENTS_H__
#define __GST_RTSP_ELEMENTS_H__
#ifdef HAVE_CONFIG_H
#include "config.h"
#endif
#include <gst/gst.h>
G_BEGIN_DECLS
void rtsp_element_init (GstPlugin * plugin);
GST_ELEMENT_REGISTER_DECLARE (rtspsrc);
GST_ELEMENT_REGISTER_DECLARE (rtpdec);
G_END_DECLS
#endif /* __GST_RTSP_H__ */
#endif /* __GST_RTSP_ELEMENTS_H__ */

View file

@ -114,6 +114,7 @@
#include "gst/gst-i18n-plugin.h"
#include "gstrtspelements.h"
#include "gstrtspsrc.h"
GST_DEBUG_CATEGORY_STATIC (rtspsrc_debug);
@ -479,6 +480,8 @@ static guint gst_rtspsrc_signals[LAST_SIGNAL] = { 0 };
#define gst_rtspsrc_parent_class parent_class
G_DEFINE_TYPE_WITH_CODE (GstRTSPSrc, gst_rtspsrc, GST_TYPE_BIN,
G_IMPLEMENT_INTERFACE (GST_TYPE_URI_HANDLER, gst_rtspsrc_uri_handler_init));
GST_ELEMENT_REGISTER_DEFINE_WITH_CODE (rtspsrc, "rtspsrc", GST_RANK_NONE,
GST_TYPE_RTSPSRC, rtsp_element_init (plugin));
#ifndef GST_DISABLE_GST_DEBUG
static inline const char *

View file

@ -1,4 +1,5 @@
rtsp_sources = [
'gstrtspelement.c',
'gstrtsp.c',
'gstrtspsrc.c',
'gstrtpdec.c',