From 891be511057dbcdf1f38740e55cbd376c4b25894 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?St=C3=A9phane=20Cerveau?= Date: Thu, 25 Feb 2021 15:22:15 +0100 Subject: gst-plugins: 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: --- gst/gaudieffects/gstburn.c | 21 ++++---------- gst/gaudieffects/gstburn.h | 1 + gst/gaudieffects/gstchromium.c | 23 ++++----------- gst/gaudieffects/gstchromium.h | 1 + gst/gaudieffects/gstdilate.c | 16 ++--------- gst/gaudieffects/gstdilate.h | 1 + gst/gaudieffects/gstdodge.c | 15 ++-------- gst/gaudieffects/gstdodge.h | 1 + gst/gaudieffects/gstexclusion.c | 17 ++--------- gst/gaudieffects/gstexclusion.h | 1 + gst/gaudieffects/gstgaussblur.c | 18 +++--------- gst/gaudieffects/gstgaussblur.h | 1 + gst/gaudieffects/gstplugin.c | 25 ++++++++++------ gst/gaudieffects/gstplugin.h | 63 ----------------------------------------- gst/gaudieffects/gstsolarize.c | 17 ++--------- gst/gaudieffects/gstsolarize.h | 1 + 16 files changed, 51 insertions(+), 171 deletions(-) delete mode 100644 gst/gaudieffects/gstplugin.h (limited to 'gst/gaudieffects') diff --git a/gst/gaudieffects/gstburn.c b/gst/gaudieffects/gstburn.c index bc5aefb63..e009fd2fe 100644 --- a/gst/gaudieffects/gstburn.c +++ b/gst/gaudieffects/gstburn.c @@ -64,17 +64,19 @@ #include #include -#include "gstplugin.h" #include "gstburn.h" #include "gstgaudieffectsorc.h" -#define gst_burn_parent_class parent_class -G_DEFINE_TYPE (GstBurn, gst_burn, GST_TYPE_VIDEO_FILTER); - GST_DEBUG_CATEGORY_STATIC (gst_burn_debug); #define GST_CAT_DEFAULT gst_burn_debug +#define gst_burn_parent_class parent_class +G_DEFINE_TYPE (GstBurn, gst_burn, GST_TYPE_VIDEO_FILTER); +GST_ELEMENT_REGISTER_DEFINE_WITH_CODE (burn, "burn", GST_RANK_NONE, + GST_TYPE_BURN, GST_DEBUG_CATEGORY_INIT (gst_burn_debug, "burn", 0, + "Template burn")); + #if G_BYTE_ORDER == G_LITTLE_ENDIAN #define CAPS_STR GST_VIDEO_CAPS_MAKE ("{ BGRx, RGBx }") #else @@ -246,14 +248,3 @@ gst_burn_transform_frame (GstVideoFilter * vfilter, return GST_FLOW_OK; } - -/* Entry point to initialize the plug-in. - * Register the element factories and other features. */ -gboolean -gst_burn_plugin_init (GstPlugin * burn) -{ - /* debug category for fltering log messages */ - GST_DEBUG_CATEGORY_INIT (gst_burn_debug, "burn", 0, "Template burn"); - - return gst_element_register (burn, "burn", GST_RANK_NONE, GST_TYPE_BURN); -} diff --git a/gst/gaudieffects/gstburn.h b/gst/gaudieffects/gstburn.h index 5f563f82c..e467e8edb 100644 --- a/gst/gaudieffects/gstburn.h +++ b/gst/gaudieffects/gstburn.h @@ -81,6 +81,7 @@ struct _GstBurnClass }; GType gst_burn_get_type (void); +GST_ELEMENT_REGISTER_DECLARE (burn); G_END_DECLS diff --git a/gst/gaudieffects/gstchromium.c b/gst/gaudieffects/gstchromium.c index 1a3f3666e..24c93aa5b 100644 --- a/gst/gaudieffects/gstchromium.c +++ b/gst/gaudieffects/gstchromium.c @@ -64,15 +64,17 @@ #include #include -#include "gstplugin.h" #include "gstchromium.h" -#define gst_chromium_parent_class parent_class -G_DEFINE_TYPE (GstChromium, gst_chromium, GST_TYPE_VIDEO_FILTER); - GST_DEBUG_CATEGORY_STATIC (gst_chromium_debug); #define GST_CAT_DEFAULT gst_chromium_debug +#define gst_chromium_parent_class parent_class +G_DEFINE_TYPE (GstChromium, gst_chromium, GST_TYPE_VIDEO_FILTER); +GST_ELEMENT_REGISTER_DEFINE_WITH_CODE (chromium, "chromium", GST_RANK_NONE, + GST_TYPE_CHROMIUM, GST_DEBUG_CATEGORY_INIT (gst_chromium_debug, "chromium", + 0, "Template chromium")); + #if G_BYTE_ORDER == G_LITTLE_ENDIAN #define CAPS_STR GST_VIDEO_CAPS_MAKE ("{ BGRx, RGBx }") #else @@ -275,19 +277,6 @@ gst_chromium_transform_frame (GstVideoFilter * vfilter, return GST_FLOW_OK; } -/* Entry point to initialize the plug-in. - * Register the element factories and other features. */ -gboolean -gst_chromium_plugin_init (GstPlugin * chromium) -{ - /* debug category for fltering log messages */ - GST_DEBUG_CATEGORY_INIT (gst_chromium_debug, "chromium", 0, - "Template chromium"); - - return gst_element_register (chromium, "chromium", GST_RANK_NONE, - GST_TYPE_CHROMIUM); -} - /*** Now the image processing work.... ***/ /* Set up the cosine table. */ void diff --git a/gst/gaudieffects/gstchromium.h b/gst/gaudieffects/gstchromium.h index 8c3b4a000..1b8a44c6d 100644 --- a/gst/gaudieffects/gstchromium.h +++ b/gst/gaudieffects/gstchromium.h @@ -79,6 +79,7 @@ struct _GstChromiumClass }; GType gst_chromium_get_type (void); +GST_ELEMENT_REGISTER_DECLARE (chromium); G_END_DECLS diff --git a/gst/gaudieffects/gstdilate.c b/gst/gaudieffects/gstdilate.c index 2a1e77521..aec92b14f 100644 --- a/gst/gaudieffects/gstdilate.c +++ b/gst/gaudieffects/gstdilate.c @@ -64,7 +64,6 @@ #include #include -#include "gstplugin.h" #include "gstdilate.h" GST_DEBUG_CATEGORY_STATIC (gst_dilate_debug); @@ -78,6 +77,9 @@ GST_DEBUG_CATEGORY_STATIC (gst_dilate_debug); #define gst_dilate_parent_class parent_class G_DEFINE_TYPE (GstDilate, gst_dilate, GST_TYPE_VIDEO_FILTER); +GST_ELEMENT_REGISTER_DEFINE_WITH_CODE (dilate, "dilate", GST_RANK_NONE, + GST_TYPE_DILATE, GST_DEBUG_CATEGORY_INIT (gst_dilate_debug, "dilate", 0, + "Template dilate")); /* Filter signals and args. */ enum @@ -250,18 +252,6 @@ gst_dilate_transform_frame (GstVideoFilter * vfilter, return GST_FLOW_OK; } -/* Entry point to initialize the plug-in. - * Register the element factories and other features. */ -gboolean -gst_dilate_plugin_init (GstPlugin * dilate) -{ - /* debug category for fltering log messages */ - GST_DEBUG_CATEGORY_INIT (gst_dilate_debug, "dilate", 0, "Template dilate"); - - return gst_element_register (dilate, "dilate", GST_RANK_NONE, - GST_TYPE_DILATE); -} - /*** Now the image processing work.... ***/ /* Return luminance of the color */ diff --git a/gst/gaudieffects/gstdilate.h b/gst/gaudieffects/gstdilate.h index afb09018f..c216a352f 100644 --- a/gst/gaudieffects/gstdilate.h +++ b/gst/gaudieffects/gstdilate.h @@ -81,6 +81,7 @@ struct _GstDilateClass }; GType gst_dilate_get_type (void); +GST_ELEMENT_REGISTER_DECLARE (dilate); G_END_DECLS diff --git a/gst/gaudieffects/gstdodge.c b/gst/gaudieffects/gstdodge.c index ee2ce7dbf..db3c251f9 100644 --- a/gst/gaudieffects/gstdodge.c +++ b/gst/gaudieffects/gstdodge.c @@ -64,7 +64,6 @@ #include #include -#include "gstplugin.h" #include "gstdodge.h" GST_DEBUG_CATEGORY_STATIC (gst_dodge_debug); @@ -78,6 +77,9 @@ GST_DEBUG_CATEGORY_STATIC (gst_dodge_debug); #define gst_dodge_parent_class parent_class G_DEFINE_TYPE (GstDodge, gst_dodge, GST_TYPE_VIDEO_FILTER); +GST_ELEMENT_REGISTER_DEFINE_WITH_CODE (dodge, "dodge", GST_RANK_NONE, + GST_TYPE_DODGE, GST_DEBUG_CATEGORY_INIT (gst_dodge_debug, "dodge", 0, + "Template dodge")); /* Filter signals and args. */ enum @@ -223,17 +225,6 @@ gst_dodge_transform_frame (GstVideoFilter * vfilter, return GST_FLOW_OK; } -/* Entry point to initialize the plug-in. - * Register the element factories and other features. */ -gboolean -gst_dodge_plugin_init (GstPlugin * dodge) -{ - /* debug category for fltering log messages */ - GST_DEBUG_CATEGORY_INIT (gst_dodge_debug, "dodge", 0, "Template dodge"); - - return gst_element_register (dodge, "dodge", GST_RANK_NONE, GST_TYPE_DODGE); -} - /*** Now the image processing work.... ***/ /* Transform processes each frame. */ diff --git a/gst/gaudieffects/gstdodge.h b/gst/gaudieffects/gstdodge.h index 64bf4d0cb..53e41c522 100644 --- a/gst/gaudieffects/gstdodge.h +++ b/gst/gaudieffects/gstdodge.h @@ -78,6 +78,7 @@ struct _GstDodgeClass }; GType gst_dodge_get_type (void); +GST_ELEMENT_REGISTER_DECLARE (dodge); G_END_DECLS diff --git a/gst/gaudieffects/gstexclusion.c b/gst/gaudieffects/gstexclusion.c index 6c696b6f3..0fa4658ad 100644 --- a/gst/gaudieffects/gstexclusion.c +++ b/gst/gaudieffects/gstexclusion.c @@ -64,7 +64,6 @@ #include #include -#include "gstplugin.h" #include "gstexclusion.h" #include @@ -115,6 +114,9 @@ GST_STATIC_PAD_TEMPLATE ("src", #define gst_exclusion_parent_class parent_class G_DEFINE_TYPE (GstExclusion, gst_exclusion, GST_TYPE_VIDEO_FILTER); +GST_ELEMENT_REGISTER_DEFINE_WITH_CODE (exclusion, "exclusion", GST_RANK_NONE, + GST_TYPE_EXCLUSION, GST_DEBUG_CATEGORY_INIT (gst_exclusion_debug, + "exclusion", 0, "Template exclusion")); static void gst_exclusion_set_property (GObject * object, guint prop_id, const GValue * value, GParamSpec * pspec); @@ -248,19 +250,6 @@ gst_exclusion_transform_frame (GstVideoFilter * vfilter, return GST_FLOW_OK; } -/* Entry point to initialize the plug-in. - * Register the element factories and other features. */ -gboolean -gst_exclusion_plugin_init (GstPlugin * exclusion) -{ - /* debug category for fltering log messages */ - GST_DEBUG_CATEGORY_INIT (gst_exclusion_debug, "exclusion", - 0, "Template exclusion"); - - return gst_element_register (exclusion, "exclusion", GST_RANK_NONE, - GST_TYPE_EXCLUSION); -} - /*** Now the image processing work.... ***/ /* Transform processes each frame. */ diff --git a/gst/gaudieffects/gstexclusion.h b/gst/gaudieffects/gstexclusion.h index b91083560..fc15e704c 100644 --- a/gst/gaudieffects/gstexclusion.h +++ b/gst/gaudieffects/gstexclusion.h @@ -81,6 +81,7 @@ struct _GstExclusionClass }; GType gst_exclusion_get_type (void); +GST_ELEMENT_REGISTER_DECLARE (exclusion); G_END_DECLS diff --git a/gst/gaudieffects/gstgaussblur.c b/gst/gaudieffects/gstgaussblur.c index dc2d479f9..1c274c814 100644 --- a/gst/gaudieffects/gstgaussblur.c +++ b/gst/gaudieffects/gstgaussblur.c @@ -66,7 +66,6 @@ #include #include -#include "gstplugin.h" #include "gstgaussblur.h" static void gst_gaussianblur_finalize (GObject * object); @@ -120,7 +119,10 @@ static void gaussian_smooth (GstGaussianBlur * gb, guint8 * image, #define gst_gaussianblur_parent_class parent_class G_DEFINE_TYPE (GstGaussianBlur, gst_gaussianblur, GST_TYPE_VIDEO_FILTER); - +GST_ELEMENT_REGISTER_DEFINE_WITH_CODE (gaussianblur, "gaussianblur", + GST_RANK_NONE, GST_TYPE_GAUSSIANBLUR, + GST_DEBUG_CATEGORY_INIT (gst_gauss_blur_debug, "gaussianblur", 0, + "Gaussian Blur video effect")); #define DEFAULT_SIGMA 1.2 /* Initialize the gaussianblur's class. */ @@ -452,15 +454,3 @@ gst_gaussianblur_get_property (GObject * object, break; } } - -/* Register the element factories and other features. */ -gboolean -gst_gauss_blur_plugin_init (GstPlugin * plugin) -{ - /* debug category for fltering log messages */ - GST_DEBUG_CATEGORY_INIT (gst_gauss_blur_debug, "gaussianblur", - 0, "Gaussian Blur video effect"); - - return gst_element_register (plugin, "gaussianblur", GST_RANK_NONE, - GST_TYPE_GAUSSIANBLUR); -} diff --git a/gst/gaudieffects/gstgaussblur.h b/gst/gaudieffects/gstgaussblur.h index 33cbb02c9..bd39ee336 100644 --- a/gst/gaudieffects/gstgaussblur.h +++ b/gst/gaudieffects/gstgaussblur.h @@ -81,6 +81,7 @@ struct _GstGaussianBlurClass }; GType gst_gaussianblur_get_type(void); +GST_ELEMENT_REGISTER_DECLARE (gaussianblur); G_END_DECLS diff --git a/gst/gaudieffects/gstplugin.c b/gst/gaudieffects/gstplugin.c index 0bcd01148..1f1ceb5bc 100644 --- a/gst/gaudieffects/gstplugin.c +++ b/gst/gaudieffects/gstplugin.c @@ -49,7 +49,14 @@ #include -#include "gstplugin.h" +#include "gstburn.h" +#include "gstchromium.h" +#include "gstdilate.h" +#include "gstdodge.h" +#include "gstexclusion.h" +#include "gstgaussblur.h" +#include "gstsolarize.h" + /* PACKAGE: this is usually set by autotools depending on some _INIT macro * in configure.ac and then written into and defined in config.h, but we can @@ -63,15 +70,15 @@ static gboolean plugin_init (GstPlugin * plugin) { - gboolean ret = TRUE; + gboolean ret = FALSE; - ret &= gst_burn_plugin_init (plugin); - ret &= gst_chromium_plugin_init (plugin); - ret &= gst_dilate_plugin_init (plugin); - ret &= gst_dodge_plugin_init (plugin); - ret &= gst_exclusion_plugin_init (plugin); - ret &= gst_solarize_plugin_init (plugin); - ret &= gst_gauss_blur_plugin_init (plugin); + ret |= GST_ELEMENT_REGISTER (burn, plugin); + ret |= GST_ELEMENT_REGISTER (chromium, plugin); + ret |= GST_ELEMENT_REGISTER (dilate, plugin); + ret |= GST_ELEMENT_REGISTER (dodge, plugin); + ret |= GST_ELEMENT_REGISTER (exclusion, plugin); + ret |= GST_ELEMENT_REGISTER (solarize, plugin); + ret |= GST_ELEMENT_REGISTER (gaussianblur, plugin); return ret; } diff --git a/gst/gaudieffects/gstplugin.h b/gst/gaudieffects/gstplugin.h deleted file mode 100644 index 5cc42493c..000000000 --- a/gst/gaudieffects/gstplugin.h +++ /dev/null @@ -1,63 +0,0 @@ -/* - * GStreamer - * Copyright (C) 2005 Thomas Vander Stichele - * Copyright (C) 2005 Ronald S. Bultje - * Copyright (C) 2010 Luis de Bethencourt - * - * Permission is hereby granted, free of charge, to any person obtaining a - * copy of this software and associated documentation files (the "Software"), - * to deal in the Software without restriction, including without limitation - * the rights to use, copy, modify, merge, publish, distribute, sublicense, - * and/or sell copies of the Software, and to permit persons to whom the - * Software is furnished to do so, subject to the following conditions: - * - * The above copyright notice and this permission notice shall be included in - * all copies or substantial portions of the Software. - * - * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR - * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, - * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE - * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER - * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING - * FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER - * DEALINGS IN THE SOFTWARE. - * - * Alternatively, the contents of this file may be used under the - * GNU Lesser General Public License Version 2.1 (the "LGPL"), in - * which case the following provisions apply instead of the ones - * mentioned above: - * - * 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_GAUDI_EFFECTS_H__ -#define __GST_GAUDI_EFFECTS_H__ - -#include - -G_BEGIN_DECLS - -gboolean gst_burn_plugin_init (GstPlugin *plugin); -gboolean gst_chromium_plugin_init (GstPlugin *plugin); -gboolean gst_dilate_plugin_init (GstPlugin *plugin); -gboolean gst_dodge_plugin_init (GstPlugin *plugin); -gboolean gst_exclusion_plugin_init (GstPlugin *plugin); -gboolean gst_gauss_blur_plugin_init (GstPlugin *plugin); -gboolean gst_solarize_plugin_init (GstPlugin *plugin); - -G_END_DECLS - -#endif /* __GST_GAUDI_EFFECTS_H__ */ diff --git a/gst/gaudieffects/gstsolarize.c b/gst/gaudieffects/gstsolarize.c index 23a69d0d8..00f317d52 100644 --- a/gst/gaudieffects/gstsolarize.c +++ b/gst/gaudieffects/gstsolarize.c @@ -64,7 +64,6 @@ #include #include -#include "gstplugin.h" #include "gstsolarize.h" GST_DEBUG_CATEGORY_STATIC (gst_solarize_debug); @@ -117,6 +116,9 @@ GST_STATIC_PAD_TEMPLATE ("src", #define gst_solarize_parent_class parent_class G_DEFINE_TYPE (GstSolarize, gst_solarize, GST_TYPE_VIDEO_FILTER); +GST_ELEMENT_REGISTER_DEFINE_WITH_CODE (solarize, "solarize", GST_RANK_NONE, + GST_TYPE_SOLARIZE, GST_DEBUG_CATEGORY_INIT (gst_solarize_debug, "solarize", + 0, "Template solarize")); static void gst_solarize_set_property (GObject * object, guint prop_id, const GValue * value, GParamSpec * pspec); @@ -278,19 +280,6 @@ gst_solarize_transform_frame (GstVideoFilter * vfilter, return GST_FLOW_OK; } -/* Entry point to initialize the plug-in. - * Register the element factories and other features. */ -gboolean -gst_solarize_plugin_init (GstPlugin * solarize) -{ - /* debug category for fltering log messages */ - GST_DEBUG_CATEGORY_INIT (gst_solarize_debug, "solarize", - 0, "Template solarize"); - - return gst_element_register (solarize, "solarize", GST_RANK_NONE, - GST_TYPE_SOLARIZE); -} - /*** Now the image processing work.... ***/ /* Transform processes each frame. */ diff --git a/gst/gaudieffects/gstsolarize.h b/gst/gaudieffects/gstsolarize.h index 239056306..e81615e19 100644 --- a/gst/gaudieffects/gstsolarize.h +++ b/gst/gaudieffects/gstsolarize.h @@ -81,6 +81,7 @@ struct _GstSolarizeClass }; GType gst_solarize_get_type (void); +GST_ELEMENT_REGISTER_DECLARE (solarize); G_END_DECLS -- cgit v1.2.1