summaryrefslogtreecommitdiff
path: root/ext
diff options
context:
space:
mode:
authorStéphane Cerveau <scerveau@collabora.com>2021-02-18 16:23:42 +0100
committerGStreamer Marge Bot <gitlab-merge-bot@gstreamer-foundation.org>2021-03-23 14:19:17 +0000
commitc271d2958ee9f61903a2dd39141794a80b26c6b7 (patch)
treea703d5f7391c069e23b9e1d66ff4889550897fcb /ext
parent358e030c09679005e9d308d1de873d5a79fef652 (diff)
downloadgstreamer-plugins-bad-c271d2958ee9f61903a2dd39141794a80b26c6b7.tar.gz
qroverlay: 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')
-rw-r--r--ext/qroverlay/gstdebugqroverlay.c5
-rw-r--r--ext/qroverlay/gstqroverlay.c28
-rw-r--r--ext/qroverlay/gstqroverlayelement.c44
-rw-r--r--ext/qroverlay/gstqroverlayelements.h38
-rw-r--r--ext/qroverlay/gstqroverlayplugin.c60
-rw-r--r--ext/qroverlay/meson.build2
6 files changed, 151 insertions, 26 deletions
diff --git a/ext/qroverlay/gstdebugqroverlay.c b/ext/qroverlay/gstdebugqroverlay.c
index 6a7f8e3b6..0c5d8a210 100644
--- a/ext/qroverlay/gstdebugqroverlay.c
+++ b/ext/qroverlay/gstdebugqroverlay.c
@@ -54,8 +54,10 @@
#include <stdio.h>
#include <stdlib.h>
+#include "gstqroverlayelements.h"
#include "gstdebugqroverlay.h"
+
GST_DEBUG_CATEGORY_STATIC (gst_debug_qr_overlay_debug);
#define GST_CAT_DEFAULT gst_debug_qr_overlay_debug
@@ -96,6 +98,9 @@ struct _GstDebugQROverlay
#define gst_debug_qr_overlay_parent_class parent_class
G_DEFINE_TYPE (GstDebugQROverlay, gst_debug_qr_overlay,
GST_TYPE_BASE_QR_OVERLAY);
+GST_ELEMENT_REGISTER_DEFINE_WITH_CODE (debugqroverlay, "debugqroverlay",
+ GST_RANK_NONE, GST_TYPE_DEBUG_QR_OVERLAY, qroverlay_element_init (plugin));
+
static void gst_debug_qr_overlay_set_property (GObject * object, guint prop_id,
const GValue * value, GParamSpec * pspec);
diff --git a/ext/qroverlay/gstqroverlay.c b/ext/qroverlay/gstqroverlay.c
index 9fc312da6..beaacb703 100644
--- a/ext/qroverlay/gstqroverlay.c
+++ b/ext/qroverlay/gstqroverlay.c
@@ -47,11 +47,9 @@
#include <stdio.h>
#include <stdlib.h>
+#include "gstqroverlayelements.h"
#include "gstqroverlay.h"
-GST_DEBUG_CATEGORY_STATIC (gst_qr_overlay_debug);
-#define GST_CAT_DEFAULT gst_qr_overlay_debug
-
enum
{
PROP_0,
@@ -68,6 +66,8 @@ struct _GstQROverlay
#define gst_qr_overlay_parent_class parent_class
G_DEFINE_TYPE (GstQROverlay, gst_qr_overlay, GST_TYPE_BASE_QR_OVERLAY);
+GST_ELEMENT_REGISTER_DEFINE_WITH_CODE (qroverlay, "qroverlay", GST_RANK_NONE,
+ GST_TYPE_QR_OVERLAY, qroverlay_element_init (plugin));
static gchar *
get_qrcode_content (GstBaseQROverlay * base, GstBuffer * buf,
@@ -156,25 +156,3 @@ static void
gst_qr_overlay_init (GstQROverlay * filter)
{
}
-
-#include "gstdebugqroverlay.h"
-
-static gboolean
-qroverlay_init (GstPlugin * qroverlay)
-{
- GST_DEBUG_CATEGORY_INIT (gst_qr_overlay_debug, "qroverlay", 0,
- "Qrcode overlay element");
-
- if (gst_element_register (qroverlay, "debugqroverlay", GST_RANK_NONE,
- GST_TYPE_DEBUG_QR_OVERLAY))
- return gst_element_register (qroverlay, "qroverlay", GST_RANK_NONE,
- GST_TYPE_QR_OVERLAY);
-
- return FALSE;
-}
-
-GST_PLUGIN_DEFINE (GST_VERSION_MAJOR,
- GST_VERSION_MINOR,
- qroverlay,
- "libqrencode qroverlay plugin",
- qroverlay_init, VERSION, "LGPL", PACKAGE_NAME, GST_PACKAGE_ORIGIN)
diff --git a/ext/qroverlay/gstqroverlayelement.c b/ext/qroverlay/gstqroverlayelement.c
new file mode 100644
index 000000000..c64958b6a
--- /dev/null
+++ b/ext/qroverlay/gstqroverlayelement.c
@@ -0,0 +1,44 @@
+/*
+ * GStreamer
+ * Copyright (C) 2006 Stefan Kost <ensonic@users.sf.net>
+ * Copyright (c) 2020 Anthony Violo <anthony.violo@ubicast.eu>
+ * Copyright (c) 2020 Thibault Saunier <tsaunier@igalia.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., 59 Temple Place - Suite 330,
+ * Boston, MA 02111-1307, USA.
+ */
+
+#ifdef HAVE_CONFIG_H
+#include "config.h"
+#endif
+
+#include <gst/gst.h>
+
+#include "gstqroverlayelements.h"
+
+GST_DEBUG_CATEGORY_STATIC (gst_qr_overlay_debug);
+#define GST_CAT_DEFAULT gst_qr_overlay_debug
+
+void
+qroverlay_element_init (GstPlugin * plugin)
+{
+ static gsize res = FALSE;
+
+ if (g_once_init_enter (&res)) {
+ GST_DEBUG_CATEGORY_INIT (gst_qr_overlay_debug, "qroverlay", 0,
+ "Qrcode overlay element");
+ g_once_init_leave (&res, TRUE);
+ }
+}
diff --git a/ext/qroverlay/gstqroverlayelements.h b/ext/qroverlay/gstqroverlayelements.h
new file mode 100644
index 000000000..7002ee0f5
--- /dev/null
+++ b/ext/qroverlay/gstqroverlayelements.h
@@ -0,0 +1,38 @@
+/*
+ * GStreamer
+ * Copyright (C) 2006 Stefan Kost <ensonic@users.sf.net>
+ * Copyright (c) 2020 Anthony Violo <anthony.violo@ubicast.eu>
+ *
+ * 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., 59 Temple Place - Suite 330,
+ * Boston, MA 02111-1307, USA.
+ */
+
+#ifndef __GST_QR_OVERLAY_H__
+#define __GST_QR_OVERLAY_H__
+
+#include "gstbaseqroverlay.h"
+
+G_BEGIN_DECLS
+#define GST_TYPE_QR_OVERLAY (gst_qr_overlay_get_type())
+
+G_DECLARE_FINAL_TYPE (GstQROverlay, gst_qr_overlay, GST, QR_OVERLAY, GstBaseQROverlay);
+
+
+void qroverlay_element_init (GstPlugin * plugin);
+GST_ELEMENT_REGISTER_DECLARE (debugqroverlay);
+GST_ELEMENT_REGISTER_DECLARE (qroverlay);
+
+G_END_DECLS
+#endif /* __GST_QR_OVERLAY_H__ */
diff --git a/ext/qroverlay/gstqroverlayplugin.c b/ext/qroverlay/gstqroverlayplugin.c
new file mode 100644
index 000000000..9a5278893
--- /dev/null
+++ b/ext/qroverlay/gstqroverlayplugin.c
@@ -0,0 +1,60 @@
+/*
+ * GStreamer
+ * Copyright (C) 2006 Stefan Kost <ensonic@users.sf.net>
+ * Copyright (c) 2020 Anthony Violo <anthony.violo@ubicast.eu>
+ * Copyright (c) 2020 Thibault Saunier <tsaunier@igalia.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., 59 Temple Place - Suite 330,
+ * Boston, MA 02111-1307, USA.
+ */
+
+/**
+ * SECTION:element-qroverlay
+ *
+ * Element to set random data on a qroverlay.
+ *
+ * ## Example launch line
+ *
+ * ``` bash
+ * gst-launch -v -m videotestsrc ! qroverlay ! fakesink silent=TRUE
+ * ```
+ *
+ * Since: 1.20
+ */
+
+#ifdef HAVE_CONFIG_H
+#include "config.h"
+#endif
+
+#include <gst/gst.h>
+
+#include "gstqroverlayelements.h"
+
+static gboolean
+plugin_init (GstPlugin * plugin)
+{
+ gboolean ret = FALSE;
+
+ ret |= GST_ELEMENT_REGISTER (debugqroverlay, plugin);
+ ret |= GST_ELEMENT_REGISTER (qroverlay, plugin);
+
+ return ret;
+}
+
+GST_PLUGIN_DEFINE (GST_VERSION_MAJOR,
+ GST_VERSION_MINOR,
+ qroverlay,
+ "libqrencode qroverlay plugin",
+ plugin_init, VERSION, "LGPL", PACKAGE_NAME, GST_PACKAGE_ORIGIN)
diff --git a/ext/qroverlay/meson.build b/ext/qroverlay/meson.build
index 0b1803d1c..3b3b51dfd 100644
--- a/ext/qroverlay/meson.build
+++ b/ext/qroverlay/meson.build
@@ -2,7 +2,7 @@ qrencode_dep = dependency('libqrencode', required: get_option('qroverlay'))
if qrencode_dep.found()
json_dep = dependency('json-glib-1.0', fallback : ['json-glib', 'json_glib_dep'], required: get_option('qroverlay'))
if json_dep.found()
- gstqroverlay = library('gstqroverlay', ['gstqroverlay.c', 'gstdebugqroverlay.c', 'gstbaseqroverlay.c'],
+ gstqroverlay = library('gstqroverlay', ['gstqroverlay.c', 'gstdebugqroverlay.c', 'gstbaseqroverlay.c', 'gstqroverlayelement.c', 'gstqroverlayplugin.c'],
c_args : gst_plugins_bad_args,
include_directories : [configinc],
dependencies : [gstvideo_dep, qrencode_dep, json_dep],