summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorStefan Sauer <ensonic@google.com>2011-08-04 13:33:20 +0200
committerStefan Sauer <ensonic@google.com>2011-08-04 13:36:05 +0200
commitf241dafe5c55c02d81f153de2a59e0a83d12d1c9 (patch)
treefc9567b1190372ec01e241ee2f578b48a388a54e
parent3d86389e068c05db54512f7e0365b9fac7030bf7 (diff)
motioncells: turn two global vars into static variables
Move 2 variable to motioncells_warpper and make them static.
-rw-r--r--ext/opencv/gstmotioncells.c6
-rw-r--r--ext/opencv/motioncells_wrapper.cpp8
-rw-r--r--ext/opencv/motioncells_wrapper.h2
3 files changed, 7 insertions, 9 deletions
diff --git a/ext/opencv/gstmotioncells.c b/ext/opencv/gstmotioncells.c
index a349bcac1..71b41c350 100644
--- a/ext/opencv/gstmotioncells.c
+++ b/ext/opencv/gstmotioncells.c
@@ -105,9 +105,6 @@ GST_DEBUG_CATEGORY_STATIC (gst_motion_cells_debug);
POINTER = NULL;\
}
-int instanceCounter = 0;
-gboolean element_id_was_max = false;
-
/* Filter signals and args */
enum
{
@@ -396,8 +393,7 @@ gst_motion_cells_init (GstMotioncells * filter, GstMotioncellsClass * gclass)
filter->datafileidx = 0;
g_mutex_lock (filter->propset_mutex);
- filter->id = instanceCounter;
- motion_cells_init ();
+ filter->id = motion_cells_init ();
g_mutex_unlock (filter->propset_mutex);
}
diff --git a/ext/opencv/motioncells_wrapper.cpp b/ext/opencv/motioncells_wrapper.cpp
index b768f9ece..d50968677 100644
--- a/ext/opencv/motioncells_wrapper.cpp
+++ b/ext/opencv/motioncells_wrapper.cpp
@@ -46,12 +46,13 @@
#include <limits.h>
#include "motioncells_wrapper.h"
-extern int instanceCounter;
-extern bool element_id_was_max;
+static int instanceCounter = 0;
+static gboolean element_id_was_max = false;
+
MotionCells *mc;
char p_str[] = "idx failed";
-void
+int
motion_cells_init ()
{
mc = new MotionCells ();
@@ -67,6 +68,7 @@ motion_cells_init ()
instanceCounter = motioncellsfreeids.back ();
motioncellsfreeids.pop_back ();
}
+ return tmpmc.id;
}
int
diff --git a/ext/opencv/motioncells_wrapper.h b/ext/opencv/motioncells_wrapper.h
index 0feaafa8b..470bcfbe4 100644
--- a/ext/opencv/motioncells_wrapper.h
+++ b/ext/opencv/motioncells_wrapper.h
@@ -62,7 +62,7 @@ extern "C"
{
#endif
- void motion_cells_init ();
+ int motion_cells_init ();
int perform_detection_motion_cells (IplImage * p_image, double p_sensitivity,
double p_framerate, int p_gridx, int p_gridy,
long int p_timestamp_millisec, bool p_isVisible, bool p_useAlpha,