--- /dev/null
+/* GStreamer
+ * Copyright (C) <1999> Erik Walthinsen <omega@cse.ogi.edu>
+ * Copyright (C) 2004 Ronald S. Bultje <rbultje@ronald.bitfreak.net>
+ * Copyright (C) 2006 Tim-Philipp Müller <tim centricular net>
+ * Copyright (C) <2015> British Broadcasting Corporation <dash@rd.bbc.co.uk>
+ *
+ * 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 "gstttmlelements.h"
+
+
+GST_DEBUG_CATEGORY (ttmlrender_debug);
+
+void
+ttml_element_init (GstPlugin * plugin)
+{
+ static gsize res = FALSE;
+
+ if (g_once_init_enter (&res)) {
+ gst_plugin_add_dependency_simple (plugin, "GST_TTML_AUTOPLUG", NULL, NULL,
+ GST_PLUGIN_DEPENDENCY_FLAG_NONE);
+ g_once_init_leave (&res, TRUE);
+ }
+}
--- /dev/null
+/* 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_TTML_ELEMENTS_H__
+#define __GST_TTML_ELEMENTS_H__
+
+#ifdef HAVE_CONFIG_H
+#include <config.h>
+#endif
+
+#include <gst/gst.h>
+
+void ttml_element_init (GstPlugin * plugin);
+
+GST_ELEMENT_REGISTER_DECLARE (ttmlparse);
+GST_ELEMENT_REGISTER_DECLARE (ttmlrender);
+
+#endif /* __GST_TTML_ELEMENTS_H__ */
#include <sys/types.h>
#include <glib.h>
+#include "gstttmlelements.h"
#include "gstttmlparse.h"
#include "ttmlparse.h"
-GST_DEBUG_CATEGORY_EXTERN (ttmlparse_debug);
+GST_DEBUG_CATEGORY (ttmlparse_debug);
#define GST_CAT_DEFAULT ttmlparse_debug
+
#define DEFAULT_ENCODING NULL
static GstStaticPadTemplate sink_templ = GST_STATIC_PAD_TEMPLATE ("sink",
static GstFlowReturn gst_ttml_parse_chain (GstPad * sinkpad, GstObject * parent,
GstBuffer * buf);
+static gboolean gst_element_ttmlparse_init (GstPlugin * plugin);
#define gst_ttml_parse_parent_class parent_class
G_DEFINE_TYPE (GstTtmlParse, gst_ttml_parse, GST_TYPE_ELEMENT);
+GST_ELEMENT_REGISTER_DEFINE_CUSTOM (ttmlparse, gst_element_ttmlparse_init);
static void
gst_ttml_parse_dispose (GObject * object)
return ret;
}
+
+static gboolean
+gst_element_ttmlparse_init (GstPlugin * plugin)
+{
+ guint rank = GST_RANK_NONE;
+
+ ttml_element_init (plugin);
+
+ /* We don't want this autoplugged by default yet for now */
+ if (g_getenv ("GST_TTML_AUTOPLUG")) {
+ GST_INFO_OBJECT (plugin, "Registering ttml elements with primary rank.");
+ rank = GST_RANK_PRIMARY;
+ }
+
+ GST_DEBUG_CATEGORY_INIT (ttmlparse_debug, "ttmlparse", 0, "TTML parser");
+
+ return gst_element_register (plugin, "ttmlparse", rank, GST_TYPE_TTML_PARSE);
+}
#include <config.h>
#endif
-#include "gstttmlparse.h"
-#include "gstttmlrender.h"
+#include "gstttmlelements.h"
-GST_DEBUG_CATEGORY (ttmlparse_debug);
-GST_DEBUG_CATEGORY (ttmlrender_debug);
static gboolean
plugin_init (GstPlugin * plugin)
{
- guint rank = GST_RANK_NONE;
+ gboolean ret = FALSE;
- /* We don't want this autoplugged by default yet for now */
- if (g_getenv ("GST_TTML_AUTOPLUG")) {
- GST_INFO_OBJECT (plugin, "Registering ttml elements with primary rank.");
- rank = GST_RANK_PRIMARY;
- }
+ ret |= GST_ELEMENT_REGISTER (ttmlparse, plugin);
+ ret |= GST_ELEMENT_REGISTER (ttmlrender, plugin);
- gst_plugin_add_dependency_simple (plugin, "GST_TTML_AUTOPLUG", NULL, NULL,
- GST_PLUGIN_DEPENDENCY_FLAG_NONE);
-
- if (!gst_element_register (plugin, "ttmlparse", rank, GST_TYPE_TTML_PARSE))
- return FALSE;
- if (!gst_element_register (plugin, "ttmlrender", rank, GST_TYPE_TTML_RENDER))
- return FALSE;
-
- GST_DEBUG_CATEGORY_INIT (ttmlparse_debug, "ttmlparse", 0, "TTML parser");
- GST_DEBUG_CATEGORY_INIT (ttmlrender_debug, "ttmlrender", 0, "TTML renderer");
-
- return TRUE;
+ return ret;
}
GST_PLUGIN_DEFINE (GST_VERSION_MAJOR,
#include <string.h>
#include <math.h>
+#include "gstttmlelements.h"
#include "gstttmlrender.h"
#include "subtitle.h"
#include "subtitlemeta.h"
images, GstTtmlDirection direction);
static gboolean gst_ttml_render_color_is_transparent (GstSubtitleColor * color);
+static gboolean gst_element_ttmlrender_init (GstPlugin * plugin);
GType
gst_ttml_render_get_type (void)
return type;
}
+GST_ELEMENT_REGISTER_DEFINE_CUSTOM (ttmlrender, gst_element_ttmlrender_init);
+
static void
gst_ttml_render_base_init (gpointer g_class)
{
return ret;
}
+
+static gboolean
+gst_element_ttmlrender_init (GstPlugin * plugin)
+{
+ guint rank = GST_RANK_NONE;
+
+ ttml_element_init (plugin);
+
+ /* We don't want this autoplugged by default yet for now */
+ if (g_getenv ("GST_TTML_AUTOPLUG")) {
+ GST_INFO_OBJECT (plugin, "Registering ttml elements with primary rank.");
+ rank = GST_RANK_PRIMARY;
+ }
+
+ GST_DEBUG_CATEGORY_INIT (ttmlrender_debug, "ttmlrender", 0, "TTML renderer");
+
+ return gst_element_register (plugin, "ttmlrender", rank,
+ GST_TYPE_TTML_RENDER);
+}
'gstttmlparse.c',
'ttmlparse.c',
'gstttmlrender.c',
+ 'gstttmlelement.c',
'gstttmlplugin.c'],
c_args : gst_plugins_bad_args,
include_directories : [configinc],