From cf9d13bb4ce1833964a55de26348f57c2705cb07 Mon Sep 17 00:00:00 2001 From: kapil Date: Fri, 8 May 2009 11:55:20 +0530 Subject: [PATCH] Registering all elements under opencv plugin --- ext/opencv/Makefile.am | 29 +++++++++++ ext/opencv/edgedetect/Makefile.am | 2 +- ext/opencv/edgedetect/gstedgedetect.c | 22 ++------ ext/opencv/edgedetect/gstedgedetect.h | 2 + ext/opencv/facedetect/Makefile.am | 2 +- ext/opencv/facedetect/gstfacedetect.c | 20 ++------ ext/opencv/facedetect/gstfacedetect.h | 2 + ext/opencv/gstopencv.c | 50 +++++++++++++++++++ ext/opencv/pyramidsegment/Makefile.am | 4 +- ext/opencv/pyramidsegment/gstpyramidsegment.c | 19 ++----- ext/opencv/pyramidsegment/gstpyramidsegment.h | 2 + 11 files changed, 97 insertions(+), 57 deletions(-) create mode 100644 ext/opencv/gstopencv.c diff --git a/ext/opencv/Makefile.am b/ext/opencv/Makefile.am index 0061f7e037..712582758d 100644 --- a/ext/opencv/Makefile.am +++ b/ext/opencv/Makefile.am @@ -1 +1,30 @@ SUBDIRS = edgedetect facedetect pyramidsegment + +# plugindir is set in configure + +plugin_LTLIBRARIES = libgstopencv.la + +# sources used to compile this plug-in +libgstopencv_la_SOURCES = gstopencv.c + +# flags used to compile this facedetect +# add other _CFLAGS and _LIBS as needed +libgstopencv_la_CFLAGS = $(GST_CFLAGS) $(OPENCV_CFLAGS) \ + -I${top_srcdir}/ext/opencv/edgedetect \ + -I${top_srcdir}/ext/opencv/facedetect \ + -I${top_srcdir}/ext/opencv/pyramidsegment + +libgstopencv_la_LIBADD = $(GST_LIBS) $(OPENCV_LIBS) \ + $(top_builddir)/ext/opencv/edgedetect/libgstedgedetect.la \ + $(top_builddir)/ext/opencv/facedetect/libgstfacedetect.la \ + $(top_builddir)/ext/opencv/pyramidsegment/libgstpyramidsegment.la + +libgstopencv_la_LDFLAGS = $(GST_PLUGIN_LDFLAGS) + +libgstopencv_la_DEPENDENCIES = \ + $(top_builddir)/ext/opencv/edgedetect/libgstedgedetect.la \ + $(top_builddir)/ext/opencv/facedetect/libgstfacedetect.la \ + $(top_builddir)/ext/opencv/pyramidsegment/libgstpyramidsegment.la + +# headers we need but don't want installed +noinst_HEADERS = diff --git a/ext/opencv/edgedetect/Makefile.am b/ext/opencv/edgedetect/Makefile.am index 54c6657d9f..63875028c4 100644 --- a/ext/opencv/edgedetect/Makefile.am +++ b/ext/opencv/edgedetect/Makefile.am @@ -1,6 +1,6 @@ # plugindir is set in configure -plugin_LTLIBRARIES = libgstedgedetect.la +noinst_LTLIBRARIES = libgstedgedetect.la # sources used to compile this plug-in libgstedgedetect_la_SOURCES = gstedgedetect.c diff --git a/ext/opencv/edgedetect/gstedgedetect.c b/ext/opencv/edgedetect/gstedgedetect.c index 26b4f47ba2..c5c226a41b 100644 --- a/ext/opencv/edgedetect/gstedgedetect.c +++ b/ext/opencv/edgedetect/gstedgedetect.c @@ -316,8 +316,8 @@ gst_edgedetect_chain (GstPad * pad, GstBuffer * buf) * initialize the plug-in itself * register the element factories and other features */ -static gboolean -edgedetect_init (GstPlugin * edgedetect) +gboolean +gst_edgedetect_plugin_init (GstPlugin * plugin) { /* debug category for fltering log messages * @@ -326,22 +326,6 @@ edgedetect_init (GstPlugin * edgedetect) GST_DEBUG_CATEGORY_INIT (gst_edgedetect_debug, "edgedetect", 0, "Performs canny edge detection on videos and images"); - return gst_element_register (edgedetect, "edgedetect", GST_RANK_NONE, + return gst_element_register (plugin, "edgedetect", GST_RANK_NONE, GST_TYPE_EDGEDETECT); } - -/* gstreamer looks for this structure to register edgedetects - * - * exchange the string 'Template edgedetect' with your edgedetect description - */ -GST_PLUGIN_DEFINE ( - GST_VERSION_MAJOR, - GST_VERSION_MINOR, - "edgedetect", - "Performs canny edge detection on videos and images", - edgedetect_init, - VERSION, - "LGPL", - "GStreamer OpenCV Plugins", - "http://www.mikeasoft.com/" -) diff --git a/ext/opencv/edgedetect/gstedgedetect.h b/ext/opencv/edgedetect/gstedgedetect.h index 5931bf1b94..9d17632f84 100644 --- a/ext/opencv/edgedetect/gstedgedetect.h +++ b/ext/opencv/edgedetect/gstedgedetect.h @@ -86,6 +86,8 @@ struct _GstedgedetectClass GType gst_edgedetect_get_type (void); +gboolean gst_edgedetect_plugin_init (GstPlugin * plugin); + G_END_DECLS #endif /* __GST_EDGEDETECT_H__ */ diff --git a/ext/opencv/facedetect/Makefile.am b/ext/opencv/facedetect/Makefile.am index 21097eff2e..b0a91ee270 100644 --- a/ext/opencv/facedetect/Makefile.am +++ b/ext/opencv/facedetect/Makefile.am @@ -1,6 +1,6 @@ # plugindir is set in configure -plugin_LTLIBRARIES = libgstfacedetect.la +noinst_LTLIBRARIES = libgstfacedetect.la # sources used to compile this plug-in libgstfacedetect_la_SOURCES = gstfacedetect.c diff --git a/ext/opencv/facedetect/gstfacedetect.c b/ext/opencv/facedetect/gstfacedetect.c index 1e1af4ce9b..03d29b18a9 100644 --- a/ext/opencv/facedetect/gstfacedetect.c +++ b/ext/opencv/facedetect/gstfacedetect.c @@ -327,27 +327,13 @@ static void gst_facedetect_load_profile(Gstfacedetect * filter) { * initialize the plug-in itself * register the element factories and other features */ -static gboolean -facedetect_init (GstPlugin * facedetect) +gboolean +gst_facedetect_plugin_init (GstPlugin * plugin) { /* debug category for fltering log messages */ GST_DEBUG_CATEGORY_INIT (gst_facedetect_debug, "facedetect", 0, "Performs face detection on videos and images, providing detected positions via bus messages"); - return gst_element_register (facedetect, "facedetect", GST_RANK_NONE, + return gst_element_register (plugin, "facedetect", GST_RANK_NONE, GST_TYPE_FACEDETECT); } - - -/* gstreamer looks for this structure to register facedetect */ -GST_PLUGIN_DEFINE ( - GST_VERSION_MAJOR, - GST_VERSION_MINOR, - "facedetect", - "Performs face detection on videos and images, providing detected positions via bus messages", - facedetect_init, - VERSION, - "LGPL", - "GStreamer OpenCV Plugins", - "http://www.mikeasoft.com/" -) diff --git a/ext/opencv/facedetect/gstfacedetect.h b/ext/opencv/facedetect/gstfacedetect.h index 97e9e02fc6..6ca56a7676 100644 --- a/ext/opencv/facedetect/gstfacedetect.h +++ b/ext/opencv/facedetect/gstfacedetect.h @@ -88,6 +88,8 @@ struct _GstfacedetectClass GType gst_facedetect_get_type (void); +gboolean gst_facedetect_plugin_init (GstPlugin * plugin); + G_END_DECLS #endif /* __GST_FACEDETECT_H__ */ diff --git a/ext/opencv/gstopencv.c b/ext/opencv/gstopencv.c new file mode 100644 index 0000000000..8c0364791b --- /dev/null +++ b/ext/opencv/gstopencv.c @@ -0,0 +1,50 @@ +/* GStreamer + * Copyright (C) <2009> Kapil Agrawal + * + * gstopencv.c: plugin registering + * + * This library is free software; you can redistribute it and/or + * modify it under the terms of the GNU Library General Public + * License as published by the Free Software Foundation; either + * version 2 of the License, or (at your option) any later version. + * + * This library is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + * Library General Public License for more details. + * + * You should have received a copy of the GNU Library General Public + * License along with this library; if not, write to the + * Free Software Foundation, Inc., 59 Temple Place - Suite 330, + * Boston, MA 02111-1307, USA. + */ + +#ifdef HAVE_CONFIG_H +#include "config.h" +#endif + +#include "gstedgedetect.h" +#include "gstfacedetect.h" +#include "gstpyramidsegment.h" + +static gboolean +plugin_init (GstPlugin * plugin) +{ + + if (!gst_edgedetect_plugin_init (plugin)) + return FALSE; + + if (!gst_facedetect_plugin_init (plugin)) + return FALSE; + + if (!gst_pyramidsegment_plugin_init (plugin)) + return FALSE; + + return TRUE; +} + +GST_PLUGIN_DEFINE (GST_VERSION_MAJOR, + GST_VERSION_MINOR, + "opencv", + "GStreamer OpenCV Plugins", + plugin_init, VERSION, "LGPL", "OpenCv", "http://opencv.willowgarage.com") diff --git a/ext/opencv/pyramidsegment/Makefile.am b/ext/opencv/pyramidsegment/Makefile.am index e55de2d536..7c4a69158f 100644 --- a/ext/opencv/pyramidsegment/Makefile.am +++ b/ext/opencv/pyramidsegment/Makefile.am @@ -1,6 +1,4 @@ -# plugindir is set in configure - -plugin_LTLIBRARIES = libgstpyramidsegment.la +noinst_LTLIBRARIES = libgstpyramidsegment.la # sources used to compile this plug-in libgstpyramidsegment_la_SOURCES = gstpyramidsegment.c diff --git a/ext/opencv/pyramidsegment/gstpyramidsegment.c b/ext/opencv/pyramidsegment/gstpyramidsegment.c index 811baead20..77afa0f305 100644 --- a/ext/opencv/pyramidsegment/gstpyramidsegment.c +++ b/ext/opencv/pyramidsegment/gstpyramidsegment.c @@ -308,26 +308,13 @@ gst_pyramidsegment_chain (GstPad * pad, GstBuffer * buf) * initialize the plug-in itself * register the element factories and other features */ -static gboolean -pyramidsegment_init (GstPlugin * pyramidsegment) +gboolean +gst_pyramidsegment_plugin_init (GstPlugin * plugin) { /* debug category for fltering log messages */ GST_DEBUG_CATEGORY_INIT (gst_pyramidsegment_debug, "pyramidsegment", 0, "Applies pyramid segmentation to a video or image"); - return gst_element_register (pyramidsegment, "pyramidsegment", GST_RANK_NONE, + return gst_element_register (plugin, "pyramidsegment", GST_RANK_NONE, GST_TYPE_PYRAMIDSEGMENT); } - -/* gstreamer looks for this structure to register pyramidsegment */ -GST_PLUGIN_DEFINE ( - GST_VERSION_MAJOR, - GST_VERSION_MINOR, - "pyramidsegment", - "Applies pyramid segmentation to a video or image", - pyramidsegment_init, - VERSION, - "LGPL", - "GStreamer OpenCV Plugins", - "http://www.mikeasoft.com" -) diff --git a/ext/opencv/pyramidsegment/gstpyramidsegment.h b/ext/opencv/pyramidsegment/gstpyramidsegment.h index d083a62381..5a04d81bbc 100644 --- a/ext/opencv/pyramidsegment/gstpyramidsegment.h +++ b/ext/opencv/pyramidsegment/gstpyramidsegment.h @@ -92,6 +92,8 @@ struct _GstpyramidsegmentClass GType gst_pyramidsegment_get_type (void); +gboolean gst_pyramidsegment_plugin_init (GstPlugin * plugin); + G_END_DECLS #endif /* __GST_PYRAMIDSEGMENT_H__ */