From 63e2705e97f12e5a9d585f66a5b03bfc13e7abf3 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?St=C3=A9phane=20Cerveau?= Date: Thu, 18 Feb 2021 13:34:54 +0100 Subject: [PATCH] opencv: 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: --- ext/opencv/gstcameracalibrate.cpp | 31 ++++------- ext/opencv/gstcameracalibrate.h | 2 +- ext/opencv/gstcameraundistort.cpp | 24 +++------ ext/opencv/gstcameraundistort.h | 2 +- ext/opencv/gstcvdilate.cpp | 15 ++---- ext/opencv/gstcvdilate.h | 2 +- ext/opencv/gstcvequalizehist.cpp | 18 +++---- ext/opencv/gstcvequalizehist.h | 2 +- ext/opencv/gstcverode.cpp | 15 ++---- ext/opencv/gstcverode.h | 2 +- ext/opencv/gstcvlaplace.cpp | 17 +++--- ext/opencv/gstcvlaplace.h | 2 +- ext/opencv/gstcvsmooth.cpp | 16 +++--- ext/opencv/gstcvsmooth.h | 2 +- ext/opencv/gstcvsobel.cpp | 15 ++---- ext/opencv/gstcvsobel.h | 2 +- ext/opencv/gstdewarp.cpp | 16 ++---- ext/opencv/gstdewarp.h | 2 +- ext/opencv/gstdisparity.cpp | 25 +++------ ext/opencv/gstdisparity.h | 2 +- ext/opencv/gstedgedetect.cpp | 22 +++----- ext/opencv/gstedgedetect.h | 2 +- ext/opencv/gstfaceblur.cpp | 22 ++------ ext/opencv/gstfaceblur.h | 2 +- ext/opencv/gstfacedetect.cpp | 24 +++------ ext/opencv/gstfacedetect.h | 2 +- ext/opencv/gstgrabcut.cpp | 24 +++------ ext/opencv/gstgrabcut.h | 2 +- ext/opencv/gsthanddetect.cpp | 19 ++----- ext/opencv/gsthanddetect.h | 2 +- ext/opencv/gstmotioncells.cpp | 24 +++------ ext/opencv/gstmotioncells.h | 2 +- ext/opencv/gstopencv.cpp | 86 +++++++++---------------------- ext/opencv/gstretinex.cpp | 25 +++------ ext/opencv/gstretinex.h | 2 +- ext/opencv/gstsegmentation.cpp | 23 +++------ ext/opencv/gstsegmentation.h | 2 +- ext/opencv/gstskindetect.cpp | 26 +++------- ext/opencv/gstskindetect.h | 2 +- ext/opencv/gsttemplatematch.cpp | 25 +++------ ext/opencv/gsttemplatematch.h | 2 +- ext/opencv/gsttextoverlay.cpp | 28 +++------- ext/opencv/gsttextoverlay.h | 2 +- 43 files changed, 178 insertions(+), 404 deletions(-) diff --git a/ext/opencv/gstcameracalibrate.cpp b/ext/opencv/gstcameracalibrate.cpp index 291f6c7fbc..b24dea09a3 100644 --- a/ext/opencv/gstcameracalibrate.cpp +++ b/ext/opencv/gstcameracalibrate.cpp @@ -157,8 +157,13 @@ camera_calibration_pattern_get_type (void) return camera_calibration_pattern_type; } -G_DEFINE_TYPE (GstCameraCalibrate, gst_camera_calibrate, - GST_TYPE_OPENCV_VIDEO_FILTER); +G_DEFINE_TYPE_WITH_CODE (GstCameraCalibrate, gst_camera_calibrate, + GST_TYPE_OPENCV_VIDEO_FILTER, + GST_DEBUG_CATEGORY_INIT (gst_camera_calibrate_debug, "cameracalibrate", 0, + "Performs camera calibration"); + ); +GST_ELEMENT_REGISTER_DEFINE (cameracalibrate, "cameracalibrate", GST_RANK_NONE, + GST_TYPE_CAMERA_CALIBRATE); static void gst_camera_calibrate_dispose (GObject * object); static void gst_camera_calibrate_set_property (GObject * object, guint prop_id, @@ -290,7 +295,8 @@ gst_camera_calibrate_class_init (GstCameraCalibrateClass * klass) templ = gst_pad_template_new ("src", GST_PAD_SRC, GST_PAD_ALWAYS, caps); gst_element_class_add_pad_template (element_class, templ); - gst_type_mark_as_plugin_api (GST_TYPE_CAMERA_CALIBRATION_PATTERN, (GstPluginAPIFlags) 0); + gst_type_mark_as_plugin_api (GST_TYPE_CAMERA_CALIBRATION_PATTERN, + (GstPluginAPIFlags) 0); } /* initialize the new element @@ -325,8 +331,8 @@ gst_camera_calibrate_init (GstCameraCalibrate * calib) calib->flags = cv::fisheye::CALIB_FIX_SKEW | cv::fisheye::CALIB_RECOMPUTE_EXTRINSIC | /*cv::fisheye::CALIB_FIX_K1 | */ - cv::fisheye::CALIB_FIX_K2 | cv::fisheye::CALIB_FIX_K3 | cv:: - fisheye::CALIB_FIX_K4; + cv::fisheye::CALIB_FIX_K2 | cv::fisheye::CALIB_FIX_K3 | cv::fisheye:: + CALIB_FIX_K4; } calib->mode = CAPTURING; //DETECTION; @@ -753,18 +759,3 @@ camera_calibrate_calibrate (GstCameraCalibrate * calib, return ok; } - -/* entry point to initialize the plug-in - * initialize the plug-in itself - * register the element factories and other features - */ -gboolean -gst_camera_calibrate_plugin_init (GstPlugin * plugin) -{ - /* debug category for filtering log messages */ - GST_DEBUG_CATEGORY_INIT (gst_camera_calibrate_debug, "cameracalibrate", - 0, "Performs camera calibration"); - - return gst_element_register (plugin, "cameracalibrate", GST_RANK_NONE, - GST_TYPE_CAMERA_CALIBRATE); -} diff --git a/ext/opencv/gstcameracalibrate.h b/ext/opencv/gstcameracalibrate.h index f161a3f28f..bc2416d7c3 100644 --- a/ext/opencv/gstcameracalibrate.h +++ b/ext/opencv/gstcameracalibrate.h @@ -107,7 +107,7 @@ struct _GstCameraCalibrateClass GType gst_camera_calibrate_get_type (void); -gboolean gst_camera_calibrate_plugin_init (GstPlugin * plugin); +GST_ELEMENT_REGISTER_DECLARE (cameracalibrate); G_END_DECLS #endif /* __GST_CAMERA_CALIBRATE_H__ */ diff --git a/ext/opencv/gstcameraundistort.cpp b/ext/opencv/gstcameraundistort.cpp index baad9cbde4..7ae90bebb3 100644 --- a/ext/opencv/gstcameraundistort.cpp +++ b/ext/opencv/gstcameraundistort.cpp @@ -97,8 +97,13 @@ enum PROP_SETTINGS }; -G_DEFINE_TYPE (GstCameraUndistort, gst_camera_undistort, - GST_TYPE_OPENCV_VIDEO_FILTER); +G_DEFINE_TYPE_WITH_CODE (GstCameraUndistort, gst_camera_undistort, + GST_TYPE_OPENCV_VIDEO_FILTER, + GST_DEBUG_CATEGORY_INIT (gst_camera_undistort_debug, "cameraundistort", 0, + "Performs camera undistortion"); + ); +GST_ELEMENT_REGISTER_DEFINE (cameraundistort, "cameraundistort", GST_RANK_NONE, + GST_TYPE_CAMERA_UNDISTORT); static void gst_camera_undistort_dispose (GObject * object); static void gst_camera_undistort_set_property (GObject * object, guint prop_id, @@ -403,18 +408,3 @@ gst_camera_undistort_src_event (GstBaseTransform * trans, GstEvent * event) GST_BASE_TRANSFORM_CLASS (gst_camera_undistort_parent_class)->src_event (trans, event); } - -/* entry point to initialize the plug-in - * initialize the plug-in itself - * register the element factories and other features - */ -gboolean -gst_camera_undistort_plugin_init (GstPlugin * plugin) -{ - /* debug category for filtering log messages */ - GST_DEBUG_CATEGORY_INIT (gst_camera_undistort_debug, "cameraundistort", - 0, "Performs camera undistortion"); - - return gst_element_register (plugin, "cameraundistort", GST_RANK_NONE, - GST_TYPE_CAMERA_UNDISTORT); -} diff --git a/ext/opencv/gstcameraundistort.h b/ext/opencv/gstcameraundistort.h index 4bbe86ec77..1a87c28c3c 100644 --- a/ext/opencv/gstcameraundistort.h +++ b/ext/opencv/gstcameraundistort.h @@ -97,7 +97,7 @@ struct _GstCameraUndistortClass GType gst_camera_undistort_get_type (void); -gboolean gst_camera_undistort_plugin_init (GstPlugin * plugin); +GST_ELEMENT_REGISTER_DECLARE (cameraundistort); G_END_DECLS diff --git a/ext/opencv/gstcvdilate.cpp b/ext/opencv/gstcvdilate.cpp index 6e450f9755..a9306cac49 100644 --- a/ext/opencv/gstcvdilate.cpp +++ b/ext/opencv/gstcvdilate.cpp @@ -64,7 +64,11 @@ GST_DEBUG_CATEGORY_STATIC (gst_cv_dilate_debug); #define GST_CAT_DEFAULT gst_cv_dilate_debug -G_DEFINE_TYPE (GstCvDilate, gst_cv_dilate, GST_TYPE_CV_DILATE_ERODE); +G_DEFINE_TYPE_WITH_CODE (GstCvDilate, gst_cv_dilate, GST_TYPE_CV_DILATE_ERODE, + GST_DEBUG_CATEGORY_INIT (gst_cv_dilate_debug, "cvdilate", 0, "cvdilate"); + ); +GST_ELEMENT_REGISTER_DEFINE (cvdilate, "cvdilate", GST_RANK_NONE, + GST_TYPE_CV_DILATE); static GstFlowReturn gst_cv_dilate_transform_ip (GstOpencvVideoFilter * filter, GstBuffer * buf, cv::Mat img); @@ -106,12 +110,3 @@ gst_cv_dilate_transform_ip (GstOpencvVideoFilter * base, GstBuffer * buf, return GST_FLOW_OK; } - -gboolean -gst_cv_dilate_plugin_init (GstPlugin * plugin) -{ - GST_DEBUG_CATEGORY_INIT (gst_cv_dilate_debug, "cvdilate", 0, "cvdilate"); - - return gst_element_register (plugin, "cvdilate", GST_RANK_NONE, - GST_TYPE_CV_DILATE); -} diff --git a/ext/opencv/gstcvdilate.h b/ext/opencv/gstcvdilate.h index fdacdd8bc5..77f0994087 100644 --- a/ext/opencv/gstcvdilate.h +++ b/ext/opencv/gstcvdilate.h @@ -77,7 +77,7 @@ struct _GstCvDilateClass GType gst_cv_dilate_get_type (void); -gboolean gst_cv_dilate_plugin_init (GstPlugin * plugin); +GST_ELEMENT_REGISTER_DECLARE (cvdilate); G_END_DECLS diff --git a/ext/opencv/gstcvequalizehist.cpp b/ext/opencv/gstcvequalizehist.cpp index 742a414362..56d9f0db1e 100644 --- a/ext/opencv/gstcvequalizehist.cpp +++ b/ext/opencv/gstcvequalizehist.cpp @@ -75,8 +75,13 @@ static GstStaticPadTemplate src_factory = GST_STATIC_PAD_TEMPLATE ("src", GST_PAD_ALWAYS, GST_STATIC_CAPS (GST_VIDEO_CAPS_MAKE ("GRAY8"))); -G_DEFINE_TYPE (GstCvEqualizeHist, gst_cv_equalize_hist, - GST_TYPE_OPENCV_VIDEO_FILTER); +G_DEFINE_TYPE_WITH_CODE (GstCvEqualizeHist, gst_cv_equalize_hist, + GST_TYPE_OPENCV_VIDEO_FILTER, + GST_DEBUG_CATEGORY_INIT (gst_cv_equalize_hist_debug, "cvequalizehist", 0, + "cvequalizehist"); + ); +GST_ELEMENT_REGISTER_DEFINE (cvequalizehist, "cvequalizehist", GST_RANK_NONE, + GST_TYPE_CV_EQUALIZE_HIST); static GstFlowReturn gst_cv_equalize_hist_transform (GstOpencvVideoFilter * filter, GstBuffer * buf, cv::Mat img, GstBuffer * outbuf, cv::Mat outimg); @@ -115,12 +120,3 @@ gst_cv_equalize_hist_transform (GstOpencvVideoFilter * base, cv::equalizeHist (img, outimg); return GST_FLOW_OK; } - -gboolean -gst_cv_equalize_hist_plugin_init (GstPlugin * plugin) -{ - GST_DEBUG_CATEGORY_INIT (gst_cv_equalize_hist_debug, "cvequalizehist", 0, - "cvequalizehist"); - return gst_element_register (plugin, "cvequalizehist", GST_RANK_NONE, - GST_TYPE_CV_EQUALIZE_HIST); -} diff --git a/ext/opencv/gstcvequalizehist.h b/ext/opencv/gstcvequalizehist.h index 6c58c01252..5672eb3b27 100644 --- a/ext/opencv/gstcvequalizehist.h +++ b/ext/opencv/gstcvequalizehist.h @@ -75,7 +75,7 @@ struct _GstCvEqualizeHistClass GType gst_cv_equalize_hist_get_type (void); -gboolean gst_cv_equalize_hist_plugin_init (GstPlugin * plugin); +GST_ELEMENT_REGISTER_DECLARE (cvequalizehist); G_END_DECLS diff --git a/ext/opencv/gstcverode.cpp b/ext/opencv/gstcverode.cpp index 4569275e2b..ac7dfa8b7a 100644 --- a/ext/opencv/gstcverode.cpp +++ b/ext/opencv/gstcverode.cpp @@ -64,7 +64,11 @@ GST_DEBUG_CATEGORY_STATIC (gst_cv_erode_debug); #define GST_CAT_DEFAULT gst_cv_erode_debug -G_DEFINE_TYPE (GstCvErode, gst_cv_erode, GST_TYPE_CV_DILATE_ERODE); +G_DEFINE_TYPE_WITH_CODE (GstCvErode, gst_cv_erode, GST_TYPE_CV_DILATE_ERODE, + GST_DEBUG_CATEGORY_INIT (gst_cv_erode_debug, "cverode", 0, "cverode"); + ); +GST_ELEMENT_REGISTER_DEFINE (cverode, "cverode", GST_RANK_NONE, + GST_TYPE_CV_ERODE); static GstFlowReturn gst_cv_erode_transform_ip (GstOpencvVideoFilter * filter, GstBuffer * buf, cv::Mat img); @@ -106,12 +110,3 @@ gst_cv_erode_transform_ip (GstOpencvVideoFilter * base, GstBuffer * buf, return GST_FLOW_OK; } - -gboolean -gst_cv_erode_plugin_init (GstPlugin * plugin) -{ - GST_DEBUG_CATEGORY_INIT (gst_cv_erode_debug, "cverode", 0, "cverode"); - - return gst_element_register (plugin, "cverode", GST_RANK_NONE, - GST_TYPE_CV_ERODE); -} diff --git a/ext/opencv/gstcverode.h b/ext/opencv/gstcverode.h index 3f2944a7c7..a4b5313a9c 100644 --- a/ext/opencv/gstcverode.h +++ b/ext/opencv/gstcverode.h @@ -77,7 +77,7 @@ struct _GstCvErodeClass GType gst_cv_erode_get_type (void); -gboolean gst_cv_erode_plugin_init (GstPlugin * plugin); +GST_ELEMENT_REGISTER_DECLARE (cverode); G_END_DECLS diff --git a/ext/opencv/gstcvlaplace.cpp b/ext/opencv/gstcvlaplace.cpp index e18e9e939d..5127d75aa9 100644 --- a/ext/opencv/gstcvlaplace.cpp +++ b/ext/opencv/gstcvlaplace.cpp @@ -96,8 +96,12 @@ enum #define DEFAULT_SHIFT 0.0 #define DEFAULT_MASK TRUE -G_DEFINE_TYPE (GstCvLaplace, gst_cv_laplace, GST_TYPE_OPENCV_VIDEO_FILTER); - +G_DEFINE_TYPE_WITH_CODE (GstCvLaplace, gst_cv_laplace, + GST_TYPE_OPENCV_VIDEO_FILTER, GST_DEBUG_CATEGORY_INIT (gst_cv_laplace_debug, + "cvlaplace", 0, "cvlaplace"); + ); +GST_ELEMENT_REGISTER_DEFINE (cvlaplace, "cvlaplace", GST_RANK_NONE, + GST_TYPE_CV_LAPLACE); static void gst_cv_laplace_set_property (GObject * object, guint prop_id, const GValue * value, GParamSpec * pspec); static void gst_cv_laplace_get_property (GObject * object, guint prop_id, @@ -274,12 +278,3 @@ gst_cv_laplace_transform (GstOpencvVideoFilter * base, GstBuffer * buf, return GST_FLOW_OK; } - -gboolean -gst_cv_laplace_plugin_init (GstPlugin * plugin) -{ - GST_DEBUG_CATEGORY_INIT (gst_cv_laplace_debug, "cvlaplace", 0, "cvlaplace"); - - return gst_element_register (plugin, "cvlaplace", GST_RANK_NONE, - GST_TYPE_CV_LAPLACE); -} diff --git a/ext/opencv/gstcvlaplace.h b/ext/opencv/gstcvlaplace.h index 9f7cf62886..42acf2885c 100644 --- a/ext/opencv/gstcvlaplace.h +++ b/ext/opencv/gstcvlaplace.h @@ -84,7 +84,7 @@ struct _GstCvLaplaceClass GType gst_cv_laplace_get_type (void); -gboolean gst_cv_laplace_plugin_init (GstPlugin * plugin); +GST_ELEMENT_REGISTER_DECLARE (cvlaplace); G_END_DECLS diff --git a/ext/opencv/gstcvsmooth.cpp b/ext/opencv/gstcvsmooth.cpp index 0aef401573..3e1ac16836 100644 --- a/ext/opencv/gstcvsmooth.cpp +++ b/ext/opencv/gstcvsmooth.cpp @@ -135,7 +135,12 @@ gst_cv_smooth_type_get_type (void) #define DEFAULT_WIDTH G_MAXINT #define DEFAULT_HEIGHT G_MAXINT -G_DEFINE_TYPE (GstCvSmooth, gst_cv_smooth, GST_TYPE_OPENCV_VIDEO_FILTER); +G_DEFINE_TYPE_WITH_CODE (GstCvSmooth, gst_cv_smooth, + GST_TYPE_OPENCV_VIDEO_FILTER, GST_DEBUG_CATEGORY_INIT (gst_cv_smooth_debug, + "cvsmooth", 0, "cvsmooth"); + ); +GST_ELEMENT_REGISTER_DEFINE (cvsmooth, "cvsmooth", GST_RANK_NONE, + GST_TYPE_CV_SMOOTH); static void gst_cv_smooth_set_property (GObject * object, guint prop_id, const GValue * value, GParamSpec * pspec); @@ -423,12 +428,3 @@ gst_cv_smooth_transform_ip (GstOpencvVideoFilter * base, GstBuffer * buf, return GST_FLOW_OK; } - -gboolean -gst_cv_smooth_plugin_init (GstPlugin * plugin) -{ - GST_DEBUG_CATEGORY_INIT (gst_cv_smooth_debug, "cvsmooth", 0, "cvsmooth"); - - return gst_element_register (plugin, "cvsmooth", GST_RANK_NONE, - GST_TYPE_CV_SMOOTH); -} diff --git a/ext/opencv/gstcvsmooth.h b/ext/opencv/gstcvsmooth.h index 0e1f51bf48..5baac4938d 100644 --- a/ext/opencv/gstcvsmooth.h +++ b/ext/opencv/gstcvsmooth.h @@ -88,7 +88,7 @@ struct _GstCvSmoothClass GType gst_cv_smooth_get_type (void); -gboolean gst_cv_smooth_plugin_init (GstPlugin * plugin); +GST_ELEMENT_REGISTER_DECLARE (cvsmooth); G_END_DECLS diff --git a/ext/opencv/gstcvsobel.cpp b/ext/opencv/gstcvsobel.cpp index 5cca14d8d7..92c606fc18 100644 --- a/ext/opencv/gstcvsobel.cpp +++ b/ext/opencv/gstcvsobel.cpp @@ -95,7 +95,11 @@ enum #define DEFAULT_APERTURE_SIZE 3 #define DEFAULT_MASK TRUE -G_DEFINE_TYPE (GstCvSobel, gst_cv_sobel, GST_TYPE_OPENCV_VIDEO_FILTER); +G_DEFINE_TYPE_WITH_CODE (GstCvSobel, gst_cv_sobel, GST_TYPE_OPENCV_VIDEO_FILTER, + GST_DEBUG_CATEGORY_INIT (gst_cv_sobel_debug, "cvsobel", 0, "cvsobel"); + ); +GST_ELEMENT_REGISTER_DEFINE (cvsobel, "cvsobel", GST_RANK_NONE, + GST_TYPE_CV_SOBEL); static void gst_cv_sobel_set_property (GObject * object, guint prop_id, const GValue * value, GParamSpec * pspec); @@ -269,12 +273,3 @@ gst_cv_sobel_transform (GstOpencvVideoFilter * base, GstBuffer * buf, return GST_FLOW_OK; } - -gboolean -gst_cv_sobel_plugin_init (GstPlugin * plugin) -{ - GST_DEBUG_CATEGORY_INIT (gst_cv_sobel_debug, "cvsobel", 0, "cvsobel"); - - return gst_element_register (plugin, "cvsobel", GST_RANK_NONE, - GST_TYPE_CV_SOBEL); -} diff --git a/ext/opencv/gstcvsobel.h b/ext/opencv/gstcvsobel.h index 0acc9dc3bc..eb28eac8ac 100644 --- a/ext/opencv/gstcvsobel.h +++ b/ext/opencv/gstcvsobel.h @@ -83,7 +83,7 @@ struct _GstCvSobelClass GType gst_cv_sobel_get_type (void); -gboolean gst_cv_sobel_plugin_init (GstPlugin * plugin); +GST_ELEMENT_REGISTER_DECLARE (cvsobel); G_END_DECLS diff --git a/ext/opencv/gstdewarp.cpp b/ext/opencv/gstdewarp.cpp index e7828aed25..8824133793 100644 --- a/ext/opencv/gstdewarp.cpp +++ b/ext/opencv/gstdewarp.cpp @@ -129,7 +129,11 @@ dewarp_interpolation_mode_get_type (void) return dewarp_interpolation_mode_type; } -G_DEFINE_TYPE (GstDewarp, gst_dewarp, GST_TYPE_OPENCV_VIDEO_FILTER); +G_DEFINE_TYPE_WITH_CODE (GstDewarp, gst_dewarp, GST_TYPE_OPENCV_VIDEO_FILTER, + GST_DEBUG_CATEGORY_INIT (gst_dewarp_debug, "dewarp", 0, + "Dewarp fisheye images"); + ); +GST_ELEMENT_REGISTER_DEFINE (dewarp, "dewarp", GST_RANK_NONE, GST_TYPE_DEWARP); static GstStaticPadTemplate sink_factory = GST_STATIC_PAD_TEMPLATE ("sink", GST_PAD_SINK, @@ -714,13 +718,3 @@ gst_dewarp_transform_frame (GstOpencvVideoFilter * btrans, GstBuffer * buffer, return ret; } - -gboolean -gst_dewarp_plugin_init (GstPlugin * plugin) -{ - GST_DEBUG_CATEGORY_INIT (gst_dewarp_debug, "dewarp", - 0, "Dewarp fisheye images"); - - return gst_element_register (plugin, "dewarp", GST_RANK_NONE, - GST_TYPE_DEWARP); -} diff --git a/ext/opencv/gstdewarp.h b/ext/opencv/gstdewarp.h index a113cc2094..df507a200d 100644 --- a/ext/opencv/gstdewarp.h +++ b/ext/opencv/gstdewarp.h @@ -106,7 +106,7 @@ struct _GstDewarpClass GType gst_dewarp_get_type (void); -gboolean gst_dewarp_plugin_init (GstPlugin * plugin); +GST_ELEMENT_REGISTER_DECLARE (dewarp); G_END_DECLS #endif /* __GST_DEWARP_H__ */ diff --git a/ext/opencv/gstdisparity.cpp b/ext/opencv/gstdisparity.cpp index 0c8b9cfd05..7d7a6ece22 100644 --- a/ext/opencv/gstdisparity.cpp +++ b/ext/opencv/gstdisparity.cpp @@ -176,7 +176,12 @@ static GstStaticPadTemplate src_factory = GST_STATIC_PAD_TEMPLATE ("src", GST_STATIC_CAPS (GST_VIDEO_CAPS_MAKE ("RGB")) ); -G_DEFINE_TYPE (GstDisparity, gst_disparity, GST_TYPE_ELEMENT); +G_DEFINE_TYPE_WITH_CODE (GstDisparity, gst_disparity, GST_TYPE_ELEMENT, + GST_DEBUG_CATEGORY_INIT (gst_disparity_debug, "disparity", 0, + "Stereo image disparity (depth) map calculation"); + ); +GST_ELEMENT_REGISTER_DEFINE (disparity, "disparity", GST_RANK_NONE, + GST_TYPE_DISPARITY); static void gst_disparity_finalize (GObject * object); static void gst_disparity_set_property (GObject * object, guint prop_id, @@ -585,24 +590,6 @@ gst_disparity_chain_right (GstPad * pad, GstObject * parent, GstBuffer * buffer) return ret; } - - - - -/* entry point to initialize the plug-in - * initialize the plug-in itself - * register the element factories and other features - */ -gboolean -gst_disparity_plugin_init (GstPlugin * disparity) -{ - GST_DEBUG_CATEGORY_INIT (gst_disparity_debug, "disparity", 0, - "Stereo image disparity (depth) map calculation"); - return gst_element_register (disparity, "disparity", GST_RANK_NONE, - GST_TYPE_DISPARITY); -} - - static void initialise_disparity (GstDisparity * fs, int width, int height, int nchannels) { diff --git a/ext/opencv/gstdisparity.h b/ext/opencv/gstdisparity.h index 7e1a7a014f..5f036c5368 100644 --- a/ext/opencv/gstdisparity.h +++ b/ext/opencv/gstdisparity.h @@ -108,7 +108,7 @@ struct _GstDisparityClass GType gst_disparity_get_type (void); -gboolean gst_disparity_plugin_init (GstPlugin * disparity); +GST_ELEMENT_REGISTER_DECLARE (disparity); G_END_DECLS #endif /* __GST_DISPARITY_H__ */ diff --git a/ext/opencv/gstedgedetect.cpp b/ext/opencv/gstedgedetect.cpp index 9ef4e10c6c..17c8357f68 100644 --- a/ext/opencv/gstedgedetect.cpp +++ b/ext/opencv/gstedgedetect.cpp @@ -97,7 +97,12 @@ static GstStaticPadTemplate src_factory = GST_STATIC_PAD_TEMPLATE ("src", GST_STATIC_CAPS (GST_VIDEO_CAPS_MAKE ("RGB")) ); -G_DEFINE_TYPE (GstEdgeDetect, gst_edge_detect, GST_TYPE_OPENCV_VIDEO_FILTER); +G_DEFINE_TYPE_WITH_CODE (GstEdgeDetect, gst_edge_detect, + GST_TYPE_OPENCV_VIDEO_FILTER, + GST_DEBUG_CATEGORY_INIT (gst_edge_detect_debug, "edgedetect", 0, + "Performs canny edge detection on videos and images");); +GST_ELEMENT_REGISTER_DEFINE (edgedetect, "edgedetect", GST_RANK_NONE, + GST_TYPE_EDGE_DETECT); static void gst_edge_detect_set_property (GObject * object, guint prop_id, const GValue * value, GParamSpec * pspec); @@ -269,18 +274,3 @@ gst_edge_detect_transform (GstOpencvVideoFilter * base, GstBuffer * buf, return GST_FLOW_OK; } - -/* entry point to initialize the plug-in - * initialize the plug-in itself - * register the element factories and other features - */ -gboolean -gst_edge_detect_plugin_init (GstPlugin * plugin) -{ - /* debug category for fltering log messages */ - GST_DEBUG_CATEGORY_INIT (gst_edge_detect_debug, "edgedetect", - 0, "Performs canny edge detection on videos and images"); - - return gst_element_register (plugin, "edgedetect", GST_RANK_NONE, - GST_TYPE_EDGE_DETECT); -} diff --git a/ext/opencv/gstedgedetect.h b/ext/opencv/gstedgedetect.h index b61f51c196..89b3df93b1 100644 --- a/ext/opencv/gstedgedetect.h +++ b/ext/opencv/gstedgedetect.h @@ -86,7 +86,7 @@ struct _GstEdgeDetectClass GType gst_edge_detect_get_type (void); -gboolean gst_edge_detect_plugin_init (GstPlugin * plugin); +GST_ELEMENT_REGISTER_DECLARE (edgedetect); G_END_DECLS #endif /* __GST_EDGE_DETECT_H__ */ diff --git a/ext/opencv/gstfaceblur.cpp b/ext/opencv/gstfaceblur.cpp index b53a4fe7d5..91bda2fda7 100644 --- a/ext/opencv/gstfaceblur.cpp +++ b/ext/opencv/gstfaceblur.cpp @@ -143,7 +143,11 @@ static GstStaticPadTemplate src_factory = GST_STATIC_PAD_TEMPLATE ("src", GST_STATIC_CAPS (GST_VIDEO_CAPS_MAKE ("RGB")) ); -G_DEFINE_TYPE (GstFaceBlur, gst_face_blur, GST_TYPE_OPENCV_VIDEO_FILTER); +G_DEFINE_TYPE_WITH_CODE (GstFaceBlur, gst_face_blur, + GST_TYPE_OPENCV_VIDEO_FILTER, GST_DEBUG_CATEGORY_INIT (gst_face_blur_debug, + "faceblur", 0, "Blurs faces in images and videos");); +GST_ELEMENT_REGISTER_DEFINE (faceblur, "faceblur", GST_RANK_NONE, + GST_TYPE_FACE_BLUR); static void gst_face_blur_set_property (GObject * object, guint prop_id, const GValue * value, GParamSpec * pspec); @@ -386,19 +390,3 @@ gst_face_blur_load_profile (GstFaceBlur * filter, gchar * profile) } return cascade; } - - -/* entry point to initialize the plug-in - * initialize the plug-in itself - * register the element factories and other features - */ -gboolean -gst_face_blur_plugin_init (GstPlugin * plugin) -{ - /* debug category for filtering log messages */ - GST_DEBUG_CATEGORY_INIT (gst_face_blur_debug, "faceblur", - 0, "Blurs faces in images and videos"); - - return gst_element_register (plugin, "faceblur", GST_RANK_NONE, - GST_TYPE_FACE_BLUR); -} diff --git a/ext/opencv/gstfaceblur.h b/ext/opencv/gstfaceblur.h index d4260a148f..476c35bcc4 100644 --- a/ext/opencv/gstfaceblur.h +++ b/ext/opencv/gstfaceblur.h @@ -93,7 +93,7 @@ struct _GstFaceBlurClass GType gst_face_blur_get_type (void); -gboolean gst_face_blur_plugin_init (GstPlugin * plugin); +GST_ELEMENT_REGISTER_DECLARE (faceblur); G_END_DECLS #endif /* __GST_FACE_BLUR_H__ */ diff --git a/ext/opencv/gstfacedetect.cpp b/ext/opencv/gstfacedetect.cpp index bab1fb90f2..5e1c781872 100644 --- a/ext/opencv/gstfacedetect.cpp +++ b/ext/opencv/gstfacedetect.cpp @@ -225,7 +225,12 @@ static GstStaticPadTemplate src_factory = GST_STATIC_PAD_TEMPLATE ("src", GST_STATIC_CAPS (GST_VIDEO_CAPS_MAKE ("RGB")) ); -G_DEFINE_TYPE (GstFaceDetect, gst_face_detect, GST_TYPE_OPENCV_VIDEO_FILTER); +G_DEFINE_TYPE_WITH_CODE (GstFaceDetect, gst_face_detect, + GST_TYPE_OPENCV_VIDEO_FILTER, + GST_DEBUG_CATEGORY_INIT (gst_face_detect_debug, "facedetect", 0, + "Performs face detection on videos and images, providing detected positions via bus messages");); +GST_ELEMENT_REGISTER_DEFINE (facedetect, "facedetect", GST_RANK_NONE, + GST_TYPE_FACE_DETECT); static void gst_face_detect_set_property (GObject * object, guint prop_id, const GValue * value, GParamSpec * pspec); @@ -789,20 +794,3 @@ gst_face_detect_load_profile (GstFaceDetect * filter, gchar * profile) return cascade; } - - -/* entry point to initialize the plug-in - * initialize the plug-in itself - * register the element factories and other features - */ -gboolean -gst_face_detect_plugin_init (GstPlugin * plugin) -{ - /* debug category for fltering log messages */ - GST_DEBUG_CATEGORY_INIT (gst_face_detect_debug, "facedetect", - 0, - "Performs face detection on videos and images, providing detected positions via bus messages"); - - return gst_element_register (plugin, "facedetect", GST_RANK_NONE, - GST_TYPE_FACE_DETECT); -} diff --git a/ext/opencv/gstfacedetect.h b/ext/opencv/gstfacedetect.h index e718844ced..27ee7d7854 100644 --- a/ext/opencv/gstfacedetect.h +++ b/ext/opencv/gstfacedetect.h @@ -117,7 +117,7 @@ struct _GstFaceDetectClass GType gst_face_detect_get_type (void); -gboolean gst_face_detect_plugin_init (GstPlugin * plugin); +GST_ELEMENT_REGISTER_DECLARE (facedetect); G_END_DECLS #endif /* __GST_FACE_DETECT_H__ */ diff --git a/ext/opencv/gstgrabcut.cpp b/ext/opencv/gstgrabcut.cpp index 1c0b8fecd7..3e88b634a2 100644 --- a/ext/opencv/gstgrabcut.cpp +++ b/ext/opencv/gstgrabcut.cpp @@ -107,7 +107,12 @@ enum #define DEFAULT_TEST_MODE FALSE #define DEFAULT_SCALE 1.6 -G_DEFINE_TYPE (GstGrabcut, gst_grabcut, GST_TYPE_OPENCV_VIDEO_FILTER); +G_DEFINE_TYPE_WITH_CODE (GstGrabcut, gst_grabcut, GST_TYPE_OPENCV_VIDEO_FILTER, + GST_DEBUG_CATEGORY_INIT (gst_grabcut_debug, "grabcut", 0, + "Grabcut image segmentation on either input alpha or input bounding box");); +GST_ELEMENT_REGISTER_DEFINE (grabcut, "grabcut", GST_RANK_NONE, + GST_TYPE_GRABCUT); + static GstStaticPadTemplate sink_factory = GST_STATIC_PAD_TEMPLATE ("sink", GST_PAD_SINK, GST_PAD_ALWAYS, @@ -353,23 +358,6 @@ gst_grabcut_transform_ip (GstOpencvVideoFilter * filter, GstBuffer * buffer, return GST_FLOW_OK; } -/* entry point to initialize the plug-in - * initialize the plug-in itself - * register the element factories and other features - */ -gboolean -gst_grabcut_plugin_init (GstPlugin * plugin) -{ - /* debug category for fltering log messages - * - */ - GST_DEBUG_CATEGORY_INIT (gst_grabcut_debug, "grabcut", - 0, - "Grabcut image segmentation on either input alpha or input bounding box"); - - return gst_element_register (plugin, "grabcut", GST_RANK_NONE, - GST_TYPE_GRABCUT); -} void compose_matrix_from_image (Mat output, Mat input) diff --git a/ext/opencv/gstgrabcut.h b/ext/opencv/gstgrabcut.h index 7abcbd5ff8..8f0ea57a9f 100644 --- a/ext/opencv/gstgrabcut.h +++ b/ext/opencv/gstgrabcut.h @@ -93,7 +93,7 @@ struct _GstGrabcutClass GType gst_grabcut_get_type (void); -gboolean gst_grabcut_plugin_init (GstPlugin * plugin); +GST_ELEMENT_REGISTER_DECLARE (grabcut); G_END_DECLS #endif /* __GST_GRABCUT_H__ */ diff --git a/ext/opencv/gsthanddetect.cpp b/ext/opencv/gsthanddetect.cpp index 9055abfd87..ec540f9791 100644 --- a/ext/opencv/gsthanddetect.cpp +++ b/ext/opencv/gsthanddetect.cpp @@ -127,7 +127,11 @@ static void gst_handdetect_navigation_send_event (GstNavigation * navigation, G_DEFINE_TYPE_WITH_CODE (GstHanddetect, gst_handdetect, GST_TYPE_OPENCV_VIDEO_FILTER, G_IMPLEMENT_INTERFACE (GST_TYPE_NAVIGATION, - gst_handdetect_navigation_interface_init);); + gst_handdetect_navigation_interface_init); + GST_DEBUG_CATEGORY_INIT (gst_handdetect_debug, + "handdetect", 0, "opencv hand gesture detection")); +GST_ELEMENT_REGISTER_DEFINE (handdetect, "handdetect", GST_RANK_NONE, + GST_TYPE_HANDDETECT); static void gst_handdetect_navigation_interface_init (GstNavigationInterface * iface) @@ -624,16 +628,3 @@ gst_handdetect_load_profile (GstHanddetect * filter, gchar * profile) return cascade; } - -/* Entry point to initialize the plug-in - * Initialize the plug-in itself - * Register the element factories and other features - */ -gboolean -gst_handdetect_plugin_init (GstPlugin * plugin) -{ - GST_DEBUG_CATEGORY_INIT (gst_handdetect_debug, - "handdetect", 0, "opencv hand gesture detection"); - return gst_element_register (plugin, "handdetect", GST_RANK_NONE, - GST_TYPE_HANDDETECT); -} diff --git a/ext/opencv/gsthanddetect.h b/ext/opencv/gsthanddetect.h index fb676c26f2..1c414cdb0c 100644 --- a/ext/opencv/gsthanddetect.h +++ b/ext/opencv/gsthanddetect.h @@ -95,7 +95,7 @@ struct _GstHanddetectClass GType gst_handdetect_get_type (void); -gboolean gst_handdetect_plugin_init (GstPlugin * plugin); +GST_ELEMENT_REGISTER_DECLARE (handdetect); G_END_DECLS #endif /* __GST_HANDDETECT_H__ */ diff --git a/ext/opencv/gstmotioncells.cpp b/ext/opencv/gstmotioncells.cpp index 47790edc2d..4a0cd0f47a 100644 --- a/ext/opencv/gstmotioncells.cpp +++ b/ext/opencv/gstmotioncells.cpp @@ -140,7 +140,12 @@ static GstStaticPadTemplate src_factory = GST_STATIC_PAD_TEMPLATE ("src", GST_PAD_ALWAYS, GST_STATIC_CAPS (GST_VIDEO_CAPS_MAKE ("RGB"))); -G_DEFINE_TYPE (GstMotioncells, gst_motion_cells, GST_TYPE_OPENCV_VIDEO_FILTER); +G_DEFINE_TYPE_WITH_CODE (GstMotioncells, gst_motion_cells, + GST_TYPE_OPENCV_VIDEO_FILTER, + GST_DEBUG_CATEGORY_INIT (gst_motion_cells_debug, "motioncells", 0, + "Performs motion detection on videos, providing detected positions via bus messages");); +GST_ELEMENT_REGISTER_DEFINE (motioncells, "motioncells", GST_RANK_NONE, + GST_TYPE_MOTIONCELLS); static void gst_motion_cells_set_property (GObject * object, guint prop_id, const GValue * value, GParamSpec * pspec); @@ -1118,20 +1123,3 @@ gst_motion_cells_transform_ip (GstOpencvVideoFilter * base, GstBuffer * buf, } return GST_FLOW_OK; } - -/* entry point to initialize the plug-in - * initialize the plug-in itself - * register the element factories and other features - */ -gboolean -gst_motion_cells_plugin_init (GstPlugin * plugin) -{ - /* debug category for fltering log messages */ - GST_DEBUG_CATEGORY_INIT (gst_motion_cells_debug, - "motioncells", - 0, - "Performs motion detection on videos, providing detected positions via bus messages"); - - return gst_element_register (plugin, "motioncells", GST_RANK_NONE, - GST_TYPE_MOTIONCELLS); -} diff --git a/ext/opencv/gstmotioncells.h b/ext/opencv/gstmotioncells.h index 804923890d..e445f1641e 100644 --- a/ext/opencv/gstmotioncells.h +++ b/ext/opencv/gstmotioncells.h @@ -99,7 +99,7 @@ struct _GstMotioncellsClass GType gst_motion_cells_get_type (void); -gboolean gst_motion_cells_plugin_init (GstPlugin * plugin); +GST_ELEMENT_REGISTER_DECLARE (motioncells); G_END_DECLS #endif /* __GST_MOTION_CELLS_H__ */ diff --git a/ext/opencv/gstopencv.cpp b/ext/opencv/gstopencv.cpp index d301442e42..aee54c35ba 100644 --- a/ext/opencv/gstopencv.cpp +++ b/ext/opencv/gstopencv.cpp @@ -45,73 +45,35 @@ #include "gstcameracalibrate.h" #include "gstcameraundistort.h" + static gboolean plugin_init (GstPlugin * plugin) { - if (!gst_cv_dilate_plugin_init (plugin)) - return FALSE; + gboolean ret = FALSE; - if (!gst_cv_equalize_hist_plugin_init (plugin)) - return FALSE; + ret |= GST_ELEMENT_REGISTER (cvdilate, plugin); + ret |= GST_ELEMENT_REGISTER (cvequalizehist, plugin); + ret |= GST_ELEMENT_REGISTER (cverode, plugin); + ret |= GST_ELEMENT_REGISTER (cvlaplace, plugin); + ret |= GST_ELEMENT_REGISTER (cvsmooth, plugin); + ret |= GST_ELEMENT_REGISTER (cvsobel, plugin); + ret |= GST_ELEMENT_REGISTER (edgedetect, plugin); + ret |= GST_ELEMENT_REGISTER (faceblur, plugin); + ret |= GST_ELEMENT_REGISTER (facedetect, plugin); + ret |= GST_ELEMENT_REGISTER (motioncells, plugin); + ret |= GST_ELEMENT_REGISTER (templatematch, plugin); + ret |= GST_ELEMENT_REGISTER (opencvtextoverlay, plugin); + ret |= GST_ELEMENT_REGISTER (handdetect, plugin); + ret |= GST_ELEMENT_REGISTER (skindetect, plugin); + ret |= GST_ELEMENT_REGISTER (retinex, plugin); + ret |= GST_ELEMENT_REGISTER (segmentation, plugin); + ret |= GST_ELEMENT_REGISTER (grabcut, plugin); + ret |= GST_ELEMENT_REGISTER (disparity, plugin); + ret |= GST_ELEMENT_REGISTER (dewarp, plugin); + ret |= GST_ELEMENT_REGISTER (cameracalibrate, plugin); + ret |= GST_ELEMENT_REGISTER (cameraundistort, plugin); - if (!gst_cv_erode_plugin_init (plugin)) - return FALSE; - - if (!gst_cv_laplace_plugin_init (plugin)) - return FALSE; - - if (!gst_cv_smooth_plugin_init (plugin)) - return FALSE; - - if (!gst_cv_sobel_plugin_init (plugin)) - return FALSE; - - if (!gst_edge_detect_plugin_init (plugin)) - return FALSE; - - if (!gst_face_blur_plugin_init (plugin)) - return FALSE; - - if (!gst_face_detect_plugin_init (plugin)) - return FALSE; - - if (!gst_motion_cells_plugin_init (plugin)) - return FALSE; - - if (!gst_template_match_plugin_init (plugin)) - return FALSE; - - if (!gst_opencv_text_overlay_plugin_init (plugin)) - return FALSE; - - if (!gst_handdetect_plugin_init (plugin)) - return FALSE; - - if (!gst_skin_detect_plugin_init (plugin)) - return FALSE; - - if (!gst_retinex_plugin_init (plugin)) - return FALSE; - - if (!gst_segmentation_plugin_init (plugin)) - return FALSE; - - if (!gst_grabcut_plugin_init (plugin)) - return FALSE; - - if (!gst_disparity_plugin_init (plugin)) - return FALSE; - - if (!gst_dewarp_plugin_init (plugin)) - return FALSE; - - if (!gst_camera_calibrate_plugin_init (plugin)) - return FALSE; - - if (!gst_camera_undistort_plugin_init (plugin)) - return FALSE; - - return TRUE; + return ret; } GST_PLUGIN_DEFINE (GST_VERSION_MAJOR, diff --git a/ext/opencv/gstretinex.cpp b/ext/opencv/gstretinex.cpp index e7cef7d2d4..6d8c9176b6 100644 --- a/ext/opencv/gstretinex.cpp +++ b/ext/opencv/gstretinex.cpp @@ -112,7 +112,13 @@ gst_retinex_method_get_type (void) return etype; } -G_DEFINE_TYPE (GstRetinex, gst_retinex, GST_TYPE_OPENCV_VIDEO_FILTER); +G_DEFINE_TYPE_WITH_CODE (GstRetinex, gst_retinex, GST_TYPE_OPENCV_VIDEO_FILTER, + GST_DEBUG_CATEGORY_INIT (gst_retinex_debug, "retinex", 0, + "Multiscale retinex for colour image enhancement"); + ); +GST_ELEMENT_REGISTER_DEFINE (retinex, "retinex", GST_RANK_NONE, + GST_TYPE_RETINEX); + static GstStaticPadTemplate sink_factory = GST_STATIC_PAD_TEMPLATE ("sink", GST_PAD_SINK, GST_PAD_ALWAYS, @@ -404,20 +410,3 @@ gst_retinex_transform_ip (GstOpencvVideoFilter * filter, GstBuffer * buf, return GST_FLOW_OK; } - -/* entry point to initialize the plug-in - * initialize the plug-in itself - * register the element factories and other features - */ -gboolean -gst_retinex_plugin_init (GstPlugin * plugin) -{ - /* debug category for fltering log messages - * - */ - GST_DEBUG_CATEGORY_INIT (gst_retinex_debug, "retinex", - 0, "Multiscale retinex for colour image enhancement"); - - return gst_element_register (plugin, "retinex", GST_RANK_NONE, - GST_TYPE_RETINEX); -} diff --git a/ext/opencv/gstretinex.h b/ext/opencv/gstretinex.h index c70300b71a..f0acba761a 100644 --- a/ext/opencv/gstretinex.h +++ b/ext/opencv/gstretinex.h @@ -88,7 +88,7 @@ struct _GstRetinexClass GType gst_retinex_get_type (void); -gboolean gst_retinex_plugin_init (GstPlugin * plugin); +GST_ELEMENT_REGISTER_DECLARE (retinex); G_END_DECLS #endif /* __GST_RETINEX_H__ */ diff --git a/ext/opencv/gstsegmentation.cpp b/ext/opencv/gstsegmentation.cpp index a93bdd54ec..cf25a6dd50 100644 --- a/ext/opencv/gstsegmentation.cpp +++ b/ext/opencv/gstsegmentation.cpp @@ -139,7 +139,13 @@ gst_segmentation_method_get_type (void) return etype; } -G_DEFINE_TYPE (GstSegmentation, gst_segmentation, GST_TYPE_OPENCV_VIDEO_FILTER); +G_DEFINE_TYPE_WITH_CODE (GstSegmentation, gst_segmentation, + GST_TYPE_OPENCV_VIDEO_FILTER, + GST_DEBUG_CATEGORY_INIT (gst_segmentation_debug, "segmentation", 0, + "Performs Foreground/Background segmentation in video sequences"); + ); +GST_ELEMENT_REGISTER_DEFINE (segmentation, "segmentation", GST_RANK_NONE, + GST_TYPE_SEGMENTATION); static GstStaticPadTemplate sink_factory = GST_STATIC_PAD_TEMPLATE ("sink", GST_PAD_SINK, @@ -450,21 +456,6 @@ gst_segmentation_transform_ip (GstOpencvVideoFilter * cvfilter, return GST_FLOW_OK; } -/* entry point to initialize the plug-in - * initialize the plug-in itself - * register the element factories and other features - */ -gboolean -gst_segmentation_plugin_init (GstPlugin * plugin) -{ - GST_DEBUG_CATEGORY_INIT (gst_segmentation_debug, "segmentation", - 0, "Performs Foreground/Background segmentation in video sequences"); - - return gst_element_register (plugin, "segmentation", GST_RANK_NONE, - GST_TYPE_SEGMENTATION); -} - - #ifdef CODE_FROM_OREILLY_BOOK /* See license at the beginning of the page */ /* diff --git a/ext/opencv/gstsegmentation.h b/ext/opencv/gstsegmentation.h index a24c205166..ab4840a90d 100644 --- a/ext/opencv/gstsegmentation.h +++ b/ext/opencv/gstsegmentation.h @@ -118,7 +118,7 @@ struct _GstSegmentationClass GType gst_segmentation_get_type (void); -gboolean gst_segmentation_plugin_init (GstPlugin * plugin); +GST_ELEMENT_REGISTER_DECLARE (segmentation); G_END_DECLS #endif /* __GST_SEGMENTATION_H__ */ diff --git a/ext/opencv/gstskindetect.cpp b/ext/opencv/gstskindetect.cpp index b1f031d0d7..997f63895f 100644 --- a/ext/opencv/gstskindetect.cpp +++ b/ext/opencv/gstskindetect.cpp @@ -99,7 +99,14 @@ gst_skin_detect_method_get_type (void) return etype; } -G_DEFINE_TYPE (GstSkinDetect, gst_skin_detect, GST_TYPE_OPENCV_VIDEO_FILTER); +G_DEFINE_TYPE_WITH_CODE (GstSkinDetect, gst_skin_detect, + GST_TYPE_OPENCV_VIDEO_FILTER, + GST_DEBUG_CATEGORY_INIT (gst_skin_detect_debug, "skindetect", 0, + "Performs skin detection on videos and images"); + ); +GST_ELEMENT_REGISTER_DEFINE (skindetect, "skindetect", GST_RANK_NONE, + GST_TYPE_SKIN_DETECT); + static GstStaticPadTemplate sink_factory = GST_STATIC_PAD_TEMPLATE ("sink", GST_PAD_SINK, GST_PAD_ALWAYS, @@ -385,20 +392,3 @@ gst_skin_detect_transform (GstOpencvVideoFilter * base, GstBuffer * buf, return GST_FLOW_OK; } - -/* entry point to initialize the plug-in - * initialize the plug-in itself - * register the element factories and other features - */ -gboolean -gst_skin_detect_plugin_init (GstPlugin * plugin) -{ - /* debug category for fltering log messages - * - */ - GST_DEBUG_CATEGORY_INIT (gst_skin_detect_debug, "skindetect", - 0, "Performs skin detection on videos and images"); - - return gst_element_register (plugin, "skindetect", GST_RANK_NONE, - GST_TYPE_SKIN_DETECT); -} diff --git a/ext/opencv/gstskindetect.h b/ext/opencv/gstskindetect.h index 4b0dbc1d51..d8b814a85f 100644 --- a/ext/opencv/gstskindetect.h +++ b/ext/opencv/gstskindetect.h @@ -84,7 +84,7 @@ struct _GstSkinDetectClass GType gst_skin_detect_get_type (void); -gboolean gst_skin_detect_plugin_init (GstPlugin * plugin); +GST_ELEMENT_REGISTER_DECLARE (skindetect); G_END_DECLS #endif /* __GST_SKIN_DETECT_H__ */ diff --git a/ext/opencv/gsttemplatematch.cpp b/ext/opencv/gsttemplatematch.cpp index 9f613c0e49..c3096a480a 100644 --- a/ext/opencv/gsttemplatematch.cpp +++ b/ext/opencv/gsttemplatematch.cpp @@ -99,8 +99,13 @@ static GstStaticPadTemplate src_factory = GST_STATIC_PAD_TEMPLATE ("src", GST_STATIC_CAPS (GST_VIDEO_CAPS_MAKE ("BGR")) ); -G_DEFINE_TYPE (GstTemplateMatch, gst_template_match, - GST_TYPE_OPENCV_VIDEO_FILTER); +G_DEFINE_TYPE_WITH_CODE (GstTemplateMatch, gst_template_match, + GST_TYPE_OPENCV_VIDEO_FILTER, + GST_DEBUG_CATEGORY_INIT (gst_template_match_debug, "templatematch", 0, + "Performs template matching on videos and images, providing detected positions via bus messages"); + ); +GST_ELEMENT_REGISTER_DEFINE (templatematch, "templatematch", + GST_RANK_NONE, GST_TYPE_TEMPLATE_MATCH); static void gst_template_match_finalize (GObject * object); static void gst_template_match_set_property (GObject * object, guint prop_id, @@ -379,19 +384,3 @@ gst_template_match_transform_ip (GstOpencvVideoFilter * base, GstBuffer * buf, } return GST_FLOW_OK; } - -/* entry point to initialize the plug-in - * initialize the plug-in itself - * register the element factories and other features - */ -gboolean -gst_template_match_plugin_init (GstPlugin * templatematch) -{ - /* debug category for fltering log messages */ - GST_DEBUG_CATEGORY_INIT (gst_template_match_debug, "templatematch", - 0, - "Performs template matching on videos and images, providing detected positions via bus messages"); - - return gst_element_register (templatematch, "templatematch", GST_RANK_NONE, - GST_TYPE_TEMPLATE_MATCH); -} diff --git a/ext/opencv/gsttemplatematch.h b/ext/opencv/gsttemplatematch.h index f781218e33..acb464e35b 100644 --- a/ext/opencv/gsttemplatematch.h +++ b/ext/opencv/gsttemplatematch.h @@ -83,7 +83,7 @@ struct _GstTemplateMatchClass GType gst_template_match_get_type (void); -gboolean gst_template_match_plugin_init (GstPlugin * templatematch); +GST_ELEMENT_REGISTER_DECLARE (templatematch); G_END_DECLS #endif /* __GST_TEMPLATE_MATCH_H__ */ diff --git a/ext/opencv/gsttextoverlay.cpp b/ext/opencv/gsttextoverlay.cpp index 950087b64a..ca4e816925 100644 --- a/ext/opencv/gsttextoverlay.cpp +++ b/ext/opencv/gsttextoverlay.cpp @@ -111,8 +111,13 @@ static GstStaticPadTemplate src_factory = GST_STATIC_PAD_TEMPLATE ("src", GST_STATIC_CAPS (GST_VIDEO_CAPS_MAKE ("RGB")) ); -G_DEFINE_TYPE (GstOpencvTextOverlay, gst_opencv_text_overlay, - GST_TYPE_OPENCV_VIDEO_FILTER); +G_DEFINE_TYPE_WITH_CODE (GstOpencvTextOverlay, gst_opencv_text_overlay, + GST_TYPE_OPENCV_VIDEO_FILTER, + GST_DEBUG_CATEGORY_INIT (gst_opencv_text_overlay_debug, "opencvtextoverlay", + 0, "Template opencvtextoverlay"); + ); +GST_ELEMENT_REGISTER_DEFINE (opencvtextoverlay, "opencvtextoverlay", + GST_RANK_NONE, GST_TYPE_OPENCV_TEXT_OVERLAY); static void gst_opencv_text_overlay_set_property (GObject * object, guint prop_id, const GValue * value, GParamSpec * pspec); @@ -336,22 +341,3 @@ gst_opencv_text_overlay_transform_ip (GstOpencvVideoFilter * base, return GST_FLOW_OK; } - - -/* entry point to initialize the plug-in - * initialize the plug-in itself - * register the element factories and other features - */ -gboolean -gst_opencv_text_overlay_plugin_init (GstPlugin * plugin) -{ - /* debug category for fltering log messages - * - * exchange the string 'Template opencvtextoverlay' with your description - */ - GST_DEBUG_CATEGORY_INIT (gst_opencv_text_overlay_debug, "opencvtextoverlay", - 0, "Template opencvtextoverlay"); - - return gst_element_register (plugin, "opencvtextoverlay", GST_RANK_NONE, - GST_TYPE_OPENCV_TEXT_OVERLAY); -} diff --git a/ext/opencv/gsttextoverlay.h b/ext/opencv/gsttextoverlay.h index d684591353..bee3a2b0e4 100644 --- a/ext/opencv/gsttextoverlay.h +++ b/ext/opencv/gsttextoverlay.h @@ -87,7 +87,7 @@ struct _GstOpencvTextOverlayClass }; GType gst_opencv_text_overlay_get_type (void); -gboolean gst_opencv_text_overlay_plugin_init (GstPlugin * plugin); +GST_ELEMENT_REGISTER_DECLARE (opencvtextoverlay); G_END_DECLS