opencv: allow per feature registration
authorStéphane Cerveau <scerveau@collabora.com>
Thu, 18 Feb 2021 12:34:54 +0000 (13:34 +0100)
committerGStreamer Marge Bot <gitlab-merge-bot@gstreamer-foundation.org>
Tue, 23 Mar 2021 14:19:17 +0000 (14:19 +0000)
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>

43 files changed:
ext/opencv/gstcameracalibrate.cpp
ext/opencv/gstcameracalibrate.h
ext/opencv/gstcameraundistort.cpp
ext/opencv/gstcameraundistort.h
ext/opencv/gstcvdilate.cpp
ext/opencv/gstcvdilate.h
ext/opencv/gstcvequalizehist.cpp
ext/opencv/gstcvequalizehist.h
ext/opencv/gstcverode.cpp
ext/opencv/gstcverode.h
ext/opencv/gstcvlaplace.cpp
ext/opencv/gstcvlaplace.h
ext/opencv/gstcvsmooth.cpp
ext/opencv/gstcvsmooth.h
ext/opencv/gstcvsobel.cpp
ext/opencv/gstcvsobel.h
ext/opencv/gstdewarp.cpp
ext/opencv/gstdewarp.h
ext/opencv/gstdisparity.cpp
ext/opencv/gstdisparity.h
ext/opencv/gstedgedetect.cpp
ext/opencv/gstedgedetect.h
ext/opencv/gstfaceblur.cpp
ext/opencv/gstfaceblur.h
ext/opencv/gstfacedetect.cpp
ext/opencv/gstfacedetect.h
ext/opencv/gstgrabcut.cpp
ext/opencv/gstgrabcut.h
ext/opencv/gsthanddetect.cpp
ext/opencv/gsthanddetect.h
ext/opencv/gstmotioncells.cpp
ext/opencv/gstmotioncells.h
ext/opencv/gstopencv.cpp
ext/opencv/gstretinex.cpp
ext/opencv/gstretinex.h
ext/opencv/gstsegmentation.cpp
ext/opencv/gstsegmentation.h
ext/opencv/gstskindetect.cpp
ext/opencv/gstskindetect.h
ext/opencv/gsttemplatematch.cpp
ext/opencv/gsttemplatematch.h
ext/opencv/gsttextoverlay.cpp
ext/opencv/gsttextoverlay.h

index 291f6c7..b24dea0 100644 (file)
@@ -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);
-}
index f161a3f..bc2416d 100644 (file)
@@ -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__ */
index baad9cb..7ae90be 100644 (file)
@@ -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);
-}
index 4bbe86e..1a87c28 100644 (file)
@@ -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
 
index 6e450f9..a9306ca 100644 (file)
 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);
-}
index fdacdd8..77f0994 100644 (file)
@@ -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
 
index 742a414..56d9f0d 100644 (file)
@@ -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);
-}
index 6c58c01..5672eb3 100644 (file)
@@ -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
 
index 4569275..ac7dfa8 100644 (file)
 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);
-}
index 3f2944a..a4b5313 100644 (file)
@@ -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
 
index e18e9e9..5127d75 100644 (file)
@@ -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);
-}
index 9f7cf62..42acf28 100644 (file)
@@ -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
 
index 0aef401..3e1ac16 100644 (file)
@@ -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);
-}
index 0e1f51b..5baac49 100644 (file)
@@ -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
 
index 5cca14d..92c606f 100644 (file)
@@ -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);
-}
index 0acc9dc..eb28eac 100644 (file)
@@ -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
 
index e7828ae..8824133 100644 (file)
@@ -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);
-}
index a113cc2..df507a2 100644 (file)
@@ -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__ */
index 0c8b9cf..7d7a6ec 100644 (file)
@@ -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)
 {
index 7e1a7a0..5f036c5 100644 (file)
@@ -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__ */
index 9ef4e10..17c8357 100644 (file)
@@ -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);
-}
index b61f51c..89b3df9 100644 (file)
@@ -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__ */
index b53a4fe..91bda2f 100644 (file)
@@ -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);
-}
index d4260a1..476c35b 100644 (file)
@@ -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__ */
index bab1fb9..5e1c781 100644 (file)
@@ -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);
-}
index e718844..27ee7d7 100644 (file)
@@ -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__ */
index 1c0b8fe..3e88b63 100644 (file)
@@ -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)
index 7abcbd5..8f0ea57 100644 (file)
@@ -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__ */
index 9055abf..ec540f9 100644 (file)
@@ -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);
-}
index fb676c2..1c414cd 100644 (file)
@@ -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__ */
index 47790ed..4a0cd0f 100644 (file)
@@ -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);
-}
index 8049238..e445f16 100644 (file)
@@ -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__ */
index d301442..aee54c3 100644 (file)
 #include "gstcameracalibrate.h"
 #include "gstcameraundistort.h"
 
+
 static gboolean
 plugin_init (GstPlugin * plugin)
 {
-  if (!gst_cv_dilate_plugin_init (plugin))
-    return FALSE;
-
-  if (!gst_cv_equalize_hist_plugin_init (plugin))
-    return FALSE;
-
-  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;
+  gboolean ret = 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);
+
+  return ret;
 }
 
 GST_PLUGIN_DEFINE (GST_VERSION_MAJOR,
index e7cef7d..6d8c917 100644 (file)
@@ -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);
-}
index c70300b..f0acba7 100644 (file)
@@ -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__ */
index a93bdd5..cf25a6d 100644 (file)
@@ -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 */
 /*
index a24c205..ab4840a 100644 (file)
@@ -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__ */
index b1f031d..997f638 100644 (file)
@@ -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);
-}
index 4b0dbc1..d8b814a 100644 (file)
@@ -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__ */
index 9f613c0..c3096a4 100644 (file)
@@ -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);
-}
index f781218..acb464e 100644 (file)
@@ -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__ */
index 950087b..ca4e816 100644 (file)
@@ -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);
-}
index d684591..bee3a2b 100644 (file)
@@ -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