motioncells: turn two global vars into static variables
authorStefan Sauer <ensonic@google.com>
Thu, 4 Aug 2011 11:33:20 +0000 (13:33 +0200)
committerStefan Sauer <ensonic@google.com>
Thu, 4 Aug 2011 11:36:05 +0000 (13:36 +0200)
Move 2 variable to motioncells_warpper and make them static.

ext/opencv/gstmotioncells.c
ext/opencv/motioncells_wrapper.cpp
ext/opencv/motioncells_wrapper.h

index a349bcac1d562af28df7565624b636053c5ddafb..71b41c350a744035a740a023e440fc77951ae85d 100644 (file)
@@ -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);
 
 }
index b768f9ece98727af8ed1ade90c7f03d55b6580aa..d50968677415dd7d72307ae5da1a9b1425bcb4c8 100644 (file)
 #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
index 0feaafa8bdc5b08ac05bacd3f76d9f65cc3778d7..470bcfbe42478922446c89bf5d7636e72f1b9c65 100644 (file)
@@ -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,