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>
This commit is contained in:
Stéphane Cerveau 2021-02-17 18:17:08 +01:00 committed by GStreamer Marge Bot
parent e2268237f1
commit 7e499b9a66
12 changed files with 61 additions and 53 deletions

View file

@ -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__ */

View file

@ -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)

View file

@ -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>

18
ext/hls/gsthlselement.c Normal file
View file

@ -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);
}
}

18
ext/hls/gsthlselements.h Normal file
View file

@ -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__ */

View file

@ -1,36 +1,24 @@
#ifdef HAVE_CONFIG_H
# include <config.h>
#endif
#include <gst/gst.h>
#include "gsthlselements.h"
#include "gsthls.h"
#include "gsthlsdemux.h"
#include "gsthlssink.h"
#include "gsthlssink2.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)");
gboolean ret = FALSE;
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;
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)

View file

@ -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 ());
}

View file

@ -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 ());
}

View file

@ -21,8 +21,8 @@
#include <glib.h>
#include "gsthls.h"
#include "gstm3u8playlist.h"
#include "gsthlselements.h"
#define GST_CAT_DEFAULT hls_debug

View file

@ -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

View file

@ -24,7 +24,7 @@
#ifndef __M3U8_H__
#define __M3U8_H__
#include <glib.h>
#include <gst/gst.h>
G_BEGIN_DECLS

View file

@ -1,6 +1,7 @@
hls_sources = [
'gsthlsdemux.c',
'gsthlsdemux-util.c',
'gsthlselement.c',
'gsthlsplugin.c',
'gsthlssink.c',
'gsthlssink2.c',