mirror of
https://gitlab.freedesktop.org/gstreamer/gstreamer.git
synced 2024-12-18 22:36:33 +00:00
curl: 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-bad/-/merge_requests/2038>
This commit is contained in:
parent
279502cd8e
commit
7c1fc06919
10 changed files with 108 additions and 40 deletions
|
@ -20,55 +20,25 @@
|
|||
#include <config.h>
|
||||
#endif
|
||||
|
||||
#include <gst/gst-i18n-plugin.h>
|
||||
#include "gstcurlelements.h"
|
||||
|
||||
#include "gstcurlbasesink.h"
|
||||
#include "gstcurltlssink.h"
|
||||
#include "gstcurlhttpsink.h"
|
||||
#include "gstcurlfilesink.h"
|
||||
#include "gstcurlftpsink.h"
|
||||
#include "gstcurlsmtpsink.h"
|
||||
#ifdef HAVE_SSH2
|
||||
#include "gstcurlsftpsink.h"
|
||||
#endif
|
||||
#include "gstcurlhttpsrc.h"
|
||||
|
||||
static gboolean
|
||||
plugin_init (GstPlugin * plugin)
|
||||
{
|
||||
#ifdef ENABLE_NLS
|
||||
GST_DEBUG ("binding text domain %s to locale dir %s", GETTEXT_PACKAGE,
|
||||
LOCALEDIR);
|
||||
bindtextdomain (GETTEXT_PACKAGE, LOCALEDIR);
|
||||
bind_textdomain_codeset (GETTEXT_PACKAGE, "UTF-8");
|
||||
#endif /* ENABLE_NLS */
|
||||
gboolean ret = FALSE;
|
||||
|
||||
if (!gst_element_register (plugin, "curlhttpsink", GST_RANK_NONE,
|
||||
GST_TYPE_CURL_HTTP_SINK))
|
||||
return FALSE;
|
||||
|
||||
if (!gst_element_register (plugin, "curlfilesink", GST_RANK_NONE,
|
||||
GST_TYPE_CURL_FILE_SINK))
|
||||
return FALSE;
|
||||
|
||||
if (!gst_element_register (plugin, "curlftpsink", GST_RANK_NONE,
|
||||
GST_TYPE_CURL_FTP_SINK))
|
||||
return FALSE;
|
||||
|
||||
if (!gst_element_register (plugin, "curlsmtpsink", GST_RANK_NONE,
|
||||
GST_TYPE_CURL_SMTP_SINK))
|
||||
return FALSE;
|
||||
ret |= GST_ELEMENT_REGISTER (curlhttpsink, plugin);
|
||||
ret |= GST_ELEMENT_REGISTER (curlfilesink, plugin);
|
||||
ret |= GST_ELEMENT_REGISTER (curlftpsink, plugin);
|
||||
ret |= GST_ELEMENT_REGISTER (curlsmtpsink, plugin);
|
||||
|
||||
#ifdef HAVE_SSH2
|
||||
if (!gst_element_register (plugin, "curlsftpsink", GST_RANK_NONE,
|
||||
GST_TYPE_CURL_SFTP_SINK))
|
||||
return FALSE;
|
||||
ret |= GST_ELEMENT_REGISTER (curlsftpsink, plugin);
|
||||
#endif
|
||||
if (!gst_element_register (plugin, "curlhttpsrc", GST_RANK_SECONDARY,
|
||||
GST_TYPE_CURLHTTPSRC))
|
||||
return FALSE;
|
||||
ret |= GST_ELEMENT_REGISTER (curlhttpsrc, plugin);
|
||||
|
||||
return TRUE;
|
||||
return ret;
|
||||
}
|
||||
|
||||
GST_PLUGIN_DEFINE (GST_VERSION_MAJOR,
|
||||
|
|
41
ext/curl/gstcurlelement.c
Normal file
41
ext/curl/gstcurlelement.c
Normal file
|
@ -0,0 +1,41 @@
|
|||
/* GStreamer
|
||||
* Copyright (C) 2011 Axis Communications <dev-gstreamer@axis.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/gst-i18n-plugin.h>
|
||||
|
||||
#include "gstcurlelements.h"
|
||||
|
||||
void
|
||||
curl_element_init (GstPlugin * plugin)
|
||||
{
|
||||
static gsize res = FALSE;
|
||||
|
||||
if (g_once_init_enter (&res)) {
|
||||
#ifdef ENABLE_NLS
|
||||
GST_DEBUG ("binding text domain %s to locale dir %s", GETTEXT_PACKAGE,
|
||||
LOCALEDIR);
|
||||
bindtextdomain (GETTEXT_PACKAGE, LOCALEDIR);
|
||||
bind_textdomain_codeset (GETTEXT_PACKAGE, "UTF-8");
|
||||
#endif /* ENABLE_NLS */
|
||||
g_once_init_leave (&res, TRUE);
|
||||
}
|
||||
}
|
39
ext/curl/gstcurlelements.h
Normal file
39
ext/curl/gstcurlelements.h
Normal file
|
@ -0,0 +1,39 @@
|
|||
/* GStreamer
|
||||
* Copyright (C) <2020> The GStreamer Contributors.
|
||||
*
|
||||
* 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_CURL_ELEMENTS_H__
|
||||
#define __GST_CURL_ELEMENTS_H__
|
||||
|
||||
#ifdef HAVE_CONFIG_H
|
||||
#include <config.h>
|
||||
#endif
|
||||
|
||||
#include <gst/gst.h>
|
||||
|
||||
void curl_element_init (GstPlugin * plugin);
|
||||
|
||||
GST_ELEMENT_REGISTER_DECLARE (curlfilesink);
|
||||
GST_ELEMENT_REGISTER_DECLARE (curlftpsink);
|
||||
GST_ELEMENT_REGISTER_DECLARE (curlhttpsink);
|
||||
GST_ELEMENT_REGISTER_DECLARE (curlhttpsrc);
|
||||
GST_ELEMENT_REGISTER_DECLARE (curlsftpsink);
|
||||
GST_ELEMENT_REGISTER_DECLARE (curlsmtpsink);
|
||||
|
||||
#endif /* __GST_CURL_ELEMENT_H__ */
|
|
@ -59,6 +59,7 @@
|
|||
#include <sys/stat.h>
|
||||
#include <fcntl.h>
|
||||
|
||||
#include "gstcurlelements.h"
|
||||
#include "gstcurlbasesink.h"
|
||||
#include "gstcurlfilesink.h"
|
||||
|
||||
|
@ -94,6 +95,8 @@ static gboolean gst_curl_file_sink_prepare_transfer (GstCurlBaseSink *
|
|||
|
||||
#define gst_curl_file_sink_parent_class parent_class
|
||||
G_DEFINE_TYPE (GstCurlFileSink, gst_curl_file_sink, GST_TYPE_CURL_BASE_SINK);
|
||||
GST_ELEMENT_REGISTER_DEFINE_WITH_CODE (curlfilesink, "curlfilesink",
|
||||
GST_RANK_NONE, GST_TYPE_CURL_FILE_SINK, curl_element_init (plugin));
|
||||
|
||||
static void
|
||||
gst_curl_file_sink_class_init (GstCurlFileSinkClass * klass)
|
||||
|
|
|
@ -62,6 +62,7 @@
|
|||
#include <sys/stat.h>
|
||||
#include <fcntl.h>
|
||||
|
||||
#include "gstcurlelements.h"
|
||||
#include "gstcurltlssink.h"
|
||||
#include "gstcurlftpsink.h"
|
||||
|
||||
|
@ -101,6 +102,8 @@ static gboolean set_ftp_dynamic_options_unlocked
|
|||
|
||||
#define gst_curl_ftp_sink_parent_class parent_class
|
||||
G_DEFINE_TYPE (GstCurlFtpSink, gst_curl_ftp_sink, GST_TYPE_CURL_TLS_SINK);
|
||||
GST_ELEMENT_REGISTER_DEFINE_WITH_CODE (curlftpsink, "curlftpsink",
|
||||
GST_RANK_NONE, GST_TYPE_CURL_FTP_SINK, curl_element_init (plugin));
|
||||
|
||||
static void
|
||||
gst_curl_ftp_sink_class_init (GstCurlFtpSinkClass * klass)
|
||||
|
|
|
@ -64,6 +64,7 @@
|
|||
#include <sys/stat.h>
|
||||
#include <fcntl.h>
|
||||
|
||||
#include "gstcurlelements.h"
|
||||
#include "gstcurltlssink.h"
|
||||
#include "gstcurlhttpsink.h"
|
||||
|
||||
|
@ -111,7 +112,8 @@ static void gst_curl_http_sink_transfer_prepare_poll_wait
|
|||
|
||||
#define gst_curl_http_sink_parent_class parent_class
|
||||
G_DEFINE_TYPE (GstCurlHttpSink, gst_curl_http_sink, GST_TYPE_CURL_TLS_SINK);
|
||||
|
||||
GST_ELEMENT_REGISTER_DEFINE_WITH_CODE (curlhttpsink, "curlhttpsink",
|
||||
GST_RANK_NONE, GST_TYPE_CURL_HTTP_SINK, curl_element_init (plugin));
|
||||
/* private functions */
|
||||
|
||||
static gboolean proxy_setup (GstCurlBaseSink * bcsink);
|
||||
|
|
|
@ -118,6 +118,7 @@
|
|||
|
||||
#include <gst/gst-i18n-plugin.h>
|
||||
|
||||
#include "gstcurlelements.h"
|
||||
#include "gstcurlhttpsrc.h"
|
||||
#include "gstcurlqueue.h"
|
||||
#include "gstcurldefaults.h"
|
||||
|
@ -254,6 +255,8 @@ gst_curl_http_version_get_type (void)
|
|||
G_DEFINE_TYPE_WITH_CODE (GstCurlHttpSrc, gst_curl_http_src, GST_TYPE_PUSH_SRC,
|
||||
G_IMPLEMENT_INTERFACE (GST_TYPE_URI_HANDLER,
|
||||
gst_curl_http_src_uri_handler_init));
|
||||
GST_ELEMENT_REGISTER_DEFINE_WITH_CODE (curlhttpsrc, "curlhttpsrc",
|
||||
GST_RANK_SECONDARY, GST_TYPE_CURLHTTPSRC, curl_element_init (plugin));
|
||||
|
||||
static void
|
||||
gst_curl_http_src_class_init (GstCurlHttpSrcClass * klass)
|
||||
|
|
|
@ -44,6 +44,7 @@
|
|||
#include "config.h"
|
||||
#endif
|
||||
|
||||
#include "gstcurlelements.h"
|
||||
#include "gstcurlsshsink.h"
|
||||
#include "gstcurlsftpsink.h"
|
||||
|
||||
|
@ -92,6 +93,8 @@ static gboolean set_sftp_dynamic_options_unlocked (GstCurlBaseSink *
|
|||
|
||||
#define gst_curl_sftp_sink_parent_class parent_class
|
||||
G_DEFINE_TYPE (GstCurlSftpSink, gst_curl_sftp_sink, GST_TYPE_CURL_SSH_SINK);
|
||||
GST_ELEMENT_REGISTER_DEFINE_WITH_CODE (curlsftpsink, "curlsftpsink",
|
||||
GST_RANK_NONE, GST_TYPE_CURL_SFTP_SINK, curl_element_init (plugin));
|
||||
|
||||
static void
|
||||
gst_curl_sftp_sink_class_init (GstCurlSftpSinkClass * klass)
|
||||
|
|
|
@ -72,6 +72,7 @@
|
|||
#include <sys/stat.h>
|
||||
#include <fcntl.h>
|
||||
|
||||
#include "gstcurlelements.h"
|
||||
#include "gstcurltlssink.h"
|
||||
#include "gstcurlsmtpsink.h"
|
||||
|
||||
|
@ -134,6 +135,8 @@ static size_t transfer_payload_headers (GstCurlSmtpSink * sink, void *curl_ptr,
|
|||
|
||||
#define gst_curl_smtp_sink_parent_class parent_class
|
||||
G_DEFINE_TYPE (GstCurlSmtpSink, gst_curl_smtp_sink, GST_TYPE_CURL_TLS_SINK);
|
||||
GST_ELEMENT_REGISTER_DEFINE_WITH_CODE (curlsmtpsink, "curlsmtpsink",
|
||||
GST_RANK_NONE, GST_TYPE_CURL_SMTP_SINK, curl_element_init (plugin));
|
||||
|
||||
static void
|
||||
gst_curl_smtp_sink_notify_transfer_end_unlocked (GstCurlSmtpSink * sink)
|
||||
|
|
|
@ -1,6 +1,7 @@
|
|||
curl_sources = [
|
||||
'gstcurlbasesink.c',
|
||||
'gstcurl.c',
|
||||
'gstcurlelement.c',
|
||||
'gstcurlfilesink.c',
|
||||
'gstcurlftpsink.c',
|
||||
'gstcurlhttpsink.c',
|
||||
|
|
Loading…
Reference in a new issue