-
Notifications
You must be signed in to change notification settings - Fork 0
/
plugins.patch
2217 lines (2177 loc) · 96.5 KB
/
plugins.patch
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
671
672
673
674
675
676
677
678
679
680
681
682
683
684
685
686
687
688
689
690
691
692
693
694
695
696
697
698
699
700
701
702
703
704
705
706
707
708
709
710
711
712
713
714
715
716
717
718
719
720
721
722
723
724
725
726
727
728
729
730
731
732
733
734
735
736
737
738
739
740
741
742
743
744
745
746
747
748
749
750
751
752
753
754
755
756
757
758
759
760
761
762
763
764
765
766
767
768
769
770
771
772
773
774
775
776
777
778
779
780
781
782
783
784
785
786
787
788
789
790
791
792
793
794
795
796
797
798
799
800
801
802
803
804
805
806
807
808
809
810
811
812
813
814
815
816
817
818
819
820
821
822
823
824
825
826
827
828
829
830
831
832
833
834
835
836
837
838
839
840
841
842
843
844
845
846
847
848
849
850
851
852
853
854
855
856
857
858
859
860
861
862
863
864
865
866
867
868
869
870
871
872
873
874
875
876
877
878
879
880
881
882
883
884
885
886
887
888
889
890
891
892
893
894
895
896
897
898
899
900
901
902
903
904
905
906
907
908
909
910
911
912
913
914
915
916
917
918
919
920
921
922
923
924
925
926
927
928
929
930
931
932
933
934
935
936
937
938
939
940
941
942
943
944
945
946
947
948
949
950
951
952
953
954
955
956
957
958
959
960
961
962
963
964
965
966
967
968
969
970
971
972
973
974
975
976
977
978
979
980
981
982
983
984
985
986
987
988
989
990
991
992
993
994
995
996
997
998
999
1000
diff -rupN ZoneMinder-1.24.2/configure ZoneMinder-edited/configure
--- ZoneMinder-1.24.2/configure 2009-06-24 14:22:41.000000000 +0400
+++ ZoneMinder-edited/configure 2011-01-10 15:14:34.688682435 +0300
@@ -1886,6 +1886,7 @@ MYSQL_CFLAGS="-I${MYSQL_PREFIX}/include"
+LDFLAGS="$LDFLAGS -rdynamic "
LDFLAGS="${MYSQL_LIBS} $LDFLAGS"
FFMPEG_PREFIX=/usr
diff -rupN ZoneMinder-1.24.2/db/Makefile.am ZoneMinder-edited/db/Makefile.am
--- ZoneMinder-1.24.2/db/Makefile.am 2009-03-31 18:06:34.000000000 +0400
+++ ZoneMinder-edited/db/Makefile.am 2011-01-10 15:43:48.307430943 +0300
@@ -38,4 +38,5 @@ EXTRA_DIST = \
zm_update-1.23.2.sql \
zm_update-1.23.3.sql \
zm_update-1.24.0.sql \
- zm_update-1.24.1.sql
+ zm_update-1.24.1.sql \
+ zm_update-plugins.sql
diff -rupN ZoneMinder-1.24.2/db/Makefile.in ZoneMinder-edited/db/Makefile.in
--- ZoneMinder-1.24.2/db/Makefile.in 2009-06-24 14:22:34.000000000 +0400
+++ ZoneMinder-edited/db/Makefile.in 2011-01-10 15:43:48.367430739 +0300
@@ -205,7 +205,8 @@ EXTRA_DIST = \
zm_update-1.23.2.sql \
zm_update-1.23.3.sql \
zm_update-1.24.0.sql \
- zm_update-1.24.1.sql
+ zm_update-1.24.1.sql \
+ zm_update-plugins.sql
all: all-am
diff -rupN ZoneMinder-1.24.2/db/zm_create.sql.in ZoneMinder-edited/db/zm_create.sql.in
--- ZoneMinder-1.24.2/db/zm_create.sql.in 2009-05-25 22:08:50.000000000 +0400
+++ ZoneMinder-edited/db/zm_create.sql.in 2011-01-10 18:26:30.211552419 +0300
@@ -351,6 +351,8 @@ CREATE TABLE `Monitors` (
`SignalCheckColour` varchar(32) NOT NULL default '#0100BE',
`WebColour` varchar(32) NOT NULL default 'red',
`Sequence` smallint(5) unsigned default NULL,
+ `UsedPl` varchar(88) NOT NULL default '',
+ `DoNativeMotDet` varchar(5) NOT NULL default 'yes',
PRIMARY KEY (`Id`)
) ENGINE=@ZM_MYSQL_ENGINE@;
@@ -847,4 +849,9 @@ insert into Config set Id = 179, Name =
insert into Config set Id = 180, Name = 'ZM_DYN_NEXT_REMINDER', Value = '', Type = 'string', DefaultValue = '', Hint = 'string', Pattern = '(?-xism:^(.+)$)', Format = ' $1 ', Prompt = 'When the earliest time to remind about versions will be', Help = '', Category = 'dynamic', Readonly = '1', Requires = '';
insert into Config set Id = 181, Name = 'ZM_DYN_DONATE_REMINDER_TIME', Value = '0', Type = 'integer', DefaultValue = '0', Hint = 'integer', Pattern = '(?-xism:^(\d+)$)', Format = ' $1 ', Prompt = 'When the earliest time to remind about donations will be', Help = '', Category = 'dynamic', Readonly = '1', Requires = '';
insert into Config set Id = 182, Name = 'ZM_DYN_SHOW_DONATE_REMINDER', Value = '1', Type = 'boolean', DefaultValue = 'yes', Hint = 'yes|no', Pattern = '(?i-xsm:^([yn]))', Format = ' ($1 =~ /^y/) ? \"yes\" : \"no\" ', Prompt = 'Remind about donations or not', Help = '', Category = 'dynamic', Readonly = '1', Requires = '';
+insert into Config set Id = 183, Name = 'ZM_PATH_PLUGINS', Value = '/usr/share/zm', Type = 'string', DefaultValue = '/usr/share/zm', 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 = '';
+insert into Config set Id = 184, 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 = '';
+insert into Config set Id = 185, Name = 'ZM_PLUGINS_CONFIG_FILE', Value = '/usr/share/zm/plugins.conf', Type = 'string', DefaultValue = '/usr/share/zm/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 = '';
+insert into Config set Id = 186, 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 = '';
+insert into Config set Id = 187, 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 = '';
diff -rupN ZoneMinder-1.24.2/db/zm_update-plugins.sql ZoneMinder-edited/db/zm_update-plugins.sql
--- ZoneMinder-1.24.2/db/zm_update-plugins.sql 1970-01-01 03:00:00.000000000 +0300
+++ ZoneMinder-edited/db/zm_update-plugins.sql 2011-01-10 15:39:54.527433198 +0300
@@ -0,0 +1,26 @@
+--
+-- This is update from 1.24.2 version to plugins supporting architecture.
+--
+
+-- Add two columns to store plugins related information.
+ALTER TABLE Monitors
+ADD ( `UsedPl` varchar(88) NOT NULL default '',
+ `DoNativeMotDet` varchar(5) NOT NULL default 'yes'
+);
+
+-- Insert some values into `Config' table.
+INSERT INTO Config SET Id = 183, Name = 'ZM_PATH_PLUGINS', Value = '/usr/share/zm', Type = 'string', DefaultValue = '/usr/share/zm', 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 = '';
+INSERT INTO Config SET Id = 184, 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 = '';
+INSERT INTO Config SET Id = 185, Name = 'ZM_PLUGINS_CONFIG_FILE', Value = '/usr/share/zm/plugins.conf', Type = 'string', DefaultValue = '/usr/share/zm/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 = '';
+INSERT INTO Config SET Id = 186, 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 = '';
+INSERT INTO Config SET Id = 187, 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 = '';
+
+--
+-- These are optional, but we might as well
+--
+optimize table Frames;
+optimize table Events;
+optimize table Filters;
+optimize table Zones;
+optimize table Monitors;
+optimize table Stats;
diff -rupN ZoneMinder-1.24.2/scripts/ZoneMinder/lib/ZoneMinder/ConfigAdmin.pm.in ZoneMinder-edited/scripts/ZoneMinder/lib/ZoneMinder/ConfigAdmin.pm.in
--- ZoneMinder-1.24.2/scripts/ZoneMinder/lib/ZoneMinder/ConfigAdmin.pm.in 2009-05-25 22:04:00.000000000 +0400
+++ ZoneMinder-edited/scripts/ZoneMinder/lib/ZoneMinder/ConfigAdmin.pm.in 2011-01-10 15:51:46.347427893 +0300
@@ -578,6 +578,46 @@ our @options =
type => $types{abs_path},
category => "paths",
},
+ {
+ name => "ZM_PATH_PLUGINS",
+ default => "/usr/share/zm",
+ description => "Path to the plugin folder",
+ help => "3d-party plugins have to be placed here.",
+ type => $types{abs_path},
+ category => "paths",
+ },
+ {
+ name => "ZM_PLUGIN_EXTENSION",
+ default => ".zmpl",
+ description => "Default extension of plugins to found.",
+ help => "Default extension of plugins to found.",
+ type => $types{rel_path},
+ category => "paths",
+ },
+ {
+ name => "ZM_PLUGINS_CONFIG_FILE",
+ default => "/usr/share/zm/plugins.conf",
+ description => "Path to the config file for plugins.",
+ help => "Path to the config file for plugins.",
+ type => $types{abs_path},
+ category => "paths",
+ },
+ {
+ name => "ZM_LOAD_PLUGINS",
+ default => "no",
+ description => "Load and use 3d-party plugins",
+ help => "3d-party plugins will be loaded and used for analysing.",
+ type => $types{boolean},
+ category => "config",
+ },
+ {
+ name => "ZM_TURNOFF_NATIVE_ANALYSIS",
+ default => "no",
+ description => "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.",
+ type => $types{boolean},
+ category => "config",
+ },
{
name => "ZM_PATH_SWAP",
default => "/tmp",
diff -rupN ZoneMinder-1.24.2/src/Makefile.am ZoneMinder-edited/src/Makefile.am
--- ZoneMinder-1.24.2/src/Makefile.am 2009-05-28 12:45:50.000000000 +0400
+++ ZoneMinder-edited/src/Makefile.am 2011-01-10 17:10:38.607779006 +0300
@@ -57,7 +57,11 @@ zm_SOURCES = \
zm_timer.cpp \
zm_user.cpp \
zm_utils.cpp \
- zm_zone.cpp
+ zm_zone.cpp \
+ zm_detector.cpp \
+ zm_plugin.cpp \
+ zm_plugin_manager.cpp \
+ zm_image_analyser.cpp
zmc_SOURCES = zmc.cpp $(zm_SOURCES)
zma_SOURCES = zma.cpp $(zm_SOURCES)
@@ -111,7 +115,11 @@ noinst_HEADERS = \
zm_timer.h \
zm_user.h \
zm_utils.h \
- zm_zone.h
+ zm_zone.h \
+ zm_detector.h \
+ zm_plugin.h \
+ zm_plugin_manager.h \
+ zm_image_analyser.h
EXTRA_DIST = \
zm_config.h.in \
diff -rupN ZoneMinder-1.24.2/src/zm_config_defines.h ZoneMinder-edited/src/zm_config_defines.h
--- ZoneMinder-1.24.2/src/zm_config_defines.h 2009-05-25 22:04:00.000000000 +0400
+++ ZoneMinder-edited/src/zm_config_defines.h 2011-01-10 15:54:51.767429136 +0300
@@ -184,9 +184,15 @@
#define ZM_DYN_NEXT_REMINDER 180
#define ZM_DYN_DONATE_REMINDER_TIME 181
#define ZM_DYN_SHOW_DONATE_REMINDER 182
+#define ZM_PATH_PLUGINS 183
+#define ZM_PLUGIN_EXTENSION 184
+#define ZM_PLUGINS_CONFIG_FILE 185
+#define ZM_LOAD_PLUGINS 186
+#define ZM_TURNOFF_NATIVE_ANALYSIS 187
-#define ZM_MAX_CFG_ID 182
+#define ZM_MAX_CFG_ID 187
+
#define ZM_CFG_DECLARE_LIST \
const char *lang_default;\
@@ -247,6 +253,11 @@
const char *path_map;\
const char *path_socks;\
const char *path_logs;\
+ const char *path_plugins;\
+ const char *plugin_extension;\
+ const char *plugins_config_path;\
+ bool load_plugins;\
+ bool turnoff_native_analysis;\
const char *path_swap;\
const char *web_title_prefix;\
bool web_resize_console;\
@@ -433,6 +444,11 @@
path_map = (const char *)config.Item( ZM_PATH_MAP );\
path_socks = (const char *)config.Item( ZM_PATH_SOCKS );\
path_logs = (const char *)config.Item( ZM_PATH_LOGS );\
+ path_plugins = (const char *)config.Item( ZM_PATH_PLUGINS );\
+ plugin_extension = (const char *)config.Item( ZM_PLUGIN_EXTENSION );\
+ plugins_config_path = (const char *)config.Item( ZM_PLUGINS_CONFIG_FILE );\
+ load_plugins = (bool)config.Item( ZM_LOAD_PLUGINS );\
+ turnoff_native_analysis = (bool)config.Item( ZM_TURNOFF_NATIVE_ANALYSIS );\
path_swap = (const char *)config.Item( ZM_PATH_SWAP );\
web_title_prefix = (const char *)config.Item( ZM_WEB_TITLE_PREFIX );\
web_resize_console = (bool)config.Item( ZM_WEB_RESIZE_CONSOLE );\
diff -rupN ZoneMinder-1.24.2/src/zm_detector.cpp ZoneMinder-edited/src/zm_detector.cpp
--- ZoneMinder-1.24.2/src/zm_detector.cpp 1970-01-01 03:00:00.000000000 +0300
+++ ZoneMinder-edited/src/zm_detector.cpp 2010-09-08 17:43:49.520237000 +0400
@@ -0,0 +1,200 @@
+#include "zm_detector.h"
+
+
+
+/*!\fn Detector::Detector(const Detector& source)
+ * \param source is the object to copy
+ */
+Detector::Detector(const Detector& source)
+ : m_sDetectionCause(source.m_sDetectionCause),
+ m_fMinAlarmScore(source.m_fMinAlarmScore),
+ m_fMaxAlarmScore(source.m_fMaxAlarmScore),
+ m_fImageScaleFactor(source.m_fImageScaleFactor),
+ m_sLogPrefix(source.m_sLogPrefix),
+ m_nNewWidth(source.m_nNewWidth),
+ m_nNewHeight(source.m_nNewHeight),
+ m_sConfigSectionName(source.m_sConfigSectionName)
+{
+ //setlogmask (LOG_UPTO (LOG_LEVEL));
+ //openlog(m_sLogPrefix.c_str(), LOG_PID|LOG_CONS, LOG_USER);
+}
+
+
+
+/*!\fn Detector& ImageAnalyser::Detector::operator=(const ImageAnalyser::Detector& source)
+ * \param source is the object to copy
+ */
+Detector& Detector::operator=(const Detector& source)
+{
+ m_sDetectionCause = source.m_sDetectionCause;
+ m_fMinAlarmScore = source.m_fMinAlarmScore;
+ m_fMaxAlarmScore = source.m_fMaxAlarmScore;
+ m_fImageScaleFactor = source.m_fImageScaleFactor;
+ m_sLogPrefix = source.m_sLogPrefix;
+ m_nNewWidth = source.m_nNewWidth;
+ m_nNewHeight = source.m_nNewHeight;
+ m_sConfigSectionName = source.m_sConfigSectionName;
+
+ //setlogmask (LOG_UPTO (LOG_LEVEL));
+ //openlog(m_sLogPrefix.c_str(), LOG_PID|LOG_CONS, LOG_USER);
+
+ return *this;
+}
+
+
+
+/*!\fn Detector::getDetectionCause()
+ * return detection cause as string
+ */
+string Detector::getDetectionCause()
+{
+ return m_sDetectionCause;
+}
+
+
+
+
+/*! \fn Detector::log(int nLogLevel, string sMessage)
+ */
+void Detector::log(int nLogLevel, string sMessage)
+{
+ string sMessageToLog = m_sLogPrefix + string(" : ") + sMessage;
+ syslog(nLogLevel, sMessageToLog.c_str());
+}
+
+
+//Detector::~Detector() {}
+
+
+
+
+/*! \fn int FaceDetectorPlugin::Detect(const Image &image, Event::StringSet &zoneSet)
+ * \param image is an image to detect faces on
+ * \param zoneSet is set of zone names (see zm_zone.h)
+ * \return detection score
+ */
+int Detector::Detect(const Image &zmImage, Zone** zones, int n_numZones, Event::StringSet &zoneSet)
+{
+ //log(LOG_LEVEL, "Detection invoking.");
+ bool alarm = false;
+ char szMessage[50];
+ unsigned int score = 0;
+
+ if (n_numZones <= 0) return (alarm);
+
+
+// // Blank out all exclusion zones
+// for ( int n_zone = 0; n_zone < n_zones; n_zone++ )
+// {
+// Zone *zone = zones[n_zone];
+// zone->ClearAlarm();
+// if ( !zone->IsInactive() )
+// {
+// continue;
+// }
+// Debug( 3, "Blanking inactive zone %s", zone->Label() );
+// delta_image->Fill( RGB_BLACK, zone->GetPolygon() );
+// }
+
+ // Check preclusive zones first
+ for (int n_zone = 0; n_zone < n_numZones; n_zone++)
+ {
+ Zone *zone = zones[n_zone];
+ if (!zone->IsPreclusive())
+ {
+ continue;
+ }
+ sprintf(szMessage, "Checking preclusive zone %s", zone->Label());
+ log(LOG_DEBUG, szMessage);
+ if (checkZone(zone, &zmImage))
+ {
+ alarm = true;
+ score += zone->Score();
+ zone->SetAlarm();
+ sprintf(szMessage, "Zone is alarmed, zone score = %d", zone->Score());
+ log(LOG_DEBUG, szMessage);
+ zoneSet.insert(zone->Label());
+ }
+ }
+
+ if ( alarm )
+ {
+ alarm = false;
+ score = 0;
+ }
+ else
+ {
+ // Find all alarm pixels in active zones
+ for (int n_zone = 0; n_zone < n_numZones; n_zone++)
+ {
+ Zone *zone = zones[n_zone];
+ if (!zone->IsActive())
+ {
+ continue;
+ }
+ sprintf(szMessage, "Checking active zone %s", zone->Label());
+ log(LOG_DEBUG, szMessage);
+ if (checkZone(zone, &zmImage))
+ {
+ alarm = true;
+ score += zone->Score();
+ zone->SetAlarm();
+ sprintf(szMessage, "Zone is alarmed, zone score = %d", zone->Score());
+ log(LOG_DEBUG, szMessage);
+ zoneSet.insert(zone->Label());
+ }
+ }
+
+ if ( alarm )
+ {
+ // Checking inclusive zones
+ for (int n_zone = 0; n_zone < n_numZones; n_zone++)
+ {
+ Zone *zone = zones[n_zone];
+ if (!zone->IsInclusive())
+ {
+ continue;
+ }
+ sprintf(szMessage, "Checking inclusive zone %s", zone->Label());
+ log(LOG_DEBUG, szMessage);
+ if (checkZone(zone, &zmImage))
+ {
+ alarm = true;
+ score += zone->Score();
+ zone->SetAlarm();
+ sprintf(szMessage, "Zone is alarmed, zone score = %d", zone->Score());
+ log(LOG_DEBUG, szMessage);
+ zoneSet.insert(zone->Label());
+ }
+ }
+ }
+ else
+ {
+ // Find all alarm pixels in exclusive zones
+ for (int n_zone = 0; n_zone < n_numZones; n_zone++)
+ {
+ Zone *zone = zones[n_zone];
+ if (!zone->IsExclusive())
+ {
+ continue;
+ }
+ sprintf(szMessage, "Checking exclusive zone %s", zone->Label());
+ log(LOG_DEBUG, szMessage);
+ if (checkZone(zone, &zmImage))
+ {
+ alarm = true;
+ score += zone->Score();
+ zone->SetAlarm();
+ sprintf(szMessage, "Zone is alarmed, zone score = %d", zone->Score());
+ log(LOG_DEBUG, szMessage);
+ zoneSet.insert(zone->Label());
+ }
+ }
+ } //else if(alarm) : exclusive
+ } //else if(alarm)
+
+
+ return(score?score:alarm);
+}
+
+
diff -rupN ZoneMinder-1.24.2/src/zm_detector.h ZoneMinder-edited/src/zm_detector.h
--- ZoneMinder-1.24.2/src/zm_detector.h 1970-01-01 03:00:00.000000000 +0300
+++ ZoneMinder-edited/src/zm_detector.h 2010-09-09 10:20:22.164274000 +0400
@@ -0,0 +1,129 @@
+#ifndef ZM_DETECTOR_H
+#define ZM_DETECTOR_H
+
+
+#include <string>
+#include <syslog.h>
+#include <libgen.h>
+
+#include "zm_image.h"
+#include "zm_zone.h"
+#include "zm_event.h"
+
+
+
+#define DEFAULT_DETECTION_CAUSE "Object Detected"
+#define DEFAULT_MIN_ALARM_SCORE 1.0
+#define DEFAULT_MAX_ALARM_SCORE 99.0
+#define DEFAULT_IMAGE_SCALE_FACTOR 1.0
+
+#define DEFAULT_LOG_PREFIX "ZM PLUGIN"
+#define LOG_LEVEL LOG_NOTICE
+#define DEFAULT_CONFIGFILE_SECTION "libzm_vscvl_plugin"
+
+using namespace std;
+
+
+//! Base class for object detectors, defined in plugins.
+class Detector
+{
+
+public:
+
+ //! Destructor
+ virtual ~Detector() { closelog(); }
+
+ //! Default constructor
+ Detector()
+{
+ m_sLogPrefix = DEFAULT_LOG_PREFIX;
+
+ //setlogmask (LOG_UPTO (LOG_LEVEL));
+ //openlog(m_sLogPrefix.c_str(), LOG_PID|LOG_CONS, LOG_USER);
+
+ m_sDetectionCause = DEFAULT_DETECTION_CAUSE;
+ m_fMinAlarmScore = DEFAULT_MIN_ALARM_SCORE;
+ m_fMaxAlarmScore = DEFAULT_MAX_ALARM_SCORE;
+ m_fImageScaleFactor = DEFAULT_IMAGE_SCALE_FACTOR;
+ m_sConfigSectionName = DEFAULT_CONFIGFILE_SECTION;
+ m_nNewWidth = 0;
+ m_nNewHeight = 0;
+}
+
+ //! Constructor with section name parameter.
+ Detector(string sPluginFileName)
+{
+ m_sLogPrefix = DEFAULT_LOG_PREFIX;
+
+ char* szPluginFileName = strdup(sPluginFileName.c_str());
+
+ string sPluginFileNameName = string(basename(szPluginFileName));
+
+ size_t idx = sPluginFileNameName.rfind('.');
+
+ if (idx == string::npos)
+ m_sConfigSectionName = sPluginFileNameName;
+ else
+ m_sConfigSectionName = sPluginFileNameName.substr(0, idx);
+
+ m_sDetectionCause = DEFAULT_DETECTION_CAUSE;
+ m_fMinAlarmScore = DEFAULT_MIN_ALARM_SCORE;
+ m_fMaxAlarmScore = DEFAULT_MAX_ALARM_SCORE;
+ m_fImageScaleFactor = DEFAULT_IMAGE_SCALE_FACTOR;
+ m_nNewWidth = 0;
+ m_nNewHeight = 0;
+}
+
+ //! Copy constructor
+ Detector(const Detector& source);
+
+ //! Assignment operator
+ Detector& operator=(const Detector& source);
+
+ //! Detect (in an image later)
+ int Detect(const Image &image, Zone** zones, int n_numZones, Event::StringSet &zoneSet);
+
+ //! Load detector's parameters from a config file.
+ virtual void loadConfig(string sConfigFileName) = 0;
+
+ //! Returns detection case string.
+ string getDetectionCause();
+
+protected:
+
+ //! Do detection inside one given zone.
+ virtual bool checkZone(Zone *zone, const Image *zmImage) = 0;
+
+ //! Log messages to the SYSLOG.
+ void log(int, string sMessage);
+
+ //! String to be shown as detection cause for event.
+ string m_sDetectionCause;
+
+ //! Minimum score value to consider frame as to be alarmed.
+ double m_fMinAlarmScore;
+
+ //! Maximum score value to consider frame as to be alarmed.
+ double m_fMaxAlarmScore;
+
+ //! Maximum allowed width of frame image.
+ double m_fImageScaleFactor;
+
+ //! Width of image to resize.
+ int m_nNewWidth;
+
+ //! Height of image to resize.
+ int m_nNewHeight;
+//
+// //! Output stream for logging errors.
+// ofstream m_outStream;
+
+ //! String prefix for SYSLOG messages.
+ string m_sLogPrefix;
+
+ //! Name of config file section to search parameters.
+ string m_sConfigSectionName;
+};
+
+
+#endif // ZM_DETECTOR_H
diff -rupN ZoneMinder-1.24.2/src/zm_event.h ZoneMinder-edited/src/zm_event.h
--- ZoneMinder-1.24.2/src/zm_event.h 2009-03-20 15:07:00.000000000 +0300
+++ ZoneMinder-edited/src/zm_event.h 2011-01-10 15:56:00.757429912 +0300
@@ -41,7 +41,7 @@
class Zone;
class Monitor;
-#define MAX_PRE_ALARM_FRAMES 16 // Maximum number of prealarm frames that can be stored
+#define MAX_PRE_ALARM_FRAMES 16 // Maximum number of prealarm frames that can be stored
//
// Class describing events, i.e. captured periods of activity.
diff -rupN ZoneMinder-1.24.2/src/zm_image_analyser.cpp ZoneMinder-edited/src/zm_image_analyser.cpp
--- ZoneMinder-1.24.2/src/zm_image_analyser.cpp 1970-01-01 03:00:00.000000000 +0300
+++ ZoneMinder-edited/src/zm_image_analyser.cpp 2010-08-27 16:53:20.000000000 +0400
@@ -0,0 +1,86 @@
+#include "zm_image_analyser.h"
+
+
+
+/*!\fn ImageAnalyser::ImageAnalyser(const ImageAnalyser& source)
+ * \param source is the object to copy
+ */
+ImageAnalyser::ImageAnalyser(const ImageAnalyser& source)
+{
+ m_Detectors = source.m_Detectors;
+}
+
+
+
+/*!\fn ImageAnalyser::operator=(const ImageAnalyser& source)
+ * \param source is the object to copy
+ */
+ImageAnalyser& ImageAnalyser::operator=(const ImageAnalyser& source)
+{
+ m_Detectors = source.m_Detectors;
+ return *this;
+}
+
+
+
+ImageAnalyser::~ImageAnalyser()
+{
+ for(DetectorsList::reverse_iterator It = m_Detectors.rbegin();
+ It != m_Detectors.rend();
+ ++It)
+ delete *It;
+}
+
+
+
+/*!\fn ImageAnalyser::DoDetection(const Image &comp_image, Zone** zones, int n_numZones, Event::StringSetMap noteSetMap, std::string& det_cause)
+ * \param comp_image is the image to analyse
+ * \param zones is the zones array to analyse
+ * \param n_numZones is the number of zones
+ * \param noteSetMap is the map of events descriptions
+ * \param det_cause is a string describing detection cause
+ */
+int ImageAnalyser::DoDetection(const Image &comp_image, Zone** zones, int n_numZones, Event::StringSetMap noteSetMap, std::string& det_cause)
+{
+ Event::StringSet zoneSet;
+ int score = 0;
+
+ for(DetectorsList::iterator It = m_Detectors.begin();
+ It != m_Detectors.end();
+ ++It)
+ {
+ int detect_score = (*It)->Detect(comp_image, zones, n_numZones, zoneSet);
+ if (detect_score)
+ {
+ score += detect_score;
+ noteSetMap[(*It)->getDetectionCause()] = zoneSet;
+ if (det_cause.length())
+ det_cause += ", ";
+ det_cause += (*It)->getDetectionCause();
+ }
+ }
+ return score;
+}
+
+
+
+/*!\fn ImageAnalyser::configurePlugins(string sConfigFileName)
+ * \param sConfigFileName is the path to the configuration file, where parameters for all plugins are given.
+ */
+void ImageAnalyser::configurePlugins(string sConfigFileName)
+{
+ for(DetectorsList::iterator It = m_Detectors.begin();
+ It != m_Detectors.end();
+ ++It)
+ {
+ try
+ {
+ (*It)->loadConfig(sConfigFileName);
+ }
+ catch(...)
+ {
+ Info("ERROR: Plugin \"%s\" couldn\'t load config file \"%s\".", (*It)->getDetectionCause(), sConfigFileName.c_str());
+ }
+ }
+
+}
diff -rupN ZoneMinder-1.24.2/src/zm_image_analyser.h ZoneMinder-edited/src/zm_image_analyser.h
--- ZoneMinder-1.24.2/src/zm_image_analyser.h 1970-01-01 03:00:00.000000000 +0300
+++ ZoneMinder-edited/src/zm_image_analyser.h 2010-08-27 16:55:26.204356000 +0400
@@ -0,0 +1,65 @@
+#ifndef ZM_IMAGE_ANALYSER_H
+#define ZM_IMAGE_ANALYSER_H
+
+
+
+#include <list>
+#include <string>
+#include <stdexcept>
+#include <iostream>
+#include <memory>
+
+#include "zm.h"
+#include "zm_detector.h"
+#include "zm_image.h"
+#include "zm_zone.h"
+#include "zm_event.h"
+
+
+
+using namespace std;
+
+
+//! List of available detectors.
+typedef std::list<Detector *> DetectorsList;
+
+
+//! Class for handling image detection.
+/*! Contains all detectors loaded from plugins.
+ */
+class ImageAnalyser {
+ public:
+
+ //!Default constructor.
+ ImageAnalyser() {};
+
+ //! Destructor.
+ ~ImageAnalyser();
+
+ //! Copy constructor.
+ ImageAnalyser(const ImageAnalyser& source);
+
+ //! Overloaded operator=.
+ ImageAnalyser& operator=(const ImageAnalyser& source);
+
+ //! Adds new plugin's detector to the list of detectors.
+ void addDetector(std::auto_ptr<Detector> Det)
+ {
+ m_Detectors.push_back(Det.release());
+ }
+
+ //! Do detection in an image by calling all available detectors.
+ int DoDetection(const Image &comp_image, Zone** zones, int n_numZones, Event::StringSetMap noteSetMap, std::string& det_cause);
+
+ //! Configure all loaded plugins using given configuration file.
+ void configurePlugins(string sConfigFileName);
+
+private:
+
+ //! All available detectors.
+ DetectorsList m_Detectors;
+};
+
+
+
+#endif //ZM_IMAGE_ANALYSER_H
diff -rupN ZoneMinder-1.24.2/src/zm_monitor.cpp ZoneMinder-edited/src/zm_monitor.cpp
--- ZoneMinder-1.24.2/src/zm_monitor.cpp 2009-06-24 14:22:23.000000000 +0400
+++ ZoneMinder-edited/src/zm_monitor.cpp 2011-01-10 15:59:06.827554798 +0300
@@ -47,6 +47,37 @@
#include <sys/shm.h>
#endif // ZM_MEM_MAPPED
+
+//=============================================================================
+std::string trimSpaces(std::string str)
+{
+ // Trim Both leading and trailing spaces
+ size_t startpos = str.find_first_not_of(" \t"); // Find the first character position after excluding leading blank spaces
+ size_t endpos = str.find_last_not_of(" \t"); // Find the first character position from reverse af
+
+ // if all spaces or empty return an empty string
+ if(( std::string::npos == startpos ) || ( std::string::npos == endpos))
+ {
+ return std::string("");
+ }
+ else
+ return str.substr( startpos, endpos-startpos+1 );
+}
+
+
+std::vector<std::string> split(const std::string &s, char delim) {
+ std::vector<std::string> elems;
+ std::stringstream ss(s);
+ std::string item;
+ while(std::getline(ss, item, delim)) {
+ elems.push_back(trimSpaces(item));
+ }
+ return elems;
+}
+//=============================================================================
+
+
+
Monitor::MonitorLink::MonitorLink( int p_id, const char *p_name ) : id( p_id )
{
strncpy( name, p_name, sizeof(name) );
@@ -261,7 +292,9 @@ Monitor::Monitor(
Rgb p_signal_check_colour,
Purpose p_purpose,
int p_n_zones,
- Zone *p_zones[]
+ Zone *p_zones[],
+ std::string p_sPlugins,
+ bool p_DoNativeMotDet
) : id( p_id ),
function( (Function)p_function ),
enabled( p_enabled ),
@@ -288,7 +321,8 @@ Monitor::Monitor(
purpose( p_purpose ),
camera( p_camera ),
n_zones( p_n_zones ),
- zones( p_zones )
+ zones( p_zones ),
+ m_bDoNativeMotDet(p_DoNativeMotDet)
{
strncpy( name, p_name, sizeof(name) );
@@ -390,6 +424,12 @@ Monitor::Monitor(
trigger_data = (TriggerData *)((char *)shared_data + sizeof(SharedData));
struct timeval *shared_timestamps = (struct timeval *)((char *)trigger_data + sizeof(TriggerData));
unsigned char *shared_images = (unsigned char *)((char *)shared_timestamps + (image_buffer_count*sizeof(struct timeval)));
+
+ //========================================================================================
+ // Get from string with plugins names particular names.
+ m_sPluginNames = split(p_sPlugins, ';');
+
+ //========================================================================================
if ( purpose == CAPTURE )
{
@@ -423,6 +463,32 @@ Monitor::Monitor(
shared_data->last_read_time = 0;
shared_data->alarm_x = -1;
shared_data->alarm_y = -1;
+
+ //========================================================================================
+ Info("In the constructor of Monitor class with ID=%d:", p_id);
+ if (config.load_plugins)
+ {
+ Info("Load plugins from the directory %s ... ", config.path_plugins);
+ std::string sPluginExt = std::string(config.plugin_extension);
+ ThePluginManager.setPluginExt(sPluginExt);
+ for (std::vector<std::string>::iterator it = m_sPluginNames.begin() ; it < m_sPluginNames.end(); it++ )
+ {
+ std::string sFullPluginPath = join_paths(config.path_plugins, *it + config.plugin_extension);
+ Info("Plugin path %s", sFullPluginPath.c_str());
+ ThePluginManager.loadPlugin(sFullPluginPath);
+ }
+
+// int count_plugins = ThePluginManager.findPlugins(config.path_plugins);
+// Info("Number of found plugins is %d", count_plugins);
+// if (count_plugins > 0)
+// {
+ std::string sPluginsConfig = std::string(config.plugins_config_path);
+ Info("Configure plugins with \'%s\' config file.", config.plugins_config_path);
+ ThePluginManager.configurePlugins(sPluginsConfig);
+// }
+
+ }
+ //========================================================================================
}
if ( !shared_data->valid )
@@ -1188,23 +1254,52 @@ bool Monitor::Analyse()
}
else if ( Active() && function != RECORD && function != NODECT )
{
- Event::StringSet zoneSet;
- int motion_score = DetectMotion( *snap_image, zoneSet );
- if ( motion_score )
- {
- if ( !event )
- {
- score += motion_score;
- if ( cause.length() )
- cause += ", ";
- cause += MOTION_CAUSE;
+ if ((config.turnoff_native_analysis && !config.load_plugins) || (!config.turnoff_native_analysis && (m_bDoNativeMotDet || (!m_bDoNativeMotDet && !config.load_plugins))) )
+ {
+ Event::StringSet zoneSet;
+ int motion_score = DetectMotion( *snap_image, zoneSet );
+ //int motion_score = DetectBlack( *snap_image, zoneSet );
+ if ( motion_score )
+ {
+ if ( !event )
+ {
+ score += motion_score;
+ if ( cause.length() )
+ cause += ", ";
+ cause += MOTION_CAUSE;
+ }
+ else
+ {
+ score += motion_score;
+ }
+ noteSetMap[MOTION_CAUSE] = zoneSet;
}
- else
+ }
+ //====================================================================
+ else
+ {
+
+ for ( int n_zone = 0; n_zone < n_zones; n_zone++ )
{
- score += motion_score;
+ zones[n_zone]->ResetStats();
}
- noteSetMap[MOTION_CAUSE] = zoneSet;
}
+
+ if (config.load_plugins)
+ {
+ std::string det_cause; // detection cause to fill in plugin's detectors
+ score += ThePluginManager.getImageAnalyser().DoDetection(*snap_image, zones, n_zones, noteSetMap, det_cause);
+ if (!event)
+ {
+ if (det_cause.length())
+ {
+ if (cause.length())
+ cause += ", ";
+ cause += det_cause;
+ }
+ }
+ }
+ //====================================================================
shared_data->active = signal;
}
if ( n_linked_monitors > 0 )
@@ -1505,7 +1600,7 @@ void Monitor::Reload()
closeEvent();
static char sql[BUFSIZ];
- 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 );
+ 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 );
if ( mysql_query( &dbconn, sql ) )
{
Error( "Can't run query: %s", mysql_error( &dbconn ) );
@@ -1545,6 +1640,14 @@ void Monitor::Reload()
fps_report_interval = atoi(dbrow[index++]);
ref_blend_perc = atoi(dbrow[index++]);
track_motion = atoi(dbrow[index++]);
+
+ //============================================================================
+ std::string plugins = dbrow[index]; index++;
+ m_sPluginNames = split(plugins ,';');
+ std::string sDoNativeMotDet = dbrow[index]; index++;
+ m_bDoNativeMotDet = !sDoNativeMotDet.compare("yes") ? true : false;
+ //============================================================================
+
if ( dbrow[index][0] == '#' )
signal_check_colour = strtol(dbrow[index]+1,0,16);
else
@@ -1690,11 +1793,11 @@ int Monitor::LoadLocalMonitors( const ch
static char sql[BUFSIZ];
if ( !device[0] )
{
- 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) );
+ 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) );
}
else
{
- 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 );
+ 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 );
}
if ( mysql_query( &dbconn, sql ) )
{
@@ -1755,6 +1858,13 @@ int Monitor::LoadLocalMonitors( const ch
int fps_report_interval = atoi(dbrow[col]); col++;
int ref_blend_perc = atoi(dbrow[col]); col++;
int track_motion = atoi(dbrow[col]); col++;
+
+ //============================================================================
+ std::string plugins = dbrow[col]; col++;
+ std::string sDoNativeMotDet = dbrow[col]; col++;
+ bool doNativeMotDet = !sDoNativeMotDet.compare("yes") ? true : false;
+ //============================================================================
+
int signal_check_colour;
if ( dbrow[col][0] == '#' )
signal_check_colour = strtol(dbrow[col]+1,0,16);
@@ -1806,7 +1916,11 @@ int Monitor::LoadLocalMonitors( const ch
ref_blend_perc,
track_motion,
signal_check_colour,
- purpose
+ purpose,
+ 0,
+ 0,
+ plugins,
+ doNativeMotDet
);
Zone **zones = 0;
int n_zones = Zone::Load( monitors[i], zones );
@@ -1829,11 +1943,11 @@ int Monitor::LoadRemoteMonitors( const c
static char sql[BUFSIZ];
if ( !protocol )
{
- 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) );
+ 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) );
}
else
{
- 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 );
+ 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 );
}
if ( mysql_query( &dbconn, sql ) )
{
@@ -1895,6 +2009,13 @@ int Monitor::LoadRemoteMonitors( const c
int fps_report_interval = atoi(dbrow[col]); col++;
int ref_blend_perc = atoi(dbrow[col]); col++;
int track_motion = atoi(dbrow[col]); col++;
+
+ //============================================================================
+ std::string plugins = dbrow[col]; col++;
+ std::string sDoNativeMotDet = dbrow[col]; col++;
+ bool doNativeMotDet = !sDoNativeMotDet.compare("yes") ? true : false;
+ //============================================================================
+
int cam_width = ((orientation==ROTATE_90||orientation==ROTATE_270)?height:width);
int cam_height = ((orientation==ROTATE_90||orientation==ROTATE_270)?width:height);
@@ -1968,7 +2089,11 @@ int Monitor::LoadRemoteMonitors( const c
ref_blend_perc,
track_motion,
RGB_WHITE,
- purpose
+ purpose,
+ 0,
+ 0,
+ plugins,
+ doNativeMotDet
);
Zone **zones = 0;
int n_zones = Zone::Load( monitors[i], zones );
@@ -1991,11 +2116,11 @@ int Monitor::LoadFileMonitors( const cha
static char sql[BUFSIZ];
if ( !file[0] )