#include <sys/stat.h>
#include <netinet/in.h>
+#include "gsttcpelements.h"
#include "gstmultifdsink.h"
#define NOT_IMPLEMENTED 0
#define gst_multi_fd_sink_parent_class parent_class
G_DEFINE_TYPE (GstMultiFdSink, gst_multi_fd_sink, GST_TYPE_MULTI_HANDLE_SINK);
+GST_ELEMENT_REGISTER_DEFINE_WITH_CODE (multifdsink, "multifdsink",
+ GST_RANK_NONE, GST_TYPE_MULTI_FD_SINK, tcp_element_init (plugin));
static guint gst_multi_fd_sink_signals[LAST_SIGNAL] = { 0 };
#include <string.h>
#include "gstmultisocketsink.h"
+#include "gsttcpelements.h"
#ifndef G_OS_WIN32
#include <netinet/in.h>
#define gst_multi_socket_sink_parent_class parent_class
G_DEFINE_TYPE (GstMultiSocketSink, gst_multi_socket_sink,
GST_TYPE_MULTI_HANDLE_SINK);
+GST_ELEMENT_REGISTER_DEFINE_WITH_CODE (multisocketsink, "multisocketsink",
+ GST_RANK_NONE, GST_TYPE_MULTI_SOCKET_SINK, tcp_element_init (plugin));
static guint gst_multi_socket_sink_signals[LAST_SIGNAL] = { 0 };
#include <gst/gst-i18n-plugin.h>
#include <gst/net/gstnetcontrolmessagemeta.h>
+#include "gsttcpelements.h"
#include "gstsocketsrc.h"
#include "gsttcp.h"
#define gst_socket_src_parent_class parent_class
G_DEFINE_TYPE (GstSocketSrc, gst_socket_src, GST_TYPE_PUSH_SRC);
-
+GST_ELEMENT_REGISTER_DEFINE_WITH_CODE (socketsrc, "socketsrc",
+ GST_RANK_NONE, GST_TYPE_SOCKET_SRC, tcp_element_init (plugin));
static void gst_socket_src_finalize (GObject * gobject);
#include <gst/gst-i18n-plugin.h>
#include "gsttcp.h"
+#include "gsttcpelements.h"
#include "gsttcpclientsink.h"
/* TCPClientSink signals and args */
#define gst_tcp_client_sink_parent_class parent_class
G_DEFINE_TYPE (GstTCPClientSink, gst_tcp_client_sink, GST_TYPE_BASE_SINK);
+GST_ELEMENT_REGISTER_DEFINE_WITH_CODE (tcpclientsink, "tcpclientsink",
+ GST_RANK_NONE, GST_TYPE_TCP_CLIENT_SINK, tcp_element_init (plugin));
static void
gst_tcp_client_sink_class_init (GstTCPClientSinkClass * klass)
#endif
#include <gst/gst-i18n-plugin.h>
+#include "gsttcpelements.h"
#include "gsttcpclientsrc.h"
#include "gsttcpsrcstats.h"
#include "gsttcp.h"
#define gst_tcp_client_src_parent_class parent_class
G_DEFINE_TYPE (GstTCPClientSrc, gst_tcp_client_src, GST_TYPE_PUSH_SRC);
-
+GST_ELEMENT_REGISTER_DEFINE_WITH_CODE (tcpclientsrc, "tcpclientsrc",
+ GST_RANK_NONE, GST_TYPE_TCP_CLIENT_SRC, tcp_element_init (plugin));
static void gst_tcp_client_src_finalize (GObject * gobject);
--- /dev/null
+/* GStreamer
+ * Copyright (C) <1999> Erik Walthinsen <omega@cse.ogi.edu>
+ * Copyright (C) 2020 Huawei Technologies Co., Ltd.
+ * @Author: Stéphane Cerveau <scerveau@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 "gsttcpelements.h"
+
+GST_DEBUG_CATEGORY (tcp_debug);
+
+void
+tcp_element_init (GstPlugin * plugin)
+{
+ static gsize res = FALSE;
+ if (g_once_init_enter (&res)) {
+ GST_DEBUG_CATEGORY_INIT (tcp_debug, "tcp", 0, "TCP calls");
+ g_once_init_leave (&res, TRUE);
+ }
+}
--- /dev/null
+/*
+ * 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_TCP_ELEMENTS_H__
+#define __GST_TCP_ELEMENTS_H__
+
+#include <gst/gst.h>
+
+G_BEGIN_DECLS
+
+G_GNUC_INTERNAL void tcp_element_init (GstPlugin * plugin);
+
+GST_ELEMENT_REGISTER_DECLARE (socketsrc);
+GST_ELEMENT_REGISTER_DECLARE (tcpclientsink);
+GST_ELEMENT_REGISTER_DECLARE (tcpclientsrc);
+GST_ELEMENT_REGISTER_DECLARE (tcpserversink);
+GST_ELEMENT_REGISTER_DECLARE (tcpserversrc);
+GST_ELEMENT_REGISTER_DECLARE (multifdsink);
+GST_ELEMENT_REGISTER_DECLARE (multisocketsink);
+
+G_END_DECLS
+
+#endif /* __GST_TCP_ELEMENTS_H__ */
#include "config.h"
#endif
-#include "gstsocketsrc.h"
-#include "gsttcpclientsrc.h"
-#include "gsttcpclientsink.h"
-#include "gsttcpserversrc.h"
-#include "gsttcpserversink.h"
-#include "gstmultifdsink.h"
-#include "gstmultisocketsink.h"
-
-GST_DEBUG_CATEGORY (tcp_debug);
+#include "gsttcpelements.h"
static gboolean
plugin_init (GstPlugin * plugin)
{
- if (!gst_element_register (plugin, "socketsrc", GST_RANK_NONE,
- GST_TYPE_SOCKET_SRC))
- return FALSE;
- if (!gst_element_register (plugin, "tcpclientsink", GST_RANK_NONE,
- GST_TYPE_TCP_CLIENT_SINK))
- return FALSE;
- if (!gst_element_register (plugin, "tcpclientsrc", GST_RANK_NONE,
- GST_TYPE_TCP_CLIENT_SRC))
- return FALSE;
- if (!gst_element_register (plugin, "tcpserversink", GST_RANK_NONE,
- GST_TYPE_TCP_SERVER_SINK))
- return FALSE;
- if (!gst_element_register (plugin, "tcpserversrc", GST_RANK_NONE,
- GST_TYPE_TCP_SERVER_SRC))
- return FALSE;
+ gboolean ret = FALSE;
+
+ ret |= GST_ELEMENT_REGISTER (socketsrc, plugin);
+ ret |= GST_ELEMENT_REGISTER (tcpclientsink, plugin);
+ ret |= GST_ELEMENT_REGISTER (tcpclientsrc, plugin);
+ ret |= GST_ELEMENT_REGISTER (tcpserversink, plugin);
+ ret |= GST_ELEMENT_REGISTER (tcpserversrc, plugin);
+
#ifdef HAVE_SYS_SOCKET_H
- if (!gst_element_register (plugin, "multifdsink", GST_RANK_NONE,
- GST_TYPE_MULTI_FD_SINK))
- return FALSE;
-#endif
- if (!gst_element_register (plugin, "multisocketsink", GST_RANK_NONE,
- GST_TYPE_MULTI_SOCKET_SINK))
- return FALSE;
+ ret |= GST_ELEMENT_REGISTER (multifdsink, plugin);
- GST_DEBUG_CATEGORY_INIT (tcp_debug, "tcp", 0, "TCP calls");
+#endif
+ ret |= GST_ELEMENT_REGISTER (multisocketsink, plugin);
- return TRUE;
+ return ret;
}
GST_PLUGIN_DEFINE (GST_VERSION_MAJOR,
#include <string.h> /* memset */
#include "gsttcp.h"
+#include "gsttcpelements.h"
#include "gsttcpserversink.h"
#define TCP_BACKLOG 5
#define gst_tcp_server_sink_parent_class parent_class
G_DEFINE_TYPE (GstTCPServerSink, gst_tcp_server_sink,
GST_TYPE_MULTI_SOCKET_SINK);
+GST_ELEMENT_REGISTER_DEFINE_WITH_CODE (tcpserversink, "tcpserversink",
+ GST_RANK_NONE, GST_TYPE_TCP_SERVER_SINK, tcp_element_init (plugin));
static void
gst_tcp_server_sink_class_init (GstTCPServerSinkClass * klass)
#include <gst/gst-i18n-plugin.h>
#include "gsttcp.h"
+#include "gsttcpelements.h"
#include "gsttcpsrcstats.h"
#include "gsttcpserversrc.h"
#define gst_tcp_server_src_parent_class parent_class
G_DEFINE_TYPE (GstTCPServerSrc, gst_tcp_server_src, GST_TYPE_PUSH_SRC);
+GST_ELEMENT_REGISTER_DEFINE_WITH_CODE (tcpserversrc, "tcpserversrc",
+ GST_RANK_NONE, GST_TYPE_TCP_SERVER_SRC, tcp_element_init (plugin));
static void gst_tcp_server_src_finalize (GObject * gobject);
'gstsocketsrc.c',
'gsttcpclientsrc.c',
'gsttcpclientsink.c',
+ 'gsttcpelement.c',
'gsttcpserversrc.c',
'gsttcpserversink.c',
'gsttcpsrcstats.c',