mirror of
https://gitlab.freedesktop.org/gstreamer/gstreamer.git
synced 2025-03-27 11:32:51 +00:00
tcp: 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-base/-/merge_requests/1029>
This commit is contained in:
parent
3d3831656d
commit
520a682c7c
11 changed files with 112 additions and 35 deletions
|
@ -119,6 +119,7 @@
|
|||
#include <sys/stat.h>
|
||||
#include <netinet/in.h>
|
||||
|
||||
#include "gsttcpelements.h"
|
||||
#include "gstmultifdsink.h"
|
||||
|
||||
#define NOT_IMPLEMENTED 0
|
||||
|
@ -194,6 +195,8 @@ static void gst_multi_fd_sink_get_property (GObject * object, guint prop_id,
|
|||
|
||||
#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 };
|
||||
|
||||
|
|
|
@ -109,6 +109,7 @@
|
|||
#include <string.h>
|
||||
|
||||
#include "gstmultisocketsink.h"
|
||||
#include "gsttcpelements.h"
|
||||
|
||||
#ifndef G_OS_WIN32
|
||||
#include <netinet/in.h>
|
||||
|
@ -206,6 +207,8 @@ static void gst_multi_socket_sink_get_property (GObject * object, guint prop_id,
|
|||
#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 };
|
||||
|
||||
|
|
|
@ -51,6 +51,7 @@
|
|||
|
||||
#include <gst/gst-i18n-plugin.h>
|
||||
#include <gst/net/gstnetcontrolmessagemeta.h>
|
||||
#include "gsttcpelements.h"
|
||||
#include "gstsocketsrc.h"
|
||||
#include "gsttcp.h"
|
||||
|
||||
|
@ -86,7 +87,8 @@ static guint gst_socket_src_signals[LAST_SIGNAL] = { 0 };
|
|||
|
||||
#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);
|
||||
|
||||
|
|
|
@ -44,6 +44,7 @@
|
|||
#include <gst/gst-i18n-plugin.h>
|
||||
|
||||
#include "gsttcp.h"
|
||||
#include "gsttcpelements.h"
|
||||
#include "gsttcpclientsink.h"
|
||||
|
||||
/* TCPClientSink signals and args */
|
||||
|
@ -90,6 +91,8 @@ static void gst_tcp_client_sink_get_property (GObject * object, guint prop_id,
|
|||
|
||||
#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)
|
||||
|
|
|
@ -44,6 +44,7 @@
|
|||
#endif
|
||||
|
||||
#include <gst/gst-i18n-plugin.h>
|
||||
#include "gsttcpelements.h"
|
||||
#include "gsttcpclientsrc.h"
|
||||
#include "gsttcpsrcstats.h"
|
||||
#include "gsttcp.h"
|
||||
|
@ -72,7 +73,8 @@ enum
|
|||
|
||||
#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);
|
||||
|
||||
|
|
38
gst/tcp/gsttcpelement.c
Normal file
38
gst/tcp/gsttcpelement.c
Normal file
|
@ -0,0 +1,38 @@
|
|||
/* 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);
|
||||
}
|
||||
}
|
39
gst/tcp/gsttcpelements.h
Normal file
39
gst/tcp/gsttcpelements.h
Normal file
|
@ -0,0 +1,39 @@
|
|||
/*
|
||||
* 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__ */
|
|
@ -21,46 +21,26 @@
|
|||
#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;
|
||||
ret |= GST_ELEMENT_REGISTER (multifdsink, plugin);
|
||||
|
||||
#endif
|
||||
if (!gst_element_register (plugin, "multisocketsink", GST_RANK_NONE,
|
||||
GST_TYPE_MULTI_SOCKET_SINK))
|
||||
return FALSE;
|
||||
ret |= GST_ELEMENT_REGISTER (multisocketsink, plugin);
|
||||
|
||||
GST_DEBUG_CATEGORY_INIT (tcp_debug, "tcp", 0, "TCP calls");
|
||||
|
||||
return TRUE;
|
||||
return ret;
|
||||
}
|
||||
|
||||
GST_PLUGIN_DEFINE (GST_VERSION_MAJOR,
|
||||
|
|
|
@ -41,6 +41,7 @@
|
|||
#include <string.h> /* memset */
|
||||
|
||||
#include "gsttcp.h"
|
||||
#include "gsttcpelements.h"
|
||||
#include "gsttcpserversink.h"
|
||||
|
||||
#define TCP_BACKLOG 5
|
||||
|
@ -71,6 +72,8 @@ static void gst_tcp_server_sink_get_property (GObject * object, guint prop_id,
|
|||
#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)
|
||||
|
|
|
@ -42,6 +42,7 @@
|
|||
|
||||
#include <gst/gst-i18n-plugin.h>
|
||||
#include "gsttcp.h"
|
||||
#include "gsttcpelements.h"
|
||||
#include "gsttcpsrcstats.h"
|
||||
#include "gsttcpserversrc.h"
|
||||
|
||||
|
@ -69,6 +70,8 @@ enum
|
|||
|
||||
#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);
|
||||
|
||||
|
|
|
@ -4,6 +4,7 @@ tcp_sources = [
|
|||
'gstsocketsrc.c',
|
||||
'gsttcpclientsrc.c',
|
||||
'gsttcpclientsink.c',
|
||||
'gsttcpelement.c',
|
||||
'gsttcpserversrc.c',
|
||||
'gsttcpserversink.c',
|
||||
'gsttcpsrcstats.c',
|
||||
|
|
Loading…
Reference in a new issue