From 466966ff6c0ce420837b418d37bf66a2db7e327f Mon Sep 17 00:00:00 2001 From: Luis de Bethencourt Date: Sun, 11 Oct 2015 21:54:30 +0100 Subject: [PATCH] opencv: pyramidsegment: Switch to C++ Switch gstpyramidsegment to C++ for consistency with other OpenCV elements, and support of the new 2.4.11 API. https://bugzilla.gnome.org/show_bug.cgi?id=754148 --- ext/opencv/Makefile.am | 2 +- ...gstpyramidsegment.c => gstpyramidsegment.cpp} | 16 +++++++++------- 2 files changed, 10 insertions(+), 8 deletions(-) rename ext/opencv/{gstpyramidsegment.c => gstpyramidsegment.cpp} (95%) diff --git a/ext/opencv/Makefile.am b/ext/opencv/Makefile.am index 6776ad1c73..f1d65c85fe 100644 --- a/ext/opencv/Makefile.am +++ b/ext/opencv/Makefile.am @@ -14,7 +14,7 @@ libgstopencv_la_SOURCES = gstopencv.cpp \ gstedgedetect.cpp \ gstfaceblur.cpp \ gsthanddetect.cpp \ - gstpyramidsegment.c \ + gstpyramidsegment.cpp \ gsttemplatematch.c \ gsttextoverlay.c \ gstmotioncells.c \ diff --git a/ext/opencv/gstpyramidsegment.c b/ext/opencv/gstpyramidsegment.cpp similarity index 95% rename from ext/opencv/gstpyramidsegment.c rename to ext/opencv/gstpyramidsegment.cpp index 618ffdffbc..a8760ca598 100644 --- a/ext/opencv/gstpyramidsegment.c +++ b/ext/opencv/gstpyramidsegment.cpp @@ -3,7 +3,7 @@ * Copyright (C) 2005 Thomas Vander Stichele * Copyright (C) 2005 Ronald S. Bultje * Copyright (C) 2008 Michael Sheldon - * + * * 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 @@ -70,6 +70,7 @@ GST_DEBUG_CATEGORY_STATIC (gst_pyramid_segment_debug); #define GST_CAT_DEFAULT gst_pyramid_segment_debug +using namespace cv; /* Filter signals and args */ enum { @@ -144,22 +145,22 @@ gst_pyramid_segment_class_init (GstPyramidSegmentClass * klass) g_object_class_install_property (gobject_class, PROP_SILENT, g_param_spec_boolean ("silent", "Silent", "Produce verbose output ?", - FALSE, G_PARAM_READWRITE | G_PARAM_STATIC_STRINGS)); + FALSE, (GParamFlags) (G_PARAM_READWRITE | G_PARAM_STATIC_STRINGS))); g_object_class_install_property (gobject_class, PROP_THRESHOLD1, g_param_spec_double ("threshold1", "Threshold1", "Error threshold for establishing links", 0, 1000, 50, - G_PARAM_READWRITE | G_PARAM_STATIC_STRINGS)); + (GParamFlags) (G_PARAM_READWRITE | G_PARAM_STATIC_STRINGS))); g_object_class_install_property (gobject_class, PROP_THRESHOLD2, g_param_spec_double ("threshold2", "Threshold2", "Error threshold for segment clustering", 0, 1000, 60, - G_PARAM_READWRITE | G_PARAM_STATIC_STRINGS)); + (GParamFlags) (G_PARAM_READWRITE | G_PARAM_STATIC_STRINGS))); g_object_class_install_property (gobject_class, PROP_LEVEL, g_param_spec_int ("level", "Level", "Maximum level of the pyramid segmentation", 1, 4, 4, - G_PARAM_READWRITE | G_PARAM_STATIC_STRINGS)); + (GParamFlags) (G_PARAM_READWRITE | G_PARAM_STATIC_STRINGS))); gst_element_class_set_static_metadata (element_class, "pyramidsegment", @@ -302,7 +303,7 @@ gst_pyramid_segment_chain (GstPad * pad, GstObject * parent, GstBuffer * buf) filter = GST_PYRAMID_SEGMENT (GST_OBJECT_PARENT (pad)); buf = gst_buffer_make_writable (buf); - gst_buffer_map (buf, &info, GST_MAP_READWRITE); + gst_buffer_map (buf, &info, (GstMapFlags) GST_MAP_READWRITE); filter->cvImage->imageData = (char *) info.data; filter->cvSegmentedImage = cvCloneImage (filter->cvImage); @@ -313,7 +314,8 @@ gst_pyramid_segment_chain (GstPad * pad, GstObject * parent, GstBuffer * buf) * delete only the struct headers. Would avoid a memcpy here */ outbuf = gst_buffer_new_and_alloc (filter->cvSegmentedImage->imageSize); - gst_buffer_copy_into (outbuf, buf, GST_BUFFER_COPY_METADATA, 0, -1); + gst_buffer_copy_into (outbuf, buf, + (GstBufferCopyFlags) GST_BUFFER_COPY_METADATA, 0, -1); gst_buffer_map (outbuf, &outinfo, GST_MAP_WRITE); memcpy (outinfo.data, filter->cvSegmentedImage->imageData, gst_buffer_get_size (outbuf));