#ifdef HAVE_CONFIG_H
#include "config.h"
#endif
+#include "gstudpelements.h"
#include "gstdynudpsink.h"
#include <gst/net/gstnetaddressmeta.h>
#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)
#ifdef HAVE_CONFIG_H
#include "config.h"
#endif
+#include "gstudpelements.h"
#include "gstmultiudpsink.h"
#include <string.h>
#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)
#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,
--- /dev/null
+/* 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);
+ }
+}
--- /dev/null
+/*
+ * 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__ */
#ifdef HAVE_CONFIG_H
#include "config.h"
#endif
+#include "gstudpelements.h"
#include "gstudpsink.h"
#define UDP_DEFAULT_HOST "localhost"
#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)
#endif
#include <string.h>
+#include "gstudpelements.h"
#include "gstudpsrc.h"
#include <gst/net/gstnetaddressmeta.h>
#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)
udp_sources = [
'gstudp.c',
+ 'gstudpelement.c',
'gstudpsrc.c',
'gstudpsink.c',
'gstmultiudpsink.c',