summaryrefslogtreecommitdiff
path: root/ext
diff options
context:
space:
mode:
authorPhilippe Renon <philippe_renon@yahoo.fr>2016-11-10 18:42:29 +0100
committerLuis de Bethencourt <luisbg@osg.samsung.com>2016-11-14 18:25:57 +0000
commit5594c7e53eb95f93cbecac33b83609e70d7a3ce5 (patch)
tree19c865c4dd8d1771b3090e1c9649aca4adef5c9a /ext
parent2121e99dc84f1b4f4f1c9191e907903a1a8bf6cb (diff)
downloadgstreamer-plugins-bad-5594c7e53eb95f93cbecac33b83609e70d7a3ce5.tar.gz
opencv: move base opencv filter class and utilities to gst-libs
https://bugzilla.gnome.org/show_bug.cgi?id=774223
Diffstat (limited to 'ext')
-rw-r--r--ext/opencv/Makefile.am15
-rw-r--r--ext/opencv/gstcvdilateerode.cpp2
-rw-r--r--ext/opencv/gstcvdilateerode.h2
-rw-r--r--ext/opencv/gstcvequalizehist.h2
-rw-r--r--ext/opencv/gstcvlaplace.h2
-rw-r--r--ext/opencv/gstcvsmooth.cpp2
-rw-r--r--ext/opencv/gstcvsmooth.h2
-rw-r--r--ext/opencv/gstcvsobel.h2
-rw-r--r--ext/opencv/gstedgedetect.h2
-rw-r--r--ext/opencv/gstfaceblur.h2
-rw-r--r--ext/opencv/gstfacedetect.h2
-rw-r--r--ext/opencv/gsthanddetect.h2
-rw-r--r--ext/opencv/gstmotioncells.h2
-rw-r--r--ext/opencv/gstopencvutils.cpp106
-rw-r--r--ext/opencv/gstopencvutils.h42
-rw-r--r--ext/opencv/gstopencvvideofilter.cpp317
-rw-r--r--ext/opencv/gstopencvvideofilter.h106
-rw-r--r--ext/opencv/gstretinex.h2
-rw-r--r--ext/opencv/gstskindetect.h2
-rw-r--r--ext/opencv/gsttemplatematch.h2
-rw-r--r--ext/opencv/gsttextoverlay.h2
21 files changed, 25 insertions, 593 deletions
diff --git a/ext/opencv/Makefile.am b/ext/opencv/Makefile.am
index 360d4abd2..02a77ea62 100644
--- a/ext/opencv/Makefile.am
+++ b/ext/opencv/Makefile.am
@@ -2,8 +2,6 @@ plugin_LTLIBRARIES = libgstopencv.la
# sources used to compile this plug-in
libgstopencv_la_SOURCES = gstopencv.cpp \
- gstopencvvideofilter.cpp \
- gstopencvutils.cpp \
gstcvdilate.cpp \
gstcvdilateerode.cpp \
gstcvequalizehist.cpp \
@@ -26,7 +24,10 @@ libgstopencv_la_SOURCES = gstopencv.cpp \
motioncells_wrapper.cpp \
MotionCells.cpp
-libgstopencv_la_CXXFLAGS = $(GST_PLUGINS_BASE_CFLAGS) $(GST_BASE_CFLAGS) $(GST_CXXFLAGS) $(OPENCV_CFLAGS) \
+libgstopencv_la_CXXFLAGS = \
+ -I$(top_srcdir)/gst-libs \
+ -I$(top_builddir)/gst-libs \
+ $(GST_PLUGINS_BASE_CFLAGS) $(GST_BASE_CFLAGS) $(GST_CXXFLAGS) $(OPENCV_CFLAGS) \
-DGST_HAAR_CASCADES_DIR=\"$(pkgdatadir)/@GST_API_VERSION@/opencv_haarcascades\"
# flags used to compile this facedetect
@@ -39,14 +40,16 @@ libgstopencv_la_CFLAGS = $(GST_PLUGINS_BASE_CFLAGS) $(GST_BASE_CFLAGS) \
-DCV_INLINE="static inline" \
-DCV_NO_BACKWARD_COMPATIBILITY
-libgstopencv_la_LIBADD = $(GST_LIBS) $(GST_BASE_LIBS) $(OPENCV_LIBS) \
- $(GSTPB_BASE_LIBS) -lgstvideo-$(GST_API_VERSION)
+libgstopencv_la_LIBADD = \
+ $(top_builddir)/gst-libs/gst/opencv/libgstopencv-$(GST_API_VERSION).la \
+ $(GST_LIBS) $(GST_BASE_LIBS) $(OPENCV_LIBS) \
+ $(GSTPB_BASE_LIBS) -lgstvideo-$(GST_API_VERSION)
libgstopencv_la_LDFLAGS = $(GST_PLUGIN_LDFLAGS)
libgstopencv_la_LIBTOOLFLAGS = $(GST_PLUGIN_LIBTOOLFLAGS)
# headers we need but don't want installed
-noinst_HEADERS = gstopencvvideofilter.h gstopencvutils.h \
+noinst_HEADERS = \
gstcvdilateerode.h \
gstcvdilate.h \
gstcvequalizehist.h \
diff --git a/ext/opencv/gstcvdilateerode.cpp b/ext/opencv/gstcvdilateerode.cpp
index 69a4169e8..f12c9915b 100644
--- a/ext/opencv/gstcvdilateerode.cpp
+++ b/ext/opencv/gstcvdilateerode.cpp
@@ -50,7 +50,7 @@
# include <config.h>
#endif
-#include "gstopencvutils.h"
+#include "gst/opencv/gstopencvutils.h"
#include "gstcvdilateerode.h"
/*
diff --git a/ext/opencv/gstcvdilateerode.h b/ext/opencv/gstcvdilateerode.h
index bd2aa7c24..69bccdb3f 100644
--- a/ext/opencv/gstcvdilateerode.h
+++ b/ext/opencv/gstcvdilateerode.h
@@ -44,7 +44,7 @@
#ifndef __GST_CV_DILATE_ERODE_H__
#define __GST_CV_DILATE_ERODE_H__
-#include <gstopencvvideofilter.h>
+#include <gst/opencv/gstopencvvideofilter.h>
G_BEGIN_DECLS
diff --git a/ext/opencv/gstcvequalizehist.h b/ext/opencv/gstcvequalizehist.h
index c185994b8..6c58c0125 100644
--- a/ext/opencv/gstcvequalizehist.h
+++ b/ext/opencv/gstcvequalizehist.h
@@ -44,7 +44,7 @@
#ifndef __GST_CV_EQUALIZE_HIST_H__
#define __GST_CV_EQUALIZE_HIST_H__
-#include <gstopencvvideofilter.h>
+#include <gst/opencv/gstopencvvideofilter.h>
G_BEGIN_DECLS
diff --git a/ext/opencv/gstcvlaplace.h b/ext/opencv/gstcvlaplace.h
index 82f237f34..7163695c9 100644
--- a/ext/opencv/gstcvlaplace.h
+++ b/ext/opencv/gstcvlaplace.h
@@ -44,7 +44,7 @@
#ifndef __GST_CV_LAPLACE_H__
#define __GST_CV_LAPLACE_H__
-#include <gstopencvvideofilter.h>
+#include <gst/opencv/gstopencvvideofilter.h>
G_BEGIN_DECLS
diff --git a/ext/opencv/gstcvsmooth.cpp b/ext/opencv/gstcvsmooth.cpp
index f9a8a02bb..72c6f4241 100644
--- a/ext/opencv/gstcvsmooth.cpp
+++ b/ext/opencv/gstcvsmooth.cpp
@@ -58,7 +58,7 @@
# include <config.h>
#endif
-#include "gstopencvutils.h"
+#include "gst/opencv/gstopencvutils.h"
#include "gstcvsmooth.h"
#include <opencv2/imgproc/imgproc.hpp>
diff --git a/ext/opencv/gstcvsmooth.h b/ext/opencv/gstcvsmooth.h
index 7c74fbd57..237f76ee5 100644
--- a/ext/opencv/gstcvsmooth.h
+++ b/ext/opencv/gstcvsmooth.h
@@ -44,7 +44,7 @@
#ifndef __GST_CV_SMOOTH_H__
#define __GST_CV_SMOOTH_H__
-#include <gstopencvvideofilter.h>
+#include <gst/opencv/gstopencvvideofilter.h>
G_BEGIN_DECLS
diff --git a/ext/opencv/gstcvsobel.h b/ext/opencv/gstcvsobel.h
index 62cabab4a..ffe78d81a 100644
--- a/ext/opencv/gstcvsobel.h
+++ b/ext/opencv/gstcvsobel.h
@@ -44,7 +44,7 @@
#ifndef __GST_CV_SOBEL_H__
#define __GST_CV_SOBEL_H__
-#include <gstopencvvideofilter.h>
+#include <gst/opencv/gstopencvvideofilter.h>
G_BEGIN_DECLS
diff --git a/ext/opencv/gstedgedetect.h b/ext/opencv/gstedgedetect.h
index 0472c5db5..ff6226689 100644
--- a/ext/opencv/gstedgedetect.h
+++ b/ext/opencv/gstedgedetect.h
@@ -46,7 +46,7 @@
#ifndef __GST_EDGE_DETECT_H__
#define __GST_EDGE_DETECT_H__
-#include <gstopencvvideofilter.h>
+#include <gst/opencv/gstopencvvideofilter.h>
#include <opencv2/core/core_c.h>
G_BEGIN_DECLS
diff --git a/ext/opencv/gstfaceblur.h b/ext/opencv/gstfaceblur.h
index 9c86e1bdb..732276d44 100644
--- a/ext/opencv/gstfaceblur.h
+++ b/ext/opencv/gstfaceblur.h
@@ -50,7 +50,7 @@
#include <gst/gst.h>
#include <opencv2/core/version.hpp>
-#include "gstopencvvideofilter.h"
+#include <gst/opencv/gstopencvvideofilter.h>
#include <opencv2/objdetect/objdetect.hpp>
G_BEGIN_DECLS
diff --git a/ext/opencv/gstfacedetect.h b/ext/opencv/gstfacedetect.h
index 3c5acf364..03cf81c2e 100644
--- a/ext/opencv/gstfacedetect.h
+++ b/ext/opencv/gstfacedetect.h
@@ -51,7 +51,7 @@
#include <gst/gst.h>
#include <opencv2/core/version.hpp>
#include <cv.h>
-#include "gstopencvvideofilter.h"
+#include <gst/opencv/gstopencvvideofilter.h>
#include <opencv2/objdetect/objdetect.hpp>
G_BEGIN_DECLS
diff --git a/ext/opencv/gsthanddetect.h b/ext/opencv/gsthanddetect.h
index 39308c81e..1137c5aa9 100644
--- a/ext/opencv/gsthanddetect.h
+++ b/ext/opencv/gsthanddetect.h
@@ -47,7 +47,7 @@
#include <cv.h>
-#include "gstopencvvideofilter.h"
+#include <gst/opencv/gstopencvvideofilter.h>
/* opencv */
#include <opencv2/core/version.hpp>
#ifdef HAVE_HIGHGUI_H
diff --git a/ext/opencv/gstmotioncells.h b/ext/opencv/gstmotioncells.h
index da04a741a..00352cfab 100644
--- a/ext/opencv/gstmotioncells.h
+++ b/ext/opencv/gstmotioncells.h
@@ -45,7 +45,7 @@
#ifndef __GST_MOTIONCELLS_H__
#define __GST_MOTIONCELLS_H__
-#include <gstopencvvideofilter.h>
+#include <gst/opencv/gstopencvvideofilter.h>
#include <opencv2/core/core_c.h>
#include "motioncells_wrapper.h"
diff --git a/ext/opencv/gstopencvutils.cpp b/ext/opencv/gstopencvutils.cpp
deleted file mode 100644
index 640486be1..000000000
--- a/ext/opencv/gstopencvutils.cpp
+++ /dev/null
@@ -1,106 +0,0 @@
-/* GStreamer
- * Copyright (C) <2010> Thiago Santos <thiago.sousa.santos@collabora.co.uk>
- *
- * gstopencvutils.c: miscellaneous utility functions
- *
- * 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.
- */
-
-#ifdef HAVE_CONFIG_H
-#include "config.h"
-#endif
-
-#include "gstopencvutils.h"
-#include <opencv2/core/core_c.h>
-
-
-gboolean
-gst_opencv_parse_iplimage_params_from_caps (GstCaps * caps, gint * width,
- gint * height, gint * ipldepth, gint * channels, GError ** err)
-{
- GstVideoInfo info;
- gint depth = 0;
- guint i;
- gchar *caps_str;
-
- if (!gst_video_info_from_caps (&info, caps)) {
- GST_ERROR ("Failed to get the videoinfo from caps");
- g_set_error (err, GST_CORE_ERROR, GST_CORE_ERROR_NEGOTIATION,
- "No width/heighti/depth/channels in caps");
- return FALSE;
- }
-
- *width = GST_VIDEO_INFO_WIDTH (&info);
- *height = GST_VIDEO_INFO_HEIGHT (&info);
- if (GST_VIDEO_INFO_IS_RGB (&info))
- *channels = 3;
- else if (GST_VIDEO_INFO_IS_GRAY (&info))
- *channels = 1;
- else {
- caps_str = gst_caps_to_string (caps);
- g_set_error (err, GST_CORE_ERROR, GST_CORE_ERROR_NEGOTIATION,
- "Unsupported caps %s", caps_str);
- g_free (caps_str);
- return FALSE;
- }
-
- for (i = 0; i < GST_VIDEO_INFO_N_COMPONENTS (&info); i++)
- depth += GST_VIDEO_INFO_COMP_DEPTH (&info, i);
-
- if (depth / *channels == 8) {
- /* TODO signdness? */
- *ipldepth = IPL_DEPTH_8U;
- } else if (depth / *channels == 16) {
- *ipldepth = IPL_DEPTH_16U;
- } else {
- g_set_error (err, GST_CORE_ERROR, GST_CORE_ERROR_NEGOTIATION,
- "Unsupported depth/channels %d/%d", depth, *channels);
- return FALSE;
- }
- return TRUE;
-}
-
-GstCaps *
-gst_opencv_caps_from_cv_image_type (int cv_type)
-{
- GstCaps *c = gst_caps_new_empty ();
- switch (cv_type) {
- case CV_8UC1:
- gst_caps_append (c, gst_caps_from_string (GST_VIDEO_CAPS_MAKE ("GRAY8")));
- break;
- case CV_8UC3:
- gst_caps_append (c, gst_caps_from_string (GST_VIDEO_CAPS_MAKE ("RGB")));
- gst_caps_append (c, gst_caps_from_string (GST_VIDEO_CAPS_MAKE ("BGR")));
- break;
- case CV_8UC4:
- gst_caps_append (c, gst_caps_from_string (GST_VIDEO_CAPS_MAKE ("RGBx")));
- gst_caps_append (c, gst_caps_from_string (GST_VIDEO_CAPS_MAKE ("xRGB")));
- gst_caps_append (c, gst_caps_from_string (GST_VIDEO_CAPS_MAKE ("BGRx")));
- gst_caps_append (c, gst_caps_from_string (GST_VIDEO_CAPS_MAKE ("xBGR")));
- gst_caps_append (c, gst_caps_from_string (GST_VIDEO_CAPS_MAKE ("RGBA")));
- gst_caps_append (c, gst_caps_from_string (GST_VIDEO_CAPS_MAKE ("ARGB")));
- gst_caps_append (c, gst_caps_from_string (GST_VIDEO_CAPS_MAKE ("BGRA")));
- gst_caps_append (c, gst_caps_from_string (GST_VIDEO_CAPS_MAKE ("ABGR")));
- break;
- case CV_16UC1:
- gst_caps_append (c,
- gst_caps_from_string (GST_VIDEO_CAPS_MAKE ("GRAY16_LE")));
- gst_caps_append (c,
- gst_caps_from_string (GST_VIDEO_CAPS_MAKE ("GRAY16_BE")));
- break;
- }
- return c;
-}
diff --git a/ext/opencv/gstopencvutils.h b/ext/opencv/gstopencvutils.h
deleted file mode 100644
index 13dfd9e07..000000000
--- a/ext/opencv/gstopencvutils.h
+++ /dev/null
@@ -1,42 +0,0 @@
-/* GStreamer
- * Copyright (C) <2010> Thiago Santos <thiago.sousa.santos@collabora.co.uk>
- *
- * gstopencvutils.h: miscellaneous utility functions
- *
- * 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_OPENCV_UTILS__
-#define __GST_OPENCV_UTILS__
-
-#ifdef HAVE_CONFIG_H
-#include "config.h"
-#endif
-
-#include <gst/gst.h>
-#include <gst/video/video.h>
-
-
-G_BEGIN_DECLS
-
-gboolean gst_opencv_parse_iplimage_params_from_caps
- (GstCaps * caps, gint * width, gint * height, gint * depth,
- gint * channels, GError ** err);
-
-GstCaps * gst_opencv_caps_from_cv_image_type (int cv_type);
-G_END_DECLS
-
-#endif /* __GST_OPENCV_UTILS__ */
diff --git a/ext/opencv/gstopencvvideofilter.cpp b/ext/opencv/gstopencvvideofilter.cpp
deleted file mode 100644
index 4b8e53670..000000000
--- a/ext/opencv/gstopencvvideofilter.cpp
+++ /dev/null
@@ -1,317 +0,0 @@
-/*
- * GStreamer
- * Copyright (C) 2010 Thiago Santos <thiago.sousa.santos@collabora.co.uk>
- *
- * 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.
- */
-
-/* TODO opencv can do scaling for some cases */
-
-#ifdef HAVE_CONFIG_H
-# include <config.h>
-#endif
-
-#include "gstopencvvideofilter.h"
-#include "gstopencvutils.h"
-
-GST_DEBUG_CATEGORY_STATIC (gst_opencv_video_filter_debug);
-#define GST_CAT_DEFAULT gst_opencv_video_filter_debug
-
-/* Filter signals and args */
-enum
-{
- /* FILL ME */
- LAST_SIGNAL
-};
-
-enum
-{
- PROP_0
-};
-
-static GstElementClass *parent_class = NULL;
-
-static void gst_opencv_video_filter_class_init (GstOpencvVideoFilterClass *
- klass);
-static void gst_opencv_video_filter_init (GstOpencvVideoFilter * trans,
- GstOpencvVideoFilterClass * klass);
-
-static gboolean gst_opencv_video_filter_set_caps (GstBaseTransform * trans,
- GstCaps * incaps, GstCaps * outcaps);
-static GstFlowReturn gst_opencv_video_filter_transform_ip (GstBaseTransform *
- trans, GstBuffer * buf);
-static GstFlowReturn gst_opencv_video_filter_transform (GstBaseTransform *
- trans, GstBuffer * inbuf, GstBuffer * outbuf);
-
-static void gst_opencv_video_filter_set_property (GObject * object,
- guint prop_id, const GValue * value, GParamSpec * pspec);
-static void gst_opencv_video_filter_get_property (GObject * object,
- guint prop_id, GValue * value, GParamSpec * pspec);
-
-GType
-gst_opencv_video_filter_get_type (void)
-{
- static volatile gsize opencv_base_transform_type = 0;
-
- if (g_once_init_enter (&opencv_base_transform_type)) {
- GType _type;
- static const GTypeInfo opencv_base_transform_info = {
- sizeof (GstOpencvVideoFilterClass),
- NULL,
- NULL,
- (GClassInitFunc) gst_opencv_video_filter_class_init,
- NULL,
- NULL,
- sizeof (GstOpencvVideoFilter),
- 0,
- (GInstanceInitFunc) gst_opencv_video_filter_init,
- };
-
- _type = g_type_register_static (GST_TYPE_VIDEO_FILTER,
- "GstOpencvVideoFilter", &opencv_base_transform_info,
- G_TYPE_FLAG_ABSTRACT);
- g_once_init_leave (&opencv_base_transform_type, _type);
- }
- return opencv_base_transform_type;
-}
-
-/* Clean up */
-static void
-gst_opencv_video_filter_finalize (GObject * obj)
-{
- GstOpencvVideoFilter *transform = GST_OPENCV_VIDEO_FILTER (obj);
-
- if (transform->cvImage)
- cvReleaseImage (&transform->cvImage);
- if (transform->out_cvImage)
- cvReleaseImage (&transform->out_cvImage);
-
- G_OBJECT_CLASS (parent_class)->finalize (obj);
-}
-
-static void
-gst_opencv_video_filter_class_init (GstOpencvVideoFilterClass * klass)
-{
- GObjectClass *gobject_class;
- GstBaseTransformClass *basetrans_class;
-
- gobject_class = (GObjectClass *) klass;
- basetrans_class = (GstBaseTransformClass *) klass;
- parent_class = (GstElementClass *) g_type_class_peek_parent (klass);
-
- GST_DEBUG_CATEGORY_INIT (gst_opencv_video_filter_debug,
- "opencvbasetransform", 0, "opencvbasetransform element");
-
- gobject_class->finalize =
- GST_DEBUG_FUNCPTR (gst_opencv_video_filter_finalize);
- gobject_class->set_property = gst_opencv_video_filter_set_property;
- gobject_class->get_property = gst_opencv_video_filter_get_property;
-
- basetrans_class->transform = gst_opencv_video_filter_transform;
- basetrans_class->transform_ip = gst_opencv_video_filter_transform_ip;
- basetrans_class->set_caps = gst_opencv_video_filter_set_caps;
-}
-
-static void
-gst_opencv_video_filter_init (GstOpencvVideoFilter * transform,
- GstOpencvVideoFilterClass * klass)
-{
-}
-
-static GstFlowReturn
-gst_opencv_video_filter_transform (GstBaseTransform * trans,
- GstBuffer * inbuf, GstBuffer * outbuf)
-{
- GstOpencvVideoFilter *transform;
- GstOpencvVideoFilterClass *fclass;
- GstMapInfo in_info;
- GstMapInfo out_info;
- GstFlowReturn ret;
-
- transform = GST_OPENCV_VIDEO_FILTER (trans);
- fclass = GST_OPENCV_VIDEO_FILTER_GET_CLASS (transform);
-
- g_return_val_if_fail (fclass->cv_trans_func != NULL, GST_FLOW_ERROR);
- g_return_val_if_fail (transform->cvImage != NULL, GST_FLOW_ERROR);
- g_return_val_if_fail (transform->out_cvImage != NULL, GST_FLOW_ERROR);
-
- if (!gst_buffer_map (inbuf, &in_info, GST_MAP_READ))
- goto inbuf_map_failed;
-
- if (!gst_buffer_map (outbuf, &out_info, GST_MAP_WRITE))
- goto outbuf_map_failed;
-
- transform->cvImage->imageData = (char *) in_info.data;
- transform->out_cvImage->imageData = (char *) out_info.data;
-
- ret = fclass->cv_trans_func (transform, inbuf, transform->cvImage, outbuf,
- transform->out_cvImage);
-
- gst_buffer_unmap (inbuf, &in_info);
- gst_buffer_unmap (outbuf, &out_info);
-
- return ret;
-
-inbuf_map_failed:
- GST_ELEMENT_ERROR (transform, RESOURCE, READ,
- ("Failed to map buffer for reading"), (NULL));
- return GST_FLOW_ERROR;
-
-outbuf_map_failed:
- GST_ELEMENT_ERROR (transform, RESOURCE, WRITE,
- ("Failed to map buffer for writing"), (NULL));
- gst_buffer_unmap (inbuf, &in_info);
- return GST_FLOW_ERROR;
-}
-
-static GstFlowReturn
-gst_opencv_video_filter_transform_ip (GstBaseTransform * trans,
- GstBuffer * buffer)
-{
- GstOpencvVideoFilter *transform;
- GstOpencvVideoFilterClass *fclass;
- GstMapInfo info;
- GstFlowReturn ret;
-
- transform = GST_OPENCV_VIDEO_FILTER (trans);
- fclass = GST_OPENCV_VIDEO_FILTER_GET_CLASS (transform);
-
- g_return_val_if_fail (fclass->cv_trans_ip_func != NULL, GST_FLOW_ERROR);
- g_return_val_if_fail (transform->cvImage != NULL, GST_FLOW_ERROR);
-
- if (!gst_buffer_map (buffer, &info, (GstMapFlags) (GST_MAP_READWRITE)))
- goto map_failed;
-
- transform->cvImage->imageData = (char *) info.data;
-
- ret = fclass->cv_trans_ip_func (transform, buffer, transform->cvImage);
-
- gst_buffer_unmap (buffer, &info);
-
- return ret;
-
-map_failed:
- GST_ELEMENT_ERROR (transform, RESOURCE, WRITE,
- ("Failed to map buffer for reading and writing"), (NULL));
- return GST_FLOW_ERROR;
-}
-
-static gboolean
-gst_opencv_video_filter_set_caps (GstBaseTransform * trans, GstCaps * incaps,
- GstCaps * outcaps)
-{
- GstOpencvVideoFilter *transform = GST_OPENCV_VIDEO_FILTER (trans);
- GstOpencvVideoFilterClass *klass =
- GST_OPENCV_VIDEO_FILTER_GET_CLASS (transform);
- gint in_width, in_height;
- gint in_depth, in_channels;
- gint out_width, out_height;
- gint out_depth, out_channels;
- GError *in_err = NULL;
- GError *out_err = NULL;
-
- if (!gst_opencv_parse_iplimage_params_from_caps (incaps, &in_width,
- &in_height, &in_depth, &in_channels, &in_err)) {
- GST_WARNING_OBJECT (transform, "Failed to parse input caps: %s",
- in_err->message);
- g_error_free (in_err);
- return FALSE;
- }
-
- if (!gst_opencv_parse_iplimage_params_from_caps (outcaps, &out_width,
- &out_height, &out_depth, &out_channels, &out_err)) {
- GST_WARNING_OBJECT (transform, "Failed to parse output caps: %s",
- out_err->message);
- g_error_free (out_err);
- return FALSE;
- }
-
- if (klass->cv_set_caps) {
- if (!klass->cv_set_caps (transform, in_width, in_height, in_depth,
- in_channels, out_width, out_height, out_depth, out_channels))
- return FALSE;
- }
-
- if (transform->cvImage) {
- cvReleaseImage (&transform->cvImage);
- }
- if (transform->out_cvImage) {
- cvReleaseImage (&transform->out_cvImage);
- }
-
- transform->cvImage =
- cvCreateImageHeader (cvSize (in_width, in_height), in_depth, in_channels);
- transform->out_cvImage =
- cvCreateImageHeader (cvSize (out_width, out_height), out_depth,
- out_channels);
-
- gst_base_transform_set_in_place (GST_BASE_TRANSFORM (transform),
- transform->in_place);
- return TRUE;
-}
-
-static void
-gst_opencv_video_filter_set_property (GObject * object, guint prop_id,
- const GValue * value, GParamSpec * pspec)
-{
- switch (prop_id) {
- default:
- G_OBJECT_WARN_INVALID_PROPERTY_ID (object, prop_id, pspec);
- break;
- }
-}
-
-static void
-gst_opencv_video_filter_get_property (GObject * object, guint prop_id,
- GValue * value, GParamSpec * pspec)
-{
- switch (prop_id) {
- default:
- G_OBJECT_WARN_INVALID_PROPERTY_ID (object, prop_id, pspec);
- break;
- }
-}
-
-void
-gst_opencv_video_filter_set_in_place (GstOpencvVideoFilter * transform,
- gboolean ip)
-{
- transform->in_place = ip;
- gst_base_transform_set_in_place (GST_BASE_TRANSFORM (transform), ip);
-}
diff --git a/ext/opencv/gstopencvvideofilter.h b/ext/opencv/gstopencvvideofilter.h
deleted file mode 100644
index 7fbafe932..000000000
--- a/ext/opencv/gstopencvvideofilter.h
+++ /dev/null
@@ -1,106 +0,0 @@
-/*
- * GStreamer
- * Copyright (C) 2010 Thiago Santos <thiago.sousa.santos@collabora.co.uk>
- *
- * 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_OPENCV_VIDEO_FILTER_H__
-#define __GST_OPENCV_VIDEO_FILTER_H__
-
-#include <gst/gst.h>
-#include <gst/video/gstvideofilter.h>
-#include <opencv2/core/core_c.h>
-
-G_BEGIN_DECLS
-/* #defines don't like whitespacey bits */
-#define GST_TYPE_OPENCV_VIDEO_FILTER \
- (gst_opencv_video_filter_get_type())
-#define GST_OPENCV_VIDEO_FILTER(obj) \
- (G_TYPE_CHECK_INSTANCE_CAST((obj),GST_TYPE_OPENCV_VIDEO_FILTER,GstOpencvVideoFilter))
-#define GST_OPENCV_VIDEO_FILTER_CLASS(klass) \
- (G_TYPE_CHECK_CLASS_CAST((klass),GST_TYPE_OPENCV_VIDEO_FILTER,GstOpencvVideoFilterClass))
-#define GST_IS_OPENCV_VIDEO_FILTER(obj) \
- (G_TYPE_CHECK_INSTANCE_TYPE((obj),GST_TYPE_OPENCV_VIDEO_FILTER))
-#define GST_IS_OPENCV_VIDEO_FILTER_CLASS(klass) \
- (G_TYPE_CHECK_CLASS_TYPE((klass),GST_TYPE_OPENCV_VIDEO_FILTER))
-#define GST_OPENCV_VIDEO_FILTER_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS((obj),GST_TYPE_OPENCV_VIDEO_FILTER,GstOpencvVideoFilterClass))
-#define GST_OPENCV_VIDEO_FILTER_CAST(obj) ((GstOpencvVideoFilter *) (obj))
-
-typedef struct _GstOpencvVideoFilter GstOpencvVideoFilter;
-typedef struct _GstOpencvVideoFilterClass GstOpencvVideoFilterClass;
-
-typedef GstFlowReturn (*GstOpencvVideoFilterTransformIPFunc)
- (GstOpencvVideoFilter * transform, GstBuffer * buffer, IplImage * img);
-typedef GstFlowReturn (*GstOpencvVideoFilterTransformFunc)
- (GstOpencvVideoFilter * transform, GstBuffer * buffer, IplImage * img,
- GstBuffer * outbuf, IplImage * outimg);
-
-typedef gboolean (*GstOpencvVideoFilterSetCaps)
- (GstOpencvVideoFilter * transform, gint in_width, gint in_height,
- gint in_depth, gint in_channels, gint out_width, gint out_height,
- gint out_depth, gint out_channels);
-
-struct _GstOpencvVideoFilter
-{
- GstVideoFilter trans;
-
- gboolean in_place;
-
- IplImage *cvImage;
- IplImage *out_cvImage;
-};
-
-struct _GstOpencvVideoFilterClass
-{
- GstVideoFilterClass parent_class;
-
- GstOpencvVideoFilterTransformFunc cv_trans_func;
- GstOpencvVideoFilterTransformIPFunc cv_trans_ip_func;
-
- GstOpencvVideoFilterSetCaps cv_set_caps;
-};
-
-GType gst_opencv_video_filter_get_type (void);
-
-void gst_opencv_video_filter_set_in_place (GstOpencvVideoFilter * transform,
- gboolean ip);
-
-G_END_DECLS
-#endif /* __GST_OPENCV_VIDEO_FILTER_H__ */
diff --git a/ext/opencv/gstretinex.h b/ext/opencv/gstretinex.h
index d090a5b8f..54c0ef97e 100644
--- a/ext/opencv/gstretinex.h
+++ b/ext/opencv/gstretinex.h
@@ -46,7 +46,7 @@
#include <opencv2/core/core_c.h>
-#include <gstopencvvideofilter.h>
+#include <gst/opencv/gstopencvvideofilter.h>
G_BEGIN_DECLS
/* #defines don't like whitespacey bits */
diff --git a/ext/opencv/gstskindetect.h b/ext/opencv/gstskindetect.h
index a9c548d05..2337c6a31 100644
--- a/ext/opencv/gstskindetect.h
+++ b/ext/opencv/gstskindetect.h
@@ -46,7 +46,7 @@
#ifndef __GST_SKIN_DETECT_H__
#define __GST_SKIN_DETECT_H__
-#include <gstopencvvideofilter.h>
+#include <gst/opencv/gstopencvvideofilter.h>
G_BEGIN_DECLS
/* #defines don't like whitespacey bits */
diff --git a/ext/opencv/gsttemplatematch.h b/ext/opencv/gsttemplatematch.h
index e7c020203..f27d9f3dd 100644
--- a/ext/opencv/gsttemplatematch.h
+++ b/ext/opencv/gsttemplatematch.h
@@ -46,7 +46,7 @@
#ifndef __GST_TEMPLATE_MATCH_H__
#define __GST_TEMPLATE_MATCH_H__
-#include <gstopencvvideofilter.h>
+#include <gst/opencv/gstopencvvideofilter.h>
#ifdef HAVE_HIGHGUI_H
#include <highgui.h> // includes highGUI definitions
diff --git a/ext/opencv/gsttextoverlay.h b/ext/opencv/gsttextoverlay.h
index 13d09fa96..794cd7973 100644
--- a/ext/opencv/gsttextoverlay.h
+++ b/ext/opencv/gsttextoverlay.h
@@ -46,7 +46,7 @@
#ifndef __GST_OPENCV_TEXT_OVERLAY_H__
#define __GST_OPENCV_TEXT_OVERLAY_H__
-#include <gstopencvvideofilter.h>
+#include <gst/opencv/gstopencvvideofilter.h>
#include <opencv2/core/core_c.h>
#if (CV_MAJOR_VERSION >= 3)
#include <opencv2/imgproc/imgproc_c.h>