#include <gst/tag/tag.h>
#include <gst/net/gstnet.h>
+#include "gstadaptivedemuxelements.h"
#include "gstdashdemux.h"
#include "gstdash_debug.h"
#define gst_dash_demux2_parent_class parent_class
-G_DEFINE_TYPE_WITH_CODE (GstDashDemux2, gst_dash_demux2,
- GST_TYPE_ADAPTIVE_DEMUX, GST_DEBUG_CATEGORY_INIT (gst_dash_demux2_debug,
- "dashdemux2", 0, "dashdemux2 element")
- );
+G_DEFINE_TYPE (GstDashDemux2, gst_dash_demux2, GST_TYPE_ADAPTIVE_DEMUX);
-GST_ELEMENT_REGISTER_DEFINE (dashdemux2, "dashdemux2",
- GST_RANK_PRIMARY + 1, GST_TYPE_DASH_DEMUX2);
+static gboolean dashdemux2_element_init (GstPlugin * plugin);
+
+GST_ELEMENT_REGISTER_DEFINE_CUSTOM (dashdemux2, dashdemux2_element_init);
static void
gst_dash_demux_dispose (GObject * obj)
g_date_time_unref (client_now);
return server_now;
}
+
+static gboolean
+dashdemux2_element_init (GstPlugin * plugin)
+{
+ gboolean ret = TRUE;
+
+ GST_DEBUG_CATEGORY_INIT (gst_dash_demux2_debug,
+ "dashdemux2", 0, "dashdemux2 element");
+
+ if (!adaptivedemux2_base_element_init (plugin))
+ return TRUE;
+
+ ret = gst_element_register (plugin, "dashdemux2",
+ GST_RANK_PRIMARY + 1, GST_TYPE_DASH_DEMUX2);
+
+ return ret;
+}
GType gst_dash_demux2_get_type (void);
GType gst_dash_demux_stream_get_type (void);
-GST_ELEMENT_REGISTER_DECLARE (dashdemux2);
-
G_END_DECLS
#endif /* __GST_DASH_DEMUX_H__ */
#include <gst/base/gstadapter.h>
#include <gst/app/gstappsrc.h>
-GST_DEBUG_CATEGORY (adaptivedemux2_debug);
+GST_DEBUG_CATEGORY_EXTERN (adaptivedemux2_debug);
#define GST_CAT_DEFAULT adaptivedemux2_debug
#define DEFAULT_FAILED_COUNT 3
--- /dev/null
+/* GStreamer
+ * Copyright (C) 2021-2022 Jan Schmidt <jan@centricular.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 "gstadaptivedemuxelements.h"
+#include "../soup/gstsouploader.h"
+
+GST_DEBUG_CATEGORY (adaptivedemux2_debug);
+#define GST_CAT_DEFAULT adaptivedemux2_debug
+
+gboolean
+adaptivedemux2_base_element_init (GstPlugin * plugin)
+{
+ static gsize res = FALSE;
+ if (g_once_init_enter (&res)) {
+ GST_DEBUG_CATEGORY_INIT (adaptivedemux2_debug, "adaptivedemux2", 0,
+ "adaptivedemux2");
+ g_once_init_leave (&res, TRUE);
+ }
+#ifndef STATIC_SOUP
+ if (!gst_soup_load_library ()) {
+ GST_WARNING ("Failed to load libsoup library");
+ return FALSE;
+ }
+#endif
+ return TRUE;
+}
--- /dev/null
+/* GStreamer
+ * Copyright (C) 2021-2022 Jan Schmidt <jan@centricular.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_ADAPTIVEDEMUX2_ELEMENTS_H__
+#define __GST_ADAPTIVEDEMUX2_ELEMENTS_H__
+
+#ifdef HAVE_CONFIG_H
+#include <config.h>
+#endif
+
+#include <gst/gst.h>
+
+gboolean adaptivedemux2_base_element_init (GstPlugin * plugin);
+
+GST_ELEMENT_REGISTER_DECLARE (mssdemux2);
+GST_ELEMENT_REGISTER_DECLARE (hlsdemux2);
+GST_ELEMENT_REGISTER_DECLARE (dashdemux2);
+
+#endif
#include <gst/tag/tag.h>
#include "gsthlselements.h"
+#include "gstadaptivedemuxelements.h"
#include "gsthlsdemux.h"
static GstStaticPadTemplate sinktemplate = GST_STATIC_PAD_TEMPLATE ("sink",
G_DEFINE_TYPE (GstHLSDemuxStream, gst_hls_demux_stream,
GST_TYPE_ADAPTIVE_DEMUX2_STREAM);
-GST_ELEMENT_REGISTER_DEFINE (hlsdemux2, "hlsdemux2",
- GST_RANK_PRIMARY + 1, GST_TYPE_HLS_DEMUX2);
+static gboolean hlsdemux2_element_init (GstPlugin * plugin);
+
+GST_ELEMENT_REGISTER_DEFINE_CUSTOM (hlsdemux2, hlsdemux2_element_init);
static void
gst_hls_demux_stream_class_init (GstHLSDemuxStreamClass * klass)
adaptivedemux_class->start_fragment = gst_hls_demux_start_fragment;
adaptivedemux_class->finish_fragment = gst_hls_demux_finish_fragment;
adaptivedemux_class->data_received = gst_hls_demux_data_received;
-
- GST_DEBUG_CATEGORY_INIT (gst_hls_demux2_debug, "hlsdemux2", 0,
- "hlsdemux2 element");
}
static void
return ret;
}
+
+static gboolean
+hlsdemux2_element_init (GstPlugin * plugin)
+{
+ gboolean ret = TRUE;
+
+ GST_DEBUG_CATEGORY_INIT (gst_hls_demux2_debug, "hlsdemux2", 0,
+ "hlsdemux2 element");
+
+ if (!adaptivedemux2_base_element_init (plugin))
+ return TRUE;
+
+ ret = gst_element_register (plugin, "hlsdemux2",
+ GST_RANK_PRIMARY + 1, GST_TYPE_HLS_DEMUX2);
+
+ return ret;
+}
GType gst_hls_demux2_get_type (void);
GType gst_hls_demux_stream_get_type (void);
-GST_ELEMENT_REGISTER_DECLARE (hlsdemux2);
-
G_END_DECLS
#endif /* __GST_HLS_DEMUX_H__ */
'plugin.c',
'gstisoff.c',
'gstadaptivedemux.c',
+ 'gstadaptivedemuxelement.c',
'gstadaptivedemuxutils.c',
'gstadaptivedemux-period.c',
'gstadaptivedemux-stream.c',
#include <stdlib.h>
#include <string.h>
+#include "gstadaptivedemuxelements.h"
#include "gstmssdemux.h"
GST_DEBUG_CATEGORY (mssdemux2_debug);
+#define GST_CAT_DEFAULT mssdemux2_debug
static GstStaticPadTemplate gst_mss_demux_sink_template =
GST_STATIC_PAD_TEMPLATE ("sink",
G_DEFINE_TYPE (GstMssDemuxStream, gst_mss_demux_stream,
GST_TYPE_ADAPTIVE_DEMUX2_STREAM);
-GST_ELEMENT_REGISTER_DEFINE (mssdemux2, "mssdemux2",
- GST_RANK_PRIMARY + 1, GST_TYPE_MSS_DEMUX2);
+static gboolean mssdemux_element_init (GstPlugin * plugin);
+
+GST_ELEMENT_REGISTER_DEFINE_CUSTOM (mssdemux2, mssdemux_element_init);
static void gst_mss_demux_dispose (GObject * object);
gstadaptivedemux_class->requires_periodical_playlist_update =
gst_mss_demux_requires_periodical_playlist_update;
- GST_DEBUG_CATEGORY_INIT (mssdemux2_debug, "mssdemux2", 0,
- "mssdemux2 element");
}
static void
return GST_STREAM_TYPE_UNKNOWN;
}
}
+
+static gboolean
+mssdemux_element_init (GstPlugin * plugin)
+{
+ gboolean ret = TRUE;
+
+ GST_DEBUG_CATEGORY_INIT (mssdemux2_debug, "mssdemux2", 0,
+ "mssdemux2 element");
+
+ if (!adaptivedemux2_base_element_init (plugin))
+ return TRUE;
+
+ ret =
+ gst_element_register (plugin, "mssdemux2", GST_RANK_PRIMARY + 1,
+ GST_TYPE_MSS_DEMUX2);
+
+ return ret;
+}
G_BEGIN_DECLS
-GST_DEBUG_CATEGORY_EXTERN (mssdemux2_debug);
-#define GST_CAT_DEFAULT mssdemux2_debug
-
#define GST_TYPE_MSS_DEMUX2 \
(gst_mss_demux2_get_type())
#define GST_MSS_DEMUX(obj) \
GType gst_mss_demux2_get_type (void);
GType gst_mss_demux_stream_get_type (void);
-GST_ELEMENT_REGISTER_DECLARE (mssdemux2);
+
G_END_DECLS
#endif /* __GST_MSSDEMUX_H__ */
# include <config.h>
#endif
-#include "dash/gstdashdemux.h"
-#include "hls/gsthlsdemux.h"
-#include "mss/gstmssdemux.h"
-#include "../soup/gstsouploader.h"
+#include "gstadaptivedemuxelements.h"
static gboolean
plugin_init (GstPlugin * plugin)
{
gboolean ret = TRUE;
-#ifndef STATIC_SOUP
- if (!gst_soup_load_library ()) {
- GST_WARNING ("Failed to load libsoup library");
- return TRUE;
- }
-#endif
-
ret |= GST_ELEMENT_REGISTER (hlsdemux2, plugin);
ret |= GST_ELEMENT_REGISTER (dashdemux2, plugin);
ret |= GST_ELEMENT_REGISTER (mssdemux2, plugin);