Gentoo Archives: gentoo-commits

From: "Andreas Hüttel" <dilfridge@g.o>
To: gentoo-commits@l.g.o
Subject: [gentoo-commits] dev/dilfridge:master commit in: media-video/zoneminder/files/, media-video/zoneminder/, ...
Date: Wed, 31 Aug 2011 17:09:36
Message-Id: 3fb67a9fa34ae8b749e3a7d3cf8291274ad4e36a.dilfridge@gentoo
1 commit: 3fb67a9fa34ae8b749e3a7d3cf8291274ad4e36a
2 Author: Andreas K. Huettel <andreas.huettel <AT> physik <DOT> uni-r <DOT> de>
3 AuthorDate: Wed Aug 31 17:08:48 2011 +0000
4 Commit: Andreas Hüttel <dilfridge <AT> gentoo <DOT> org>
5 CommitDate: Wed Aug 31 17:08:48 2011 +0000
6 URL: http://git.overlays.gentoo.org/gitweb/?p=dev/dilfridge.git;a=commit;h=3fb67a9f
7
8 [media-video/zoneminder] Imported from zugagina overlay
9
10 (Portage version: 2.1.10.11/git/Linux x86_64, RepoMan options: --force, signed Manifest commit with key 7887F787)
11
12 ---
13 media-video/zoneminder/ChangeLog | 19 +
14 media-video/zoneminder/Manifest | 36 +
15 .../zoneminder/files/1.24.4/Makefile.am.patch | 15 +
16 .../files/1.24.4/db_upgrade_script_location.patch | 11 +
17 .../files/1.24.4/zm_remote_camera_http.patch | 55 +
18 media-video/zoneminder/files/10_zoneminder.conf | 18 +
19 .../zoneminder/files/9999/Makefile.am.patch | 15 +
20 .../zoneminder/files/9999/cvisionlab-plugins.patch | 2259 ++++++++++++++++++++
21 .../files/9999/db_upgrade_script_location.patch | 11 +
22 .../files/9999/zm_remote_camera_http.patch | 55 +
23 .../9999/zoneminder-facedetector-plugin.tar.bz2 | Bin 0 -> 63945 bytes
24 media-video/zoneminder/files/conf.d | 6 +
25 media-video/zoneminder/files/init.d | 20 +
26 media-video/zoneminder/metadata.xml | 9 +
27 media-video/zoneminder/zoneminder-1.24.4.ebuild | 147 ++
28 media-video/zoneminder/zoneminder-9999.ebuild | 165 ++
29 16 files changed, 2841 insertions(+), 0 deletions(-)
30
31 diff --git a/media-video/zoneminder/ChangeLog b/media-video/zoneminder/ChangeLog
32 new file mode 100644
33 index 0000000..7c8eb66
34 --- /dev/null
35 +++ b/media-video/zoneminder/ChangeLog
36 @@ -0,0 +1,19 @@
37 +# ChangeLog for media-video/zoneminder
38 +# Copyright 1999-2011 Gentoo Foundation; Distributed under the GPL v2
39 +# $Header: $
40 +
41 +*zoneminder-9999 (31 Aug 2011)
42 +*zoneminder-1.24.4 (31 Aug 2011)
43 +
44 + 31 Aug 2011; Andreas K. Huettel <dilfridge@g.o>
45 + +files/1.24.4/Makefile.am.patch,
46 + +files/1.24.4/db_upgrade_script_location.patch,
47 + +files/1.24.4/zm_remote_camera_http.patch, +files/10_zoneminder.conf,
48 + +files/9999/Makefile.am.patch, +files/9999/cvisionlab-plugins.patch,
49 + +files/9999/db_upgrade_script_location.patch,
50 + +files/9999/zm_remote_camera_http.patch,
51 + +files/9999/zoneminder-facedetector-plugin.tar.bz2,
52 + +zoneminder-1.24.4.ebuild, +zoneminder-9999.ebuild, +files/conf.d,
53 + +files/init.d:
54 + Imported without changes from zugagina overlay
55 +
56
57 diff --git a/media-video/zoneminder/Manifest b/media-video/zoneminder/Manifest
58 new file mode 100644
59 index 0000000..f836cb5
60 --- /dev/null
61 +++ b/media-video/zoneminder/Manifest
62 @@ -0,0 +1,36 @@
63 +-----BEGIN PGP SIGNED MESSAGE-----
64 +Hash: SHA512
65 +
66 +AUX 1.24.4/Makefile.am.patch 1610 RMD160 f04f44a2773c9d66481db4597369058f955ed150 SHA1 2d7bc1294c9549127b2d57e41a1251fc53f3563d SHA256 d0446e2b957320e0a5c5eda0a782848001f73f52adfb89ff282b4bd5e161d358
67 +AUX 1.24.4/db_upgrade_script_location.patch 412 RMD160 368052be3fc8f32276cd59a146fd99a3b23b05f8 SHA1 a7a04bb212c0ca6ec693ca821d4c5de56b3e65c9 SHA256 3ffaa44c013dd27c3e5e937de77158c60b4cd37f28e1fc42dd7283f80075b067
68 +AUX 1.24.4/zm_remote_camera_http.patch 1566 RMD160 644a681789d0ecf424156cde4b4ea8f6c5065197 SHA1 74dbe274d129997826b9a775c672c28286b60e3f SHA256 f554f2bcc7977e5ac151bd87aa2b8a0b7a9eeb9099839afe0d8b2b60a37ce04e
69 +AUX 10_zoneminder.conf 462 RMD160 d032813c63f4676e06658da3668c50f88886efab SHA1 9c834372d5bab84fe3e368be94bd951c2122ed7a SHA256 96306fd39bcffeaf15db4309b8f5f08e54a2409029f92d4a84b6f3e42f05434f
70 +AUX 9999/Makefile.am.patch 1292 RMD160 59274d0bc7a01e42d0a2667ece7e5d1b2984e6be SHA1 60d6ea2de24fb2a72acaf5291e39d2e9aa3310f4 SHA256 81e49df5f7fd277e6264530e7e8ee2cfffa10c7781799a091e131265d74c1b7e
71 +AUX 9999/cvisionlab-plugins.patch 104381 RMD160 58013be56f1c6945f805b0629e452be6f2871f0d SHA1 cf868a45f3ce66dce1778c0c87e35528fa54f446 SHA256 7730da09668d9000dbc201a1562d1ca26dd52d99ef7b5adb9f716bb74e446fe8
72 +AUX 9999/db_upgrade_script_location.patch 412 RMD160 368052be3fc8f32276cd59a146fd99a3b23b05f8 SHA1 a7a04bb212c0ca6ec693ca821d4c5de56b3e65c9 SHA256 3ffaa44c013dd27c3e5e937de77158c60b4cd37f28e1fc42dd7283f80075b067
73 +AUX 9999/zm_remote_camera_http.patch 1566 RMD160 644a681789d0ecf424156cde4b4ea8f6c5065197 SHA1 74dbe274d129997826b9a775c672c28286b60e3f SHA256 f554f2bcc7977e5ac151bd87aa2b8a0b7a9eeb9099839afe0d8b2b60a37ce04e
74 +AUX 9999/zoneminder-facedetector-plugin.tar.bz2 63945 RMD160 2caee00449c819f3a0218f1ae5d4a3d9da264a62 SHA1 9405f2563484eccce592d11284aad9d17e1e34a3 SHA256 2fca44472589a3624789a62d203549ef4c51d9e74fda544715c1bdf85fe3a668
75 +AUX conf.d 138 RMD160 e7c71690bac83c1bee63c6b602b15910d3a8967c SHA1 719a2cb400a0a107accb28be3bd17f6269d41f76 SHA256 65e935cb63bf3d072b9317842944d808550ef3f933d834bb95aaacf3253bd85c
76 +AUX init.d 392 RMD160 96ac2e9ea5cd34a6aef26fe2c8fce91e6e551952 SHA1 7ef3e47e07cf7015d0c33f5a20d1994c94f0eb48 SHA256 83acb1cdc2c469a8fdfa13d9d80369b9b22535875491dfdfca498f6029cb290d
77 +DIST ZoneMinder-1.24.4.tar.gz 1061935 RMD160 8f736d94436e966b377a896c16d01e3efc869773 SHA1 cfbf0793d6b8a6d811fa1a1a60ac7faa02ca16fa SHA256 af4fa2fdb1e5287dbdea05b97e14376c9ec7ccaae0f1760e754a6a92595892c0
78 +EBUILD zoneminder-1.24.4.ebuild 3935 RMD160 821b72cb2cbf1a84d12e4fc34b60e99c8b9954dd SHA1 8e3bdbb03c1024247f7b8eedae3db3b92eb1508e SHA256 01a89429c91c6e3512a45eaab127fd84fe7c800e17249cbe83d3e0284cb9b384
79 +EBUILD zoneminder-9999.ebuild 4448 RMD160 be93f3004d0e1a866c9f083ef5fc8d456c58b26e SHA1 57cc23564151c98a334b3d2505c0ee66d7993931 SHA256 15dbdd933b5ada88f39c145a45946434cdddffc6985767fc7e8cfa0cf9adcc55
80 +MISC ChangeLog 754 RMD160 023cbc33d90c98d2ab40b7ff7c4c378c6d55a549 SHA1 7fbc66927d13de03e756c0f1d0a72745f95a4683 SHA256 a21eab1e5ec2cb69fb93d4173a859cb2224728c54513360dde1f67ba0ea37f03
81 +MISC metadata.xml 262 RMD160 24e1a7cfcbca1e2f41e8c062c448d9150f6320b8 SHA1 951224aa9eb92e898209936836a18e844ae1f169 SHA256 7e8dde52c550f9cfc6d74b78c19f6900a8cc241f2bf136610a4fc3b0aa95f3f5
82 +-----BEGIN PGP SIGNATURE-----
83 +Version: GnuPG v2.0.17 (GNU/Linux)
84 +
85 +iQIcBAEBCgAGBQJOXmqgAAoJEEb+UGWnxTyHvccP/AmesNfuqM/jv45Du2H/PTEz
86 +5ECxScCTv58xDsBB/J9CRsXhd8AR7sy5APAiFHJ/YROLKKQ1QibtOexwdqSmkWrA
87 +TnLtMe3Ya/8KR7RLDuNeF0Uk3cL8EK+nm9AMDJOzUKG3dyIkUJ5knf/d5Edbw0xr
88 +m8zXc90ImWuQrzZ2tgR7oiLz4KiN0drbNp4QEqsnbS1NLcHN/iWet/Vlr+UXgevG
89 +EK8trWX0OUZAKlTm8pWanc37fFnTrpsMxth4TS9zR1p5bFGohQzdz1JFrCvqnRPL
90 +3KlIrkqxtv+7G2UI2jZLYlQOG6kiQac6s19pjIjLjdqxKZ9hCtttEeVa44lX7dFH
91 +hARFJOBtA7VRBGH8k7cKlkTeKMImDfxcfCs9FyZUDmdwsTfVM5yHPhKpULWyg6rX
92 +R831eLNmXUxN1HwPdcdsI8kXc8H7hgO+i1EZj/P17Am3QDT+T6V8dv1fNN9wdQW9
93 +gu30pQvOk8Fpf60jdd86EPPmiqceqNHmaWdRof9Az6vqVcjsiXGNYEl8zTR56r2N
94 +wNK3euitaDR9JbNhx80SRpw8mOTMFLnmT0wQ2PnrBAjgrgaaM/6jiR3XjGNnBjIC
95 +DEAw3z0E1VlM/szkXtND5kLKnfndoERpl7T6sFDpnuWE+FwQVTjtscHrWLINeZ42
96 +mfU/CtO+9bx+bie9Jel1
97 +=xQxS
98 +-----END PGP SIGNATURE-----
99
100 diff --git a/media-video/zoneminder/files/1.24.4/Makefile.am.patch b/media-video/zoneminder/files/1.24.4/Makefile.am.patch
101 new file mode 100644
102 index 0000000..8d77ad2
103 --- /dev/null
104 +++ b/media-video/zoneminder/files/1.24.4/Makefile.am.patch
105 @@ -0,0 +1,15 @@
106 +--- Makefile.am.anc 2011-06-06 11:00:27.000000000 +0200
107 ++++ Makefile.am 2011-06-06 11:01:30.000000000 +0200
108 +@@ -21,9 +21,9 @@
109 + # Yes, you are correct. This is a HACK!
110 + install-data-hook:
111 + ( cd $(DESTDIR)$(sysconfdir); chown $(webuser):$(webgroup) $(sysconf_DATA); chmod 600 $(sysconf_DATA) )
112 +- ( if ! test -e $(ZM_RUNDIR); then mkdir -p $(ZM_RUNDIR); fi; if test "$(ZM_RUNDIR)" != "/var/run"; then chown $(webuser):$(webgroup) $(ZM_RUNDIR); chmod u+w $(ZM_RUNDIR); fi )
113 +- ( if ! test -e $(ZM_TMPDIR); then mkdir -m 700 -p $(ZM_TMPDIR); fi; if test "$(ZM_TMPDIR)" != "/tmp"; then chown $(webuser):$(webgroup) $(ZM_TMPDIR); chmod u+w $(ZM_TMPDIR); fi )
114 +- ( if ! test -e $(ZM_LOGDIR); then mkdir -p $(ZM_LOGDIR); fi; if test "$(ZM_LOGDIR)" != "/var/log"; then chown $(webuser):$(webgroup) $(ZM_LOGDIR); chmod u+w $(ZM_LOGDIR); fi )
115 ++ ( if ! test -e $(DESTDIR)$(ZM_RUNDIR); then mkdir -p $(DESTDIR)$(ZM_RUNDIR); fi; if test "$(DESTDIR)$(ZM_RUNDIR)" != "/var/run"; then chown $(webuser):$(webgroup) $(DESTDIR)$(ZM_RUNDIR); chmod u+w $(DESTDIR)$(ZM_RUNDIR); fi )
116 ++ ( if ! test -e $(DESTDIR)$(ZM_TMPDIR); then mkdir -m 700 -p $(DESTDIR)$(ZM_TMPDIR); fi; if test "$(DESTDIR)$(ZM_TMPDIR)" != "/tmp"; then chown $(webuser):$(webgroup) $(DESTDIR)$(ZM_TMPDIR); chmod u+w $(DESTDIR)$(ZM_TMPDIR); fi )
117 ++ ( if ! test -e $(DESTDIR)$(ZM_LOGDIR); then mkdir -p $(DESTDIR)$(ZM_LOGDIR); fi; if test "$(DESTDIR)$(ZM_LOGDIR)" != "/var/log"; then chown $(webuser):$(webgroup) $(DESTDIR)$(ZM_LOGDIR); chmod u+w $(DESTDIR)$(ZM_LOGDIR); fi )
118 +
119 + uninstall-hook:
120 + @-( cd $(DESTDIR)$(webdir); rm -rf events graphics images sounds temp )
121
122 diff --git a/media-video/zoneminder/files/1.24.4/db_upgrade_script_location.patch b/media-video/zoneminder/files/1.24.4/db_upgrade_script_location.patch
123 new file mode 100644
124 index 0000000..41b537c
125 --- /dev/null
126 +++ b/media-video/zoneminder/files/1.24.4/db_upgrade_script_location.patch
127 @@ -0,0 +1,11 @@
128 +--- ZoneMinder-1.24.1/zm.conf.in.orig 2009-03-23 13:55:43.000000000 +0000
129 ++++ ZoneMinder-1.24.1/zm.conf.in 2009-03-23 13:57:22.000000000 +0000
130 +@@ -13,7 +13,7 @@
131 + ZM_VERSION=@VERSION@
132 +
133 + # Path to build directory, used mostly for finding DB upgrade scripts
134 +-ZM_PATH_BUILD=@PATH_BUILD@
135 ++ZM_PATH_BUILD=/usr/share/zoneminder
136 +
137 + # Build time, used to record when to trigger various checks
138 + ZM_TIME_BUILD=@TIME_BUILD@
139
140 diff --git a/media-video/zoneminder/files/1.24.4/zm_remote_camera_http.patch b/media-video/zoneminder/files/1.24.4/zm_remote_camera_http.patch
141 new file mode 100644
142 index 0000000..ca937b6
143 --- /dev/null
144 +++ b/media-video/zoneminder/files/1.24.4/zm_remote_camera_http.patch
145 @@ -0,0 +1,55 @@
146 +Index: ZoneMinder-1.24.1/src/zm_remote_camera_http.cpp
147 +===================================================================
148 +--- ZoneMinder-1.24.1.orig/src/zm_remote_camera_http.cpp
149 ++++ ZoneMinder-1.24.1/src/zm_remote_camera_http.cpp
150 +@@ -356,6 +356,14 @@ int RemoteCamera::GetResponse()
151 + format = JPEG;
152 + state = CONTENT;
153 + }
154 ++ else if ( !strcasecmp( content_type, "image/mpeg" ) )
155 ++ {
156 ++ // Single image
157 ++ mode = SINGLE_IMAGE;
158 ++ format = JPEG;
159 ++ state = CONTENT;
160 ++
161 ++ }
162 + else if ( !strcasecmp( content_type, "image/x-rgb" ) )
163 + {
164 + // Single image
165 +@@ -453,6 +461,10 @@ int RemoteCamera::GetResponse()
166 + {
167 + format = JPEG;
168 + }
169 ++ else if ( !strcasecmp( content_type, "image/mpeg" ) )
170 ++ {
171 ++ format = JPEG;
172 ++ }
173 + else if ( !strcasecmp( content_type, "image/x-rgb" ) )
174 + {
175 + format = X_RGB;
176 +@@ -783,6 +795,13 @@ int RemoteCamera::GetResponse()
177 + format = JPEG;
178 + state = CONTENT;
179 + }
180 ++ else if ( !strcasecmp( content_type, "image/mpeg" ) )
181 ++ {
182 ++ // Single image
183 ++ mode = SINGLE_IMAGE;
184 ++ format = JPEG;
185 ++ state = CONTENT;
186 ++ }
187 + else if ( !strcasecmp( content_type, "image/x-rgb" ) )
188 + {
189 + // Single image
190 +@@ -947,6 +966,10 @@ int RemoteCamera::GetResponse()
191 + {
192 + format = JPEG;
193 + }
194 ++ else if ( !strcasecmp( content_type, "image/mpeg" ) )
195 ++ {
196 ++ format = JPEG;
197 ++ }
198 + else if ( !strcasecmp( content_type, "image/x-rgb" ) )
199 + {
200 + format = X_RGB;
201
202 diff --git a/media-video/zoneminder/files/10_zoneminder.conf b/media-video/zoneminder/files/10_zoneminder.conf
203 new file mode 100644
204 index 0000000..0ddb675
205 --- /dev/null
206 +++ b/media-video/zoneminder/files/10_zoneminder.conf
207 @@ -0,0 +1,18 @@
208 +ScriptAlias /cgi-bin/zms "/var/www/zoneminder/cgi-bin/zms"
209 +ScriptAlias /cgi-bin/nph-zms "/var/www/zoneminder/cgi-bin/nph-zms"
210 +
211 +<Directory "/var/www/zoneminder/cgi-bin">
212 + AllowOverride All
213 + Options ExecCGI
214 + Order allow,deny
215 + Allow from all
216 +</Directory>
217 +
218 +Alias /zoneminder "/var/www/zoneminder/htdocs"
219 +
220 +<Directory "/var/www/zoneminder/htdocs">
221 + Options -Indexes MultiViews FollowSymLinks
222 + AllowOverride All
223 + Order allow,deny
224 + Allow from all
225 +</Directory>
226
227 diff --git a/media-video/zoneminder/files/9999/Makefile.am.patch b/media-video/zoneminder/files/9999/Makefile.am.patch
228 new file mode 100644
229 index 0000000..a22e93f
230 --- /dev/null
231 +++ b/media-video/zoneminder/files/9999/Makefile.am.patch
232 @@ -0,0 +1,15 @@
233 +--- Makefile.am.anc 2011-03-31 13:13:24.000000000 +0200
234 ++++ Makefile.am 2011-03-31 13:14:32.000000000 +0200
235 +@@ -20,9 +20,9 @@
236 + # Yes, you are correct. This is a HACK!
237 + install-data-hook:
238 + ( cd $(DESTDIR)$(sysconfdir); chown $(webuser):$(webgroup) $(sysconf_DATA); chmod 600 $(sysconf_DATA) )
239 +- ( if ! test -e $(ZM_RUNDIR); then mkdir -p $(ZM_RUNDIR); fi; chown $(webuser):$(webgroup) $(ZM_RUNDIR); chmod u+w $(ZM_RUNDIR) )
240 +- ( if ! test -e $(ZM_TMPDIR); then mkdir -p $(ZM_TMPDIR); fi; chown $(webuser):$(webgroup) $(ZM_TMPDIR); chmod u+w $(ZM_TMPDIR) )
241 +- ( if ! test -e $(ZM_LOGDIR); then mkdir -p $(ZM_LOGDIR); fi; chown $(webuser):$(webgroup) $(ZM_LOGDIR); chmod u+w $(ZM_LOGDIR) )
242 ++ ( if ! test -e $(DESTDIR)$(ZM_RUNDIR); then mkdir -p $(DESTDIR)$(ZM_RUNDIR); fi; chown $(webuser):$(webgroup) $(DESTDIR)$(ZM_RUNDIR); chmod u+w $(DESTDIR)$(ZM_RUNDIR) )
243 ++ ( if ! test -e $(DESTDIR)$(ZM_TMPDIR); then mkdir -p $(DESTDIR)$(ZM_TMPDIR); fi; chown $(webuser):$(webgroup) $(DESTDIR)$(ZM_TMPDIR); chmod u+w $(DESTDIR)$(ZM_TMPDIR) )
244 ++ ( if ! test -e $(DESTDIR)$(ZM_LOGDIR); then mkdir -p $(DESTDIR)$(ZM_LOGDIR); fi; chown $(webuser):$(webgroup) $(DESTDIR)$(ZM_LOGDIR); chmod u+w $(DESTDIR)$(ZM_LOGDIR) )
245 +
246 + uninstall-hook:
247 + @-( cd $(DESTDIR)$(webdir); rm -rf events graphics images sounds temp )
248
249 diff --git a/media-video/zoneminder/files/9999/cvisionlab-plugins.patch b/media-video/zoneminder/files/9999/cvisionlab-plugins.patch
250 new file mode 100644
251 index 0000000..314ef53
252 --- /dev/null
253 +++ b/media-video/zoneminder/files/9999/cvisionlab-plugins.patch
254 @@ -0,0 +1,2259 @@
255 +diff -aurN zoneminder/trunk/configure zoneminder_new/trunk/configure
256 +--- zoneminder/trunk/configure 2011-04-01 17:08:37.000000000 +0200
257 ++++ zoneminder_new/trunk/configure 2011-04-01 21:14:15.000000000 +0200
258 +@@ -2999,6 +2999,7 @@
259 +
260 +
261 +
262 ++LDFLAGS="$LDFLAGS -rdynamic "
263 + LDFLAGS="${MYSQL_LIBS} $LDFLAGS"
264 +
265 + FFMPEG_PREFIX=/usr
266 +@@ -9324,7 +9325,7 @@
267 +
268 +
269 +
270 +-ac_config_files="$ac_config_files Makefile zm.conf zmconfgen.pl db/Makefile db/zm_create.sql scripts/Makefile scripts/zm scripts/zmaudit.pl scripts/zmcontrol.pl scripts/zmdc.pl scripts/zmfilter.pl scripts/zmpkg.pl scripts/zmtrack.pl scripts/zmtrigger.pl scripts/zmupdate.pl scripts/zmvideo.pl scripts/zmwatch.pl scripts/zmx10.pl scripts/zmdbbackup scripts/zmdbrestore scripts/zmeventdump scripts/zmlogrotate.conf scripts/ZoneMinder/lib/ZoneMinder/Base.pm scripts/ZoneMinder/lib/ZoneMinder/Config.pm scripts/ZoneMinder/lib/ZoneMinder/Memory.pm scripts/ZoneMinder/lib/ZoneMinder/ConfigData.pm src/Makefile src/zm_config.h web/Makefile web/ajax/Makefile web/css/Makefile web/graphics/Makefile web/includes/Makefile web/includes/config.php web/js/Makefile web/lang/Makefile web/skins/Makefile web/skins/classic/Makefile web/skins/classic/ajax/Makefile web/skins/classic/css/Makefile web/skins/classic/graphics/Makefile web/skins/classic/includes/Makefile web/skins/classic/js/Makefile web/ski
271 ns/classic/lang/Makefile web/skins/classic/views/Makefile web/skins/classic/views/css/Makefile web/skins/classic/views/js/Makefile web/skins/mobile/Makefile web/skins/mobile/ajax/Makefile web/skins/mobile/css/Makefile web/skins/mobile/graphics/Makefile web/skins/mobile/includes/Makefile web/skins/mobile/lang/Makefile web/skins/mobile/views/Makefile web/skins/mobile/views/css/Makefile web/tools/Makefile web/tools/mootools/Makefile web/views/Makefile web/skins/xml/Makefile web/skins/xml/views/Makefile web/skins/xml/includes/Makefile web/zmApache.conf"
272 ++ac_config_files="$ac_config_files Makefile zm.conf db/Makefile db/zm_create.sql scripts/Makefile scripts/zm scripts/zmaudit.pl scripts/zmcontrol.pl scripts/zmdc.pl scripts/zmfilter.pl scripts/zmpkg.pl scripts/zmtrack.pl scripts/zmtrigger.pl scripts/zmupdate.pl scripts/zmvideo.pl scripts/zmwatch.pl scripts/zmx10.pl scripts/zmdbbackup scripts/zmdbrestore scripts/zmeventdump scripts/zmlogrotate.conf scripts/ZoneMinder/lib/ZoneMinder/Base.pm scripts/ZoneMinder/lib/ZoneMinder/Config.pm scripts/ZoneMinder/lib/ZoneMinder/Memory.pm scripts/ZoneMinder/lib/ZoneMinder/ConfigData.pm src/Makefile src/zm_config.h web/Makefile web/ajax/Makefile web/css/Makefile web/graphics/Makefile web/includes/Makefile web/includes/config.php web/js/Makefile web/lang/Makefile web/skins/Makefile web/skins/classic/Makefile web/skins/classic/ajax/Makefile web/skins/classic/css/Makefile web/skins/classic/graphics/Makefile web/skins/classic/includes/Makefile web/skins/classic/js/Makefile web/skins/classic/la
273 ng/Makefile web/skins/classic/views/Makefile web/skins/classic/views/css/Makefile web/skins/classic/views/js/Makefile web/skins/mobile/Makefile web/skins/mobile/ajax/Makefile web/skins/mobile/css/Makefile web/skins/mobile/graphics/Makefile web/skins/mobile/includes/Makefile web/skins/mobile/lang/Makefile web/skins/mobile/views/Makefile web/skins/mobile/views/css/Makefile web/tools/Makefile web/tools/mootools/Makefile web/views/Makefile web/skins/xml/Makefile web/skins/xml/views/Makefile web/skins/xml/includes/Makefile web/zmApache.conf"
274 +
275 +
276 + # Create the definitions for compilation and defaults for the database
277 +@@ -10054,7 +10055,6 @@
278 + "depfiles") CONFIG_COMMANDS="$CONFIG_COMMANDS depfiles" ;;
279 + "Makefile") CONFIG_FILES="$CONFIG_FILES Makefile" ;;
280 + "zm.conf") CONFIG_FILES="$CONFIG_FILES zm.conf" ;;
281 +- "zmconfgen.pl") CONFIG_FILES="$CONFIG_FILES zmconfgen.pl" ;;
282 + "db/Makefile") CONFIG_FILES="$CONFIG_FILES db/Makefile" ;;
283 + "db/zm_create.sql") CONFIG_FILES="$CONFIG_FILES db/zm_create.sql" ;;
284 + "scripts/Makefile") CONFIG_FILES="$CONFIG_FILES scripts/Makefile" ;;
285 +@@ -10795,7 +10795,6 @@
286 + done
287 + }
288 + ;;
289 +- "src/zm_config_defines.h":C) perl ./zmconfgen.pl ;;
290 + "scripts/ZoneMinder/Makefile":C) (cd scripts/ZoneMinder; echo "perl Makefile.PL $PERL_MM_PARMS"; perl Makefile.PL $PERL_MM_PARMS) ;;
291 +
292 + esac
293 +diff -aurN zoneminder/trunk/configure.ac zoneminder_new/trunk/configure.ac
294 +--- zoneminder/trunk/configure.ac 2011-04-01 17:08:37.000000000 +0200
295 ++++ zoneminder_new/trunk/configure.ac 2011-04-01 21:14:33.000000000 +0200
296 +@@ -372,10 +372,8 @@
297 + AC_SUBST(PERL_MM_PARMS)
298 + AC_SUBST(EXTRA_PERL_LIB)
299 +
300 +-AC_CONFIG_FILES([Makefile zm.conf zmconfgen.pl db/Makefile db/zm_create.sql scripts/Makefile scripts/zm scripts/zmaudit.pl scripts/zmcontrol.pl scripts/zmdc.pl scripts/zmfilter.pl scripts/zmpkg.pl scripts/zmtrack.pl scripts/zmtrigger.pl scripts/zmupdate.pl scripts/zmvideo.pl scripts/zmwatch.pl scripts/zmx10.pl scripts/zmdbbackup scripts/zmdbrestore scripts/zmeventdump scripts/zmlogrotate.conf scripts/ZoneMinder/lib/ZoneMinder/Base.pm scripts/ZoneMinder/lib/ZoneMinder/Config.pm scripts/ZoneMinder/lib/ZoneMinder/Memory.pm scripts/ZoneMinder/lib/ZoneMinder/ConfigData.pm src/Makefile src/zm_config.h web/Makefile web/ajax/Makefile web/css/Makefile web/graphics/Makefile web/includes/Makefile web/includes/config.php web/js/Makefile web/lang/Makefile web/skins/Makefile web/skins/classic/Makefile web/skins/classic/ajax/Makefile web/skins/classic/css/Makefile web/skins/classic/graphics/Makefile web/skins/classic/includes/Makefile web/skins/classic/js/Makefile web/skins/classic/lang/M
301 akefile web/skins/classic/views/Makefile web/skins/classic/views/css/Makefile web/skins/classic/views/js/Makefile web/skins/mobile/Makefile web/skins/mobile/ajax/Makefile web/skins/mobile/css/Makefile web/skins/mobile/graphics/Makefile web/skins/mobile/includes/Makefile web/skins/mobile/lang/Makefile web/skins/mobile/views/Makefile web/skins/mobile/views/css/Makefile web/tools/Makefile web/tools/mootools/Makefile web/views/Makefile web/skins/xml/Makefile web/skins/xml/views/Makefile web/skins/xml/includes/Makefile web/zmApache.conf])
302 ++AC_CONFIG_FILES([Makefile zm.conf db/Makefile db/zm_create.sql scripts/Makefile scripts/zm scripts/zmaudit.pl scripts/zmcontrol.pl scripts/zmdc.pl scripts/zmfilter.pl scripts/zmpkg.pl scripts/zmtrack.pl scripts/zmtrigger.pl scripts/zmupdate.pl scripts/zmvideo.pl scripts/zmwatch.pl scripts/zmx10.pl scripts/zmdbbackup scripts/zmdbrestore scripts/zmeventdump scripts/zmlogrotate.conf scripts/ZoneMinder/lib/ZoneMinder/Base.pm scripts/ZoneMinder/lib/ZoneMinder/Config.pm scripts/ZoneMinder/lib/ZoneMinder/Memory.pm scripts/ZoneMinder/lib/ZoneMinder/ConfigData.pm src/Makefile src/zm_config.h web/Makefile web/ajax/Makefile web/css/Makefile web/graphics/Makefile web/includes/Makefile web/includes/config.php web/js/Makefile web/lang/Makefile web/skins/Makefile web/skins/classic/Makefile web/skins/classic/ajax/Makefile web/skins/classic/css/Makefile web/skins/classic/graphics/Makefile web/skins/classic/includes/Makefile web/skins/classic/js/Makefile web/skins/classic/lang/Makefile web/s
303 kins/classic/views/Makefile web/skins/classic/views/css/Makefile web/skins/classic/views/js/Makefile web/skins/mobile/Makefile web/skins/mobile/ajax/Makefile web/skins/mobile/css/Makefile web/skins/mobile/graphics/Makefile web/skins/mobile/includes/Makefile web/skins/mobile/lang/Makefile web/skins/mobile/views/Makefile web/skins/mobile/views/css/Makefile web/tools/Makefile web/tools/mootools/Makefile web/views/Makefile web/skins/xml/Makefile web/skins/xml/views/Makefile web/skins/xml/includes/Makefile web/zmApache.conf])
304 +
305 +-# Create the definitions for compilation and defaults for the database
306 +-AC_CONFIG_COMMANDS([src/zm_config_defines.h],[perl ./zmconfgen.pl])
307 + # Manually generate the perl Makefile maker
308 + AC_CONFIG_COMMANDS([scripts/ZoneMinder/Makefile],[(cd scripts/ZoneMinder; echo "perl Makefile.PL $PERL_MM_PARMS"; perl Makefile.PL $PERL_MM_PARMS)],[PERL_MM_PARMS=$PERL_MM_PARMS])
309 +
310 +diff -aurN zoneminder/trunk/db/Makefile.am zoneminder_new/trunk/db/Makefile.am
311 +--- zoneminder/trunk/db/Makefile.am 2011-04-01 17:08:29.000000000 +0200
312 ++++ zoneminder_new/trunk/db/Makefile.am 2011-04-01 20:01:20.000000000 +0200
313 +@@ -39,4 +39,5 @@
314 + zm_update-1.23.3.sql \
315 + zm_update-1.24.0.sql \
316 + zm_update-1.24.1.sql \
317 +- zm_update-1.24.2.sql
318 ++ zm_update-1.24.2.sql \
319 ++ zm_update-plugins.sql
320 +diff -aurN zoneminder/trunk/db/Makefile.in zoneminder_new/trunk/db/Makefile.in
321 +--- zoneminder/trunk/db/Makefile.in 2011-04-01 17:08:29.000000000 +0200
322 ++++ zoneminder_new/trunk/db/Makefile.in 2011-04-01 20:01:20.000000000 +0200
323 +@@ -221,7 +221,8 @@
324 + zm_update-1.23.3.sql \
325 + zm_update-1.24.0.sql \
326 + zm_update-1.24.1.sql \
327 +- zm_update-1.24.2.sql
328 ++ zm_update-1.24.2.sql \
329 ++ zm_update-plugins.sql
330 +
331 + all: all-am
332 +
333 +diff -aurN zoneminder/trunk/db/zm_create.sql.in zoneminder_new/trunk/db/zm_create.sql.in
334 +--- zoneminder/trunk/db/zm_create.sql.in 2011-04-01 17:08:29.000000000 +0200
335 ++++ zoneminder_new/trunk/db/zm_create.sql.in 2011-04-01 20:01:20.000000000 +0200
336 +@@ -351,6 +351,8 @@
337 + `SignalCheckColour` varchar(32) NOT NULL default '#0000BE',
338 + `WebColour` varchar(32) NOT NULL default 'red',
339 + `Sequence` smallint(5) unsigned default NULL,
340 ++ `UsedPl` varchar(88) NOT NULL default '',
341 ++ `DoNativeMotDet` varchar(5) NOT NULL default 'yes',
342 + PRIMARY KEY (`Id`)
343 + ) ENGINE=@ZM_MYSQL_ENGINE@;
344 +
345 +@@ -596,6 +598,13 @@
346 + INSERT INTO ZonePresets VALUES (5,'Best, medium sensitivity','Active','Percent','Blobs',40,NULL,16,NULL,5,5,12,NULL,10,NULL,1,NULL,0);
347 + INSERT INTO ZonePresets VALUES (6,'Best, high sensitivity','Active','Percent','Blobs',20,NULL,8,NULL,3,3,6,NULL,5,NULL,1,NULL,0);
348 +
349 ++insert into Config set Id=197, Name = 'ZM_PATH_PLUGINS', Value = '/usr/share/zoneminder', Type = 'string', DefaultValue = '/usr/share/zoneminder', Hint = '/absolute/path/to/somewhere', Pattern = '(?-xism:^((?:/[^/]*)+?)/?$)', Format = ' $1 ', Prompt = 'Path to the plugin folder', Help = '3d-party plugins have to be placed here.', Category = 'paths', Readonly = '0', Requires = '';
350 ++insert into Config set Id=198, Name = 'ZM_PLUGIN_EXTENSION', Value = '.zmpl', Type = 'string', DefaultValue = '.zmpl', Hint = '.bla', Pattern = '.(?-xism:^((?:/[^/]*)+?)/?$)', Format = ' $1 ', Prompt = 'Default extension of plugins to found', Help = '3d-party plugins extension.', Category = 'paths', Readonly = '0', Requires = '';
351 ++insert into Config set Id=199, Name = 'ZM_PLUGINS_CONFIG_FILE', Value = '/usr/share/zoneminder/plugins.conf', Type = 'string', DefaultValue = '/usr/share/zoneminder/plugins.conf', Hint = '/absolute/path/to/somewhere', Pattern = '(?-xism:^((?:/[^/]*)+?)/?$)', Format = ' $1 ', Prompt = 'Path to the config file for plugins', Help = 'Path to the config file for plugins.', Category = 'paths', Readonly = '0', Requires = '';
352 ++insert into Config set Id=200, Name = 'ZM_LOAD_PLUGINS', Value = '0', Type = 'boolean', DefaultValue = 'no', Hint = 'yes|no', Pattern = '(?i-xsm:^([yn]))', Format = ' $1 =~ /^y/) ? \"yes\" : \"no\" ', Prompt = 'Load and use 3d-party plugins', Help = '3d-party plugins will be loaded and used for analysing.', Category = 'config', Readonly = '0', Requires = '';
353 ++insert into Config set Id=201, Name = 'ZM_TURNOFF_NATIVE_ANALYSIS', Value = '0', Type = 'boolean', DefaultValue = 'no', Hint = 'yes|no', Pattern = '(?i-xsm:^([yn]))', Format = ' $1 =~ /^y/) ? \"yes\" : \"no\" ', Prompt = 'Turn native ZM\'s image analysis possibility off', Help = 'Image analysis with ZM\'s motion detected function will be turned off. Only detection functions from loaded plugins will be used. Note, that if no plugins have be loaded, no detection will be done', Category = 'config', Readonly = '0', Requires = '';
354 ++
355 ++
356 + --
357 + -- Apply the initial configuration
358 + --
359 +diff -aurN zoneminder/trunk/db/zm_update-plugins.sql zoneminder_new/trunk/db/zm_update-plugins.sql
360 +--- zoneminder/trunk/db/zm_update-plugins.sql 1970-01-01 01:00:00.000000000 +0100
361 ++++ zoneminder_new/trunk/db/zm_update-plugins.sql 2011-04-01 21:13:32.000000000 +0200
362 +@@ -0,0 +1,26 @@
363 ++--
364 ++-- This is update from 1.24.2 version to plugins supporting architecture.
365 ++--
366 ++
367 ++-- Add two columns to store plugins related information.
368 ++ALTER TABLE Monitors
369 ++ADD ( `UsedPl` varchar(88) NOT NULL default '',
370 ++ `DoNativeMotDet` varchar(5) NOT NULL default 'yes'
371 ++);
372 ++
373 ++-- Insert some values into `Config' table.
374 ++INSERT INTO Config SET Id = 197, Name = 'ZM_PATH_PLUGINS', Value = '/usr/share/zoneminder', Type = 'string', DefaultValue = '/usr/share/zoneminder', Hint = '/absolute/path/to/somewhere', Pattern = '(?-xism:^((?:/[^/]*)+?)/?$)', Format = ' $1 ', Prompt = 'Path to the plugin folder', Help = '3d-party plugins have to be placed here.', Category = 'paths', Readonly = '0', Requires = '';
375 ++INSERT INTO Config SET Id = 198, Name = 'ZM_PLUGIN_EXTENSION', Value = '.zmpl', Type = 'string', DefaultValue = '.zmpl', Hint = '.bla', Pattern = '.(?-xism:^((?:/[^/]*)+?)/?$)', Format = ' $1 ', Prompt = 'Default extension of plugins to found', Help = '3d-party plugins extension.', Category = 'paths', Readonly = '0', Requires = '';
376 ++INSERT INTO Config SET Id = 199, Name = 'ZM_PLUGINS_CONFIG_FILE', Value = '/usr/share/zoneminder/plugins.conf', Type = 'string', DefaultValue = '/usr/share/zoneminder/plugins.conf', Hint = '/absolute/path/to/somewhere', Pattern = '(?-xism:^((?:/[^/]*)+?)/?$)', Format = ' $1 ', Prompt = 'Path to the config file for plugins', Help = 'Path to the config file for plugins.', Category = 'paths', Readonly = '0', Requires = '';
377 ++INSERT INTO Config SET Id = 200, Name = 'ZM_LOAD_PLUGINS', Value = '0', Type = 'boolean', DefaultValue = 'no', Hint = 'yes|no', Pattern = '(?i-xsm:^([yn]))', Format = ' $1 =~ /^y/) ? \"yes\" : \"no\" ', Prompt = 'Load and use 3d-party plugins', Help = '3d-party plugins will be loaded and used for analysing.', Category = 'config', Readonly = '0', Requires = '';
378 ++INSERT INTO Config SET Id = 201, Name = 'ZM_TURNOFF_NATIVE_ANALYSIS', Value = '0', Type = 'boolean', DefaultValue = 'no', Hint = 'yes|no', Pattern = '(?i-xsm:^([yn]))', Format = ' $1 =~ /^y/) ? \"yes\" : \"no\" ', Prompt = 'Turn native ZM\'s image analysis possibility off', Help = 'Image analysis with ZM\'s motion detected function will be turned off. Only detection functions from loaded plugins will be used. Note, that if no plugins have be loaded, no detection will be done', Category = 'config', Readonly = '0', Requires = '';
379 ++
380 ++--
381 ++-- These are optional, but we might as well
382 ++--
383 ++optimize table Frames;
384 ++optimize table Events;
385 ++optimize table Filters;
386 ++optimize table Zones;
387 ++optimize table Monitors;
388 ++optimize table Stats;
389 +diff -aurN zoneminder/trunk/scripts/ZoneMinder/lib/ZoneMinder/ConfigData.pm.in zoneminder_new/trunk/scripts/ZoneMinder/lib/ZoneMinder/ConfigData.pm.in
390 +--- zoneminder/trunk/scripts/ZoneMinder/lib/ZoneMinder/ConfigData.pm.in 2011-04-01 17:08:31.000000000 +0200
391 ++++ zoneminder_new/trunk/scripts/ZoneMinder/lib/ZoneMinder/ConfigData.pm.in 2011-04-01 20:00:17.000000000 +0200
392 +@@ -542,6 +542,46 @@
393 + category => "paths",
394 + },
395 + {
396 ++ name => "ZM_PATH_PLUGINS",
397 ++ default => "/usr/share/zoneminder",
398 ++ description => "Path to the plugin folder",
399 ++ help => "3d-party plugins have to be placed here.",
400 ++ type => $types{abs_path},
401 ++ category => "paths",
402 ++ },
403 ++ {
404 ++ name => "ZM_PLUGIN_EXTENSION",
405 ++ default => ".zmpl",
406 ++ description => "Default extension of plugins to found.",
407 ++ help => "Default extension of plugins to found.",
408 ++ type => $types{rel_path},
409 ++ category => "paths",
410 ++ },
411 ++ {
412 ++ name => "ZM_PLUGINS_CONFIG_FILE",
413 ++ default => "/usr/share/zoneminder/plugins.conf",
414 ++ description => "Path to the config file for plugins.",
415 ++ help => "Path to the config file for plugins.",
416 ++ type => $types{abs_path},
417 ++ category => "paths",
418 ++ },
419 ++ {
420 ++ name => "ZM_LOAD_PLUGINS",
421 ++ default => "no",
422 ++ description => "Load and use 3d-party plugins",
423 ++ help => "3d-party plugins will be loaded and used for analysing.",
424 ++ type => $types{boolean},
425 ++ category => "config",
426 ++ },
427 ++ {
428 ++ name => "ZM_TURNOFF_NATIVE_ANALYSIS",
429 ++ default => "no",
430 ++ description => "Turn native ZM\'s image analysis possibility off",
431 ++ help => "Image analysis with ZM\'s motion detected function will be turned off. Only detection functions from loaded plugins will be used. Note, that if no plugins have be loaded, no detection will be done.",
432 ++ type => $types{boolean},
433 ++ category => "config",
434 ++ },
435 ++ {
436 + name => "ZM_PATH_SWAP",
437 + default => "@ZM_TMPDIR@",
438 + description => "Path to location for temporary swap images used in streaming",
439 +diff -aurN zoneminder/trunk/src/Makefile.am zoneminder_new/trunk/src/Makefile.am
440 +--- zoneminder/trunk/src/Makefile.am 2011-04-01 17:08:30.000000000 +0200
441 ++++ zoneminder_new/trunk/src/Makefile.am 2011-04-01 17:10:30.000000000 +0200
442 +@@ -58,7 +58,11 @@
443 + zm_timer.cpp \
444 + zm_user.cpp \
445 + zm_utils.cpp \
446 +- zm_zone.cpp
447 ++ zm_zone.cpp \
448 ++ zm_detector.cpp \
449 ++ zm_plugin.cpp \
450 ++ zm_plugin_manager.cpp \
451 ++ zm_image_analyser.cpp
452 +
453 + zmc_SOURCES = zmc.cpp $(zm_SOURCES)
454 + zma_SOURCES = zma.cpp $(zm_SOURCES)
455 +@@ -113,7 +117,11 @@
456 + zm_timer.h \
457 + zm_user.h \
458 + zm_utils.h \
459 +- zm_zone.h
460 ++ zm_zone.h \
461 ++ zm_detector.h \
462 ++ zm_plugin.h \
463 ++ zm_plugin_manager.h \
464 ++ zm_image_analyser.h
465 +
466 + EXTRA_DIST = \
467 + zm_config.h.in \
468 +diff -aurN zoneminder/trunk/src/zm_config_defines.h zoneminder_new/trunk/src/zm_config_defines.h
469 +--- zoneminder/trunk/src/zm_config_defines.h 2011-04-01 17:08:30.000000000 +0200
470 ++++ zoneminder_new/trunk/src/zm_config_defines.h 2011-04-01 17:18:50.000000000 +0200
471 +@@ -198,9 +198,13 @@
472 + #define ZM_EYEZM_H264_DEFAULT_EVBR 194
473 + #define ZM_EYEZM_H264_TIMEOUT 195
474 + #define ZM_EYEZM_SEG_DURATION 196
475 ++#define ZM_PATH_PLUGINS 197
476 ++#define ZM_PLUGIN_EXTENSION 198
477 ++#define ZM_PLUGINS_CONFIG_FILE 199
478 ++#define ZM_LOAD_PLUGINS 200
479 ++#define ZM_TURNOFF_NATIVE_ANALYSIS 201
480 +
481 +-
482 +-#define ZM_MAX_CFG_ID 196
483 ++#define ZM_MAX_CFG_ID 201
484 +
485 + #define ZM_CFG_DECLARE_LIST \
486 + const char *lang_default;\
487 +@@ -257,6 +261,11 @@
488 + const char *path_map;\
489 + const char *path_socks;\
490 + const char *path_logs;\
491 ++ const char *path_plugins;\
492 ++ const char *plugin_extension;\
493 ++ const char *plugins_config_path;\
494 ++ bool load_plugins;\
495 ++ bool turnoff_native_analysis;\
496 + const char *path_swap;\
497 + const char *web_title_prefix;\
498 + bool web_resize_console;\
499 +@@ -457,6 +466,11 @@
500 + path_map = (const char *)config.Item( ZM_PATH_MAP );\
501 + path_socks = (const char *)config.Item( ZM_PATH_SOCKS );\
502 + path_logs = (const char *)config.Item( ZM_PATH_LOGS );\
503 ++ path_plugins = (const char *)config.Item( ZM_PATH_PLUGINS );\
504 ++ plugin_extension = (const char *)config.Item( ZM_PLUGIN_EXTENSION );\
505 ++ plugins_config_path = (const char *)config.Item( ZM_PLUGINS_CONFIG_FILE );\
506 ++ load_plugins = (bool)config.Item( ZM_LOAD_PLUGINS );\
507 ++ turnoff_native_analysis = (bool)config.Item( ZM_TURNOFF_NATIVE_ANALYSIS );\
508 + path_swap = (const char *)config.Item( ZM_PATH_SWAP );\
509 + web_title_prefix = (const char *)config.Item( ZM_WEB_TITLE_PREFIX );\
510 + web_resize_console = (bool)config.Item( ZM_WEB_RESIZE_CONSOLE );\
511 +diff -aurN zoneminder/trunk/src/zm_detector.cpp zoneminder_new/trunk/src/zm_detector.cpp
512 +--- zoneminder/trunk/src/zm_detector.cpp 1970-01-01 01:00:00.000000000 +0100
513 ++++ zoneminder_new/trunk/src/zm_detector.cpp 2011-04-01 17:10:30.000000000 +0200
514 +@@ -0,0 +1,200 @@
515 ++#include "zm_detector.h"
516 ++
517 ++
518 ++
519 ++/*!\fn Detector::Detector(const Detector& source)
520 ++ * \param source is the object to copy
521 ++ */
522 ++Detector::Detector(const Detector& source)
523 ++ : m_sDetectionCause(source.m_sDetectionCause),
524 ++ m_fMinAlarmScore(source.m_fMinAlarmScore),
525 ++ m_fMaxAlarmScore(source.m_fMaxAlarmScore),
526 ++ m_fImageScaleFactor(source.m_fImageScaleFactor),
527 ++ m_sLogPrefix(source.m_sLogPrefix),
528 ++ m_nNewWidth(source.m_nNewWidth),
529 ++ m_nNewHeight(source.m_nNewHeight),
530 ++ m_sConfigSectionName(source.m_sConfigSectionName)
531 ++{
532 ++ //setlogmask (LOG_UPTO (LOG_LEVEL));
533 ++ //openlog(m_sLogPrefix.c_str(), LOG_PID|LOG_CONS, LOG_USER);
534 ++}
535 ++
536 ++
537 ++
538 ++/*!\fn Detector& ImageAnalyser::Detector::operator=(const ImageAnalyser::Detector& source)
539 ++ * \param source is the object to copy
540 ++ */
541 ++Detector& Detector::operator=(const Detector& source)
542 ++{
543 ++ m_sDetectionCause = source.m_sDetectionCause;
544 ++ m_fMinAlarmScore = source.m_fMinAlarmScore;
545 ++ m_fMaxAlarmScore = source.m_fMaxAlarmScore;
546 ++ m_fImageScaleFactor = source.m_fImageScaleFactor;
547 ++ m_sLogPrefix = source.m_sLogPrefix;
548 ++ m_nNewWidth = source.m_nNewWidth;
549 ++ m_nNewHeight = source.m_nNewHeight;
550 ++ m_sConfigSectionName = source.m_sConfigSectionName;
551 ++
552 ++ //setlogmask (LOG_UPTO (LOG_LEVEL));
553 ++ //openlog(m_sLogPrefix.c_str(), LOG_PID|LOG_CONS, LOG_USER);
554 ++
555 ++ return *this;
556 ++}
557 ++
558 ++
559 ++
560 ++/*!\fn Detector::getDetectionCause()
561 ++ * return detection cause as string
562 ++ */
563 ++string Detector::getDetectionCause()
564 ++{
565 ++ return m_sDetectionCause;
566 ++}
567 ++
568 ++
569 ++
570 ++
571 ++/*! \fn Detector::log(int nLogLevel, string sMessage)
572 ++ */
573 ++void Detector::log(int nLogLevel, string sMessage)
574 ++{
575 ++ string sMessageToLog = m_sLogPrefix + string(" : ") + sMessage;
576 ++ syslog(nLogLevel, sMessageToLog.c_str());
577 ++}
578 ++
579 ++
580 ++//Detector::~Detector() {}
581 ++
582 ++
583 ++
584 ++
585 ++/*! \fn int FaceDetectorPlugin::Detect(const Image &image, Event::StringSet &zoneSet)
586 ++ * \param image is an image to detect faces on
587 ++ * \param zoneSet is set of zone names (see zm_zone.h)
588 ++ * \return detection score
589 ++ */
590 ++int Detector::Detect(const Image &zmImage, Zone** zones, int n_numZones, Event::StringSet &zoneSet)
591 ++{
592 ++ //log(LOG_LEVEL, "Detection invoking.");
593 ++ bool alarm = false;
594 ++ char szMessage[50];
595 ++ unsigned int score = 0;
596 ++
597 ++ if (n_numZones <= 0) return (alarm);
598 ++
599 ++
600 ++// // Blank out all exclusion zones
601 ++// for ( int n_zone = 0; n_zone < n_zones; n_zone++ )
602 ++// {
603 ++// Zone *zone = zones[n_zone];
604 ++// zone->ClearAlarm();
605 ++// if ( !zone->IsInactive() )
606 ++// {
607 ++// continue;
608 ++// }
609 ++// Debug( 3, "Blanking inactive zone %s", zone->Label() );
610 ++// delta_image->Fill( RGB_BLACK, zone->GetPolygon() );
611 ++// }
612 ++
613 ++ // Check preclusive zones first
614 ++ for (int n_zone = 0; n_zone < n_numZones; n_zone++)
615 ++ {
616 ++ Zone *zone = zones[n_zone];
617 ++ if (!zone->IsPreclusive())
618 ++ {
619 ++ continue;
620 ++ }
621 ++ sprintf(szMessage, "Checking preclusive zone %s", zone->Label());
622 ++ log(LOG_DEBUG, szMessage);
623 ++ if (checkZone(zone, &zmImage))
624 ++ {
625 ++ alarm = true;
626 ++ score += zone->Score();
627 ++ zone->SetAlarm();
628 ++ sprintf(szMessage, "Zone is alarmed, zone score = %d", zone->Score());
629 ++ log(LOG_DEBUG, szMessage);
630 ++ zoneSet.insert(zone->Label());
631 ++ }
632 ++ }
633 ++
634 ++ if ( alarm )
635 ++ {
636 ++ alarm = false;
637 ++ score = 0;
638 ++ }
639 ++ else
640 ++ {
641 ++ // Find all alarm pixels in active zones
642 ++ for (int n_zone = 0; n_zone < n_numZones; n_zone++)
643 ++ {
644 ++ Zone *zone = zones[n_zone];
645 ++ if (!zone->IsActive())
646 ++ {
647 ++ continue;
648 ++ }
649 ++ sprintf(szMessage, "Checking active zone %s", zone->Label());
650 ++ log(LOG_DEBUG, szMessage);
651 ++ if (checkZone(zone, &zmImage))
652 ++ {
653 ++ alarm = true;
654 ++ score += zone->Score();
655 ++ zone->SetAlarm();
656 ++ sprintf(szMessage, "Zone is alarmed, zone score = %d", zone->Score());
657 ++ log(LOG_DEBUG, szMessage);
658 ++ zoneSet.insert(zone->Label());
659 ++ }
660 ++ }
661 ++
662 ++ if ( alarm )
663 ++ {
664 ++ // Checking inclusive zones
665 ++ for (int n_zone = 0; n_zone < n_numZones; n_zone++)
666 ++ {
667 ++ Zone *zone = zones[n_zone];
668 ++ if (!zone->IsInclusive())
669 ++ {
670 ++ continue;
671 ++ }
672 ++ sprintf(szMessage, "Checking inclusive zone %s", zone->Label());
673 ++ log(LOG_DEBUG, szMessage);
674 ++ if (checkZone(zone, &zmImage))
675 ++ {
676 ++ alarm = true;
677 ++ score += zone->Score();
678 ++ zone->SetAlarm();
679 ++ sprintf(szMessage, "Zone is alarmed, zone score = %d", zone->Score());
680 ++ log(LOG_DEBUG, szMessage);
681 ++ zoneSet.insert(zone->Label());
682 ++ }
683 ++ }
684 ++ }
685 ++ else
686 ++ {
687 ++ // Find all alarm pixels in exclusive zones
688 ++ for (int n_zone = 0; n_zone < n_numZones; n_zone++)
689 ++ {
690 ++ Zone *zone = zones[n_zone];
691 ++ if (!zone->IsExclusive())
692 ++ {
693 ++ continue;
694 ++ }
695 ++ sprintf(szMessage, "Checking exclusive zone %s", zone->Label());
696 ++ log(LOG_DEBUG, szMessage);
697 ++ if (checkZone(zone, &zmImage))
698 ++ {
699 ++ alarm = true;
700 ++ score += zone->Score();
701 ++ zone->SetAlarm();
702 ++ sprintf(szMessage, "Zone is alarmed, zone score = %d", zone->Score());
703 ++ log(LOG_DEBUG, szMessage);
704 ++ zoneSet.insert(zone->Label());
705 ++ }
706 ++ }
707 ++ } //else if(alarm) : exclusive
708 ++ } //else if(alarm)
709 ++
710 ++
711 ++ return(score?score:alarm);
712 ++}
713 ++
714 ++
715 +diff -aurN zoneminder/trunk/src/zm_detector.h zoneminder_new/trunk/src/zm_detector.h
716 +--- zoneminder/trunk/src/zm_detector.h 1970-01-01 01:00:00.000000000 +0100
717 ++++ zoneminder_new/trunk/src/zm_detector.h 2011-04-01 17:10:30.000000000 +0200
718 +@@ -0,0 +1,129 @@
719 ++#ifndef ZM_DETECTOR_H
720 ++#define ZM_DETECTOR_H
721 ++
722 ++
723 ++#include <string>
724 ++#include <syslog.h>
725 ++#include <libgen.h>
726 ++
727 ++#include "zm_image.h"
728 ++#include "zm_zone.h"
729 ++#include "zm_event.h"
730 ++
731 ++
732 ++
733 ++#define DEFAULT_DETECTION_CAUSE "Object Detected"
734 ++#define DEFAULT_MIN_ALARM_SCORE 1.0
735 ++#define DEFAULT_MAX_ALARM_SCORE 99.0
736 ++#define DEFAULT_IMAGE_SCALE_FACTOR 1.0
737 ++
738 ++#define DEFAULT_LOG_PREFIX "ZM PLUGIN"
739 ++#define LOG_LEVEL LOG_NOTICE
740 ++#define DEFAULT_CONFIGFILE_SECTION "libzm_vscvl_plugin"
741 ++
742 ++using namespace std;
743 ++
744 ++
745 ++//! Base class for object detectors, defined in plugins.
746 ++class Detector
747 ++{
748 ++
749 ++public:
750 ++
751 ++ //! Destructor
752 ++ virtual ~Detector() { closelog(); }
753 ++
754 ++ //! Default constructor
755 ++ Detector()
756 ++{
757 ++ m_sLogPrefix = DEFAULT_LOG_PREFIX;
758 ++
759 ++ //setlogmask (LOG_UPTO (LOG_LEVEL));
760 ++ //openlog(m_sLogPrefix.c_str(), LOG_PID|LOG_CONS, LOG_USER);
761 ++
762 ++ m_sDetectionCause = DEFAULT_DETECTION_CAUSE;
763 ++ m_fMinAlarmScore = DEFAULT_MIN_ALARM_SCORE;
764 ++ m_fMaxAlarmScore = DEFAULT_MAX_ALARM_SCORE;
765 ++ m_fImageScaleFactor = DEFAULT_IMAGE_SCALE_FACTOR;
766 ++ m_sConfigSectionName = DEFAULT_CONFIGFILE_SECTION;
767 ++ m_nNewWidth = 0;
768 ++ m_nNewHeight = 0;
769 ++}
770 ++
771 ++ //! Constructor with section name parameter.
772 ++ Detector(string sPluginFileName)
773 ++{
774 ++ m_sLogPrefix = DEFAULT_LOG_PREFIX;
775 ++
776 ++ char* szPluginFileName = strdup(sPluginFileName.c_str());
777 ++
778 ++ string sPluginFileNameName = string(basename(szPluginFileName));
779 ++
780 ++ size_t idx = sPluginFileNameName.rfind('.');
781 ++
782 ++ if (idx == string::npos)
783 ++ m_sConfigSectionName = sPluginFileNameName;
784 ++ else
785 ++ m_sConfigSectionName = sPluginFileNameName.substr(0, idx);
786 ++
787 ++ m_sDetectionCause = DEFAULT_DETECTION_CAUSE;
788 ++ m_fMinAlarmScore = DEFAULT_MIN_ALARM_SCORE;
789 ++ m_fMaxAlarmScore = DEFAULT_MAX_ALARM_SCORE;
790 ++ m_fImageScaleFactor = DEFAULT_IMAGE_SCALE_FACTOR;
791 ++ m_nNewWidth = 0;
792 ++ m_nNewHeight = 0;
793 ++}
794 ++
795 ++ //! Copy constructor
796 ++ Detector(const Detector& source);
797 ++
798 ++ //! Assignment operator
799 ++ Detector& operator=(const Detector& source);
800 ++
801 ++ //! Detect (in an image later)
802 ++ int Detect(const Image &image, Zone** zones, int n_numZones, Event::StringSet &zoneSet);
803 ++
804 ++ //! Load detector's parameters from a config file.
805 ++ virtual void loadConfig(string sConfigFileName) = 0;
806 ++
807 ++ //! Returns detection case string.
808 ++ string getDetectionCause();
809 ++
810 ++protected:
811 ++
812 ++ //! Do detection inside one given zone.
813 ++ virtual bool checkZone(Zone *zone, const Image *zmImage) = 0;
814 ++
815 ++ //! Log messages to the SYSLOG.
816 ++ void log(int, string sMessage);
817 ++
818 ++ //! String to be shown as detection cause for event.
819 ++ string m_sDetectionCause;
820 ++
821 ++ //! Minimum score value to consider frame as to be alarmed.
822 ++ double m_fMinAlarmScore;
823 ++
824 ++ //! Maximum score value to consider frame as to be alarmed.
825 ++ double m_fMaxAlarmScore;
826 ++
827 ++ //! Maximum allowed width of frame image.
828 ++ double m_fImageScaleFactor;
829 ++
830 ++ //! Width of image to resize.
831 ++ int m_nNewWidth;
832 ++
833 ++ //! Height of image to resize.
834 ++ int m_nNewHeight;
835 ++//
836 ++// //! Output stream for logging errors.
837 ++// ofstream m_outStream;
838 ++
839 ++ //! String prefix for SYSLOG messages.
840 ++ string m_sLogPrefix;
841 ++
842 ++ //! Name of config file section to search parameters.
843 ++ string m_sConfigSectionName;
844 ++};
845 ++
846 ++
847 ++#endif // ZM_DETECTOR_H
848 +diff -aurN zoneminder/trunk/src/zm_event.h zoneminder_new/trunk/src/zm_event.h
849 +--- zoneminder/trunk/src/zm_event.h 2011-04-01 17:08:30.000000000 +0200
850 ++++ zoneminder_new/trunk/src/zm_event.h 2011-04-01 17:10:30.000000000 +0200
851 +@@ -41,7 +41,7 @@
852 + class Zone;
853 + class Monitor;
854 +
855 +-#define MAX_PRE_ALARM_FRAMES 16 // Maximum number of prealarm frames that can be stored
856 ++#define MAX_PRE_ALARM_FRAMES 16 // Maximum number of prealarm frames that can be stored
857 +
858 + //
859 + // Class describing events, i.e. captured periods of activity.
860 +diff -aurN zoneminder/trunk/src/zm_image_analyser.cpp zoneminder_new/trunk/src/zm_image_analyser.cpp
861 +--- zoneminder/trunk/src/zm_image_analyser.cpp 1970-01-01 01:00:00.000000000 +0100
862 ++++ zoneminder_new/trunk/src/zm_image_analyser.cpp 2011-04-01 17:10:30.000000000 +0200
863 +@@ -0,0 +1,86 @@
864 ++#include "zm_image_analyser.h"
865 ++
866 ++
867 ++
868 ++/*!\fn ImageAnalyser::ImageAnalyser(const ImageAnalyser& source)
869 ++ * \param source is the object to copy
870 ++ */
871 ++ImageAnalyser::ImageAnalyser(const ImageAnalyser& source)
872 ++{
873 ++ m_Detectors = source.m_Detectors;
874 ++}
875 ++
876 ++
877 ++
878 ++/*!\fn ImageAnalyser::operator=(const ImageAnalyser& source)
879 ++ * \param source is the object to copy
880 ++ */
881 ++ImageAnalyser& ImageAnalyser::operator=(const ImageAnalyser& source)
882 ++{
883 ++ m_Detectors = source.m_Detectors;
884 ++ return *this;
885 ++}
886 ++
887 ++
888 ++
889 ++ImageAnalyser::~ImageAnalyser()
890 ++{
891 ++ for(DetectorsList::reverse_iterator It = m_Detectors.rbegin();
892 ++ It != m_Detectors.rend();
893 ++ ++It)
894 ++ delete *It;
895 ++}
896 ++
897 ++
898 ++
899 ++/*!\fn ImageAnalyser::DoDetection(const Image &comp_image, Zone** zones, int n_numZones, Event::StringSetMap noteSetMap, std::string& det_cause)
900 ++ * \param comp_image is the image to analyse
901 ++ * \param zones is the zones array to analyse
902 ++ * \param n_numZones is the number of zones
903 ++ * \param noteSetMap is the map of events descriptions
904 ++ * \param det_cause is a string describing detection cause
905 ++ */
906 ++int ImageAnalyser::DoDetection(const Image &comp_image, Zone** zones, int n_numZones, Event::StringSetMap noteSetMap, std::string& det_cause)
907 ++{
908 ++ Event::StringSet zoneSet;
909 ++ int score = 0;
910 ++
911 ++ for(DetectorsList::iterator It = m_Detectors.begin();
912 ++ It != m_Detectors.end();
913 ++ ++It)
914 ++ {
915 ++ int detect_score = (*It)->Detect(comp_image, zones, n_numZones, zoneSet);
916 ++ if (detect_score)
917 ++ {
918 ++ score += detect_score;
919 ++ noteSetMap[(*It)->getDetectionCause()] = zoneSet;
920 ++ if (det_cause.length())
921 ++ det_cause += ", ";
922 ++ det_cause += (*It)->getDetectionCause();
923 ++ }
924 ++ }
925 ++ return score;
926 ++}
927 ++
928 ++
929 ++
930 ++/*!\fn ImageAnalyser::configurePlugins(string sConfigFileName)
931 ++ * \param sConfigFileName is the path to the configuration file, where parameters for all plugins are given.
932 ++ */
933 ++void ImageAnalyser::configurePlugins(string sConfigFileName)
934 ++{
935 ++ for(DetectorsList::iterator It = m_Detectors.begin();
936 ++ It != m_Detectors.end();
937 ++ ++It)
938 ++ {
939 ++ try
940 ++ {
941 ++ (*It)->loadConfig(sConfigFileName);
942 ++ }
943 ++ catch(...)
944 ++ {
945 ++ Info("ERROR: Plugin \"%s\" couldn\'t load config file \"%s\".", (*It)->getDetectionCause(), sConfigFileName.c_str());
946 ++ }
947 ++ }
948 ++
949 ++}
950 +diff -aurN zoneminder/trunk/src/zm_image_analyser.h zoneminder_new/trunk/src/zm_image_analyser.h
951 +--- zoneminder/trunk/src/zm_image_analyser.h 1970-01-01 01:00:00.000000000 +0100
952 ++++ zoneminder_new/trunk/src/zm_image_analyser.h 2011-04-01 17:10:30.000000000 +0200
953 +@@ -0,0 +1,65 @@
954 ++#ifndef ZM_IMAGE_ANALYSER_H
955 ++#define ZM_IMAGE_ANALYSER_H
956 ++
957 ++
958 ++
959 ++#include <list>
960 ++#include <string>
961 ++#include <stdexcept>
962 ++#include <iostream>
963 ++#include <memory>
964 ++
965 ++#include "zm.h"
966 ++#include "zm_detector.h"
967 ++#include "zm_image.h"
968 ++#include "zm_zone.h"
969 ++#include "zm_event.h"
970 ++
971 ++
972 ++
973 ++using namespace std;
974 ++
975 ++
976 ++//! List of available detectors.
977 ++typedef std::list<Detector *> DetectorsList;
978 ++
979 ++
980 ++//! Class for handling image detection.
981 ++/*! Contains all detectors loaded from plugins.
982 ++ */
983 ++class ImageAnalyser {
984 ++ public:
985 ++
986 ++ //!Default constructor.
987 ++ ImageAnalyser() {};
988 ++
989 ++ //! Destructor.
990 ++ ~ImageAnalyser();
991 ++
992 ++ //! Copy constructor.
993 ++ ImageAnalyser(const ImageAnalyser& source);
994 ++
995 ++ //! Overloaded operator=.
996 ++ ImageAnalyser& operator=(const ImageAnalyser& source);
997 ++
998 ++ //! Adds new plugin's detector to the list of detectors.
999 ++ void addDetector(std::auto_ptr<Detector> Det)
1000 ++ {
1001 ++ m_Detectors.push_back(Det.release());
1002 ++ }
1003 ++
1004 ++ //! Do detection in an image by calling all available detectors.
1005 ++ int DoDetection(const Image &comp_image, Zone** zones, int n_numZones, Event::StringSetMap noteSetMap, std::string& det_cause);
1006 ++
1007 ++ //! Configure all loaded plugins using given configuration file.
1008 ++ void configurePlugins(string sConfigFileName);
1009 ++
1010 ++private:
1011 ++
1012 ++ //! All available detectors.
1013 ++ DetectorsList m_Detectors;
1014 ++};
1015 ++
1016 ++
1017 ++
1018 ++#endif //ZM_IMAGE_ANALYSER_H
1019 +diff -aurN zoneminder/trunk/src/zm_monitor.cpp zoneminder_new/trunk/src/zm_monitor.cpp
1020 +--- zoneminder/trunk/src/zm_monitor.cpp 2011-04-01 17:08:30.000000000 +0200
1021 ++++ zoneminder_new/trunk/src/zm_monitor.cpp 2011-04-01 17:35:20.000000000 +0200
1022 +@@ -49,6 +49,37 @@
1023 + #include <sys/shm.h>
1024 + #endif // ZM_MEM_MAPPED
1025 +
1026 ++
1027 ++//=============================================================================
1028 ++std::string trimSpaces(std::string str)
1029 ++{
1030 ++ // Trim Both leading and trailing spaces
1031 ++ size_t startpos = str.find_first_not_of(" \t"); // Find the first character position after excluding leading blank spaces
1032 ++ size_t endpos = str.find_last_not_of(" \t"); // Find the first character position from reverse af
1033 ++
1034 ++ // if all spaces or empty return an empty string
1035 ++ if(( std::string::npos == startpos ) || ( std::string::npos == endpos))
1036 ++ {
1037 ++ return std::string("");
1038 ++ }
1039 ++ else
1040 ++ return str.substr( startpos, endpos-startpos+1 );
1041 ++}
1042 ++
1043 ++
1044 ++std::vector<std::string> split(const std::string &s, char delim) {
1045 ++ std::vector<std::string> elems;
1046 ++ std::stringstream ss(s);
1047 ++ std::string item;
1048 ++ while(std::getline(ss, item, delim)) {
1049 ++ elems.push_back(trimSpaces(item));
1050 ++ }
1051 ++ return elems;
1052 ++}
1053 ++//=============================================================================
1054 ++
1055 ++
1056 ++
1057 + Monitor::MonitorLink::MonitorLink( int p_id, const char *p_name ) : id( p_id )
1058 + {
1059 + strncpy( name, p_name, sizeof(name) );
1060 +@@ -263,7 +294,9 @@
1061 + Rgb p_signal_check_colour,
1062 + Purpose p_purpose,
1063 + int p_n_zones,
1064 +- Zone *p_zones[]
1065 ++ Zone *p_zones[],
1066 ++ std::string p_sPlugins,
1067 ++ bool p_DoNativeMotDet
1068 + ) : id( p_id ),
1069 + function( (Function)p_function ),
1070 + enabled( p_enabled ),
1071 +@@ -290,7 +323,8 @@
1072 + purpose( p_purpose ),
1073 + camera( p_camera ),
1074 + n_zones( p_n_zones ),
1075 +- zones( p_zones )
1076 ++ zones( p_zones ),
1077 ++ m_bDoNativeMotDet(p_DoNativeMotDet)
1078 + {
1079 + strncpy( name, p_name, sizeof(name) );
1080 +
1081 +@@ -392,6 +426,12 @@
1082 + trigger_data = (TriggerData *)((char *)shared_data + sizeof(SharedData));
1083 + struct timeval *shared_timestamps = (struct timeval *)((char *)trigger_data + sizeof(TriggerData));
1084 + unsigned char *shared_images = (unsigned char *)((char *)shared_timestamps + (image_buffer_count*sizeof(struct timeval)));
1085 ++
1086 ++ //========================================================================================
1087 ++ // Get from string with plugins names particular names.
1088 ++ m_sPluginNames = split(p_sPlugins, ';');
1089 ++
1090 ++ //========================================================================================
1091 +
1092 + if ( purpose == CAPTURE )
1093 + {
1094 +@@ -425,6 +465,32 @@
1095 + shared_data->last_read_time = 0;
1096 + shared_data->alarm_x = -1;
1097 + shared_data->alarm_y = -1;
1098 ++
1099 ++ //========================================================================================
1100 ++ Info("In the constructor of Monitor class with ID=%d:", p_id);
1101 ++ if (config.load_plugins)
1102 ++ {
1103 ++ Info("Load plugins from the directory %s ... ", config.path_plugins);
1104 ++ std::string sPluginExt = std::string(config.plugin_extension);
1105 ++ ThePluginManager.setPluginExt(sPluginExt);
1106 ++ for (std::vector<std::string>::iterator it = m_sPluginNames.begin() ; it < m_sPluginNames.end(); it++ )
1107 ++ {
1108 ++ std::string sFullPluginPath = join_paths(config.path_plugins, *it + config.plugin_extension);
1109 ++ Info("Plugin path %s", sFullPluginPath.c_str());
1110 ++ ThePluginManager.loadPlugin(sFullPluginPath);
1111 ++ }
1112 ++
1113 ++// int count_plugins = ThePluginManager.findPlugins(config.path_plugins);
1114 ++// Info("Number of found plugins is %d", count_plugins);
1115 ++// if (count_plugins > 0)
1116 ++// {
1117 ++ std::string sPluginsConfig = std::string(config.plugins_config_path);
1118 ++ Info("Configure plugins with \'%s\' config file.", config.plugins_config_path);
1119 ++ ThePluginManager.configurePlugins(sPluginsConfig);
1120 ++// }
1121 ++
1122 ++ }
1123 ++ //========================================================================================
1124 + }
1125 +
1126 + if ( !shared_data->valid )
1127 +@@ -1209,23 +1275,52 @@
1128 + }
1129 + else if ( signal && Active() && function != RECORD && function != NODECT )
1130 + {
1131 +- Event::StringSet zoneSet;
1132 +- int motion_score = DetectMotion( *snap_image, zoneSet );
1133 +- if ( motion_score )
1134 +- {
1135 +- if ( !event )
1136 +- {
1137 +- score += motion_score;
1138 +- if ( cause.length() )
1139 +- cause += ", ";
1140 +- cause += MOTION_CAUSE;
1141 ++ if ((config.turnoff_native_analysis && !config.load_plugins) || (!config.turnoff_native_analysis && (m_bDoNativeMotDet || (!m_bDoNativeMotDet && !config.load_plugins))) )
1142 ++ {
1143 ++ Event::StringSet zoneSet;
1144 ++ int motion_score = DetectMotion( *snap_image, zoneSet );
1145 ++ //int motion_score = DetectBlack( *snap_image, zoneSet );
1146 ++ if ( motion_score )
1147 ++ {
1148 ++ if ( !event )
1149 ++ {
1150 ++ score += motion_score;
1151 ++ if ( cause.length() )
1152 ++ cause += ", ";
1153 ++ cause += MOTION_CAUSE;
1154 ++ }
1155 ++ else
1156 ++ {
1157 ++ score += motion_score;
1158 ++ }
1159 ++ noteSetMap[MOTION_CAUSE] = zoneSet;
1160 + }
1161 +- else
1162 ++ }
1163 ++ //====================================================================
1164 ++ else
1165 ++ {
1166 ++
1167 ++ for ( int n_zone = 0; n_zone < n_zones; n_zone++ )
1168 + {
1169 +- score += motion_score;
1170 ++ zones[n_zone]->ResetStats();
1171 + }
1172 +- noteSetMap[MOTION_CAUSE] = zoneSet;
1173 + }
1174 ++
1175 ++ if (config.load_plugins)
1176 ++ {
1177 ++ std::string det_cause; // detection cause to fill in plugin's detectors
1178 ++ score += ThePluginManager.getImageAnalyser().DoDetection(*snap_image, zones, n_zones, noteSetMap, det_cause);
1179 ++ if (!event)
1180 ++ {
1181 ++ if (det_cause.length())
1182 ++ {
1183 ++ if (cause.length())
1184 ++ cause += ", ";
1185 ++ cause += det_cause;
1186 ++ }
1187 ++ }
1188 ++ }
1189 ++ //====================================================================
1190 + shared_data->active = signal;
1191 + }
1192 + if ( n_linked_monitors > 0 )
1193 +@@ -1547,7 +1642,7 @@
1194 + closeEvent();
1195 +
1196 + static char sql[ZM_SQL_MED_BUFSIZ];
1197 +- snprintf( sql, sizeof(sql), "select Function+0, Enabled, LinkedMonitors, EventPrefix, LabelFormat, LabelX, LabelY, WarmupCount, PreEventCount, PostEventCount, AlarmFrameCount, SectionLength, FrameSkip, MaxFPS, AlarmMaxFPS, FPSReportInterval, RefBlendPerc, TrackMotion, SignalCheckColour from Monitors where Id = '%d'", id );
1198 ++ snprintf( sql, sizeof(sql), "select Function+0, Enabled, LinkedMonitors, EventPrefix, LabelFormat, LabelX, LabelY, WarmupCount, PreEventCount, PostEventCount, AlarmFrameCount, SectionLength, FrameSkip, MaxFPS, AlarmMaxFPS, FPSReportInterval, RefBlendPerc, TrackMotion, UsedPl, DoNativeMotDet, SignalCheckColour from Monitors where Id = '%d'", id );
1199 + if ( mysql_query( &dbconn, sql ) )
1200 + {
1201 + Error( "Can't run query: %s", mysql_error( &dbconn ) );
1202 +@@ -1587,6 +1682,14 @@
1203 + fps_report_interval = atoi(dbrow[index++]);
1204 + ref_blend_perc = atoi(dbrow[index++]);
1205 + track_motion = atoi(dbrow[index++]);
1206 ++
1207 ++ //============================================================================
1208 ++ std::string plugins = dbrow[index]; index++;
1209 ++ m_sPluginNames = split(plugins ,';');
1210 ++ std::string sDoNativeMotDet = dbrow[index]; index++;
1211 ++ m_bDoNativeMotDet = !sDoNativeMotDet.compare("yes") ? true : false;
1212 ++ //============================================================================
1213 ++
1214 + if ( dbrow[index][0] == '#' )
1215 + signal_check_colour = strtol(dbrow[index]+1,0,16);
1216 + else
1217 +@@ -1733,11 +1836,11 @@
1218 + static char sql[ZM_SQL_MED_BUFSIZ];
1219 + if ( !device[0] )
1220 + {
1221 +- strncpy( sql, "select Id, Name, Function+0, Enabled, LinkedMonitors, Device, Channel, Format, Method, Width, Height, Palette, Orientation+0, Brightness, Contrast, Hue, Colour, EventPrefix, LabelFormat, LabelX, LabelY, ImageBufferCount, WarmupCount, PreEventCount, PostEventCount, StreamReplayBuffer, AlarmFrameCount, SectionLength, FrameSkip, MaxFPS, AlarmMaxFPS, FPSReportInterval, RefBlendPerc, TrackMotion, SignalCheckColour from Monitors where Function != 'None' and Type = 'Local' order by Device, Channel", sizeof(sql) );
1222 ++ strncpy( sql, "select Id, Name, Function+0, Enabled, LinkedMonitors, Device, Channel, Format, Method, Width, Height, Palette, Orientation+0, Brightness, Contrast, Hue, Colour, EventPrefix, LabelFormat, LabelX, LabelY, ImageBufferCount, WarmupCount, PreEventCount, PostEventCount, StreamReplayBuffer, AlarmFrameCount, SectionLength, FrameSkip, MaxFPS, AlarmMaxFPS, FPSReportInterval, RefBlendPerc, TrackMotion, UsedPl, DoNativeMotDet, SignalCheckColour from Monitors where Function != 'None' and Type = 'Local' order by Device, Channel", sizeof(sql) );
1223 + }
1224 + else
1225 + {
1226 +- snprintf( sql, sizeof(sql), "select Id, Name, Function+0, Enabled, LinkedMonitors, Device, Channel, Format, Method, Width, Height, Palette, Orientation+0, Brightness, Contrast, Hue, Colour, EventPrefix, LabelFormat, LabelX, LabelY, ImageBufferCount, WarmupCount, PreEventCount, PostEventCount, StreamReplayBuffer, AlarmFrameCount, SectionLength, FrameSkip, MaxFPS, AlarmMaxFPS, FPSReportInterval, RefBlendPerc, TrackMotion, SignalCheckColour from Monitors where Function != 'None' and Type = 'Local' and Device = '%s' order by Channel", device );
1227 ++ snprintf( sql, sizeof(sql), "select Id, Name, Function+0, Enabled, LinkedMonitors, Device, Channel, Format, Method, Width, Height, Palette, Orientation+0, Brightness, Contrast, Hue, Colour, EventPrefix, LabelFormat, LabelX, LabelY, ImageBufferCount, WarmupCount, PreEventCount, PostEventCount, StreamReplayBuffer, AlarmFrameCount, SectionLength, FrameSkip, MaxFPS, AlarmMaxFPS, FPSReportInterval, RefBlendPerc, TrackMotion, UsedPl, DoNativeMotDet, SignalCheckColour from Monitors where Function != 'None' and Type = 'Local' and Device = '%s' order by Channel", device );
1228 + }
1229 + if ( mysql_query( &dbconn, sql ) )
1230 + {
1231 +@@ -1798,6 +1901,13 @@
1232 + int fps_report_interval = atoi(dbrow[col]); col++;
1233 + int ref_blend_perc = atoi(dbrow[col]); col++;
1234 + int track_motion = atoi(dbrow[col]); col++;
1235 ++
1236 ++ //============================================================================
1237 ++ std::string plugins = dbrow[col]; col++;
1238 ++ std::string sDoNativeMotDet = dbrow[col]; col++;
1239 ++ bool doNativeMotDet = !sDoNativeMotDet.compare("yes") ? true : false;
1240 ++ //============================================================================
1241 ++
1242 + int signal_check_colour;
1243 + if ( dbrow[col][0] == '#' )
1244 + signal_check_colour = strtol(dbrow[col]+1,0,16);
1245 +@@ -1849,7 +1959,11 @@
1246 + ref_blend_perc,
1247 + track_motion,
1248 + signal_check_colour,
1249 +- purpose
1250 ++ purpose,
1251 ++ 0,
1252 ++ 0,
1253 ++ plugins,
1254 ++ doNativeMotDet
1255 + );
1256 + Zone **zones = 0;
1257 + int n_zones = Zone::Load( monitors[i], zones );
1258 +@@ -1873,11 +1987,11 @@
1259 + static char sql[ZM_SQL_MED_BUFSIZ];
1260 + if ( !protocol )
1261 + {
1262 +- strncpy( sql, "select Id, Name, Function+0, Enabled, LinkedMonitors, Protocol, Method, Host, Port, Path, Width, Height, Palette, Orientation+0, Brightness, Contrast, Hue, Colour, EventPrefix, LabelFormat, LabelX, LabelY, ImageBufferCount, WarmupCount, PreEventCount, PostEventCount, StreamReplayBuffer, AlarmFrameCount, SectionLength, FrameSkip, MaxFPS, AlarmMaxFPS, FPSReportInterval, RefBlendPerc, TrackMotion from Monitors where Function != 'None' and Type = 'Remote'", sizeof(sql) );
1263 ++ strncpy( sql, "select Id, Name, Function+0, Enabled, LinkedMonitors, Protocol, Method, Host, Port, Path, Width, Height, Palette, Orientation+0, Brightness, Contrast, Hue, Colour, EventPrefix, LabelFormat, LabelX, LabelY, ImageBufferCount, WarmupCount, PreEventCount, PostEventCount, StreamReplayBuffer, AlarmFrameCount, SectionLength, FrameSkip, MaxFPS, AlarmMaxFPS, FPSReportInterval, RefBlendPerc, TrackMotion, UsedPl, DoNativeMotDet from Monitors where Function != 'None' and Type = 'Remote'", sizeof(sql) );
1264 + }
1265 + else
1266 + {
1267 +- snprintf( sql, sizeof(sql), "select Id, Name, Function+0, Enabled, LinkedMonitors, Protocol, Method, Host, Port, Path, Width, Height, Palette, Orientation+0, Brightness, Contrast, Hue, Colour, EventPrefix, LabelFormat, LabelX, LabelY, ImageBufferCount, WarmupCount, PreEventCount, PostEventCount, StreamReplayBuffer, AlarmFrameCount, SectionLength, FrameSkip, MaxFPS, AlarmMaxFPS, FPSReportInterval, RefBlendPerc, TrackMotion from Monitors where Function != 'None' and Type = 'Remote' and Protocol = '%s' and Host = '%s' and Port = '%s' and Path = '%s'", protocol, host, port, path );
1268 ++ snprintf( sql, sizeof(sql), "select Id, Name, Function+0, Enabled, LinkedMonitors, Protocol, Method, Host, Port, Path, Width, Height, Palette, Orientation+0, Brightness, Contrast, Hue, Colour, EventPrefix, LabelFormat, LabelX, LabelY, ImageBufferCount, WarmupCount, PreEventCount, PostEventCount, StreamReplayBuffer, AlarmFrameCount, SectionLength, FrameSkip, MaxFPS, AlarmMaxFPS, FPSReportInterval, RefBlendPerc, TrackMotion, UsedPl, DoNativeMotDet from Monitors where Function != 'None' and Type = 'Remote' and Protocol = '%s' and Host = '%s' and Port = '%s' and Path = '%s'", protocol, host, port, path );
1269 + }
1270 + if ( mysql_query( &dbconn, sql ) )
1271 + {
1272 +@@ -1939,6 +2053,13 @@
1273 + int fps_report_interval = atoi(dbrow[col]); col++;
1274 + int ref_blend_perc = atoi(dbrow[col]); col++;
1275 + int track_motion = atoi(dbrow[col]); col++;
1276 ++
1277 ++ //============================================================================
1278 ++ std::string plugins = dbrow[col]; col++;
1279 ++ std::string sDoNativeMotDet = dbrow[col]; col++;
1280 ++ bool doNativeMotDet = !sDoNativeMotDet.compare("yes") ? true : false;
1281 ++ //============================================================================
1282 ++
1283 +
1284 + int cam_width = ((orientation==ROTATE_90||orientation==ROTATE_270)?height:width);
1285 + int cam_height = ((orientation==ROTATE_90||orientation==ROTATE_270)?width:height);
1286 +@@ -2012,7 +2133,11 @@
1287 + ref_blend_perc,
1288 + track_motion,
1289 + RGB_WHITE,
1290 +- purpose
1291 ++ purpose,
1292 ++ 0,
1293 ++ 0,
1294 ++ plugins,
1295 ++ doNativeMotDet
1296 + );
1297 + Zone **zones = 0;
1298 + int n_zones = Zone::Load( monitors[i], zones );
1299 +@@ -2035,11 +2160,11 @@
1300 + static char sql[ZM_SQL_MED_BUFSIZ];
1301 + if ( !file[0] )
1302 + {
1303 +- strncpy( sql, "select Id, Name, Function+0, Enabled, LinkedMonitors, Path, Width, Height, Palette, Orientation+0, Brightness, Contrast, Hue, Colour, EventPrefix, LabelFormat, LabelX, LabelY, ImageBufferCount, WarmupCount, PreEventCount, PostEventCount, StreamReplayBuffer, AlarmFrameCount, SectionLength, FrameSkip, MaxFPS, AlarmMaxFPS, FPSReportInterval, RefBlendPerc, TrackMotion from Monitors where Function != 'None' and Type = 'File'", sizeof(sql) );
1304 ++ strncpy( sql, "select Id, Name, Function+0, Enabled, LinkedMonitors, Path, Width, Height, Palette, Orientation+0, Brightness, Contrast, Hue, Colour, EventPrefix, LabelFormat, LabelX, LabelY, ImageBufferCount, WarmupCount, PreEventCount, PostEventCount, StreamReplayBuffer, AlarmFrameCount, SectionLength, FrameSkip, MaxFPS, AlarmMaxFPS, FPSReportInterval, RefBlendPerc, TrackMotion, UsedPl, DoNativeMotDet from Monitors where Function != 'None' and Type = 'File'", sizeof(sql) );
1305 + }
1306 + else
1307 + {
1308 +- snprintf( sql, sizeof(sql), "select Id, Name, Function+0, Enabled, LinkedMonitors, Path, Width, Height, Palette, Orientation+0, Brightness, Contrast, Hue, Colour, EventPrefix, LabelFormat, LabelX, LabelY, ImageBufferCount, WarmupCount, PreEventCount, PostEventCount, StreamReplayBuffer, AlarmFrameCount, SectionLength, FrameSkip, MaxFPS, AlarmMaxFPS, FPSReportInterval, RefBlendPerc, TrackMotion from Monitors where Function != 'None' and Type = 'File' and Path = '%s'", file );
1309 ++ snprintf( sql, sizeof(sql), "select Id, Name, Function+0, Enabled, LinkedMonitors, Path, Width, Height, Palette, Orientation+0, Brightness, Contrast, Hue, Colour, EventPrefix, LabelFormat, LabelX, LabelY, ImageBufferCount, WarmupCount, PreEventCount, PostEventCount, StreamReplayBuffer, AlarmFrameCount, SectionLength, FrameSkip, MaxFPS, AlarmMaxFPS, FPSReportInterval, RefBlendPerc, TrackMotion, UsedPl, DoNativeMotDet from Monitors where Function != 'None' and Type = 'File' and Path = '%s'", file );
1310 + }
1311 + if ( mysql_query( &dbconn, sql ) )
1312 + {
1313 +@@ -2097,6 +2222,13 @@
1314 + int fps_report_interval = atoi(dbrow[col]); col++;
1315 + int ref_blend_perc = atoi(dbrow[col]); col++;
1316 + int track_motion = atoi(dbrow[col]); col++;
1317 ++
1318 ++ //============================================================================
1319 ++ std::string plugins = dbrow[col]; col++;
1320 ++ std::string sDoNativeMotDet = dbrow[col]; col++;
1321 ++ bool doNativeMotDet = !sDoNativeMotDet.compare("yes") ? true : false;
1322 ++ //============================================================================
1323 ++
1324 +
1325 + int cam_width = ((orientation==ROTATE_90||orientation==ROTATE_270)?height:width);
1326 + int cam_height = ((orientation==ROTATE_90||orientation==ROTATE_270)?width:height);
1327 +@@ -2139,7 +2271,11 @@
1328 + ref_blend_perc,
1329 + track_motion,
1330 + RGB_WHITE,
1331 +- purpose
1332 ++ purpose,
1333 ++ 0,
1334 ++ 0,
1335 ++ plugins,
1336 ++ doNativeMotDet
1337 + );
1338 + Zone **zones = 0;
1339 + int n_zones = Zone::Load( monitors[i], zones );
1340 +@@ -2163,11 +2299,11 @@
1341 + static char sql[ZM_SQL_MED_BUFSIZ];
1342 + if ( !file[0] )
1343 + {
1344 +- strncpy( sql, "select Id, Name, Function+0, Enabled, LinkedMonitors, Path, Width, Height, Palette, Orientation+0, Brightness, Contrast, Hue, Colour, EventPrefix, LabelFormat, LabelX, LabelY, ImageBufferCount, WarmupCount, PreEventCount, PostEventCount, StreamReplayBuffer, AlarmFrameCount, SectionLength, FrameSkip, MaxFPS, AlarmMaxFPS, FPSReportInterval, RefBlendPerc, TrackMotion from Monitors where Function != 'None' and Type = 'Ffmpeg'", sizeof(sql) );
1345 ++ strncpy( sql, "select Id, Name, Function+0, Enabled, LinkedMonitors, Path, Width, Height, Palette, Orientation+0, Brightness, Contrast, Hue, Colour, EventPrefix, LabelFormat, LabelX, LabelY, ImageBufferCount, WarmupCount, PreEventCount, PostEventCount, StreamReplayBuffer, AlarmFrameCount, SectionLength, FrameSkip, MaxFPS, AlarmMaxFPS, FPSReportInterval, RefBlendPerc, TrackMotion, UsedPl, DoNativeMotDet from Monitors where Function != 'None' and Type = 'Ffmpeg'", sizeof(sql) );
1346 + }
1347 + else
1348 + {
1349 +- snprintf( sql, sizeof(sql), "select Id, Name, Function+0, Enabled, LinkedMonitors, Path, Width, Height, Palette, Orientation+0, Brightness, Contrast, Hue, Colour, EventPrefix, LabelFormat, LabelX, LabelY, ImageBufferCount, WarmupCount, PreEventCount, PostEventCount, StreamReplayBuffer, AlarmFrameCount, SectionLength, FrameSkip, MaxFPS, AlarmMaxFPS, FPSReportInterval, RefBlendPerc, TrackMotion from Monitors where Function != 'None' and Type = 'Ffmpeg' and Path = '%s'", file );
1350 ++ snprintf( sql, sizeof(sql), "select Id, Name, Function+0, Enabled, LinkedMonitors, Path, Width, Height, Palette, Orientation+0, Brightness, Contrast, Hue, Colour, EventPrefix, LabelFormat, LabelX, LabelY, ImageBufferCount, WarmupCount, PreEventCount, PostEventCount, StreamReplayBuffer, AlarmFrameCount, SectionLength, FrameSkip, MaxFPS, AlarmMaxFPS, FPSReportInterval, RefBlendPerc, TrackMotion, UsedPl, DoNativeMotDet from Monitors where Function != 'None' and Type = 'Ffmpeg' and Path = '%s'", file );
1351 + }
1352 + if ( mysql_query( &dbconn, sql ) )
1353 + {
1354 +@@ -2225,6 +2361,13 @@
1355 + int fps_report_interval = atoi(dbrow[col]); col++;
1356 + int ref_blend_perc = atoi(dbrow[col]); col++;
1357 + int track_motion = atoi(dbrow[col]); col++;
1358 ++
1359 ++ //============================================================================
1360 ++ std::string plugins = dbrow[col]; col++;
1361 ++ std::string sDoNativeMotDet = dbrow[col]; col++;
1362 ++ bool doNativeMotDet = !sDoNativeMotDet.compare("yes") ? true : false;
1363 ++ //============================================================================
1364 ++
1365 +
1366 + int cam_width = ((orientation==ROTATE_90||orientation==ROTATE_270)?height:width);
1367 + int cam_height = ((orientation==ROTATE_90||orientation==ROTATE_270)?width:height);
1368 +@@ -2267,7 +2410,11 @@
1369 + ref_blend_perc,
1370 + track_motion,
1371 + RGB_WHITE,
1372 +- purpose
1373 ++ purpose,
1374 ++ 0,
1375 ++ 0,
1376 ++ plugins,
1377 ++ doNativeMotDet
1378 + );
1379 + Zone **zones = 0;
1380 + int n_zones = Zone::Load( monitors[i], zones );
1381 +@@ -2288,8 +2435,9 @@
1382 +
1383 + Monitor *Monitor::Load( int id, bool load_zones, Purpose purpose )
1384 + {
1385 ++Info("Load monitor %d, purpose = %d", id, purpose);
1386 + static char sql[ZM_SQL_MED_BUFSIZ];
1387 +- snprintf( sql, sizeof(sql), "select Id, Name, Type, Function+0, Enabled, LinkedMonitors, Device, Channel, Format, Protocol, Method, Host, Port, Path, Width, Height, Palette, Orientation+0, Brightness, Contrast, Hue, Colour, EventPrefix, LabelFormat, LabelX, LabelY, ImageBufferCount, WarmupCount, PreEventCount, PostEventCount, StreamReplayBuffer, AlarmFrameCount, SectionLength, FrameSkip, MaxFPS, AlarmMaxFPS, FPSReportInterval, RefBlendPerc, TrackMotion, SignalCheckColour from Monitors where Id = %d", id );
1388 ++ snprintf( sql, sizeof(sql), "select Id, Name, Type, Function+0, Enabled, LinkedMonitors, Device, Channel, Format, Protocol, Method, Host, Port, Path, Width, Height, Palette, Orientation+0, Brightness, Contrast, Hue, Colour, EventPrefix, LabelFormat, LabelX, LabelY, ImageBufferCount, WarmupCount, PreEventCount, PostEventCount, StreamReplayBuffer, AlarmFrameCount, SectionLength, FrameSkip, MaxFPS, AlarmMaxFPS, FPSReportInterval, RefBlendPerc, TrackMotion, UsedPl, DoNativeMotDet, SignalCheckColour from Monitors where Id = %d", id );
1389 + if ( mysql_query( &dbconn, sql ) )
1390 + {
1391 + Error( "Can't run query: %s", mysql_error( &dbconn ) );
1392 +@@ -2305,6 +2453,7 @@
1393 + int n_monitors = mysql_num_rows( result );
1394 + Debug( 1, "Got %d monitors", n_monitors );
1395 + Monitor *monitor = 0;
1396 ++
1397 + for( int i = 0; MYSQL_ROW dbrow = mysql_fetch_row( result ); i++ )
1398 + {
1399 + int col = 0;
1400 +@@ -2354,6 +2503,13 @@
1401 + int fps_report_interval = atoi(dbrow[col]); col++;
1402 + int ref_blend_perc = atoi(dbrow[col]); col++;
1403 + int track_motion = atoi(dbrow[col]); col++;
1404 ++
1405 ++ //============================================================================
1406 ++ std::string plugins = dbrow[col]; col++;
1407 ++ std::string sDoNativeMotDet = dbrow[col]; col++;
1408 ++ bool doNativeMotDet = !sDoNativeMotDet.compare("yes") ? true : false;
1409 ++ //============================================================================
1410 ++
1411 + int signal_check_colour;
1412 + if ( dbrow[col][0] == '#' )
1413 + signal_check_colour = strtol(dbrow[col]+1,0,16);
1414 +@@ -2496,7 +2652,11 @@
1415 + ref_blend_perc,
1416 + track_motion,
1417 + signal_check_colour,
1418 +- purpose
1419 ++ purpose,
1420 ++ 0,
1421 ++ 0,
1422 ++ plugins,
1423 ++ doNativeMotDet
1424 + );
1425 +
1426 + int n_zones = 0;
1427 +@@ -2680,6 +2840,166 @@
1428 + return( false );
1429 + }
1430 +
1431 ++//-----------------------------------------
1432 ++
1433 ++bool Monitor::OurCheckAlarms( Zone *zone, const Image *pImage )
1434 ++{
1435 ++ Info("Entering OurCheckAlarms >>>>>>>>>>>>>>>>>>>>>>>>>>>>");
1436 ++ unsigned char black_thr = 23;
1437 ++ int min_alarm_score = 10;
1438 ++ int max_alarm_score = 99;
1439 ++ //bool alarm = false;
1440 ++ unsigned int score;
1441 ++ Polygon zone_polygon = zone->GetPolygon();
1442 ++ Info("Got polygon of a zone. It has %d vertices.", zone_polygon.getNumCoords());
1443 ++
1444 ++ zone->ResetStats();
1445 ++ Info("ResetStats done.");
1446 ++
1447 ++ if ( !zone->CheckOverloadCount() )
1448 ++ {
1449 ++ Info("CheckOverloadCount() return false, we'll return false.");
1450 ++ return( false );
1451 ++ }
1452 ++
1453 ++ Image *pMaskImage = new Image(pImage->Width(), pImage->Height(), 1);
1454 ++ Info("Mask image created.");
1455 ++
1456 ++ pMaskImage->Fill(BLACK);
1457 ++ Info("Mask image filled with BLACK.");
1458 ++
1459 ++ if (pImage->Colours() == 1)
1460 ++ {
1461 ++ Info("Analysed image is not colored! Set score = 0.");
1462 ++ score = 0;
1463 ++ }
1464 ++ else
1465 ++ {
1466 ++ Info("Start processing image.");
1467 ++ //Process image
1468 ++ unsigned char *buffer = pImage->Buffer();
1469 ++ unsigned char *mask_buffer = pMaskImage->Buffer();
1470 ++
1471 ++ int black_pixels_count = 0;
1472 ++ Info("Loop for black pixels counting and mask filling.");
1473 ++
1474 ++ while (buffer < (pImage->Buffer() + pImage->Size()))
1475 ++ {
1476 ++ if ( (RED(buffer) < black_thr) && (GREEN(buffer) < black_thr) && (BLUE(buffer) < black_thr) )
1477 ++ {
1478 ++ *mask_buffer = WHITE;
1479 ++ black_pixels_count++;
1480 ++ }
1481 ++ buffer += 3;
1482 ++ mask_buffer++;
1483 ++ }
1484 ++
1485 ++ if ( !black_pixels_count )
1486 ++ {
1487 ++ delete pMaskImage;
1488 ++ return( false );
1489 ++ }
1490 ++
1491 ++ score = (100*black_pixels_count)/zone_polygon.Area();
1492 ++ Info("Number of black pixels is %d, zone polygon area is %d, score is %d", black_pixels_count, zone_polygon.Area(), score);
1493 ++
1494 ++ if ( min_alarm_score && ( score < min_alarm_score) )
1495 ++ {
1496 ++ delete pMaskImage;
1497 ++ return( false );
1498 ++ }
1499 ++ if ( max_alarm_score && (score > max_alarm_score) )
1500 ++ {
1501 ++ zone->SetOverloadCount(zone->GetOverloadFrames());
1502 ++ delete pMaskImage;
1503 ++ return( false );
1504 ++ }
1505 ++ }
1506 ++
1507 ++ zone->SetScore(score);
1508 ++ Info("Score have been set in zone.");
1509 ++
1510 ++ //Get mask
1511 ++ Rgb alarm_colour = RGB_RED;
1512 ++ Image *tempImage = pMaskImage->HighlightEdges(alarm_colour, &zone_polygon.Extent() );
1513 ++ Info("After HighlightEdges");
1514 ++
1515 ++ zone->SetAlarmImage(tempImage);
1516 ++ Info("After SetAlarmImage");
1517 ++ delete pMaskImage;
1518 ++ Info("After Delete pMaskImage");
1519 ++ delete tempImage;
1520 ++
1521 ++ Info("Leaving OurCheckAlarms >>>>>>>>>>>>>>>>>>>>>>>>>>>>");
1522 ++ return true;
1523 ++}
1524 ++
1525 ++
1526 ++unsigned int Monitor::DetectBlack(const Image &comp_image, Event::StringSet &zoneSet )
1527 ++{
1528 ++ Info("Entering DetectBlack >>>>>>>>>>>>>>>>>>>>>>>>>>");
1529 ++ bool alarm = false;
1530 ++ unsigned int score = 0;
1531 ++
1532 ++ if ( n_zones <= 0 ) return( alarm );
1533 ++
1534 ++// Coord alarm_centre;
1535 ++// int top_score = -1;
1536 ++
1537 ++ // Find all alarm pixels in active zones
1538 ++ Info("Number of zones to process %d", n_zones);
1539 ++ for ( int n_zone = 0; n_zone < n_zones; n_zone++ )
1540 ++ {
1541 ++ Zone *zone = zones[n_zone];
1542 ++ if ( !zone->IsActive() )
1543 ++ {
1544 ++ continue;
1545 ++ }
1546 ++ Debug( 3, "Checking active zone %s", zone->Label() );
1547 ++ Info( "Checking active zone %s", zone->Label() );
1548 ++ if ( OurCheckAlarms( zone, &comp_image ) )
1549 ++ {
1550 ++ Info("OurCheckAlarm is TRUE!!!!!!");
1551 ++ alarm = true;
1552 ++ score += zone->Score();
1553 ++ zone->SetAlarm();
1554 ++ Debug( 3, "Zone is alarmed, zone score = %d", zone->Score() );
1555 ++ Info( "Zone is alarmed, zone score = %d", zone->Score() );
1556 ++ zoneSet.insert( zone->Label() );
1557 ++// if ( config.opt_control && track_motion )
1558 ++// {
1559 ++// if ( (int)zone->Score() > top_score )
1560 ++// {
1561 ++// top_score = zone->Score();
1562 ++// alarm_centre = zone->GetAlarmCentre();
1563 ++// }
1564 ++// }
1565 ++ }
1566 ++ Info( "Finish checking active zone %s", zone->Label() );
1567 ++ }
1568 ++
1569 ++
1570 ++// if ( top_score > 0 )
1571 ++// {
1572 ++// shared_data->alarm_x = alarm_centre.X();
1573 ++// shared_data->alarm_y = alarm_centre.Y();
1574 ++//
1575 ++// Info( "Got alarm centre at %d,%d, at count %d", shared_data->alarm_x, shared_data->alarm_y, image_count );
1576 ++// }
1577 ++// else
1578 ++// {
1579 ++// shared_data->alarm_x = shared_data->alarm_y = -1;
1580 ++// }
1581 ++
1582 ++ // This is a small and innocent hack to prevent scores of 0 being returned in alarm state
1583 ++ Info("Leaving DetectBlack <<<<<<<<<<<<<<<<<<<<<<<<<<<");
1584 ++ return( score?score:alarm );
1585 ++}
1586 ++
1587 ++
1588 ++//-----------------------------------------------------------------------------------------------
1589 ++
1590 ++
1591 + unsigned int Monitor::DetectMotion( const Image &comp_image, Event::StringSet &zoneSet )
1592 + {
1593 + bool alarm = false;
1594 +diff -aurN zoneminder/trunk/src/zm_monitor.h zoneminder_new/trunk/src/zm_monitor.h
1595 +--- zoneminder/trunk/src/zm_monitor.h 2011-04-01 17:08:30.000000000 +0200
1596 ++++ zoneminder_new/trunk/src/zm_monitor.h 2011-04-01 17:10:30.000000000 +0200
1597 +@@ -20,6 +20,9 @@
1598 + #ifndef ZM_MONITOR_H
1599 + #define ZM_MONITOR_H
1600 +
1601 ++#include <vector>
1602 ++#include <sstream>
1603 ++
1604 + #include "zm.h"
1605 + #include "zm_coord.h"
1606 + #include "zm_image.h"
1607 +@@ -27,6 +30,9 @@
1608 + #include "zm_event.h"
1609 + #include "zm_camera.h"
1610 +
1611 ++#include "zm_plugin_manager.h"
1612 ++#include "zm_image_analyser.h"
1613 ++
1614 + #include <sys/time.h>
1615 +
1616 + #define SIGNAL_CAUSE "Signal"
1617 +@@ -124,6 +130,13 @@
1618 + Image *image;
1619 + };
1620 +
1621 ++ //=========================================================================
1622 ++ PluginManager ThePluginManager;
1623 ++
1624 ++ std::vector<std::string> m_sPluginNames;
1625 ++ bool m_bDoNativeMotDet;
1626 ++ //============================================================================
1627 ++
1628 + class MonitorLink
1629 + {
1630 + protected:
1631 +@@ -253,7 +266,10 @@
1632 + MonitorLink **linked_monitors;
1633 +
1634 + public:
1635 +- Monitor( int p_id, const char *p_name, int p_function, bool p_enabled, const char *p_linked_monitors, Camera *p_camera, int p_orientation, const char *p_event_prefix, const char *p_label_format, const Coord &p_label_coord, int p_image_buffer_count, int p_warmup_count, int p_pre_event_count, int p_post_event_count, int p_stream_replay_buffer, int p_alarm_frame_count, int p_section_length, int p_frame_skip, int p_capture_delay, int p_alarm_capture_delay, int p_fps_report_interval, int p_ref_blend_perc, bool p_track_motion, Rgb p_signal_check_colour, Purpose p_purpose, int p_n_zones=0, Zone *p_zones[]=0 );
1636 ++//============================================================================
1637 ++bool OurCheckAlarms( Zone *zone, const Image *pImage );
1638 ++//============================================================================
1639 ++ Monitor( int p_id, const char *p_name, int p_function, bool p_enabled, const char *p_linked_monitors, Camera *p_camera, int p_orientation, const char *p_event_prefix, const char *p_label_format, const Coord &p_label_coord, int p_image_buffer_count, int p_warmup_count, int p_pre_event_count, int p_post_event_count, int p_stream_replay_buffer, int p_alarm_frame_count, int p_section_length, int p_frame_skip, int p_capture_delay, int p_alarm_capture_delay, int p_fps_report_interval, int p_ref_blend_perc, bool p_track_motion, Rgb p_signal_check_colour, Purpose p_purpose, int p_n_zones=0, Zone *p_zones[]=0, std::string plugins = "", bool p_DoNativeMotDect = 1);
1640 + ~Monitor();
1641 +
1642 + void AddZones( int p_n_zones, Zone *p_zones[] );
1643 +@@ -342,6 +358,9 @@
1644 + }
1645 +
1646 + unsigned int DetectMotion( const Image &comp_image, Event::StringSet &zoneSet );
1647 ++ //==============================================================================
1648 ++ unsigned int DetectBlack( const Image &comp_image, Event::StringSet &zoneSet );
1649 ++ //==============================================================================
1650 + bool CheckSignal( const Image *image );
1651 + bool Analyse();
1652 + void DumpImage( Image *dump_image ) const;
1653 +diff -aurN zoneminder/trunk/src/zm_plugin.cpp zoneminder_new/trunk/src/zm_plugin.cpp
1654 +--- zoneminder/trunk/src/zm_plugin.cpp 1970-01-01 01:00:00.000000000 +0100
1655 ++++ zoneminder_new/trunk/src/zm_plugin.cpp 2011-04-01 17:10:30.000000000 +0200
1656 +@@ -0,0 +1,103 @@
1657 ++#include "zm_plugin.h"
1658 ++
1659 ++
1660 ++
1661 ++/*!\fn Plugin::Plugin(const std::string &sFilename)
1662 ++ * \param sFilename is the name of plugin file to load
1663 ++ */
1664 ++Plugin::Plugin(const std::string &sFilename)
1665 ++ : m_hDLL(0),
1666 ++ m_pfnGetEngineVersion(0),
1667 ++ m_pfnRegisterPlugin(0),
1668 ++ m_pDLLRefCount(0),
1669 ++ m_sPluginFileName(sFilename)
1670 ++{
1671 ++
1672 ++ // Try to load the plugin as a dynamic library
1673 ++ m_hDLL = dlopen(sFilename.c_str(), RTLD_LAZY|RTLD_GLOBAL);
1674 ++
1675 ++ if(!m_hDLL) // if library hasn't been loaded successfully
1676 ++ {
1677 ++ throw runtime_error(string("Could not load '") + sFilename + "'");
1678 ++ }
1679 ++
1680 ++ // Locate the plugin's exported functions
1681 ++ try
1682 ++ {
1683 ++ m_pfnGetEngineVersion = reinterpret_cast<fnGetEngineVersion *>(dlsym(m_hDLL, "getEngineVersion"));
1684 ++ m_pfnRegisterPlugin = reinterpret_cast<fnRegisterPlugin *>(dlsym(m_hDLL, "registerPlugin"));
1685 ++
1686 ++ // If the functions aren't found, we're going to assume this is
1687 ++ // a plain simple DLL and not one of our plugins
1688 ++ if(!m_pfnGetEngineVersion || ! m_pfnRegisterPlugin)
1689 ++ throw runtime_error(string("'") + sFilename + "' is not a valid plugin");
1690 ++
1691 ++ // Initialize a new DLL reference counter
1692 ++ m_pDLLRefCount = new size_t(1);
1693 ++ }
1694 ++ catch(runtime_error &ex)
1695 ++ {
1696 ++ dlclose(m_hDLL);
1697 ++ throw ex;
1698 ++ }
1699 ++ catch(...)
1700 ++ {
1701 ++ dlclose(m_hDLL);
1702 ++ throw runtime_error(string("Unknown exception while loading plugin '") + sFilename + string("'"));
1703 ++ }
1704 ++}
1705 ++
1706 ++
1707 ++
1708 ++/*!\fn Plugin::Plugin(const Plugin &Other)
1709 ++ * \param Other is the other plugin instance to copy
1710 ++ */
1711 ++Plugin::Plugin(const Plugin &Other)
1712 ++ : m_hDLL(Other.m_hDLL),
1713 ++ m_pfnGetEngineVersion(Other.m_pfnGetEngineVersion),
1714 ++ m_pfnRegisterPlugin(Other.m_pfnRegisterPlugin),
1715 ++ m_pDLLRefCount(Other.m_pDLLRefCount),
1716 ++ m_sPluginFileName(Other.m_sPluginFileName)
1717 ++{
1718 ++ // Increase DLL reference counter
1719 ++ ++*m_pDLLRefCount;
1720 ++}
1721 ++
1722 ++
1723 ++
1724 ++/*!\fn Plugin::operator=(const Plugin &Other)
1725 ++ * \param Other is the other plugin instance to copy
1726 ++ * return copy of object
1727 ++ */
1728 ++Plugin& Plugin::operator=(const Plugin &Other)
1729 ++{
1730 ++ m_hDLL = Other.m_hDLL;
1731 ++ m_pfnGetEngineVersion = Other.m_pfnGetEngineVersion;
1732 ++ m_pfnRegisterPlugin = Other.m_pfnRegisterPlugin;
1733 ++ m_pDLLRefCount = Other.m_pDLLRefCount;
1734 ++ m_sPluginFileName = Other.m_sPluginFileName;
1735 ++ // Increase DLL reference counter
1736 ++ ++*m_pDLLRefCount;
1737 ++}
1738 ++
1739 ++
1740 ++
1741 ++Plugin::~Plugin()
1742 ++{
1743 ++ // Only unload the DLL if there are no more references to it
1744 ++ if(!--*m_pDLLRefCount)
1745 ++ {
1746 ++ delete m_pDLLRefCount;
1747 ++ dlclose(m_hDLL);
1748 ++ }
1749 ++}
1750 ++
1751 ++
1752 ++
1753 ++/*!\fn Plugin::registerPlugin(PluginManager &K)
1754 ++ * \param K is the pointer to plugin manager
1755 ++ */
1756 ++void Plugin::registerPlugin(PluginManager &K)
1757 ++{
1758 ++ m_pfnRegisterPlugin(K, m_sPluginFileName);
1759 ++}
1760 +diff -aurN zoneminder/trunk/src/zm_plugin.h zoneminder_new/trunk/src/zm_plugin.h
1761 +--- zoneminder/trunk/src/zm_plugin.h 1970-01-01 01:00:00.000000000 +0100
1762 ++++ zoneminder_new/trunk/src/zm_plugin.h 2011-04-01 17:10:30.000000000 +0200
1763 +@@ -0,0 +1,78 @@
1764 ++#ifndef ZM_PLUGIN_H
1765 ++#define ZM_PLUGIN_H
1766 ++
1767 ++
1768 ++
1769 ++#include <stdlib.h>
1770 ++#include <stdio.h>
1771 ++#include <dlfcn.h>
1772 ++
1773 ++#include <stdexcept>
1774 ++#include "zm.h"
1775 ++
1776 ++
1777 ++
1778 ++using namespace std;
1779 ++
1780 ++
1781 ++
1782 ++class PluginManager;
1783 ++
1784 ++
1785 ++
1786 ++//! Signature for the version query function
1787 ++typedef int fnGetEngineVersion();
1788 ++
1789 ++//! Signature for the plugin's registration function
1790 ++typedef void fnRegisterPlugin(PluginManager &, string);
1791 ++
1792 ++
1793 ++
1794 ++//! Representation of a plugin.
1795 ++/*! Use for loading plugin's shared library
1796 ++ * and registration of it to the PluginManager.
1797 ++ */
1798 ++class Plugin
1799 ++{
1800 ++
1801 ++public:
1802 ++
1803 ++ //! Initialize and load plugin
1804 ++ Plugin(const std::string &sFilename);
1805 ++
1806 ++ //! Copy existing plugin instance
1807 ++ Plugin(const Plugin &Other);
1808 ++
1809 ++ //! Operator =.
1810 ++ Plugin &operator =(const Plugin &Other);
1811 ++
1812 ++ //! Unload a plugin
1813 ++ ~Plugin();
1814 ++
1815 ++ //! Query the plugin for its expected engine version
1816 ++ int getEngineVersion() const { return m_pfnGetEngineVersion();}
1817 ++
1818 ++ //! Register the plugin to a PluginManager
1819 ++ void registerPlugin(PluginManager &K);
1820 ++
1821 ++private:
1822 ++
1823 ++ //! Shared file name.
1824 ++ string m_sPluginFileName;
1825 ++
1826 ++ //! DLL handle
1827 ++ void* m_hDLL;
1828 ++
1829 ++ //! Number of references to the DLL
1830 ++ size_t *m_pDLLRefCount;
1831 ++
1832 ++ //! Version query function
1833 ++ fnGetEngineVersion *m_pfnGetEngineVersion;
1834 ++
1835 ++ //! Plugin registration function
1836 ++ fnRegisterPlugin *m_pfnRegisterPlugin;
1837 ++};
1838 ++
1839 ++
1840 ++
1841 ++#endif //ZM_PLUGIN_H
1842 +diff -aurN zoneminder/trunk/src/zm_plugin_manager.cpp zoneminder_new/trunk/src/zm_plugin_manager.cpp
1843 +--- zoneminder/trunk/src/zm_plugin_manager.cpp 1970-01-01 01:00:00.000000000 +0100
1844 ++++ zoneminder_new/trunk/src/zm_plugin_manager.cpp 2011-04-01 17:10:30.000000000 +0200
1845 +@@ -0,0 +1,118 @@
1846 ++#include "zm_plugin_manager.h"
1847 ++
1848 ++
1849 ++
1850 ++/*! \fn file_select(const struct direct *entry)
1851 ++ * A functor for selection of files with specified extension.
1852 ++ * \param entry is file structure
1853 ++ * \return 1 if file match selection criteria and
1854 ++ * 0 otherwise.
1855 ++ * NOTE: file extension is specified by PluginManager::m_sPluginExt
1856 ++ * static variable.
1857 ++ */
1858 ++int file_select(const struct direct *entry)
1859 ++{
1860 ++ char *ptr;
1861 ++
1862 ++ if ((strcmp(entry->d_name, ".")== 0) || (strcmp(entry->d_name, "..") == 0))
1863 ++ return 0;
1864 ++
1865 ++ // Check for filename extensions.
1866 ++ ptr = rindex((char*)entry->d_name, '.');
1867 ++ if ((ptr != NULL) && (strcmp(ptr, (PluginManager::m_sPluginExt).c_str()) == 0))
1868 ++ return 1;
1869 ++ else
1870 ++ return 0;
1871 ++}
1872 ++
1873 ++
1874 ++
1875 ++
1876 ++/*! \fn join_paths(const string& p1, const string& p2)
1877 ++ * \param p1 is the first part of desired path
1878 ++ * \param p2 is the second part of desired path
1879 ++ * \return joined path string.
1880 ++ */
1881 ++string join_paths(const string& p1, const string& p2)
1882 ++{
1883 ++ char sep = '/';
1884 ++ string tmp = p1;
1885 ++
1886 ++#ifdef _WIN32
1887 ++ sep = '\\';
1888 ++#endif
1889 ++
1890 ++ if (p1[p1.length()] != sep)
1891 ++ { // Need to add a path separator
1892 ++ tmp += sep;
1893 ++ return(tmp + p2);
1894 ++ }
1895 ++ else
1896 ++ return(p1 + p2);
1897 ++}
1898 ++
1899 ++
1900 ++
1901 ++string PluginManager::m_sPluginExt = DEFAULT_PLUGIN_EXT;
1902 ++
1903 ++
1904 ++PluginManager::PluginManager()
1905 ++{
1906 ++}
1907 ++
1908 ++
1909 ++
1910 ++/*!\fn PluginManager::loadPlugin(const string &sFilename))
1911 ++ * \param sFilename is the name of plugin file to load
1912 ++ */
1913 ++void PluginManager::loadPlugin(const string &sFilename)
1914 ++{
1915 ++ try
1916 ++ {
1917 ++ if(m_LoadedPlugins.find(sFilename) == m_LoadedPlugins.end())
1918 ++ m_LoadedPlugins.insert(PluginMap::value_type(sFilename, Plugin(sFilename))).first->second.registerPlugin(*this);
1919 ++ }
1920 ++ catch(runtime_error &ex)
1921 ++ {
1922 ++ Info("Runtime error: %s", ex.what());
1923 ++ }
1924 ++ catch(...)
1925 ++ {
1926 ++ Info("Unknown exception. Could not load %s.", sFilename.c_str());
1927 ++ }
1928 ++}
1929 ++
1930 ++
1931 ++
1932 ++/*!\fn PluginManager::findPlugins(const string &sPath)
1933 ++ * \param sPath is the path to folder to search plugins
1934 ++ * return count of found plugins
1935 ++ */
1936 ++int PluginManager::findPlugins(const string &sPath)
1937 ++{
1938 ++
1939 ++ struct direct **files;
1940 ++
1941 ++ int count = scandir(sPath.c_str(), &files, file_select, alphasort);
1942 ++
1943 ++ for (int i = 1; i < count + 1; ++i)
1944 ++ {
1945 ++ string sFileName = files[i-1]->d_name;
1946 ++ string sFullPath = join_paths(sPath, sFileName);
1947 ++
1948 ++ Info("Loading plugin %s ... ", sFullPath.c_str());
1949 ++
1950 ++ loadPlugin(sFullPath);
1951 ++ }
1952 ++
1953 ++ return count;
1954 ++}
1955 ++
1956 ++
1957 ++/*!\fn PluginManager::configurePlugins(string sConfigFileName)
1958 ++ * \param sConfigFileName is the path to the configuration file, where parameters for all plugins are given.
1959 ++ */
1960 ++void PluginManager::configurePlugins(string sConfigFileName)
1961 ++{
1962 ++ m_ImageAnalyser.configurePlugins(sConfigFileName);
1963 ++}
1964 +diff -aurN zoneminder/trunk/src/zm_plugin_manager.h zoneminder_new/trunk/src/zm_plugin_manager.h
1965 +--- zoneminder/trunk/src/zm_plugin_manager.h 1970-01-01 01:00:00.000000000 +0100
1966 ++++ zoneminder_new/trunk/src/zm_plugin_manager.h 2011-04-01 17:10:30.000000000 +0200
1967 +@@ -0,0 +1,85 @@
1968 ++#ifndef ZM_PLUGIN_MANAGER_H
1969 ++#define ZM_PLUGIN_MANAGER_H
1970 ++
1971 ++
1972 ++
1973 ++#include <stdio.h>
1974 ++#include <stdlib.h>
1975 ++#include <string>
1976 ++#include <map>
1977 ++#include <sys/types.h>
1978 ++#include <sys/dir.h>
1979 ++#include <sys/param.h>
1980 ++#include <unistd.h>
1981 ++
1982 ++#include "zm.h"
1983 ++#include "zm_image_analyser.h"
1984 ++#include "zm_detector.h"
1985 ++#include "zm_plugin.h"
1986 ++
1987 ++
1988 ++
1989 ++using namespace std;
1990 ++
1991 ++
1992 ++#define ZM_ENGINE_VERSION 24
1993 ++#define DEFAULT_PLUGIN_EXT ".zmpl"
1994 ++
1995 ++
1996 ++
1997 ++//! Map of plugins by their associated file names.
1998 ++typedef std::map<std::string, Plugin> PluginMap;
1999 ++
2000 ++
2001 ++//! External function for sorting of files in directory.
2002 ++extern int alphasort();
2003 ++
2004 ++
2005 ++//! Function to select files with plugins by extension.
2006 ++int file_select(const struct direct *entry);
2007 ++
2008 ++
2009 ++//! Join two path strings.
2010 ++string join_paths(const string& p1, const string& p2);
2011 ++
2012 ++
2013 ++
2014 ++//! Class for managing all loaded plugins.
2015 ++class PluginManager
2016 ++{
2017 ++
2018 ++public:
2019 ++
2020 ++ //! Default constructor.
2021 ++ PluginManager();
2022 ++
2023 ++ //! Access the image analyser.
2024 ++ ImageAnalyser &getImageAnalyser() {return m_ImageAnalyser;}
2025 ++
2026 ++ //! Loads a plugin.
2027 ++ void loadPlugin(const string &sFilename);
2028 ++
2029 ++ //! Find and load all plugins from given directory, returns number of found plugins.
2030 ++ int findPlugins(const string &sPath);
2031 ++
2032 ++ //! Configure all loaded plugins using given configuration file.
2033 ++ void configurePlugins(string sConfigFileName);
2034 ++
2035 ++ //! Set plugin extension.
2036 ++ void setPluginExt(string sPluginExt) { m_sPluginExt = sPluginExt; }
2037 ++
2038 ++ //! Extension for zm plugins.
2039 ++ static string m_sPluginExt;
2040 ++
2041 ++private:
2042 ++
2043 ++ //! All plugins currently loaded.
2044 ++ PluginMap m_LoadedPlugins;
2045 ++
2046 ++ //! The image analyser.
2047 ++ ImageAnalyser m_ImageAnalyser;
2048 ++};
2049 ++
2050 ++
2051 ++
2052 ++#endif //ZM_PLUGIN_MANAGER_H
2053 +diff -aurN zoneminder/trunk/src/zm_utils.h zoneminder_new/trunk/src/zm_utils.h
2054 +--- zoneminder/trunk/src/zm_utils.h 2011-04-01 17:08:30.000000000 +0200
2055 ++++ zoneminder_new/trunk/src/zm_utils.h 2011-04-01 17:10:30.000000000 +0200
2056 +@@ -22,6 +22,7 @@
2057 +
2058 + #include <string>
2059 + #include <vector>
2060 ++#include <stdio.h>
2061 +
2062 + typedef std::vector<std::string> StringVector;
2063 +
2064 +diff -aurN zoneminder/trunk/src/zm_zone.cpp zoneminder_new/trunk/src/zm_zone.cpp
2065 +--- zoneminder/trunk/src/zm_zone.cpp 2011-04-01 17:08:30.000000000 +0200
2066 ++++ zoneminder_new/trunk/src/zm_zone.cpp 2011-04-01 17:10:30.000000000 +0200
2067 +@@ -113,6 +113,48 @@
2068 + }
2069 + }
2070 +
2071 ++//=============================================================================
2072 ++bool Zone::CheckOverloadCount()
2073 ++{
2074 ++ Info("Overloaded count: %d, Overloaded frames: %d", overload_count, overload_frames);
2075 ++ if ( overload_count )
2076 ++ {
2077 ++ Info( "In overload mode, %d frames of %d remaining", overload_count, overload_frames );
2078 ++ Debug( 4, "In overload mode, %d frames of %d remaining", overload_count, overload_frames );
2079 ++ overload_count--;
2080 ++ return( false );
2081 ++ }
2082 ++ return true;
2083 ++}
2084 ++
2085 ++void Zone::SetScore(unsigned int nScore)
2086 ++{
2087 ++ score = nScore;
2088 ++}
2089 ++
2090 ++
2091 ++void Zone::SetAlarmImage(const Image* srcImage)
2092 ++{
2093 ++ delete image;
2094 ++ image = new Image(*srcImage);
2095 ++}
2096 ++
2097 ++int Zone::GetOverloadCount()
2098 ++{
2099 ++ return overload_count;
2100 ++}
2101 ++
2102 ++void Zone::SetOverloadCount(int nOverCount)
2103 ++{
2104 ++ overload_count = nOverCount;
2105 ++}
2106 ++
2107 ++int Zone::GetOverloadFrames()
2108 ++{
2109 ++ return overload_frames;
2110 ++}
2111 ++//===========================================================================
2112 ++
2113 + bool Zone::CheckAlarms( const Image *delta_image )
2114 + {
2115 + bool alarm = false;
2116 +diff -aurN zoneminder/trunk/src/zm_zone.h zoneminder_new/trunk/src/zm_zone.h
2117 +--- zoneminder/trunk/src/zm_zone.h 2011-04-01 17:08:30.000000000 +0200
2118 ++++ zoneminder_new/trunk/src/zm_zone.h 2011-04-01 17:10:30.000000000 +0200
2119 +@@ -147,6 +147,17 @@
2120 + static bool ParsePolygonString( const char *polygon_string, Polygon &polygon );
2121 + static bool ParseZoneString( const char *zone_string, int &zone_id, int &colour, Polygon &polygon );
2122 + static int Load( Monitor *monitor, Zone **&zones );
2123 ++
2124 ++ //=================================================
2125 ++ bool CheckOverloadCount();
2126 ++ int GetOverloadCount();
2127 ++ void SetOverloadCount(int nOverCount);
2128 ++ int GetOverloadFrames();
2129 ++ void SetScore(unsigned int nScore);
2130 ++ void SetAlarmImage(const Image* srcImage);
2131 ++
2132 ++ inline const Image *getPgImage() const { return( pg_image ); }
2133 ++ inline const Range *getRanges() const { return( ranges ); }
2134 + };
2135 +
2136 + #endif // ZM_ZONE_H
2137 +diff -aurN zoneminder/trunk/web/lang/big5_big5.php zoneminder_new/trunk/web/lang/big5_big5.php
2138 +--- zoneminder/trunk/web/lang/big5_big5.php 2011-04-01 17:08:32.000000000 +0200
2139 ++++ zoneminder_new/trunk/web/lang/big5_big5.php 2011-04-01 17:10:30.000000000 +0200
2140 +@@ -260,6 +260,7 @@
2141 + 'DonateRemindNever' => 'No, I don\'t want to donate, never remind',
2142 + 'DonateRemindWeek' => 'Not yet, remind again in 1 week',
2143 + 'DonateYes' => 'Yes, I\'d like to donate now',
2144 ++ 'DoNativeMotionDetection'=> 'Do Native Motion Detection',
2145 + 'Download' => '下載',
2146 + 'DuplicateMonitorName' => 'Duplicate Monitor Name', // Added - 2009-03-31
2147 + 'Duration' => '歷時',
2148 +@@ -632,6 +633,7 @@
2149 + 'Update' => 'Update', // Added - 2009-02-08
2150 + 'UpdateAvailable' => 'An update to ZoneMinder is available.',
2151 + 'UpdateNotNecessary' => 'No update is necessary.',
2152 ++ 'UsedPlugins' => 'Used Plugins',
2153 + 'UseFilter' => 'Use Filter',
2154 + 'UseFilterExprsPost' => '&nbsp;filter&nbsp;expressions', // This is used at the end of the phrase 'use N filter expressions'
2155 + 'UseFilterExprsPre' => 'Use&nbsp;', // This is used at the beginning of the phrase 'use N filter expressions'
2156 +diff -aurN zoneminder/trunk/web/lang/cn_zh.php zoneminder_new/trunk/web/lang/cn_zh.php
2157 +--- zoneminder/trunk/web/lang/cn_zh.php 2011-04-01 17:08:32.000000000 +0200
2158 ++++ zoneminder_new/trunk/web/lang/cn_zh.php 2011-04-01 17:10:30.000000000 +0200
2159 +@@ -256,6 +256,7 @@
2160 + 'DonateRemindNever' => '不,我不打算捐款',
2161 + 'DonateRemindWeek' => '现在不,1星期内再次提醒我',
2162 + 'DonateYes' => '好,我现在就捐款',
2163 ++ 'DoNativeMotionDetection'=> 'Do Native Motion Detection',
2164 + 'Download' => '下载',
2165 + 'DuplicateMonitorName' => 'Duplicate Monitor Name', // Added - 2009-03-31
2166 + 'Duration' => 'Duration',
2167 +@@ -628,6 +629,7 @@
2168 + 'Update' => '更新',
2169 + 'UpdateAvailable' => '有新版本的ZoneMinder.',
2170 + 'UpdateNotNecessary' => '无须更新',
2171 ++ 'UsedPlugins' => 'Used Plugins',
2172 + 'UseFilter' => '使用筛选器',
2173 + 'UseFilterExprsPost' => '&nbsp;筛选器&nbsp;表达式', // This is used at the end of the phrase 'use N filter expressions'
2174 + 'UseFilterExprsPre' => '使用&nbsp;', // This is used at the beginning of the phrase 'use N filter expressions'
2175 +diff -aurN zoneminder/trunk/web/lang/cs_cz.php zoneminder_new/trunk/web/lang/cs_cz.php
2176 +--- zoneminder/trunk/web/lang/cs_cz.php 2011-04-01 17:08:32.000000000 +0200
2177 ++++ zoneminder_new/trunk/web/lang/cs_cz.php 2011-04-01 17:10:30.000000000 +0200
2178 +@@ -256,6 +256,7 @@
2179 + 'DonateRemindNever' => 'Ne, nechci podpoøit ZoneMinder, nepøipomínat',
2180 + 'DonateRemindWeek' => 'Nyní ne, pøipomenout za týden',
2181 + 'DonateYes' => 'Ano, chcit podpoøit ZoneMinder nyní',
2182 ++ 'DoNativeMotionDetection'=> 'Do Native Motion Detection',
2183 + 'Download' => 'Stáhnout',
2184 + 'DuplicateMonitorName' => 'Duplicate Monitor Name', // Added - 2009-03-31
2185 + 'Duration' => 'Prùbìh',
2186 +@@ -628,6 +629,7 @@
2187 + 'Update' => 'Update',
2188 + 'UpdateAvailable' => 'Je dostupný nový update ZoneMinder.',
2189 + 'UpdateNotNecessary' => 'Update není potøeba.',
2190 ++ 'UsedPlugins' => 'Used Plugins',
2191 + 'UseFilter' => 'Pou¾ít filtr',
2192 + 'UseFilterExprsPost' => '&nbsp;výrazù', // This is used at the end of the phrase 'use N filter expressions'
2193 + 'UseFilterExprsPre' => 'Pou¾ít&nbsp;', // This is used at the beginning of the phrase 'use N filter expressions'
2194 +diff -aurN zoneminder/trunk/web/lang/de_de.php zoneminder_new/trunk/web/lang/de_de.php
2195 +--- zoneminder/trunk/web/lang/de_de.php 2011-04-01 17:08:32.000000000 +0200
2196 ++++ zoneminder_new/trunk/web/lang/de_de.php 2011-04-01 17:10:30.000000000 +0200
2197 +@@ -256,6 +256,7 @@
2198 + 'DonateRemindNever' => 'Nein, ich m&ouml;chte nicht spenden, niemals erinnern.',
2199 + 'DonateRemindWeek' => 'Noch nicht, erinnere mich in einer Woche noch mal.',
2200 + 'DonateYes' => 'Ja, ich m&ouml;chte jetzt spenden.',
2201 ++ 'DoNativeMotionDetection'=> 'Do Native Motion Detection',
2202 + 'Download' => 'Download',
2203 + 'DuplicateMonitorName' => 'Duplicate Monitor Name', // Added - 2009-03-31
2204 + 'Duration' => 'Dauer',
2205 +@@ -628,6 +629,7 @@
2206 + 'Update' => 'Aktualisieren',
2207 + 'UpdateAvailable' => 'Eine Aktualisierung f&uuml;r ZoneMinder ist verf&uuml;gbar.',
2208 + 'UpdateNotNecessary' => 'Es ist keine Aktualisierung verf&uuml;gbar.',
2209 ++ 'UsedPlugins' => 'Used Plugins',
2210 + 'UseFilter' => 'Benutze Filter',
2211 + 'UseFilterExprsPost' => '&nbsp;Filter&nbsp;Ausdr&uuml;cke', // This is used at the end of the phrase 'use N filter expressions'
2212 + 'UseFilterExprsPre' => 'Benutze&nbsp;', // This is used at the beginning of the phrase 'use N filter expressions'
2213 +diff -aurN zoneminder/trunk/web/lang/dk_dk.php zoneminder_new/trunk/web/lang/dk_dk.php
2214 +--- zoneminder/trunk/web/lang/dk_dk.php 2011-04-01 17:08:32.000000000 +0200
2215 ++++ zoneminder_new/trunk/web/lang/dk_dk.php 2011-04-01 17:10:30.000000000 +0200
2216 +@@ -257,6 +257,7 @@
2217 + 'DonateRemindNever' => 'No, I don\'t want to donate, never remind',
2218 + 'DonateRemindWeek' => 'Not yet, remind again in 1 week',
2219 + 'DonateYes' => 'Yes, I\'d like to donate now',
2220 ++ 'DoNativeMotionDetection'=> 'Do Native Motion Detection',
2221 + 'Download' => 'Download',
2222 + 'DuplicateMonitorName' => 'Duplicate Monitor Name', // Added - 2009-03-31
2223 + 'Duration' => 'Forløb',
2224 +@@ -629,6 +630,7 @@
2225 + 'Update' => 'Update',
2226 + 'UpdateAvailable' => 'En updatering til ZoneMinder er tilstede.',
2227 + 'UpdateNotNecessary' => 'Ingen updatering er nødvendig.',
2228 ++ 'UsedPlugins' => 'Used Plugins',
2229 + 'UseFilter' => 'Brug Filter',
2230 + 'UseFilterExprsPost' => '&nbsp;filter&nbsp;expressions', // This is used at the end of the phrase 'use N filter expressions'
2231 + 'UseFilterExprsPre' => 'Brug&nbsp;', // This is used at the beginning of the phrase 'use N filter expressions'
2232 +diff -aurN zoneminder/trunk/web/lang/en_gb.php zoneminder_new/trunk/web/lang/en_gb.php
2233 +--- zoneminder/trunk/web/lang/en_gb.php 2011-04-01 17:08:32.000000000 +0200
2234 ++++ zoneminder_new/trunk/web/lang/en_gb.php 2011-04-01 17:10:30.000000000 +0200
2235 +@@ -257,6 +257,7 @@
2236 + 'DonateRemindNever' => 'No, I don\'t want to donate, never remind',
2237 + 'DonateRemindWeek' => 'Not yet, remind again in 1 week',
2238 + 'DonateYes' => 'Yes, I\'d like to donate now',
2239 ++ 'DoNativeMotionDetection'=> 'Do Native Motion Detection',
2240 + 'Download' => 'Download',
2241 + 'DuplicateMonitorName' => 'Duplicate Monitor Name',
2242 + 'Duration' => 'Duration',
2243 +@@ -628,6 +629,7 @@
2244 + 'UpdateAvailable' => 'An update to ZoneMinder is available.',
2245 + 'UpdateNotNecessary' => 'No update is necessary.',
2246 + 'Update' => 'Update',
2247 ++ 'UsedPlugins' => 'Used Plugins',
2248 + 'UseFilterExprsPost' => '&nbsp;filter&nbsp;expressions', // This is used at the end of the phrase 'use N filter expressions'
2249 + 'UseFilterExprsPre' => 'Use&nbsp;', // This is used at the beginning of the phrase 'use N filter expressions'
2250 + 'UseFilter' => 'Use Filter',
2251 +diff -aurN zoneminder/trunk/web/lang/es_ar.php zoneminder_new/trunk/web/lang/es_ar.php
2252 +--- zoneminder/trunk/web/lang/es_ar.php 2011-04-01 17:08:32.000000000 +0200
2253 ++++ zoneminder_new/trunk/web/lang/es_ar.php 2011-04-01 17:10:30.000000000 +0200
2254 +@@ -207,6 +207,7 @@
2255 + 'DonateRemindNever' => 'No, I don\'t want to donate, never remind',
2256 + 'DonateRemindWeek' => 'Not yet, remind again in 1 week',
2257 + 'DonateYes' => 'Yes, I\'d like to donate now',
2258 ++ 'DoNativeMotionDetection'=> 'Do Native Motion Detection',
2259 + 'Download' => 'Download',
2260 + 'DuplicateMonitorName' => 'Duplicate Monitor Name', // Added - 2009-03-31
2261 + 'Duration' => 'Duración',
2262 +@@ -579,6 +580,7 @@
2263 + 'Update' => 'Update',
2264 + 'UpdateAvailable' => 'Una Actualización a ZoneMinder esta disponible',
2265 + 'UpdateNotNecessary' => 'No se requiere Actualización',
2266 ++ 'UsedPlugins' => 'Used Plugins',
2267 + 'UseFilter' => 'Usar Filtro',
2268 + 'UseFilterExprsPost' => '&nbsp;filtrar&nbsp;sentencias', // This is used at the end of the phrase 'use N filter expressions'
2269 + 'UseFilterExprsPre' => 'Utilizar&nbsp;', // This is used at the beginning of the phrase 'use N filter expressions'
2270 +diff -aurN zoneminder/trunk/web/lang/fr_fr.php zoneminder_new/trunk/web/lang/fr_fr.php
2271 +--- zoneminder/trunk/web/lang/fr_fr.php 2011-04-01 17:08:32.000000000 +0200
2272 ++++ zoneminder_new/trunk/web/lang/fr_fr.php 2011-04-01 17:10:30.000000000 +0200
2273 +@@ -256,6 +256,7 @@
2274 + 'DonateRemindNever' => 'No, I don\'t want to donate, never remind',
2275 + 'DonateRemindWeek' => 'Not yet, remind again in 1 week',
2276 + 'DonateYes' => 'Yes, I\'d like to donate now',
2277 ++ 'DoNativeMotionDetection'=> 'Do Native Motion Detection',
2278 + 'Download' => 'Download',
2279 + 'DuplicateMonitorName' => 'Duplicate Monitor Name', // Added - 2009-03-31
2280 + 'Duration' => 'Durée',
2281 +@@ -628,6 +629,7 @@
2282 + 'Update' => 'Update',
2283 + 'UpdateAvailable' => 'Mise à jour de ZM dispo.',
2284 + 'UpdateNotNecessary' => 'Pas de mise à jour dispo.',
2285 ++ 'UsedPlugins' => 'Utiliser des Plugins',
2286 + 'UseFilter' => 'Util. Filtre',
2287 + 'UseFilterExprsPost' => '&nbsp;filter&nbsp;expressions', // This is used at the end of the phrase 'use N filter expressions'
2288 + 'UseFilterExprsPre' => 'Util.&nbsp;', // This is used at the beginning of the phrase 'use N filter expressions'
2289 +diff -aurN zoneminder/trunk/web/lang/he_il.php zoneminder_new/trunk/web/lang/he_il.php
2290 +--- zoneminder/trunk/web/lang/he_il.php 2011-04-01 17:08:32.000000000 +0200
2291 ++++ zoneminder_new/trunk/web/lang/he_il.php 2011-04-01 17:10:30.000000000 +0200
2292 +@@ -256,6 +256,7 @@
2293 + 'DonateRemindNever' => 'ìà, àðé ìà øåöä ìúøåí, àì úúæëø àåúé',
2294 + 'DonateRemindWeek' => 'òãééï ìà, äæëø ìé áòåã ùáåò àçã',
2295 + 'DonateYes' => 'ëï, àðé îòåðééï ìúøåí òëùéå',
2296 ++ 'DoNativeMotionDetection'=> 'Do Native Motion Detection',
2297 + 'Download' => 'äåøã',
2298 + 'DuplicateMonitorName' => 'Duplicate Monitor Name', // Added - 2009-03-31
2299 + 'Duration' => 'îùê æîï',
2300 +@@ -628,6 +629,7 @@
2301 + 'Update' => 'òãëåï',
2302 + 'UpdateAvailable' => 'òãëåï ìæåï-îéðãø àôùøé.',
2303 + 'UpdateNotNecessary' => 'òãëåï àéðå äëøçé.',
2304 ++ 'UsedPlugins' => 'Used Plugins',
2305 + 'UseFilter' => 'ùéîåù áîñðï',
2306 + 'UseFilterExprsPost' => '&nbsp;filter&nbsp;expressions', // This is used at the end of the phrase 'use N filter expressions'
2307 + 'UseFilterExprsPre' => 'ùéîåù&nbsp;', // This is used at the beginning of the phrase 'use N filter expressions'
2308 +diff -aurN zoneminder/trunk/web/lang/hu_hu.php zoneminder_new/trunk/web/lang/hu_hu.php
2309 +--- zoneminder/trunk/web/lang/hu_hu.php 2011-04-01 17:08:32.000000000 +0200
2310 ++++ zoneminder_new/trunk/web/lang/hu_hu.php 2011-04-01 17:10:30.000000000 +0200
2311 +@@ -265,6 +265,7 @@
2312 + 'DonateRemindNever' => 'Nem akarom támogatni, ne is emlékeztess',
2313 + 'DonateRemindWeek' => 'Nem most, figyelmeztess 1 hét múlva',
2314 + 'DonateYes' => 'Igen, most szeretném támogatni',
2315 ++ 'DoNativeMotionDetection'=> 'Do Native Motion Detection',
2316 + 'Download' => 'Letölt',
2317 + 'DuplicateMonitorName' => 'Monitor nevének duplikálása',
2318 + 'Duration' => 'Idõtartam',
2319 +@@ -637,6 +638,7 @@
2320 + 'Update' => 'Frissítés',
2321 + 'UpdateAvailable' => 'Elérhetõ ZoneMinder frissítés.',
2322 + 'UpdateNotNecessary' => 'Nem szükséges a frissítés.',
2323 ++ 'UsedPlugins' => 'Used Plugins',
2324 + 'UseFilter' => 'Szûrõt használ',
2325 + 'UseFilterExprsPost' => '&nbsp;szürõ&nbsp;kifejezés használata', // This is used at the end of the phrase 'use N filter expressions'
2326 + 'UseFilterExprsPre' => '&nbsp;', // This is used at the beginning of the phrase 'use N filter expressions'
2327 +diff -aurN zoneminder/trunk/web/lang/it_it.php zoneminder_new/trunk/web/lang/it_it.php
2328 +--- zoneminder/trunk/web/lang/it_it.php 2011-04-01 17:08:32.000000000 +0200
2329 ++++ zoneminder_new/trunk/web/lang/it_it.php 2011-04-01 17:10:30.000000000 +0200
2330 +@@ -261,6 +261,7 @@
2331 + 'DonateRemindNever' => 'No, io non voglio donare, non lo faro\' mai',
2332 + 'DonateRemindWeek' => 'Non ancora, ricordamelo ancora tra 1 settimana',
2333 + 'DonateYes' => 'Si,mi piacerebbe donare qualcosa ora',
2334 ++ 'DoNativeMotionDetection'=> 'Do Native Motion Detection',
2335 + 'Download' => 'Download',
2336 + 'DuplicateMonitorName' => 'Il nome del monitor e\' gia\' presente', // Added - 2009-03-31
2337 + 'Duration' => 'Durata',
2338 +@@ -633,6 +634,7 @@
2339 + 'Update' => 'Aggiorna',
2340 + 'UpdateAvailable' => 'Un aggiornamento di ZoneMinder &egrave; disponibilie.',
2341 + 'UpdateNotNecessary' => 'Nessun aggiornamento necessario.',
2342 ++ 'UsedPlugins' => 'Used Plugins',
2343 + 'UseFilter' => 'Usa Filtro',
2344 + 'UseFilterExprsPost' => '&nbsp;espressioni&nbsp;filtri', // This is used at the end of the phrase 'use N filter expressions'
2345 + 'UseFilterExprsPre' => 'Usa&nbsp;', // This is used at the beginning of the phrase 'use N filter expressions'
2346 +diff -aurN zoneminder/trunk/web/lang/ja_jp.php zoneminder_new/trunk/web/lang/ja_jp.php
2347 +--- zoneminder/trunk/web/lang/ja_jp.php 2011-04-01 17:08:32.000000000 +0200
2348 ++++ zoneminder_new/trunk/web/lang/ja_jp.php 2011-04-01 17:10:30.000000000 +0200
2349 +@@ -256,6 +256,7 @@
2350 + 'DonateRemindNever' => 'No, I don\'t want to donate, never remind',
2351 + 'DonateRemindWeek' => 'Not yet, remind again in 1 week',
2352 + 'DonateYes' => 'Yes, I\'d like to donate now',
2353 ++ 'DoNativeMotionDetection'=> 'Do Native Motion Detection',
2354 + 'Download' => 'Download',
2355 + 'DuplicateMonitorName' => 'Duplicate Monitor Name', // Added - 2009-03-31
2356 + 'Duration' => 'Œp‘±ŽžŠÔ',
2357 +@@ -628,6 +629,7 @@
2358 + 'Update' => 'Update',
2359 + 'UpdateAvailable' => 'ZoneMinder‚̱¯ÌßÃްĂª‚ ‚è‚Ü‚·',
2360 + 'UpdateNotNecessary' => '±¯ÌßÃްĂ̕K—v‚Í‚ ‚è‚Ü‚¹‚ñ',
2361 ++ 'UsedPlugins' => 'Used Plugins',
2362 + 'UseFilter' => '̨ÙÀ°‚ðŽg—p‚µ‚Ä‚­‚¾‚³‚¢',
2363 + 'UseFilterExprsPost' => '&nbsp;̨ÙÀ°ŒÂ”', // This is used at the end of the phrase 'use N filter expressions'
2364 + 'UseFilterExprsPre' => 'Žw’肵‚Ä‚­‚¾‚³‚¢:&nbsp;', // This is used at the beginning of the phrase 'use N filter expressions'
2365 +diff -aurN zoneminder/trunk/web/lang/nl_nl.php zoneminder_new/trunk/web/lang/nl_nl.php
2366 +--- zoneminder/trunk/web/lang/nl_nl.php 2011-04-01 17:08:32.000000000 +0200
2367 ++++ zoneminder_new/trunk/web/lang/nl_nl.php 2011-04-01 17:10:30.000000000 +0200
2368 +@@ -256,6 +256,7 @@
2369 + 'DonateRemindNever' => 'No, I don\'t want to donate, never remind',
2370 + 'DonateRemindWeek' => 'Not yet, remind again in 1 week',
2371 + 'DonateYes' => 'Yes, I\'d like to donate now',
2372 ++ 'DoNativeMotionDetection'=> 'Do Native Motion Detection',
2373 + 'Download' => 'Download',
2374 + 'DuplicateMonitorName' => 'Duplicate Monitor Name', // Added - 2009-03-31
2375 + 'Duration' => 'Duur',
2376 +@@ -628,6 +629,7 @@
2377 + 'Update' => 'Update',
2378 + 'UpdateAvailable' => 'een update voor ZoneMinder is beschikbaar',
2379 + 'UpdateNotNecessary' => 'geen update noodzakelijk',
2380 ++ 'UsedPlugins' => 'Used Plugins',
2381 + 'UseFilter' => 'Gebruik Filter',
2382 + 'UseFilterExprsPost' => '&nbsp;filter&nbsp;expressies', // This is used at the end of the phrase 'use N filter expressions'
2383 + 'UseFilterExprsPre' => 'Gebruik&nbsp;', // This is used at the beginning of the phrase 'use N filter expressions'
2384 +diff -aurN zoneminder/trunk/web/lang/pl_pl.php zoneminder_new/trunk/web/lang/pl_pl.php
2385 +--- zoneminder/trunk/web/lang/pl_pl.php 2011-04-01 17:08:32.000000000 +0200
2386 ++++ zoneminder_new/trunk/web/lang/pl_pl.php 2011-04-01 17:10:30.000000000 +0200
2387 +@@ -256,6 +256,7 @@
2388 + 'DonateRemindNever' => 'No, I don\'t want to donate, never remind',
2389 + 'DonateRemindWeek' => 'Not yet, remind again in 1 week',
2390 + 'DonateYes' => 'Yes, I\'d like to donate now',
2391 ++ 'DoNativeMotionDetection'=> 'Do Native Motion Detection',
2392 + 'Download' => 'Download',
2393 + 'DuplicateMonitorName' => 'Duplicate Monitor Name', // Added - 2009-03-31
2394 + 'Duration' => 'Czas trwania',
2395 +@@ -628,6 +629,7 @@
2396 + 'Update' => 'Update',
2397 + 'UpdateAvailable' => 'Jest dostêpne uaktualnienie ZoneMinder ',
2398 + 'UpdateNotNecessary' => 'Nie jest wymagane uaktualnienie',
2399 ++ 'UsedPlugins' => 'Used Plugins',
2400 + 'UseFilter' => 'U¿yj filtru',
2401 + 'UseFilterExprsPost' => '&nbsp;wyra¿enie&nbsp;filtru', // This is used at the end of the phrase 'use N filter expressions'
2402 + 'UseFilterExprsPre' => 'U¿yj&nbsp;', // This is used at the beginning of the phrase 'use N filter expressions'
2403 +diff -aurN zoneminder/trunk/web/lang/pt_br.php zoneminder_new/trunk/web/lang/pt_br.php
2404 +--- zoneminder/trunk/web/lang/pt_br.php 2011-04-01 17:08:32.000000000 +0200
2405 ++++ zoneminder_new/trunk/web/lang/pt_br.php 2011-04-01 17:10:30.000000000 +0200
2406 +@@ -196,6 +196,7 @@
2407 + 'DonateRemindNever' => 'No, I don\'t want to donate, never remind',
2408 + 'DonateRemindWeek' => 'Not yet, remind again in 1 week',
2409 + 'DonateYes' => 'Yes, I\'d like to donate now',
2410 ++ 'DoNativeMotionDetection'=> 'Do Native Motion Detection',
2411 + 'Download' => 'Download',
2412 + 'DuplicateMonitorName' => 'Duplicate Monitor Name', // Added - 2009-03-31
2413 + 'Duration' => 'Duração',
2414 +@@ -568,6 +569,7 @@
2415 + 'Update' => 'Update',
2416 + 'UpdateAvailable' => 'Um update ao zoneminder está disponível.',
2417 + 'UpdateNotNecessary' => 'Não é necessário update.',
2418 ++ 'UsedPlugins' => 'Used Plugins',
2419 + 'UseFilter' => 'Use Filtro',
2420 + 'UseFilterExprsPost' => '&nbsp;expressões&nbsp;de&nbsp;filtragem', // This is used at the end of the phrase 'use N filter expressions'
2421 + 'UseFilterExprsPre' => 'Use&nbsp;', // This is used at the beginning of the phrase 'use N filter expressions'
2422 +diff -aurN zoneminder/trunk/web/lang/ro_ro.php zoneminder_new/trunk/web/lang/ro_ro.php
2423 +--- zoneminder/trunk/web/lang/ro_ro.php 2011-04-01 17:08:32.000000000 +0200
2424 ++++ zoneminder_new/trunk/web/lang/ro_ro.php 2011-04-01 17:10:30.000000000 +0200
2425 +@@ -227,6 +227,7 @@
2426 + 'DonateRemindNever' => 'No, I don\'t want to donate, never remind',
2427 + 'DonateRemindWeek' => 'Not yet, remind again in 1 week',
2428 + 'DonateYes' => 'Yes, I\'d like to donate now',
2429 ++ 'DoNativeMotionDetection'=> 'Do Native Motion Detection',
2430 + 'Download' => 'Download',
2431 + 'DuplicateMonitorName' => 'Duplicate Monitor Name', // Added - 2009-03-31
2432 + 'Duration' => 'Durata',
2433 +@@ -599,6 +600,7 @@
2434 + 'Update' => 'Update',
2435 + 'UpdateAvailable' => 'Sunt disponibile actualiz&#259;ri ZoneMinder.',
2436 + 'UpdateNotNecessary' => 'Actulizarea nu este necesar&#259;.',
2437 ++ 'UsedPlugins' => 'Used Plugins',
2438 + 'UseFilter' => 'Folose&#351;te filtru',
2439 + 'UseFilterExprsPost' => '&nbsp;expresii&nbsp;de&nbsp;filtrare ',
2440 + 'UseFilterExprsPre' => 'Folose&#351;te&nbsp;',
2441 +diff -aurN zoneminder/trunk/web/lang/ru_ru.php zoneminder_new/trunk/web/lang/ru_ru.php
2442 +--- zoneminder/trunk/web/lang/ru_ru.php 2011-04-01 17:08:32.000000000 +0200
2443 ++++ zoneminder_new/trunk/web/lang/ru_ru.php 2011-04-01 17:10:30.000000000 +0200
2444 +@@ -256,6 +256,7 @@
2445 + 'DonateRemindNever' => 'No, I don\'t want to donate, never remind',
2446 + 'DonateRemindWeek' => 'Not yet, remind again in 1 week',
2447 + 'DonateYes' => 'Yes, I\'d like to donate now',
2448 ++ 'DoNativeMotionDetection'=> '¿¿¿¿¿¿ ¿¿¿¿¿¿¿¿¿ ¿ Motion Detection',
2449 + 'Download' => 'Download',
2450 + 'DuplicateMonitorName' => 'Duplicate Monitor Name', // Added - 2009-03-31
2451 + 'Duration' => 'äÌÉÔÅÌØÎÏÓÔØ',
2452 +@@ -628,6 +629,7 @@
2453 + 'Update' => 'Update',
2454 + 'UpdateAvailable' => 'äÏÓÔÕÐÎÏ ÏÂÎÏ×ÌÅÎÉÅ ZoneMinder',
2455 + 'UpdateNotNecessary' => 'ïÂÎÏ×ÌÅÎÉÅ ÎÅ ÔÒÅÂÕÅÔÓÑ',
2456 ++ 'UsedPlugins' => '¿¿¿¿¿¿¿¿¿¿¿¿ ¿¿¿¿¿¿¿',
2457 + 'UseFilter' => 'éÓÐÏÌØÚÏ×ÁÔØ ÆÉÌØÔÒ',
2458 + 'UseFilterExprsPost' => '&nbsp;×ÙÒÁÖÅÎÉÊ&nbsp;ÄÌÑ&nbsp;ÆÉÌØÔÒÁ', // This is used at the end of the phrase 'use N filter expressions'
2459 + 'UseFilterExprsPre' => 'éÓÐÏÌ.&nbsp;', // This is used at the beginning of the phrase 'use N filter expressions'
2460 +diff -aurN zoneminder/trunk/web/lang/se_se.php zoneminder_new/trunk/web/lang/se_se.php
2461 +--- zoneminder/trunk/web/lang/se_se.php 2011-04-01 17:08:32.000000000 +0200
2462 ++++ zoneminder_new/trunk/web/lang/se_se.php 2011-04-01 17:10:30.000000000 +0200
2463 +@@ -257,6 +257,7 @@
2464 + 'DonateRemindNever' => 'Nej, Jag vill inte donera, påminn mig inte mer',
2465 + 'DonateRemindWeek' => 'Inte än, påminn om 1 vecka',
2466 + 'DonateYes' => 'Ja, jag vill gärna donera nu',
2467 ++ 'DoNativeMotionDetection'=> 'Do Native Motion Detection',
2468 + 'Download' => 'Ladda ner',
2469 + 'DuplicateMonitorName' => 'Duplicate Monitor Name', // Added - 2009-03-31
2470 + 'Duration' => 'Längd',
2471 +@@ -629,6 +630,7 @@
2472 + 'Update' => 'Uppdatera',
2473 + 'UpdateAvailable' => 'En uppdatering till ZoneMinder finns tillgänglig.',
2474 + 'UpdateNotNecessary' => 'Ingen uppdatering behövs.',
2475 ++ 'UsedPlugins' => 'Used Plugins',
2476 + 'UseFilter' => 'Använd filter',
2477 + 'UseFilterExprsPost' => '&nbsp;filter&nbsp;expressions', // This is used at the end of the phrase 'use N filter expressions'
2478 + 'UseFilterExprsPre' => 'Använd&nbsp;', // This is used at the beginning of the phrase 'use N filter expressions'
2479 +diff -aurN zoneminder/trunk/web/skins/classic/views/monitor.php zoneminder_new/trunk/web/skins/classic/views/monitor.php
2480 +--- zoneminder/trunk/web/skins/classic/views/monitor.php 2011-04-01 17:08:34.000000000 +0200
2481 ++++ zoneminder_new/trunk/web/skins/classic/views/monitor.php 2011-04-01 17:10:30.000000000 +0200
2482 +@@ -24,6 +24,8 @@
2483 + return;
2484 + }
2485 +
2486 ++$newDoNativeMotDet = 0;
2487 ++
2488 + $tabs = array();
2489 + $tabs["general"] = $SLANG['General'];
2490 + $tabs["source"] = $SLANG['Source'];
2491 +@@ -100,6 +102,8 @@
2492 + 'SignalCheckColour' => '#0100BE',
2493 + 'WebColour' => 'red',
2494 + 'Triggers' => "",
2495 ++ 'DoNativeMotDet' => "yes",
2496 ++ 'UsedPl' => "",
2497 + );
2498 + }
2499 +
2500 +@@ -416,6 +420,8 @@
2501 + <input type="hidden" name="newMonitor[Function]" value="<?= validHtmlStr($newMonitor['Function']) ?>"/>
2502 + <input type="hidden" name="newMonitor[Enabled]" value="<?= validHtmlStr($newMonitor['Enabled']) ?>"/>
2503 + <input type="hidden" name="newMonitor[RefBlendPerc]" value="<?= validHtmlStr($newMonitor['RefBlendPerc']) ?>"/>
2504 ++ <input type="hidden" name="newMonitor[DoNativeMotDet]" value="<?= validHtmlStr($newMonitor['DoNativeMotDet']) ?>"/>
2505 ++ <input type="hidden" name="newMonitor[UsedPlugins]" value="<?= validHtmlStr($newMonitor['UsedPlugins']) ?>"/>
2506 + <input type="hidden" name="newMonitor[MaxFPS]" value="<?= validHtmlStr($newMonitor['MaxFPS']) ?>"/>
2507 + <input type="hidden" name="newMonitor[AlarmMaxFPS]" value="<?= validHtmlStr($newMonitor['AlarmMaxFPS']) ?>"/>
2508 + <?php
2509 +@@ -575,6 +581,8 @@
2510 + <tr><td><?= $SLANG['AlarmMaximumFPS'] ?></td><td><input type="text" name="newMonitor[AlarmMaxFPS]" value="<?= validHtmlStr($newMonitor['AlarmMaxFPS']) ?>" size="6"/></td></tr>
2511 + <tr><td><?= $SLANG['RefImageBlendPct'] ?></td><td><input type="text" name="newMonitor[RefBlendPerc]" value="<?= validHtmlStr($newMonitor['RefBlendPerc']) ?>" size="4"/></td></tr>
2512 + <tr><td><?= $SLANG['Triggers'] ?></td><td>
2513 ++ <tr><td><?= $SLANG['UsedPlugins'] ?></td><td><input type="text" name="newMonitor[UsedPl]" value="<?= validHtmlStr($newMonitor['UsedPl']) ?>" size="50"/></td></tr>
2514 ++ <tr><td><?= $SLANG['DoNativeMotionDetection'] ?></td><td><input type="text" name="newMonitor[DoNativeMotDet]" value="<?= validHtmlStr($newMonitor['DoNativeMotDet']) ?>" size="5"/></td></tr>
2515 + <?php
2516 + $optTriggers = getSetValues( 'Monitors', 'Triggers' );
2517 + $breakCount = (int)(ceil(count($optTriggers)));
2518
2519 diff --git a/media-video/zoneminder/files/9999/db_upgrade_script_location.patch b/media-video/zoneminder/files/9999/db_upgrade_script_location.patch
2520 new file mode 100644
2521 index 0000000..41b537c
2522 --- /dev/null
2523 +++ b/media-video/zoneminder/files/9999/db_upgrade_script_location.patch
2524 @@ -0,0 +1,11 @@
2525 +--- ZoneMinder-1.24.1/zm.conf.in.orig 2009-03-23 13:55:43.000000000 +0000
2526 ++++ ZoneMinder-1.24.1/zm.conf.in 2009-03-23 13:57:22.000000000 +0000
2527 +@@ -13,7 +13,7 @@
2528 + ZM_VERSION=@VERSION@
2529 +
2530 + # Path to build directory, used mostly for finding DB upgrade scripts
2531 +-ZM_PATH_BUILD=@PATH_BUILD@
2532 ++ZM_PATH_BUILD=/usr/share/zoneminder
2533 +
2534 + # Build time, used to record when to trigger various checks
2535 + ZM_TIME_BUILD=@TIME_BUILD@
2536
2537 diff --git a/media-video/zoneminder/files/9999/zm_remote_camera_http.patch b/media-video/zoneminder/files/9999/zm_remote_camera_http.patch
2538 new file mode 100644
2539 index 0000000..ca937b6
2540 --- /dev/null
2541 +++ b/media-video/zoneminder/files/9999/zm_remote_camera_http.patch
2542 @@ -0,0 +1,55 @@
2543 +Index: ZoneMinder-1.24.1/src/zm_remote_camera_http.cpp
2544 +===================================================================
2545 +--- ZoneMinder-1.24.1.orig/src/zm_remote_camera_http.cpp
2546 ++++ ZoneMinder-1.24.1/src/zm_remote_camera_http.cpp
2547 +@@ -356,6 +356,14 @@ int RemoteCamera::GetResponse()
2548 + format = JPEG;
2549 + state = CONTENT;
2550 + }
2551 ++ else if ( !strcasecmp( content_type, "image/mpeg" ) )
2552 ++ {
2553 ++ // Single image
2554 ++ mode = SINGLE_IMAGE;
2555 ++ format = JPEG;
2556 ++ state = CONTENT;
2557 ++
2558 ++ }
2559 + else if ( !strcasecmp( content_type, "image/x-rgb" ) )
2560 + {
2561 + // Single image
2562 +@@ -453,6 +461,10 @@ int RemoteCamera::GetResponse()
2563 + {
2564 + format = JPEG;
2565 + }
2566 ++ else if ( !strcasecmp( content_type, "image/mpeg" ) )
2567 ++ {
2568 ++ format = JPEG;
2569 ++ }
2570 + else if ( !strcasecmp( content_type, "image/x-rgb" ) )
2571 + {
2572 + format = X_RGB;
2573 +@@ -783,6 +795,13 @@ int RemoteCamera::GetResponse()
2574 + format = JPEG;
2575 + state = CONTENT;
2576 + }
2577 ++ else if ( !strcasecmp( content_type, "image/mpeg" ) )
2578 ++ {
2579 ++ // Single image
2580 ++ mode = SINGLE_IMAGE;
2581 ++ format = JPEG;
2582 ++ state = CONTENT;
2583 ++ }
2584 + else if ( !strcasecmp( content_type, "image/x-rgb" ) )
2585 + {
2586 + // Single image
2587 +@@ -947,6 +966,10 @@ int RemoteCamera::GetResponse()
2588 + {
2589 + format = JPEG;
2590 + }
2591 ++ else if ( !strcasecmp( content_type, "image/mpeg" ) )
2592 ++ {
2593 ++ format = JPEG;
2594 ++ }
2595 + else if ( !strcasecmp( content_type, "image/x-rgb" ) )
2596 + {
2597 + format = X_RGB;
2598
2599 diff --git a/media-video/zoneminder/files/9999/zoneminder-facedetector-plugin.tar.bz2 b/media-video/zoneminder/files/9999/zoneminder-facedetector-plugin.tar.bz2
2600 new file mode 100644
2601 index 0000000..1e710b9
2602 Binary files /dev/null and b/media-video/zoneminder/files/9999/zoneminder-facedetector-plugin.tar.bz2 differ
2603
2604 diff --git a/media-video/zoneminder/files/conf.d b/media-video/zoneminder/files/conf.d
2605 new file mode 100644
2606 index 0000000..d2e0336
2607 --- /dev/null
2608 +++ b/media-video/zoneminder/files/conf.d
2609 @@ -0,0 +1,6 @@
2610 +ZM_SCRIPT=/usr/bin/zmpkg.pl
2611 +
2612 +# Commands for starting and stopping the server
2613 +
2614 +CMD_START="${ZM_SCRIPT} start"
2615 +CMD_STOP="${ZM_SCRIPT} stop"
2616
2617 diff --git a/media-video/zoneminder/files/init.d b/media-video/zoneminder/files/init.d
2618 new file mode 100644
2619 index 0000000..5388f03
2620 --- /dev/null
2621 +++ b/media-video/zoneminder/files/init.d
2622 @@ -0,0 +1,20 @@
2623 +#!/sbin/runscript
2624 +# Copyright 1999-2011 Gentoo Foundation
2625 +# Distributed under the terms of the GNU General Public License v2
2626 +# $Header: /var/cvsroot/gentoo-x86/www-misc/zoneminder/files/init.d,v 1.3 2009/01/01 16:47:24 gentoofan23 Exp $
2627 +
2628 +depend() {
2629 + use mysql
2630 +}
2631 +
2632 +start() {
2633 + ebegin "Starting zoneminder"
2634 + ${CMD_START}
2635 + eend $?
2636 +}
2637 +
2638 +stop() {
2639 + ebegin "Stopping zoneminder"
2640 + ${CMD_STOP}
2641 + eend $?
2642 +}
2643
2644 diff --git a/media-video/zoneminder/metadata.xml b/media-video/zoneminder/metadata.xml
2645 new file mode 100644
2646 index 0000000..90e3ad4
2647 --- /dev/null
2648 +++ b/media-video/zoneminder/metadata.xml
2649 @@ -0,0 +1,9 @@
2650 +<?xml version="1.0" encoding="UTF-8"?>
2651 +<!DOCTYPE pkgmetadata SYSTEM "http://www.gentoo.org/dtd/metadata.dtd">
2652 +<pkgmetadata>
2653 + <herd>no-herd</herd>
2654 + <maintainer>
2655 + <email>dilfridge@g.o</email>
2656 + <name>Andreas K. Huettel</name>
2657 + </maintainer>
2658 +</pkgmetadata>
2659
2660 diff --git a/media-video/zoneminder/zoneminder-1.24.4.ebuild b/media-video/zoneminder/zoneminder-1.24.4.ebuild
2661 new file mode 100644
2662 index 0000000..ccd4883
2663 --- /dev/null
2664 +++ b/media-video/zoneminder/zoneminder-1.24.4.ebuild
2665 @@ -0,0 +1,147 @@
2666 +# Copyright 1999-2011 Gentoo Foundation
2667 +# Distributed under the terms of the GNU General Public License v2
2668 +# $Header: $
2669 +
2670 +inherit eutils autotools depend.php depend.apache multilib flag-o-matic scons-utils
2671 +
2672 +MY_P="ZoneMinder-${PV}"
2673 +
2674 +DESCRIPTION="ZoneMinder allows you to capture, analyse, record and monitor any cameras attached to your system."
2675 +HOMEPAGE="http://www.zoneminder.com/"
2676 +SRC_URI="http://www2.zoneminder.com/downloads/${MY_P}.tar.gz
2677 + http://www.zoneminder.com/downloads/${MY_P}.tar.gz"
2678 +LICENSE="GPL-2"
2679 +KEYWORDS=""
2680 +IUSE="debug ffmpeg mmap"
2681 +SLOT="0"
2682 +
2683 +DEPEND="app-admin/sudo
2684 + dev-libs/libpcre
2685 + virtual/jpeg
2686 + net-libs/gnutls
2687 + >=dev-lang/perl-5.6.0
2688 + virtual/perl-Archive-Tar
2689 + dev-perl/Archive-Zip
2690 + dev-perl/DateManip
2691 + dev-perl/DBD-mysql
2692 + dev-perl/DBI
2693 + dev-perl/Device-SerialPort
2694 + dev-perl/libwww-perl
2695 + dev-perl/MIME-Lite
2696 + dev-perl/MIME-tools
2697 + dev-perl/PHP-Serialization
2698 + virtual/perl-Getopt-Long
2699 + virtual/perl-libnet
2700 + virtual/perl-Module-Load
2701 + virtual/perl-Sys-Syslog
2702 + virtual/perl-Time-HiRes
2703 + mmap? ( dev-perl/Sys-Mmap )"
2704 +
2705 +RDEPEND="dev-perl/DBD-mysql
2706 + ffmpeg? ( >=media-video/ffmpeg-0.5-r1 )
2707 + media-libs/netpbm"
2708 +
2709 +# we cannot use need_httpd_cgi here, since we need to setup permissions for the
2710 +# webserver in global scope (/etc/zm.conf etc), so we hardcode apache here.
2711 +need_apache
2712 +need_php_httpd
2713 +
2714 +S=${WORKDIR}/${MY_P}
2715 +
2716 +pkg_setup() {
2717 + require_php_with_use mysql sockets apache2
2718 +}
2719 +
2720 +src_unpack() {
2721 + unpack ${A}
2722 + cd "${S}"
2723 +
2724 + epatch "${FILESDIR}"/${PV}/Makefile.am.patch
2725 + epatch "${FILESDIR}"/${PV}/zm_remote_camera_http.patch
2726 + epatch "${FILESDIR}"/${PV}/db_upgrade_script_location.patch
2727 +
2728 + eautoreconf
2729 +}
2730 +
2731 +src_compile() {
2732 + local myconf
2733 +
2734 + append-flags "-D__STDC_CONSTANT_MACROS"
2735 +# To enable mmap support we need a dependancy of Sys::Mmap
2736 +# It installs fine via g-cpan, but there's no ebuild currently in portage.
2737 + if use mmap; then
2738 + myconf="${myconf} --enable-mmap=yes"
2739 + else
2740 + myconf="${myconf} --enable-mmap=no"
2741 + fi
2742 +
2743 + if use debug; then
2744 + myconf="${myconf} --enable-debug=yes --enable-crashtrace=yes"
2745 + else
2746 + myconf="${myconf} --enable-debug=no --enable-crashtrace=no"
2747 + fi
2748 +
2749 + econf --with-libarch=$(get_libdir) \
2750 + --with-mysql=/usr \
2751 + $(use_with ffmpeg) \
2752 + --with-webdir="${ROOT}var/www/zoneminder/htdocs" \
2753 + --with-cgidir="${ROOT}var/www/zoneminder/cgi-bin" \
2754 + --with-webuser=apache \
2755 + --with-webgroup=apache \
2756 + ${myconf}
2757 +
2758 + einfo "${PN} does not parallel build... using forcing make -j1..."
2759 + MAKEOPTS="-j1" emake || die "emake failed"
2760 +}
2761 +
2762 +src_install() {
2763 + keepdir /var/run/zm
2764 + emake -j1 DESTDIR="${D}" install || die "emake install failed"
2765 +
2766 + fperms 0640 /etc/zm.conf
2767 +
2768 + keepdir /var/log/zm
2769 + fowners apache:apache /var/log/zm
2770 + fowners apache:apache /var/run/zm
2771 +
2772 + newinitd "${FILESDIR}"/init.d zoneminder
2773 + newconfd "${FILESDIR}"/conf.d zoneminder
2774 +
2775 + dodoc AUTHORS ChangeLog INSTALL NEWS README TODO
2776 +
2777 + insinto /usr/share/${PN}/db
2778 + doins db/zm_u* db/zm_create.sql
2779 +
2780 + insinto /etc/apache2/vhosts.d
2781 + doins "${FILESDIR}"/10_zoneminder.conf
2782 +
2783 + for DIR in events images sound; do
2784 + dodir /var/www/zoneminder/htdocs/${DIR}
2785 + done
2786 +}
2787 +
2788 +pkg_postinst() {
2789 + elog ""
2790 + elog "0. If this is a new installation, you will need to create a MySQL database"
2791 + elog " for ${PN} to use. (see http://www.gentoo.org/doc/en/mysql-howto.xml)."
2792 + elog " Once you completed that you should execute the following:"
2793 + elog ""
2794 + elog " cd /usr/share/${PN}"
2795 + elog " mysql -u <my_database_user> -p<my_database_pass> <my_zoneminder_db> < db/zm_create.sql"
2796 + elog ""
2797 + elog "1. Set your database settings in /etc/zm.conf"
2798 + elog ""
2799 + elog "2. Start the ${PN} daemon:"
2800 + elog ""
2801 + elog " /etc/init.d/${PN} start"
2802 + elog ""
2803 + elog "3. Finally point your browser to http://localhost/${PN}"
2804 + elog ""
2805 + elog ""
2806 + elog "If you are upgrading, you will need to run the zmupdate.pl script:"
2807 + elog ""
2808 + elog " /usr/bin/zmupdate.pl version=<from version> [--user=<my_database_user> --pass=<my_database_pass>]"
2809 + elog ""
2810 + elog "You must gave short_open_tag = On in /etc/php/php.ini"
2811 + elog ""
2812 +}
2813
2814 diff --git a/media-video/zoneminder/zoneminder-9999.ebuild b/media-video/zoneminder/zoneminder-9999.ebuild
2815 new file mode 100644
2816 index 0000000..6c90e7e
2817 --- /dev/null
2818 +++ b/media-video/zoneminder/zoneminder-9999.ebuild
2819 @@ -0,0 +1,165 @@
2820 +# Copyright 1999-2011 Gentoo Foundation
2821 +# Distributed under the terms of the GNU General Public License v2
2822 +# $Header: $
2823 +
2824 +inherit eutils autotools depend.php depend.apache multilib subversion flag-o-matic scons-utils
2825 +
2826 +DESCRIPTION="ZoneMinder allows you to capture, analyse, record and monitor any cameras attached to your system."
2827 +HOMEPAGE="http://www.zoneminder.com/"
2828 +ESVN_REPO_URI="http://svn.zoneminder.com/svn/zm/trunk"
2829 +ESVN_PROJECT="${PN}"
2830 +LICENSE="GPL-2"
2831 +KEYWORDS=""
2832 +IUSE="debug ffmpeg mmap"
2833 +# plugins"
2834 +SLOT="0"
2835 +
2836 +DEPEND="app-admin/sudo
2837 + dev-libs/libpcre
2838 + virtual/jpeg
2839 + net-libs/gnutls
2840 + >=dev-lang/perl-5.6.0
2841 + virtual/perl-Archive-Tar
2842 + dev-perl/Archive-Zip
2843 + dev-perl/DateManip
2844 + dev-perl/DBD-mysql
2845 + dev-perl/DBI
2846 + dev-perl/Device-SerialPort
2847 + dev-perl/libwww-perl
2848 + dev-perl/MIME-Lite
2849 + dev-perl/MIME-tools
2850 + dev-perl/PHP-Serialization
2851 + virtual/perl-Getopt-Long
2852 + virtual/perl-libnet
2853 + virtual/perl-Module-Load
2854 + virtual/perl-Sys-Syslog
2855 + virtual/perl-Time-HiRes
2856 + mmap? ( dev-perl/Sys-Mmap )"
2857 +# plugins? ( dev-util/scons )"
2858 +
2859 +RDEPEND="dev-perl/DBD-mysql
2860 + ffmpeg? ( >=media-video/ffmpeg-0.5-r1 )
2861 + media-libs/netpbm"
2862 +# plugins? ( media-libs/opencv
2863 +# >=dev-libs/boost-1.40 )"
2864 +
2865 +# we cannot use need_httpd_cgi here, since we need to setup permissions for the
2866 +# webserver in global scope (/etc/zm.conf etc), so we hardcode apache here.
2867 +need_apache
2868 +need_php_httpd
2869 +
2870 +#S=${WORKDIR}/${MY_PN}-${MY_PV}
2871 +
2872 +pkg_setup() {
2873 + require_php_with_use mysql sockets apache2
2874 +}
2875 +
2876 +src_unpack() {
2877 +# unpack ${A}
2878 + subversion_src_unpack
2879 + cd "${S}"
2880 + tar xjf "${FILESDIR}"/9999/zoneminder-facedetector-plugin.tar.bz2
2881 +
2882 + epatch "${FILESDIR}"/9999/Makefile.am.patch
2883 + epatch "${FILESDIR}"/9999/zm_remote_camera_http.patch
2884 + epatch "${FILESDIR}"/9999/db_upgrade_script_location.patch
2885 +# if use plugins; then
2886 +# epatch "${FILESDIR}"/9999/cvisionlab-plugins.patch
2887 +# fi
2888 +
2889 + eautoreconf
2890 +}
2891 +
2892 +src_compile() {
2893 + local myconf
2894 +
2895 + append-flags "-D__STDC_CONSTANT_MACROS"
2896 +# To enable mmap support we need a dependancy of Sys::Mmap
2897 +# It installs fine via g-cpan, but there's no ebuild currently in portage.
2898 + if use mmap; then
2899 + myconf="${myconf} --enable-mmap=yes"
2900 + else
2901 + myconf="${myconf} --enable-mmap=no"
2902 + fi
2903 +
2904 + if use debug; then
2905 + myconf="${myconf} --enable-debug=yes --enable-crashtrace=yes"
2906 + else
2907 + myconf="${myconf} --enable-debug=no --enable-crashtrace=no"
2908 + fi
2909 +
2910 + econf --with-libarch=$(get_libdir) \
2911 + --with-mysql=/usr \
2912 + $(use_with ffmpeg) \
2913 + --with-webdir="${ROOT}var/www/zoneminder/htdocs" \
2914 + --with-cgidir="${ROOT}var/www/zoneminder/cgi-bin" \
2915 + --with-webuser=apache \
2916 + --with-webgroup=apache \
2917 + ${myconf}
2918 +
2919 + einfo "${PN} does not parallel build... using forcing make -j1..."
2920 + MAKEOPTS="-j1" emake || die "emake failed"
2921 +# if use plugins; then
2922 +# cd plugins
2923 +# scons
2924 +# fi
2925 +}
2926 +
2927 +src_install() {
2928 + keepdir /var/run/zm
2929 + emake -j1 DESTDIR="${D}" install || die "emake install failed"
2930 +
2931 + fperms 0640 /etc/zm.conf
2932 +
2933 + keepdir /var/log/zm
2934 + fowners apache:apache /var/log/zm
2935 + fowners apache:apache /var/run/zm
2936 +
2937 + newinitd "${FILESDIR}"/init.d zoneminder
2938 + newconfd "${FILESDIR}"/conf.d zoneminder
2939 +
2940 + dodoc AUTHORS ChangeLog INSTALL NEWS README TODO
2941 +
2942 + insinto /usr/share/${PN}/db
2943 + doins db/zm_u* db/zm_create.sql
2944 +
2945 + insinto /etc/apache2/vhosts.d
2946 + doins "${FILESDIR}"/10_zoneminder.conf
2947 +
2948 + for DIR in events images sound; do
2949 + dodir /var/www/zoneminder/htdocs/${DIR}
2950 + done
2951 +
2952 +# if use plugins; then
2953 +# sed -i "s:zoneminder:opencv:g" ${S}/plugins/data/plugins.conf
2954 +# insinto /usr/share/${PN}
2955 +# newins plugins/release/face_detector_plugin.os face_detector_plugin.zmpl
2956 +# doins plugins/data/plugins.conf
2957 +# fi
2958 +}
2959 +
2960 +pkg_postinst() {
2961 + elog ""
2962 + elog "0. If this is a new installation, you will need to create a MySQL database"
2963 + elog " for ${PN} to use. (see http://www.gentoo.org/doc/en/mysql-howto.xml)."
2964 + elog " Once you completed that you should execute the following:"
2965 + elog ""
2966 + elog " cd /usr/share/${PN}"
2967 + elog " mysql -u <my_database_user> -p<my_database_pass> <my_zoneminder_db> < db/zm_create.sql"
2968 + elog ""
2969 + elog "1. Set your database settings in /etc/zm.conf"
2970 + elog ""
2971 + elog "2. Start the ${PN} daemon:"
2972 + elog ""
2973 + elog " /etc/init.d/${PN} start"
2974 + elog ""
2975 + elog "3. Finally point your browser to http://localhost/${PN}"
2976 + elog ""
2977 + elog ""
2978 + elog "If you are upgrading, you will need to run the zmupdate.pl script:"
2979 + elog ""
2980 + elog " /usr/bin/zmupdate.pl version=<from version> [--user=<my_database_user> --pass=<my_database_pass>]"
2981 + elog ""
2982 + elog "You must gave short_open_tag = On in /etc/php/php.ini"
2983 + elog ""
2984 +}