debugutils: 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-good/-/merge_requests/876>
This commit is contained in:
Stéphane Cerveau 2021-02-15 14:55:15 +01:00
parent 434955e0ff
commit 6823afde01
14 changed files with 100 additions and 41 deletions

View file

@ -32,6 +32,8 @@
#include <gst/gst.h>
#include <gst/base/gstbasetransform.h>
#include "gstdebugutilselements.h"
GST_DEBUG_CATEGORY_STATIC (gst_break_my_data_debug);
#define GST_CAT_DEFAULT gst_break_my_data_debug
@ -100,7 +102,8 @@ GstStaticPadTemplate bmd_sink_template = GST_STATIC_PAD_TEMPLATE ("sink",
#define gst_break_my_data_parent_class parent_class
G_DEFINE_TYPE (GstBreakMyData, gst_break_my_data, GST_TYPE_BASE_TRANSFORM);
GST_ELEMENT_REGISTER_DEFINE (breakmydata, "breakmydata",
GST_RANK_NONE, gst_break_my_data_get_type ());
static void
gst_break_my_data_class_init (GstBreakMyDataClass * klass)

View file

@ -26,6 +26,7 @@
#include <math.h>
#include <time.h>
#include "gstdebugutilselements.h"
#include "cpureport.h"
@ -52,6 +53,8 @@ static gboolean gst_cpu_report_stop (GstBaseTransform * trans);
#define gst_cpu_report_parent_class parent_class
G_DEFINE_TYPE (GstCpuReport, gst_cpu_report, GST_TYPE_BASE_TRANSFORM);
GST_ELEMENT_REGISTER_DEFINE (cpureport, "cpureport",
GST_RANK_NONE, gst_cpu_report_get_type ());
static void
gst_cpu_report_finalize (GObject * obj)

View file

@ -24,6 +24,7 @@
#include <gst/gst.h>
#include <gst/gst.h>
#include "gstdebugutilselements.h"
#include "gstcapsdebug.h"
GST_DEBUG_CATEGORY_STATIC (gst_caps_debug_debug);
@ -63,6 +64,8 @@ GST_STATIC_PAD_TEMPLATE ("src",
#define gst_caps_debug_parent_class parent_class
G_DEFINE_TYPE (GstCapsDebug, gst_caps_debug, GST_TYPE_ELEMENT);
GST_ELEMENT_REGISTER_DEFINE (capsdebug, "capsdebug",
GST_RANK_PRIMARY, gst_caps_debug_get_type ());
static void
gst_caps_debug_class_init (GstCapsDebugClass * klass)

View file

@ -46,6 +46,7 @@
#include "config.h"
#endif
#include "gstdebugutilselements.h"
#include "gstcapssetter.h"
#include <string.h>
@ -104,6 +105,8 @@ static void gst_caps_setter_get_property (GObject * object, guint prop_id,
#define gst_caps_setter_parent_class parent_class
G_DEFINE_TYPE (GstCapsSetter, gst_caps_setter, GST_TYPE_BASE_TRANSFORM);
GST_ELEMENT_REGISTER_DEFINE (capssetter, "capssetter",
GST_RANK_NONE, gst_caps_setter_get_type ());
static void
gst_caps_setter_class_init (GstCapsSetterClass * g_class)

View file

@ -1,5 +1,7 @@
/* GStreamer
* Copyright (C) 2004 Benjamin Otte <otte@gnome.org>
* Copyright (C) 2020 Huawei Technologies Co., Ltd.
* @Author: Stéphane Cerveau <stephane.cerveau@collabora.com>
*
* This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Library General Public
@ -23,50 +25,27 @@
#include <gst/gst.h>
GType gst_break_my_data_get_type (void);
//GType gst_caps_debug_get_type (void);
GType gst_caps_setter_get_type (void);
GType gst_rnd_buffer_size_get_type (void);
GType gst_navseek_get_type (void);
GType gst_progress_report_get_type (void);
GType gst_tag_inject_get_type (void);
GType gst_test_get_type (void);
GType gst_push_file_src_get_type (void);
/*
GType gst_gst_negotiation_get_type (void);
*/
GType gst_cpu_report_get_type (void);
#include "gstdebugutilselements.h"
static gboolean
plugin_init (GstPlugin * plugin)
{
if (!gst_element_register (plugin, "breakmydata", GST_RANK_NONE,
gst_break_my_data_get_type ())
|| !gst_element_register (plugin, "capssetter", GST_RANK_NONE,
gst_caps_setter_get_type ())
|| !gst_element_register (plugin, "rndbuffersize", GST_RANK_NONE,
gst_rnd_buffer_size_get_type ())
|| !gst_element_register (plugin, "navseek", GST_RANK_NONE,
gst_navseek_get_type ())
|| !gst_element_register (plugin, "pushfilesrc", GST_RANK_NONE,
gst_push_file_src_get_type ()) ||
/* !gst_element_register (plugin, "negotiation", GST_RANK_NONE, gst_gst_negotiation_get_type ()) || */
!gst_element_register (plugin, "progressreport", GST_RANK_NONE,
gst_progress_report_get_type ())
|| !gst_element_register (plugin, "taginject", GST_RANK_NONE,
gst_tag_inject_get_type ())
|| !gst_element_register (plugin, "testsink", GST_RANK_NONE,
gst_test_get_type ())
gboolean ret = FALSE;
ret |= GST_ELEMENT_REGISTER (breakmydata, plugin);
ret |= GST_ELEMENT_REGISTER (capssetter, plugin);
ret |= GST_ELEMENT_REGISTER (rndbuffersize, plugin);
ret |= GST_ELEMENT_REGISTER (navseek, plugin);
ret |= GST_ELEMENT_REGISTER (pushfilesrc, plugin);
ret |= GST_ELEMENT_REGISTER (progressreport, plugin);
ret |= GST_ELEMENT_REGISTER (taginject, plugin);
ret |= GST_ELEMENT_REGISTER (testsink, plugin);
#if 0
|| !gst_element_register (plugin, "capsdebug", GST_RANK_NONE,
gst_caps_debug_get_type ())
ret |= GST_ELEMENT_REGISTER (capsdebug, plugin);
#endif
|| !gst_element_register (plugin, "cpureport", GST_RANK_NONE,
gst_cpu_report_get_type ()))
ret |= GST_ELEMENT_REGISTER (cpureport, plugin);
return FALSE;
return TRUE;
return ret;
}
GST_PLUGIN_DEFINE (GST_VERSION_MAJOR,

View file

@ -0,0 +1,47 @@
/*
* Copyright (C) 2004 Benjamin Otte <otte@gnome.org>
* Copyright (C) 2020 Huawei Technologies Co., Ltd.
* @Author: Stéphane Cerveau <stephane.cerveau@collabora.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_DEBUGUTILS_ELEMENTS_H__
#define __GST_DEBUGUTILS_ELEMENTS_H__
#ifdef HAVE_CONFIG_H
#include "config.h"
#endif
#include <gst/gst.h>
G_BEGIN_DECLS
GST_ELEMENT_REGISTER_DECLARE (breakmydata);
GST_ELEMENT_REGISTER_DECLARE (capssetter);
GST_ELEMENT_REGISTER_DECLARE (rndbuffersize);
GST_ELEMENT_REGISTER_DECLARE (navseek);
GST_ELEMENT_REGISTER_DECLARE (pushfilesrc);
GST_ELEMENT_REGISTER_DECLARE (progressreport);
GST_ELEMENT_REGISTER_DECLARE (taginject);
GST_ELEMENT_REGISTER_DECLARE (testsink);
#if 0
GST_ELEMENT_REGISTER_DECLARE (capsdebug);
#endif
GST_ELEMENT_REGISTER_DECLARE (cpureport);
G_END_DECLS
#endif /* __GST_DEBUGUTILS_ELEMENTS_H__ */

View file

@ -51,6 +51,8 @@ GST_STATIC_PAD_TEMPLATE ("sink",
#define gst_navigationtest_parent_class parent_class
G_DEFINE_TYPE (GstNavigationtest, gst_navigationtest, GST_TYPE_VIDEO_FILTER);
GST_ELEMENT_REGISTER_DEFINE (navigationtest, "navigationtest", GST_RANK_NONE,
GST_TYPE_NAVIGATIONTEST);
static gboolean
gst_navigationtest_src_event (GstBaseTransform * trans, GstEvent * event)
@ -266,8 +268,7 @@ plugin_init (GstPlugin * plugin)
GST_DEBUG_CATEGORY_INIT (navigationtest_debug, "navigationtest", 0,
"navigationtest");
return gst_element_register (plugin, "navigationtest", GST_RANK_NONE,
GST_TYPE_NAVIGATIONTEST);
return GST_ELEMENT_REGISTER (navigationtest, plugin);
}
GST_PLUGIN_DEFINE (GST_VERSION_MAJOR,

View file

@ -61,5 +61,7 @@ struct _GstNavigationtestClass
GType gst_navigationtest_get_type (void);
GST_ELEMENT_REGISTER_DECLARE (navigationtest);
G_END_DECLS
#endif /* __GST_NAVIGATIONTEST_H__ */

View file

@ -27,6 +27,7 @@
#include "config.h"
#endif
#include "gstdebugutilselements.h"
#include "gstnavseek.h"
#include <string.h>
#include <math.h>
@ -65,6 +66,8 @@ static void gst_navseek_get_property (GObject * object, guint prop_id,
GType gst_navseek_get_type (void);
#define gst_navseek_parent_class parent_class
G_DEFINE_TYPE (GstNavSeek, gst_navseek, GST_TYPE_BASE_TRANSFORM);
GST_ELEMENT_REGISTER_DEFINE (navseek, "navseek",
GST_RANK_NONE, gst_navseek_get_type ());
static void
gst_navseek_class_init (GstNavSeekClass * klass)

View file

@ -41,6 +41,7 @@
#include "config.h"
#endif
#include "gstdebugutilselements.h"
#include "gstpushfilesrc.h"
#include <gst/gst.h>
@ -84,6 +85,8 @@ static void gst_push_file_src_uri_handler_init (gpointer g_iface,
G_DEFINE_TYPE_WITH_CODE (GstPushFileSrc, gst_push_file_src, GST_TYPE_BIN,
G_IMPLEMENT_INTERFACE (GST_TYPE_URI_HANDLER,
gst_push_file_src_uri_handler_init));
GST_ELEMENT_REGISTER_DEFINE (pushfilesrc, "pushfilesrc",
GST_RANK_NONE, gst_push_file_src_get_type ());
static void
gst_push_file_src_dispose (GObject * obj)

View file

@ -41,6 +41,7 @@
#include <stdlib.h>
#include "gstdebugutilselements.h"
#include "gsttaginject.h"
static GstStaticPadTemplate sinktemplate = GST_STATIC_PAD_TEMPLATE ("sink",
@ -64,6 +65,8 @@ enum
#define gst_tag_inject_parent_class parent_class
G_DEFINE_TYPE (GstTagInject, gst_tag_inject, GST_TYPE_BASE_TRANSFORM);
GST_ELEMENT_REGISTER_DEFINE (taginject, "taginject",
GST_RANK_NONE, gst_tag_inject_get_type ());
static void gst_tag_inject_finalize (GObject * object);
static void gst_tag_inject_set_property (GObject * object, guint prop_id,

View file

@ -73,6 +73,7 @@
#include <math.h>
#include <time.h>
#include "gstdebugutilselements.h"
#include "progressreport.h"
@ -117,6 +118,8 @@ static gboolean gst_progress_report_stop (GstBaseTransform * trans);
#define gst_progress_report_parent_class parent_class
G_DEFINE_TYPE (GstProgressReport, gst_progress_report, GST_TYPE_BASE_TRANSFORM);
GST_ELEMENT_REGISTER_DEFINE (progressreport, "progressreport",
GST_RANK_NONE, gst_progress_report_get_type ());
static void
gst_progress_report_finalize (GObject * obj)

View file

@ -30,6 +30,8 @@
#include <gst/gst.h>
#include <gst/base/gstadapter.h>
#include "gstdebugutilselements.h"
GST_DEBUG_CATEGORY_STATIC (gst_rnd_buffer_size_debug);
#define GST_CAT_DEFAULT gst_rnd_buffer_size_debug
@ -107,6 +109,8 @@ static GstFlowReturn gst_rnd_buffer_size_chain (GstPad * pad,
GType gst_rnd_buffer_size_get_type (void);
#define gst_rnd_buffer_size_parent_class parent_class
G_DEFINE_TYPE (GstRndBufferSize, gst_rnd_buffer_size, GST_TYPE_ELEMENT);
GST_ELEMENT_REGISTER_DEFINE (rndbuffersize, "rndbuffersize",
GST_RANK_NONE, gst_rnd_buffer_size_get_type ());
static void
gst_rnd_buffer_size_class_init (GstRndBufferSizeClass * klass)

View file

@ -23,6 +23,7 @@
#include <gst/gst.h>
#include <gst/base/gstbasesink.h>
#include "gstdebugutilselements.h"
#include "tests.h"
GST_DEBUG_CATEGORY_STATIC (gst_test_debug);
@ -83,7 +84,8 @@ static GstStaticPadTemplate sinktemplate = GST_STATIC_PAD_TEMPLATE ("sink",
GType gst_test_get_type (void);
#define gst_test_parent_class parent_class
G_DEFINE_TYPE (GstTest, gst_test, GST_TYPE_BASE_SINK);
GST_ELEMENT_REGISTER_DEFINE (testsink, "testsink",
GST_RANK_NONE, gst_test_get_type ());
static void
gst_test_class_init (GstTestClass * klass)