mirror of
https://gitlab.freedesktop.org/gstreamer/gstreamer.git
synced 2025-02-11 16:55:23 +00:00
udp: 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:
parent
0ea8c2e3a1
commit
72c7ae54dd
8 changed files with 108 additions and 24 deletions
|
@ -24,6 +24,7 @@
|
|||
#ifdef HAVE_CONFIG_H
|
||||
#include "config.h"
|
||||
#endif
|
||||
#include "gstudpelements.h"
|
||||
#include "gstdynudpsink.h"
|
||||
|
||||
#include <gst/net/gstnetaddressmeta.h>
|
||||
|
@ -83,6 +84,8 @@ static guint gst_dynudpsink_signals[LAST_SIGNAL] = { 0 };
|
|||
|
||||
#define gst_dynudpsink_parent_class parent_class
|
||||
G_DEFINE_TYPE (GstDynUDPSink, gst_dynudpsink, GST_TYPE_BASE_SINK);
|
||||
GST_ELEMENT_REGISTER_DEFINE_WITH_CODE (dynudpsink, "dynudpsink", GST_RANK_NONE,
|
||||
GST_TYPE_DYNUDPSINK, udp_element_init (plugin));
|
||||
|
||||
static void
|
||||
gst_dynudpsink_class_init (GstDynUDPSinkClass * klass)
|
||||
|
|
|
@ -33,6 +33,7 @@
|
|||
#ifdef HAVE_CONFIG_H
|
||||
#include "config.h"
|
||||
#endif
|
||||
#include "gstudpelements.h"
|
||||
#include "gstmultiudpsink.h"
|
||||
|
||||
#include <string.h>
|
||||
|
@ -140,6 +141,8 @@ static guint gst_multiudpsink_signals[LAST_SIGNAL] = { 0 };
|
|||
|
||||
#define gst_multiudpsink_parent_class parent_class
|
||||
G_DEFINE_TYPE (GstMultiUDPSink, gst_multiudpsink, GST_TYPE_BASE_SINK);
|
||||
GST_ELEMENT_REGISTER_DEFINE_WITH_CODE (multiudpsink, "multiudpsink",
|
||||
GST_RANK_NONE, GST_TYPE_MULTIUDPSINK, udp_element_init (plugin));
|
||||
|
||||
static void
|
||||
gst_multiudpsink_class_init (GstMultiUDPSinkClass * klass)
|
||||
|
|
|
@ -21,37 +21,20 @@
|
|||
#include "config.h"
|
||||
#endif
|
||||
|
||||
#include <gst/net/gstnetaddressmeta.h>
|
||||
#include "gstudpelements.h"
|
||||
|
||||
#include "gstudpsrc.h"
|
||||
#include "gstmultiudpsink.h"
|
||||
#include "gstudpsink.h"
|
||||
#include "gstdynudpsink.h"
|
||||
|
||||
static gboolean
|
||||
plugin_init (GstPlugin * plugin)
|
||||
{
|
||||
/* register info of the netaddress metadata so that we can use it from
|
||||
* multiple threads right away. Note that the plugin loading is always
|
||||
* serialized */
|
||||
gst_net_address_meta_get_info ();
|
||||
gboolean ret = FALSE;
|
||||
|
||||
if (!gst_element_register (plugin, "udpsink", GST_RANK_NONE,
|
||||
GST_TYPE_UDPSINK))
|
||||
return FALSE;
|
||||
ret |= GST_ELEMENT_REGISTER (udpsink, plugin);
|
||||
ret |= GST_ELEMENT_REGISTER (multiudpsink, plugin);
|
||||
ret |= GST_ELEMENT_REGISTER (dynudpsink, plugin);
|
||||
ret |= GST_ELEMENT_REGISTER (udpsrc, plugin);
|
||||
|
||||
if (!gst_element_register (plugin, "multiudpsink", GST_RANK_NONE,
|
||||
GST_TYPE_MULTIUDPSINK))
|
||||
return FALSE;
|
||||
|
||||
if (!gst_element_register (plugin, "dynudpsink", GST_RANK_NONE,
|
||||
GST_TYPE_DYNUDPSINK))
|
||||
return FALSE;
|
||||
|
||||
if (!gst_element_register (plugin, "udpsrc", GST_RANK_NONE, GST_TYPE_UDPSRC))
|
||||
return FALSE;
|
||||
|
||||
return TRUE;
|
||||
return ret;
|
||||
}
|
||||
|
||||
GST_PLUGIN_DEFINE (GST_VERSION_MAJOR,
|
||||
|
|
47
gst/udp/gstudpelement.c
Normal file
47
gst/udp/gstudpelement.c
Normal file
|
@ -0,0 +1,47 @@
|
|||
/* GStreamer
|
||||
* Copyright (C) <1999> Erik Walthinsen <omega@cse.ogi.edu>
|
||||
* Copyright (C) 2020 Huawei Technologies Co., Ltd.
|
||||
* @Author: Julian Bouzas <julian.bouzas@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.
|
||||
*/
|
||||
|
||||
#ifdef HAVE_CONFIG_H
|
||||
#include "config.h"
|
||||
#endif
|
||||
|
||||
#include <gst/net/gstnetaddressmeta.h>
|
||||
|
||||
#include "gstudpelements.h"
|
||||
|
||||
void
|
||||
udp_element_init (GstPlugin * plugin)
|
||||
{
|
||||
static gsize res = FALSE;
|
||||
if (g_once_init_enter (&res)) {
|
||||
/* not using GLIB_CHECK_VERSION on purpose, run-time version matters */
|
||||
if (glib_check_version (2, 36, 0) != NULL) {
|
||||
GST_WARNING ("Your GLib version is < 2.36, UDP multicasting support may "
|
||||
"be broken, see https://bugzilla.gnome.org/show_bug.cgi?id=688378");
|
||||
}
|
||||
|
||||
/* register info of the netaddress metadata so that we can use it from
|
||||
* multiple threads right away. Note that the plugin loading is always
|
||||
* serialized */
|
||||
gst_net_address_meta_get_info ();
|
||||
g_once_init_leave (&res, TRUE);
|
||||
}
|
||||
}
|
41
gst/udp/gstudpelements.h
Normal file
41
gst/udp/gstudpelements.h
Normal file
|
@ -0,0 +1,41 @@
|
|||
/*
|
||||
* Copyright (C) <1999> Erik Walthinsen <omega@cse.ogi.edu>
|
||||
* Copyright (C) 2020 Huawei Technologies Co., Ltd.
|
||||
* @Author: Julian Bouzas <julian.bouzas@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.
|
||||
*/
|
||||
|
||||
#ifndef __GST_UDP_ELEMENTS_H__
|
||||
#define __GST_UDP_ELEMENTS_H__
|
||||
|
||||
#ifdef HAVE_CONFIG_H
|
||||
#include "config.h"
|
||||
#endif
|
||||
|
||||
#include <gst/gst.h>
|
||||
|
||||
G_BEGIN_DECLS
|
||||
|
||||
void udp_element_init (GstPlugin * plugin);
|
||||
|
||||
GST_ELEMENT_REGISTER_DECLARE (dynudpsink);
|
||||
GST_ELEMENT_REGISTER_DECLARE (multiudpsink);
|
||||
GST_ELEMENT_REGISTER_DECLARE (udpsink);
|
||||
GST_ELEMENT_REGISTER_DECLARE (udpsrc);
|
||||
|
||||
G_END_DECLS
|
||||
|
||||
#endif /* __GST_UDP_ELEMENTS_H__ */
|
|
@ -35,6 +35,7 @@
|
|||
#ifdef HAVE_CONFIG_H
|
||||
#include "config.h"
|
||||
#endif
|
||||
#include "gstudpelements.h"
|
||||
#include "gstudpsink.h"
|
||||
|
||||
#define UDP_DEFAULT_HOST "localhost"
|
||||
|
@ -70,6 +71,8 @@ static void gst_udpsink_get_property (GObject * object, guint prop_id,
|
|||
#define gst_udpsink_parent_class parent_class
|
||||
G_DEFINE_TYPE_WITH_CODE (GstUDPSink, gst_udpsink, GST_TYPE_MULTIUDPSINK,
|
||||
G_IMPLEMENT_INTERFACE (GST_TYPE_URI_HANDLER, gst_udpsink_uri_handler_init));
|
||||
GST_ELEMENT_REGISTER_DEFINE_WITH_CODE (udpsink, "udpsink", GST_RANK_NONE,
|
||||
GST_TYPE_UDPSINK, udp_element_init (plugin));
|
||||
|
||||
static void
|
||||
gst_udpsink_class_init (GstUDPSinkClass * klass)
|
||||
|
|
|
@ -114,6 +114,7 @@
|
|||
#endif
|
||||
|
||||
#include <string.h>
|
||||
#include "gstudpelements.h"
|
||||
#include "gstudpsrc.h"
|
||||
|
||||
#include <gst/net/gstnetaddressmeta.h>
|
||||
|
@ -615,6 +616,8 @@ static GstStateChangeReturn gst_udpsrc_change_state (GstElement * element,
|
|||
#define gst_udpsrc_parent_class parent_class
|
||||
G_DEFINE_TYPE_WITH_CODE (GstUDPSrc, gst_udpsrc, GST_TYPE_PUSH_SRC,
|
||||
G_IMPLEMENT_INTERFACE (GST_TYPE_URI_HANDLER, gst_udpsrc_uri_handler_init));
|
||||
GST_ELEMENT_REGISTER_DEFINE_WITH_CODE (udpsrc, "udpsrc", GST_RANK_NONE,
|
||||
GST_TYPE_UDPSRC, udp_element_init (plugin));
|
||||
|
||||
static void
|
||||
gst_udpsrc_class_init (GstUDPSrcClass * klass)
|
||||
|
|
|
@ -1,5 +1,6 @@
|
|||
udp_sources = [
|
||||
'gstudp.c',
|
||||
'gstudpelement.c',
|
||||
'gstudpsrc.c',
|
||||
'gstudpsink.c',
|
||||
'gstmultiudpsink.c',
|
||||
|
|
Loading…
Reference in a new issue