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>
This commit is contained in:
Stéphane Cerveau 2021-02-18 16:23:42 +01:00 committed by GStreamer Marge Bot
parent 358e030c09
commit c271d2958e
6 changed files with 151 additions and 26 deletions

View file

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

View file

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

View file

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

View file

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

View file

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

View file

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