diff options
author | Stéphane Cerveau <scerveau@collabora.com> | 2021-02-17 18:17:08 +0100 |
---|---|---|
committer | GStreamer Marge Bot <gitlab-merge-bot@gstreamer-foundation.org> | 2021-03-23 14:19:17 +0000 |
commit | 7e499b9a66c2d2227ea1c52e13b2b7da8cea674a (patch) | |
tree | 6f4e50463c783ce37d9c396cab3672c3a51df40b /ext/hls | |
parent | e2268237f167b32557bd1e8ad1dca9c6577766fc (diff) |
hls: 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>
Diffstat (limited to 'ext/hls')
-rw-r--r-- | ext/hls/gsthls.h | 12 | ||||
-rw-r--r-- | ext/hls/gsthlsdemux.c | 3 | ||||
-rw-r--r-- | ext/hls/gsthlsdemux.h | 1 | ||||
-rw-r--r-- | ext/hls/gsthlselement.c | 18 | ||||
-rw-r--r-- | ext/hls/gsthlselements.h | 18 | ||||
-rw-r--r-- | ext/hls/gsthlsplugin.c | 30 | ||||
-rw-r--r-- | ext/hls/gsthlssink.c | 14 | ||||
-rw-r--r-- | ext/hls/gsthlssink2.c | 11 | ||||
-rw-r--r-- | ext/hls/gstm3u8playlist.c | 2 | ||||
-rw-r--r-- | ext/hls/m3u8.c | 2 | ||||
-rw-r--r-- | ext/hls/m3u8.h | 2 | ||||
-rw-r--r-- | ext/hls/meson.build | 1 |
12 files changed, 61 insertions, 53 deletions
diff --git a/ext/hls/gsthls.h b/ext/hls/gsthls.h deleted file mode 100644 index 3806f4f21..000000000 --- a/ext/hls/gsthls.h +++ /dev/null @@ -1,12 +0,0 @@ -#ifndef __GST_HLS_H__ -#define __GST_HLS_H__ - -#include <gst/gst.h> - -G_BEGIN_DECLS - -GST_DEBUG_CATEGORY_EXTERN (hls_debug); - -G_END_DECLS - -#endif /* __GST_HLS_H__ */ diff --git a/ext/hls/gsthlsdemux.c b/ext/hls/gsthlsdemux.c index f923a2674..46e99f41c 100644 --- a/ext/hls/gsthlsdemux.c +++ b/ext/hls/gsthlsdemux.c @@ -43,6 +43,7 @@ #include <string.h> #include <gst/base/gsttypefindhelper.h> +#include "gsthlselements.h" #include "gsthlsdemux.h" static GstStaticPadTemplate srctemplate = GST_STATIC_PAD_TEMPLATE ("src_%u", @@ -119,6 +120,8 @@ static void gst_hls_demux_set_current_variant (GstHLSDemux * hlsdemux, #define gst_hls_demux_parent_class parent_class G_DEFINE_TYPE (GstHLSDemux, gst_hls_demux, GST_TYPE_ADAPTIVE_DEMUX); +GST_ELEMENT_REGISTER_DEFINE_WITH_CODE (hlsdemux, "hlsdemux", GST_RANK_PRIMARY, + GST_TYPE_HLS_DEMUX, hls_element_init (plugin)); static void gst_hls_demux_finalize (GObject * obj) diff --git a/ext/hls/gsthlsdemux.h b/ext/hls/gsthlsdemux.h index 14b78864b..98d6099cb 100644 --- a/ext/hls/gsthlsdemux.h +++ b/ext/hls/gsthlsdemux.h @@ -27,7 +27,6 @@ #include <gst/gst.h> #include "m3u8.h" -#include "gsthls.h" #include <gst/adaptivedemux/gstadaptivedemux.h> #if defined(HAVE_OPENSSL) #include <openssl/evp.h> diff --git a/ext/hls/gsthlselement.c b/ext/hls/gsthlselement.c new file mode 100644 index 000000000..a469e44f7 --- /dev/null +++ b/ext/hls/gsthlselement.c @@ -0,0 +1,18 @@ + +#ifdef HAVE_CONFIG_H +# include <config.h> +#endif + +#include "gsthlselements.h" + +GST_DEBUG_CATEGORY (hls_debug); + +void +hls_element_init (GstPlugin * plugin) +{ + static gsize res = FALSE; + if (g_once_init_enter (&res)) { + GST_DEBUG_CATEGORY_INIT (hls_debug, "hls", 0, "HTTP Live Streaming (HLS)"); + g_once_init_leave (&res, TRUE); + } +} diff --git a/ext/hls/gsthlselements.h b/ext/hls/gsthlselements.h new file mode 100644 index 000000000..4395230e4 --- /dev/null +++ b/ext/hls/gsthlselements.h @@ -0,0 +1,18 @@ +#ifndef __GST_HLS_ELEMENT_H__ +#define __GST_HLS_ELEMENT_H__ + +#include <gst/gst.h> + +G_BEGIN_DECLS + +void hls_element_init (GstPlugin * plugin); + +GST_ELEMENT_REGISTER_DECLARE (hlsdemux); +GST_ELEMENT_REGISTER_DECLARE (hlssink); +GST_ELEMENT_REGISTER_DECLARE (hlssink2); + +GST_DEBUG_CATEGORY_EXTERN (hls_debug); + +G_END_DECLS + +#endif /* __GST_HLS_ELEMENT_H__ */ diff --git a/ext/hls/gsthlsplugin.c b/ext/hls/gsthlsplugin.c index fc2658847..cad1b5583 100644 --- a/ext/hls/gsthlsplugin.c +++ b/ext/hls/gsthlsplugin.c @@ -1,36 +1,24 @@ + #ifdef HAVE_CONFIG_H # include <config.h> #endif -#include <gst/gst.h> - -#include "gsthls.h" -#include "gsthlsdemux.h" -#include "gsthlssink.h" -#include "gsthlssink2.h" +#include "gsthlselements.h" -GST_DEBUG_CATEGORY (hls_debug); static gboolean -hls_init (GstPlugin * plugin) +plugin_init (GstPlugin * plugin) { - GST_DEBUG_CATEGORY_INIT (hls_debug, "hls", 0, "HTTP Live Streaming (HLS)"); - - if (!gst_element_register (plugin, "hlsdemux", GST_RANK_PRIMARY, - GST_TYPE_HLS_DEMUX) || FALSE) - return FALSE; - - if (!gst_hls_sink_plugin_init (plugin)) - return FALSE; - - if (!gst_hls_sink2_plugin_init (plugin)) - return FALSE; + gboolean ret = FALSE; - return TRUE; + ret |= GST_ELEMENT_REGISTER (hlsdemux, plugin); + ret |= GST_ELEMENT_REGISTER (hlssink, plugin); + ret |= GST_ELEMENT_REGISTER (hlssink2, plugin); + return ret; } GST_PLUGIN_DEFINE (GST_VERSION_MAJOR, GST_VERSION_MINOR, hls, "HTTP Live Streaming (HLS)", - hls_init, VERSION, GST_LICENSE, PACKAGE_NAME, GST_PACKAGE_ORIGIN) + plugin_init, VERSION, GST_LICENSE, PACKAGE_NAME, GST_PACKAGE_ORIGIN) diff --git a/ext/hls/gsthlssink.c b/ext/hls/gsthlssink.c index 78f8df1e6..a5f2f5e52 100644 --- a/ext/hls/gsthlssink.c +++ b/ext/hls/gsthlssink.c @@ -33,6 +33,7 @@ #include "config.h" #endif +#include "gsthlselements.h" #include "gsthlssink.h" #include <gst/pbutils/pbutils.h> #include <gst/video/video.h> @@ -70,6 +71,11 @@ static GstStaticPadTemplate sink_template = GST_STATIC_PAD_TEMPLATE ("sink", #define gst_hls_sink_parent_class parent_class G_DEFINE_TYPE (GstHlsSink, gst_hls_sink, GST_TYPE_BIN); +#define _do_init \ + hls_element_init (plugin); \ + GST_DEBUG_CATEGORY_INIT (gst_hls_sink_debug, "hlssink", 0, "HlsSink"); +GST_ELEMENT_REGISTER_DEFINE_WITH_CODE (hlssink, "hlssink", GST_RANK_NONE, + GST_TYPE_HLS_SINK, _do_init); static void gst_hls_sink_set_property (GObject * object, guint prop_id, const GValue * value, GParamSpec * spec); @@ -580,11 +586,3 @@ gst_hls_sink_chain_list (GstPad * pad, GstObject * parent, GstBufferList * list) return ret; } - -gboolean -gst_hls_sink_plugin_init (GstPlugin * plugin) -{ - GST_DEBUG_CATEGORY_INIT (gst_hls_sink_debug, "hlssink", 0, "HlsSink"); - return gst_element_register (plugin, "hlssink", GST_RANK_NONE, - gst_hls_sink_get_type ()); -} diff --git a/ext/hls/gsthlssink2.c b/ext/hls/gsthlssink2.c index 257c38271..16bda35c1 100644 --- a/ext/hls/gsthlssink2.c +++ b/ext/hls/gsthlssink2.c @@ -44,6 +44,7 @@ #include "config.h" #endif +#include "gsthlselements.h" #include "gsthlssink2.h" #include <gst/pbutils/pbutils.h> #include <gst/video/video.h> @@ -97,6 +98,8 @@ static GstStaticPadTemplate audio_template = GST_STATIC_PAD_TEMPLATE ("audio", #define gst_hls_sink2_parent_class parent_class G_DEFINE_TYPE (GstHlsSink2, gst_hls_sink2, GST_TYPE_BIN); +GST_ELEMENT_REGISTER_DEFINE_WITH_CODE (hlssink2, "hlssink2", GST_RANK_NONE, + GST_TYPE_HLS_SINK2, hls_element_init (plugin)); static void gst_hls_sink2_set_property (GObject * object, guint prop_id, const GValue * value, GParamSpec * spec); @@ -683,11 +686,3 @@ gst_hls_sink2_get_property (GObject * object, guint prop_id, break; } } - -gboolean -gst_hls_sink2_plugin_init (GstPlugin * plugin) -{ - GST_DEBUG_CATEGORY_INIT (gst_hls_sink2_debug, "hlssink2", 0, "HlsSink2"); - return gst_element_register (plugin, "hlssink2", GST_RANK_NONE, - gst_hls_sink2_get_type ()); -} diff --git a/ext/hls/gstm3u8playlist.c b/ext/hls/gstm3u8playlist.c index c6007020b..f2f1a5ef6 100644 --- a/ext/hls/gstm3u8playlist.c +++ b/ext/hls/gstm3u8playlist.c @@ -21,8 +21,8 @@ #include <glib.h> -#include "gsthls.h" #include "gstm3u8playlist.h" +#include "gsthlselements.h" #define GST_CAT_DEFAULT hls_debug diff --git a/ext/hls/m3u8.c b/ext/hls/m3u8.c index 7f24226ce..d20e352c3 100644 --- a/ext/hls/m3u8.c +++ b/ext/hls/m3u8.c @@ -26,8 +26,8 @@ #include <glib.h> #include <string.h> -#include "gsthls.h" #include "m3u8.h" +#include "gsthlselements.h" #define GST_CAT_DEFAULT hls_debug diff --git a/ext/hls/m3u8.h b/ext/hls/m3u8.h index e7b4fe10c..aa511360d 100644 --- a/ext/hls/m3u8.h +++ b/ext/hls/m3u8.h @@ -24,7 +24,7 @@ #ifndef __M3U8_H__ #define __M3U8_H__ -#include <glib.h> +#include <gst/gst.h> G_BEGIN_DECLS diff --git a/ext/hls/meson.build b/ext/hls/meson.build index 3ef45ee03..3444d37e7 100644 --- a/ext/hls/meson.build +++ b/ext/hls/meson.build @@ -1,6 +1,7 @@ hls_sources = [ 'gsthlsdemux.c', 'gsthlsdemux-util.c', + 'gsthlselement.c', 'gsthlsplugin.c', 'gsthlssink.c', 'gsthlssink2.c', |