diff --git a/distros/redhat/zoneminder.el7.spec b/distros/redhat/zoneminder.el7.spec index 33a9c3f30..63d7fe920 100644 --- a/distros/redhat/zoneminder.el7.spec +++ b/distros/redhat/zoneminder.el7.spec @@ -107,6 +107,8 @@ if [ $1 -eq 0 ] ; then # Package removal, not upgrade /bin/systemctl --no-reload disable zoneminder.service > /dev/null 2>&1 || : /bin/systemctl stop zoneminder.service > /dev/null 2>&1 || : + echo -e "\nRemoving ZoneMinder SELinux policy module. Please wait.\n" + /usr/sbin/semodule -r local_zoneminder.pp fi %postun @@ -128,7 +130,8 @@ fi %files %defattr(-,root,root,-) -%doc AUTHORS COPYING README.md distros/redhat/README.Centos7 distros/redhat/jscalendar-doc +%doc AUTHORS BUGS ChangeLog COPYING LICENSE NEWS README.md distros/redhat/README.Centos7 distros/redhat/jscalendar-doc +%doc distros/redhat/cambozola-doc distros/redhat/local_zoneminder.te %config %attr(640,root,%{zmgid_final}) /etc/zm/zm.conf %config(noreplace) %attr(644,root,root) /etc/httpd/conf.d/zoneminder.conf %config(noreplace) /etc/tmpfiles.d/zoneminder.conf @@ -156,7 +159,8 @@ fi %{_bindir}/zmx10.pl %{perl_vendorlib}/ZoneMinder* -%{perl_vendorlib}/%{_arch}-linux-thread-multi/auto/ZoneMinder* +%{perl_vendorarch}/auto/ZoneMinder/.packlist +#%{perl_vendorlib}/%{_arch}-linux-thread-multi/auto/ZoneMinder* #%{perl_archlib}/ZoneMinder* %{_mandir}/man*/* %dir %{_libexecdir}/zoneminder diff --git a/scripts/ZoneMinder/lib/ZoneMinder.pm b/scripts/ZoneMinder/lib/ZoneMinder.pm index 41c972650..87a6b14b7 100644 --- a/scripts/ZoneMinder/lib/ZoneMinder.pm +++ b/scripts/ZoneMinder/lib/ZoneMinder.pm @@ -36,34 +36,42 @@ use ZoneMinder::General qw(:all); use ZoneMinder::Database qw(:all); use ZoneMinder::Memory qw(:all); -our @ISA = qw(Exporter ZoneMinder::Base ZoneMinder::Config ZoneMinder::Logger ZoneMinder::General ZoneMinder::Database ZoneMinder::Memory); +our @ISA = qw( + Exporter + ZoneMinder::Base + ZoneMinder::Config + ZoneMinder::Logger + ZoneMinder::General + ZoneMinder::Database + ZoneMinder::Memory +); # Items to export into callers namespace by default. Note: do not export # names by default without a very good reason. Use EXPORT_OK instead. # Do not simply export all your public functions/methods/constants. -# This allows declaration use ZoneMinder ':all'; +# This allows declaration use ZoneMinder ':all'; # If you do not need this, moving things directly into @EXPORT or @EXPORT_OK # will save memory. our %EXPORT_TAGS = ( - 'base' => [ - @ZoneMinder::Base::EXPORT_OK - ], - 'config' => [ - @ZoneMinder::Config::EXPORT_OK - ], - 'debug' => [ - @ZoneMinder::Logger::EXPORT_OK - ], - 'general' => [ - @ZoneMinder::General::EXPORT_OK - ], - 'database' => [ - @ZoneMinder::Database::EXPORT_OK - ], - 'memory' => [ - @ZoneMinder::Memory::EXPORT_OK - ], + 'base' => [ + @ZoneMinder::Base::EXPORT_OK + ], + 'config' => [ + @ZoneMinder::Config::EXPORT_OK + ], + 'debug' => [ + @ZoneMinder::Logger::EXPORT_OK + ], + 'general' => [ + @ZoneMinder::General::EXPORT_OK + ], + 'database' => [ + @ZoneMinder::Database::EXPORT_OK + ], + 'memory' => [ + @ZoneMinder::Memory::EXPORT_OK + ], ); push( @{$EXPORT_TAGS{all}}, @{$EXPORT_TAGS{$_}} ) foreach keys %EXPORT_TAGS; diff --git a/scripts/ZoneMinder/lib/ZoneMinder/Base.pm.in b/scripts/ZoneMinder/lib/ZoneMinder/Base.pm.in index 3f10e9137..70140ea66 100644 --- a/scripts/ZoneMinder/lib/ZoneMinder/Base.pm.in +++ b/scripts/ZoneMinder/lib/ZoneMinder/Base.pm.in @@ -19,7 +19,7 @@ # # ========================================================================== # -# This module contains the common definitions and functions used by the rest +# This module contains the common definitions and functions used by the rest # of the ZoneMinder scripts # package ZoneMinder::Base; @@ -38,7 +38,7 @@ use constant ZM_VERSION => "@VERSION@"; # names by default without a very good reason. Use EXPORT_OK instead. # Do not simply export all your public functions/methods/constants. -# This allows declaration use ZoneMinder ':all'; +# This allows declaration use ZoneMinder ':all'; # If you do not need this, moving things directly into @EXPORT or @EXPORT_OK # will save memory. our %EXPORT_TAGS = ( 'all' => [ qw(ZM_VERSION) ] ); @@ -62,7 +62,11 @@ ZoneMinder::Base - Base perl module for ZoneMinder =head1 DESCRIPTION -This module is the base module for the rest of the ZoneMinder modules. It is included by each of the other modules but serves no purpose other than to propagate the perl module version amongst the other modules. You will never need to use this module directly but if you write new ZoneMinder modules they should include it. +This module is the base module for the rest of the ZoneMinder modules. It +is included by each of the other modules but serves no purpose other than +to propagate the perl module version amongst the other modules. You will +never need to use this module directly but if you write new ZoneMinder +modules they should include it. =head2 EXPORT diff --git a/scripts/ZoneMinder/lib/ZoneMinder/Config.pm.in b/scripts/ZoneMinder/lib/ZoneMinder/Config.pm.in index 5a6c0b774..e38d151c0 100644 --- a/scripts/ZoneMinder/lib/ZoneMinder/Config.pm.in +++ b/scripts/ZoneMinder/lib/ZoneMinder/Config.pm.in @@ -19,7 +19,7 @@ # # ========================================================================== # -# This module contains the common definitions and functions used by the rest +# This module contains the common definitions and functions used by the rest # of the ZoneMinder scripts # package ZoneMinder::Config; @@ -38,15 +38,15 @@ use vars qw( %Config ); # names by default without a very good reason. Use EXPORT_OK instead. # Do not simply export all your public functions/methods/constants. -# This allows declaration use ZoneMinder ':all'; +# This allows declaration use ZoneMinder ':all'; # If you do not need this, moving things directly into @EXPORT or @EXPORT_OK # will save memory. our @EXPORT_CONFIG = qw( %Config ); # Get populated by BEGIN our %EXPORT_TAGS = ( - 'constants' => [ qw( - ZM_PID - ) ] + 'constants' => [ qw( + ZM_PID + ) ] ); push( @{$EXPORT_TAGS{config}}, @EXPORT_CONFIG ); push( @{$EXPORT_TAGS{all}}, @{$EXPORT_TAGS{$_}} ) foreach keys %EXPORT_TAGS; @@ -65,39 +65,43 @@ use Carp; # Load the config from the database into the symbol table BEGIN { - my $config_file = ZM_CONFIG; - ( my $local_config_file = $config_file ) =~ s|^.*/|./|; - if ( -s $local_config_file and -r $local_config_file ) - { - print( STDERR "Warning, overriding installed $local_config_file file with local copy\n" ); - $config_file = $local_config_file; - } - open( my $CONFIG, "<", $config_file ) + my $config_file = ZM_CONFIG; + ( my $local_config_file = $config_file ) =~ s|^.*/|./|; + if ( -s $local_config_file and -r $local_config_file ) + { + print( STDERR "Warning, overriding installed $local_config_file file with local copy\n" ); + $config_file = $local_config_file; + } + open( my $CONFIG, "<", $config_file ) or croak( "Can't open config file '$config_file': $!" ); - foreach my $str ( <$CONFIG> ) - { - next if ( $str =~ /^\s*$/ ); - next if ( $str =~ /^\s*#/ ); + foreach my $str ( <$CONFIG> ) + { + next if ( $str =~ /^\s*$/ ); + next if ( $str =~ /^\s*#/ ); my ( $name, $value ) = $str =~ /^\s*([^=\s]+)\s*=\s*(.*?)\s*$/; - if ( ! $name ) { - print( STDERR "Warning, bad line in $config_file: $str\n" ); - next; - } # end if - $name =~ tr/a-z/A-Z/; - $Config{$name} = $value; - } - close( $CONFIG ); + if ( ! $name ) { + print( STDERR "Warning, bad line in $config_file: $str\n" ); + next; + } # end if + $name =~ tr/a-z/A-Z/; + $Config{$name} = $value; + } + close( $CONFIG ); - use DBI; - my $dbh = DBI->connect( "DBI:mysql:database=".$Config{ZM_DB_NAME}.";host=".$Config{ZM_DB_HOST}, $Config{ZM_DB_USER}, $Config{ZM_DB_PASS} ) or croak( "Can't connect to db" ); - my $sql = 'select * from Config'; - my $sth = $dbh->prepare_cached( $sql ) or croak( "Can't prepare '$sql': ".$dbh->errstr() ); - my $res = $sth->execute() or croak( "Can't execute: ".$sth->errstr() ); - while( my $config = $sth->fetchrow_hashref() ) { - $Config{$config->{Name}} = $config->{Value}; - } - $sth->finish(); - #$dbh->disconnect(); + use DBI; + my $dbh = DBI->connect( "DBI:mysql:database=".$Config{ZM_DB_NAME} + .";host=".$Config{ZM_DB_HOST} + , $Config{ZM_DB_USER} + , $Config{ZM_DB_PASS} + ) or croak( "Can't connect to db" ); + my $sql = 'select * from Config'; + my $sth = $dbh->prepare_cached( $sql ) or croak( "Can't prepare '$sql': ".$dbh->errstr() ); + my $res = $sth->execute() or croak( "Can't execute: ".$sth->errstr() ); + while( my $config = $sth->fetchrow_hashref() ) { + $Config{$config->{Name}} = $config->{Value}; + } + $sth->finish(); + #$dbh->disconnect(); } 1; @@ -113,9 +117,16 @@ ZoneMinder::Config - ZoneMinder configuration module. =head1 DESCRIPTION -The ZoneMinder::Config module is used to import the ZoneMinder configuration from the database. It will do this at compile time in a BEGIN block and require access to the zm.conf file either in the current directory or in its defined location in order to determine database access details, configuration from this file will also be included. If the :all or :config tags are used then this configuration is exported into the namespace of the calling program or module. +The ZoneMinder::Config module is used to import the ZoneMinder +configuration from the database. It will do this at compile time in a BEGIN +block and require access to the zm.conf file either in the current +directory or in its defined location in order to determine database access +details, configuration from this file will also be included. If the :all or +:config tags are used then this configuration is exported into the +namespace of the calling program or module. -Once the configuration has been imported then configuration variables are defined as constants and can be accessed directory by name, e.g. +Once the configuration has been imported then configuration variables are +defined as constants and can be accessed directory by name, e.g. $lang = $Config{ZM_LANG_DEFAULT}; diff --git a/scripts/ZoneMinder/lib/ZoneMinder/ConfigAdmin.pm b/scripts/ZoneMinder/lib/ZoneMinder/ConfigAdmin.pm index d57493fc8..f586448fb 100644 --- a/scripts/ZoneMinder/lib/ZoneMinder/ConfigAdmin.pm +++ b/scripts/ZoneMinder/lib/ZoneMinder/ConfigAdmin.pm @@ -19,7 +19,7 @@ # # ========================================================================== # -# This module contains the debug definitions and functions used by the rest +# This module contains the debug definitions and functions used by the rest # of the ZoneMinder scripts # package ZoneMinder::ConfigAdmin; @@ -37,14 +37,14 @@ our @ISA = qw(Exporter ZoneMinder::Base); # names by default without a very good reason. Use EXPORT_OK instead. # Do not simply export all your public functions/methods/constants. -# This allows declaration use ZoneMinder ':all'; +# This allows declaration use ZoneMinder ':all'; # If you do not need this, moving things directly into @EXPORT or @EXPORT_OK # will save memory. our %EXPORT_TAGS = ( - 'functions' => [ qw( - loadConfigFromDB - saveConfigToDB - ) ] + 'functions' => [ qw( + loadConfigFromDB + saveConfigToDB + ) ] ); push( @{$EXPORT_TAGS{all}}, @{$EXPORT_TAGS{$_}} ) foreach keys %EXPORT_TAGS; @@ -67,99 +67,138 @@ use Carp; sub loadConfigFromDB { - print( "Loading config from DB\n" ); - my $dbh = DBI->connect( "DBI:mysql:database=".$Config{ZM_DB_NAME}.";host=".$Config{ZM_DB_HOST}, $Config{ZM_DB_USER}, $Config{ZM_DB_PASS} ); - - if ( !$dbh ) - { - print( "Error: unable to load options from database: $DBI::errstr\n" ); - return( 0 ); - } - my $sql = "select * from Config"; - my $sth = $dbh->prepare_cached( $sql ) or croak( "Can't prepare '$sql': ".$dbh->errstr() ); - my $res = $sth->execute() or croak( "Can't execute: ".$sth->errstr() ); - my $option_count = 0; - while( my $config = $sth->fetchrow_hashref() ) - { - my ( $name, $value ) = ( $config->{Name}, $config->{Value} ); - #print( "Name = '$name'\n" ); - my $option = $options_hash{$name}; - if ( !$option ) - { - warn( "No option '$name' found, removing" ); - next; - } - #next if ( $option->{category} eq 'hidden' ); - if ( defined($value) ) - { - if ( $option->{type} == $types{boolean} ) - { - $option->{value} = $value?"yes":"no"; - } - else - { - $option->{value} = $value; - } - } - $option_count++;; - } - $sth->finish(); - $dbh->disconnect(); - return( $option_count ); + print( "Loading config from DB\n" ); + my $dbh = DBI->connect( "DBI:mysql:database=".$Config{ZM_DB_NAME} + .";host=".$Config{ZM_DB_HOST} + ,$Config{ZM_DB_USER} + ,$Config{ZM_DB_PASS} + ); + + if ( !$dbh ) + { + print( "Error: unable to load options from database: $DBI::errstr\n" ); + return( 0 ); + } + my $sql = "select * from Config"; + my $sth = $dbh->prepare_cached( $sql ) + or croak( "Can't prepare '$sql': ".$dbh->errstr() ); + my $res = $sth->execute() + or croak( "Can't execute: ".$sth->errstr() ); + my $option_count = 0; + while( my $config = $sth->fetchrow_hashref() ) + { + my ( $name, $value ) = ( $config->{Name}, $config->{Value} ); + #print( "Name = '$name'\n" ); + my $option = $options_hash{$name}; + if ( !$option ) + { + warn( "No option '$name' found, removing" ); + next; + } + #next if ( $option->{category} eq 'hidden' ); + if ( defined($value) ) + { + if ( $option->{type} == $types{boolean} ) + { + $option->{value} = $value?"yes":"no"; + } + else + { + $option->{value} = $value; + } + } + $option_count++;; + } + $sth->finish(); + $dbh->disconnect(); + return( $option_count ); } sub saveConfigToDB { - print( "Saving config to DB\n" ); - my $dbh = DBI->connect( "DBI:mysql:database=".$Config{ZM_DB_NAME}.";host=".$Config{ZM_DB_HOST}, $Config{ZM_DB_USER}, $Config{ZM_DB_PASS} ); + print( "Saving config to DB\n" ); + my $dbh = DBI->connect( "DBI:mysql:database=".$Config{ZM_DB_NAME} + .";host=".$Config{ZM_DB_HOST} + ,$Config{ZM_DB_USER} + ,$Config{ZM_DB_PASS} + ); - if ( !$dbh ) - { - print( "Error: unable to save options to database: $DBI::errstr\n" ); - return( 0 ); - } + if ( !$dbh ) + { + print( "Error: unable to save options to database: $DBI::errstr\n" ); + return( 0 ); + } my $ac = $dbh->{AutoCommit}; $dbh->{AutoCommit} = 0; - $dbh->do('LOCK TABLE Config WRITE') or croak( "Can't lock Config table: " . $dbh->errstr() ); + $dbh->do('LOCK TABLE Config WRITE') + or croak( "Can't lock Config table: " . $dbh->errstr() ); - my $sql = "delete from Config"; - my $res = $dbh->do( $sql ) or croak( "Can't do '$sql': ".$dbh->errstr() ); + my $sql = "delete from Config"; + my $res = $dbh->do( $sql ) + or croak( "Can't do '$sql': ".$dbh->errstr() ); - $sql = "replace into Config set Id = ?, Name = ?, Value = ?, Type = ?, DefaultValue = ?, Hint = ?, Pattern = ?, Format = ?, Prompt = ?, Help = ?, Category = ?, Readonly = ?, Requires = ?"; - my $sth = $dbh->prepare_cached( $sql ) or croak( "Can't prepare '$sql': ".$dbh->errstr() ); - foreach my $option ( @options ) - { - #next if ( $option->{category} eq 'hidden' ); - #print( $option->{name}."\n" ) if ( !$option->{category} ); - $option->{db_type} = $option->{type}->{db_type}; - $option->{db_hint} = $option->{type}->{hint}; - $option->{db_pattern} = $option->{type}->{pattern}; - $option->{db_format} = $option->{type}->{format}; - if ( $option->{db_type} eq "boolean" ) - { - $option->{db_value} = ($option->{value} eq "yes")?"1":"0"; - } - else - { - $option->{db_value} = $option->{value}; - } - if ( my $requires = $option->{requires} ) - { - $option->{db_requires} = join( ";", map { my $value = $_->{value}; $value = ($value eq "yes")?1:0 if ( $options_hash{$_->{name}}->{db_type} eq "boolean" ); ( "$_->{name}=$value" ) } @$requires ); - } - else - { - } - my $res = $sth->execute( $option->{id}, $option->{name}, $option->{db_value}, $option->{db_type}, $option->{default}, $option->{db_hint}, $option->{db_pattern}, $option->{db_format}, $option->{description}, $option->{help}, $option->{category}, $option->{readonly}?1:0, $option->{db_requires} ) or croak( "Can't execute: ".$sth->errstr() ); - } - $sth->finish(); + $sql = "replace into Config set Id = ?, Name = ?, Value = ?, Type = ?, DefaultValue = ?, Hint = ?, Pattern = ?, Format = ?, Prompt = ?, Help = ?, Category = ?, Readonly = ?, Requires = ?"; + my $sth = $dbh->prepare_cached( $sql ) + or croak( "Can't prepare '$sql': ".$dbh->errstr() ); + foreach my $option ( @options ) + { + #next if ( $option->{category} eq 'hidden' ); + #print( $option->{name}."\n" ) if ( !$option->{category} ); + $option->{db_type} = $option->{type}->{db_type}; + $option->{db_hint} = $option->{type}->{hint}; + $option->{db_pattern} = $option->{type}->{pattern}; + $option->{db_format} = $option->{type}->{format}; + if ( $option->{db_type} eq "boolean" ) + { + $option->{db_value} = ($option->{value} eq "yes") + ? "1" + : "0" + ; + } + else + { + $option->{db_value} = $option->{value}; + } + if ( my $requires = $option->{requires} ) + { + $option->{db_requires} = join( ";", + map { + my $value = $_->{value}; + $value = ($value eq "yes") + ? 1 + : 0 + if ( $options_hash{$_->{name}}->{db_type} eq "boolean" ) + ; ( "$_->{name}=$value" ) + } @$requires + ); + } + else + { + } + my $res = $sth->execute( + $option->{id}, + $option->{name}, + $option->{db_value}, + $option->{db_type}, + $option->{default}, + $option->{db_hint}, + $option->{db_pattern}, + $option->{db_format}, + $option->{description}, + $option->{help}, + $option->{category}, + $option->{readonly} ? 1 : 0, + $option->{db_requires} + ) or croak( "Can't execute: ".$sth->errstr() ); + } + $sth->finish(); $dbh->do('UNLOCK TABLES'); $dbh->{AutoCommit} = $ac; - $dbh->disconnect(); + $dbh->disconnect(); } 1; @@ -179,9 +218,15 @@ ZoneMinder::ConfigAdmin - ZoneMinder Configuration Administration module =head1 DESCRIPTION -The ZoneMinder:ConfigAdmin module contains the master definition of the ZoneMinder configuration options as well as helper methods. This module is intended for specialist confguration management and would not normally be used by end users. +The ZoneMinder:ConfigAdmin module contains the master definition of the +ZoneMinder configuration options as well as helper methods. This module is +intended for specialist confguration management and would not normally be +used by end users. -The configuration held in this module, which was previously in zmconfig.pl, includes the name, default value, description, help text, type and category for each option, as well as a number of additional fields in a small number of cases. +The configuration held in this module, which was previously in zmconfig.pl, +includes the name, default value, description, help text, type and category +for each option, as well as a number of additional fields in a small number +of cases. =head1 METHODS @@ -189,11 +234,17 @@ The configuration held in this module, which was previously in zmconfig.pl, incl =item loadConfigFromDB (); -Loads existing configuration from the database (if any) and merges it with the definitions held in this module. This results in the merging of any new configuration and the removal of any deprecated configuration while preserving the existing values of every else. +Loads existing configuration from the database (if any) and merges it with +the definitions held in this module. This results in the merging of any new +configuration and the removal of any deprecated configuration while +preserving the existing values of every else. =item saveConfigToDB (); -Saves configuration held in memory to the database. The act of loading and saving configuration is a convenient way to ensure that the configuration held in the database corresponds with the most recent definitions and that all components are using the same set of configuration. +Saves configuration held in memory to the database. The act of loading and +saving configuration is a convenient way to ensure that the configuration +held in the database corresponds with the most recent definitions and that +all components are using the same set of configuration. =back diff --git a/scripts/ZoneMinder/lib/ZoneMinder/ConfigData.pm.in b/scripts/ZoneMinder/lib/ZoneMinder/ConfigData.pm.in index 14e7ee766..1aeed93f6 100644 --- a/scripts/ZoneMinder/lib/ZoneMinder/ConfigData.pm.in +++ b/scripts/ZoneMinder/lib/ZoneMinder/ConfigData.pm.in @@ -19,7 +19,7 @@ # # ========================================================================== # -# This module contains the debug definitions and functions used by the rest +# This module contains the debug definitions and functions used by the rest # of the ZoneMinder scripts # package ZoneMinder::ConfigData; @@ -37,15 +37,15 @@ our @ISA = qw(Exporter ZoneMinder::Base); # names by default without a very good reason. Use EXPORT_OK instead. # Do not simply export all your public functions/methods/constants. -# This allows declaration use ZoneMinder ':all'; +# This allows declaration use ZoneMinder ':all'; # If you do not need this, moving things directly into @EXPORT or @EXPORT_OK # will save memory. our %EXPORT_TAGS = ( - 'data' => [ qw( - %types - @options - %options_hash - ) ] + 'data' => [ qw( + %types + @options + %options_hash + ) ] ); push( @{$EXPORT_TAGS{all}}, @{$EXPORT_TAGS{$_}} ) foreach keys %EXPORT_TAGS; @@ -73,944 +73,2022 @@ sub INIT # Types our %types = ( - string => { db_type=>"string", hint=>"string", pattern=>qr|^(.+)$|, format=>q( $1 ) }, - alphanum => { db_type=>"string", hint=>"alphanumeric", pattern=>qr|^([a-zA-Z0-9-_]+)$|, format=>q( $1 ) }, - text => { db_type=>"text", hint=>"free text", pattern=>qr|^(.+)$|, format=>q( $1 ) }, - boolean => { db_type=>"boolean", hint=>"yes|no", pattern=>qr|^([yn])|i, check=>q( $1 ), format=>q( ($1 =~ /^y/) ? "yes" : "no" ) }, - integer => { db_type=>"integer", hint=>"integer", pattern=>qr|^(\d+)$|, format=>q( $1 ) }, - decimal => { db_type=>"decimal", hint=>"decimal", pattern=>qr|^(\d+(?:\.\d+)?)$|, format=>q( $1 ) }, - hexadecimal => { db_type=>"hexadecimal", hint=>"hexadecimal", pattern=>qr|^(?:0x)?([0-9a-f]{1,8})$|, format=>q( "0x".$1 ) }, - tristate => { db_type=>"string", hint=>"auto|yes|no", pattern=>qr|^([ayn])|i, check=>q( $1 ), format=>q( ($1 =~ /^y/) ? "yes" : ($1 =~ /^n/ ? "no" : "auto" ) ) }, - abs_path => { db_type=>"string", hint=>"/absolute/path/to/somewhere", pattern=>qr|^((?:/[^/]*)+?)/?$|, format=>q( $1 ) }, - rel_path => { db_type=>"string", hint=>"relative/path/to/somewhere", pattern=>qr|^((?:[^/].*)?)/?$|, format=>q( $1 ) }, - directory => { db_type=>"string", hint=>"directory", pattern=>qr|^([a-zA-Z0-9-_.]+)$|, format=>q( $1 ) }, - file => { db_type=>"string", hint=>"filename", pattern=>qr|^([a-zA-Z0-9-_.]+)$|, format=>q( $1 ) }, - hostname => { db_type=>"string", hint=>"host.your.domain", pattern=>qr|^([a-zA-Z0-9_.-]+)$|, format=>q( $1 ) }, - url => { db_type=>"string", hint=>"http://host.your.domain/", pattern=>qr|^(?:http://)?(.+)$|, format=>q( "http://".$1 ) }, - email => { db_type=>"string", hint=>"your.name\@your.domain", pattern=>qr|^([a-zA-Z0-9_.-]+)\@([a-zA-Z0-9_.-]+)$|, format=>q( $1\@$2 ) }, + string => { + db_type =>"string", + hint =>"string", + pattern =>qr|^(.+)$|, + format =>q( $1 ) + }, + alphanum => { + db_type =>"string", + hint =>"alphanumeric", + pattern =>qr|^([a-zA-Z0-9-_]+)$|, + format =>q( $1 ) + }, + text => { + db_type =>"text", + hint =>"free text", + pattern =>qr|^(.+)$|, + format =>q( $1 ) + }, + boolean => { + db_type =>"boolean", + hint =>"yes|no", + pattern =>qr|^([yn])|i, + check =>q( $1 ), + format =>q( ($1 =~ /^y/) + ? "yes" + : "no" + ) + }, + integer => { + db_type =>"integer", + hint =>"integer", + pattern =>qr|^(\d+)$|, + format =>q( $1 ) + }, + decimal => { + db_type =>"decimal", + hint =>"decimal", + pattern =>qr|^(\d+(?:\.\d+)?)$|, + format =>q( $1 ) + }, + hexadecimal => { + db_type =>"hexadecimal", + hint =>"hexadecimal", + pattern =>qr|^(?:0x)?([0-9a-f]{1,8})$|, + format =>q( "0x".$1 ) + }, + tristate => { + db_type =>"string", + hint =>"auto|yes|no", + pattern =>qr|^([ayn])|i, check=>q( $1 ), + format =>q( ($1 =~ /^y/) + ? "yes" + : ($1 =~ /^n/ ? "no" : "auto" ) + ) + }, + abs_path => { + db_type =>"string", + hint =>"/absolute/path/to/somewhere", + pattern =>qr|^((?:/[^/]*)+?)/?$|, + format =>q( $1 ) + }, + rel_path => { + db_type =>"string", + hint =>"relative/path/to/somewhere", + pattern =>qr|^((?:[^/].*)?)/?$|, + format =>q( $1 ) + }, + directory => { + db_type =>"string", + hint =>"directory", + pattern =>qr|^([a-zA-Z0-9-_.]+)$|, + format =>q( $1 ) + }, + file => { + db_type =>"string", + hint =>"filename", + pattern =>qr|^([a-zA-Z0-9-_.]+)$|, + format =>q( $1 ) + }, + hostname => { + db_type =>"string", + hint =>"host.your.domain", + pattern =>qr|^([a-zA-Z0-9_.-]+)$|, + format =>q( $1 ) + }, + url => { + db_type =>"string", + hint =>"http://host.your.domain/", + pattern =>qr|^(?:http://)?(.+)$|, + format =>q( "http://".$1 ) + }, + email => { + db_type =>"string", + hint =>"your.name\@your.domain", + pattern =>qr|^([a-zA-Z0-9_.-]+)\@([a-zA-Z0-9_.-]+)$|, + format =>q( $1\@$2 ) + }, ); +sub qqq { ## Un-pad paragraph of text. + local $_ = shift; + s{\n?^\s*}{ }mg; + return $_; +} + our @options = ( { - name => "ZM_SKIN_DEFAULT", - default => "classic", + name => "ZM_SKIN_DEFAULT", + default => "classic", description => "Default skin used by web interface", - help => "ZoneMinder allows the use of many different web interfaces. This option allows you to set the default skin used by the website. Users can change their skin later, this merely sets the default.", - type => $types{string}, - category => "system", + + help => qqq(" + ZoneMinder allows the use of many different web interfaces. + This option allows you to set the default skin used by the + website. Users can change their skin later, this merely sets + the default. + "), + type => $types{string}, + category => "system", }, { - name => "ZM_CSS_DEFAULT", - default => "classic", + name => "ZM_CSS_DEFAULT", + default => "classic", description => "Default set of css files used by web interface", - help => "ZoneMinder allows the use of many different web interfaces, and some skins allow the use of different set of CSS files to control the appearance. This option allows you to set the default set of css files used by the website. Users can change their css later, this merely sets the default.", - type => $types{string}, - category => "system", + help => qqq(" + ZoneMinder allows the use of many different web interfaces, and + some skins allow the use of different set of CSS files to + control the appearance. This option allows you to set the + default set of css files used by the website. Users can change + their css later, this merely sets the default. + "), + type => $types{string}, + category => "system", }, - { - name => "ZM_LANG_DEFAULT", - default => "en_gb", - description => "Default language used by web interface", - help => "ZoneMinder allows the web interface to use languages other than English if the appropriate language file has been created and is present. This option allows you to change the default language that is used from the shipped language, British English, to another language", - type => $types{string}, - category => "system", - }, - { - name => "ZM_OPT_USE_AUTH", - default => "no", - description => "Authenticate user logins to ZoneMinder", - help => "ZoneMinder can run in two modes. The simplest is an entirely unauthenticated mode where anyone can access ZoneMinder and perform all tasks. This is most suitable for installations where the web server access is limited in other ways. The other mode enables user accounts with varying sets of permissions. Users must login or authenticate to access ZoneMinder and are limited by their defined permissions.", - type => $types{boolean}, - category => "system", - }, - { - name => "ZM_AUTH_TYPE", - default => "builtin", - description => "What is used to authenticate ZoneMinder users", - help => "ZoneMinder can use two methods to authenticate users when running in authenticated mode. The first is a builtin method where ZoneMinder provides facilities for users to log in and maintains track of their identity. The second method allows interworking with other methods such as http basic authentication which passes an independently authentication 'remote' user via http. In this case ZoneMinder would use the supplied user without additional authentication provided such a user is configured ion ZoneMinder.", - requires => [ { name=>"ZM_OPT_USE_AUTH", value=>"yes" } ], - type => { db_type=>"string", hint=>"builtin|remote", pattern=>qr|^([br])|i, format=>q( $1 =~ /^b/ ? "builtin" : "remote" ) }, - category => "system", - }, - { - name => "ZM_AUTH_RELAY", - default => "hashed", - description => "Method used to relay authentication information", - help => "When ZoneMinder is running in authenticated mode it can pass user details between the web pages and the back end processes. There are two methods for doing this. This first is to use a time limited hashed string which contains no direct username or password details, the second method is to pass the username and passwords around in plaintext. This method is not recommend except where you do not have the md5 libraries available on your system or you have a completely isolated system with no external access. You can also switch off authentication relaying if your system is isolated in other ways.", - requires => [ { name=>"ZM_OPT_USE_AUTH", value=>"yes" } ], - type => { db_type=>"string", hint=>"hashed|plain|none", pattern=>qr|^([hpn])|i, format=>q( ($1 =~ /^h/) ? "hashed" : ($1 =~ /^p/ ? "plain" : "none" ) ) }, - category => "system", - }, - { - name => "ZM_AUTH_HASH_SECRET", - default => "...Change me to something unique...", - description => "Secret for encoding hashed authentication information", - help => "When ZoneMinder is running in hashed authenticated mode it is necessary to generate hashed strings containing encrypted sensitive information such as usernames and password. Although these string are reasonably secure the addition of a random secret increases security substantially.", - requires => [ { name=>"ZM_OPT_USE_AUTH", value=>"yes" }, { name=>"ZM_AUTH_RELAY", value=>"hashed" } ], - type => $types{string}, - category => "system", - }, - { - name => "ZM_AUTH_HASH_IPS", - default => "yes", - description => "Include IP addresses in the authentication hash", - help => "When ZoneMinder is running in hashed authenticated mode it can optionally include the requesting IP address in the resultant hash. This adds an extra level of security as only requests from that address may use that authentication key. However in some circumstances, such as access over mobile networks, the requesting address can change for each request which will cause most requests to fail. This option allows you to control whether IP addresses are included in the authentication hash on your system. If you experience intermitent problems with authentication, switching this option off may help.", - requires => [ { name=>"ZM_OPT_USE_AUTH", value=>"yes" }, { name=>"ZM_AUTH_RELAY", value=>"hashed" } ], - type => $types{boolean}, - category => "system", - }, - { - name => "ZM_AUTH_HASH_LOGINS", - default => "no", - description => "Allow login by authentication hash", - help => "The normal process for logging into ZoneMinder is via the login screen with username and password. In some circumstances it may be desirable to allow access directly to one or more pages, for instance from a third party application. If this option is enabled then adding an 'auth' parameter to any request will include a shortcut login bypassing the login screen, if not already logged in. As authentication hashes are time and, optionally, IP limited this can allow short-term access to ZoneMinder screens from other web pages etc. In order to use this the calling application will hae to generate the authentication hash itself and ensure it is valid. If you use this option you should ensure that you have modified the ZM_AUTH_HASH_SECRET to somethign unique to your system.", - requires => [ { name=>"ZM_OPT_USE_AUTH", value=>"yes" }, { name=>"ZM_AUTH_RELAY", value=>"hashed" } ], - type => $types{boolean}, - category => "system", - }, - { - name => "ZM_DIR_EVENTS", - default => "events", - description => "Directory where events are stored", - help => "This is the path to the events directory where all the event images and other miscellaneous files are stored. CAUTION: The directory you specify here cannot be outside the web root. This is a common mistake. Most users should never change this value. If you intend to record events to a second disk or network share, then you should mount the drive or share directly to the ZoneMinder events folder or follow the instructions in the ZoneMinder Wiki titled Using a dedicated Hard Drive.", - type => $types{directory}, - category => "paths", - }, - { - name => "ZM_USE_DEEP_STORAGE", - default => "yes", - description => "Use a deep filesystem hierarchy for events", - help => "This option is now the default for new ZoneMinder systems and should not be changed. Previous versions of ZoneMinder stored all events for a monitor under one folder. Enabling USE_DEEP_STORAGE causes ZoneMinder to store events under a folder structure that follows year/month/day/hour/min/second. Storing events this way avoids the limitation of storing more than 32k files in a single folder inherent in some filesystems. It is important to note that you cannot simply change this option. You must stop zoneminder, enable USE_DEEP_STORAGE, and then run \"sudo zmupdate.pl --migrate-events\". FAILURE TO DO SO WILL RESULT IN LOSS OF YOUR DATA! Consult the ZoneMinder WiKi for further details.", - type => $types{boolean}, - category => "hidden", - }, - { - name => "ZM_DIR_IMAGES", - default => "images", - description => "Directory where the images that the ZoneMinder client generates are stored", - help => "ZoneMinder generates a myriad of images, mostly of which are associated with events. For those that aren't this is where they go. CAUTION: The directory you specify here cannot be outside the web root. This is a common mistake. Most users should never change this value. If you intend to save images to a second disk or network share, then you should mount the drive or share directly to the ZoneMinder images folder or follow the instructions in the ZoneMinder Wiki titled Using a dedicated Hard Drive.", - type => $types{directory}, - category => "paths", - }, - { - name => "ZM_DIR_SOUNDS", - default => "sounds", - description => "Directory to the sounds that the ZoneMinder client can use", - help => "ZoneMinder can optionally play a sound file when an alarm is detected. This indicates where to look for this file. CAUTION: The directory you specify here cannot be outside the web root. Most users should never change this value.", - type => $types{directory}, - category => "paths", - }, - { - name => "ZM_PATH_ZMS", - default => "/cgi-bin/nph-zms", - description => "Web path to zms streaming server", - help => "The ZoneMinder streaming server is required to send streamed images to your browser. It will be installed into the cgi-bin path given at configuration time. This option determines what the web path to the server is rather than the local path on your machine. Ordinarily the streaming server runs in parser-header mode however if you experience problems with streaming you can change this to non-parsed-header (nph) mode by changing 'zms' to 'nph-zms'.", - type => $types{rel_path}, - category => "paths", - }, - { - name => "ZM_COLOUR_JPEG_FILES", - default => "no", - description => "Colourise greyscale JPEG files", - help => "Cameras that capture in greyscale can write their captured images to jpeg files with a corresponding greyscale colour space. This saves a small amount of disk space over colour ones. However some tools such as ffmpeg either fail to work with this colour space or have to convert it beforehand. Setting this option to yes uses up a little more space but makes creation of MPEG files much faster.", - type => $types{boolean}, - category => "images", - }, - { - name => "ZM_ADD_JPEG_COMMENTS", - default => "no", - description => "Add jpeg timestamp annotations as file header comments", - help => "JPEG files may have a number of extra fields added to the file header. The comment field may have any kind of text added. This options allows you to have the same text that is used to annotate the image additionally included as a file header comment. If you archive event images to other locations this may help you locate images for particular events or times if you use software that can read comment headers.", - type => $types{boolean}, - category => "images", - }, - { - name => "ZM_JPEG_FILE_QUALITY", - default => "70", - description => "Set the JPEG quality setting for the saved event files (1-100)", - help => "When ZoneMinder detects an event it will save the images associated with that event to files. These files are in the JPEG format and can be viewed or streamed later. This option specifies what image quality should be used to save these files. A higher number means better quality but less compression so will take up more disk space and take longer to view over a slow connection. By contrast a low number means smaller, quicker to view, files but at the price of lower quality images. This setting applies to all images written except if the capture image has caused an alarm and the alarm file quality option is set at a higher value when that is used instead.", - type => $types{integer}, - category => "images", - }, - { - name => "ZM_JPEG_ALARM_FILE_QUALITY", - default => "0", - description => "Set the JPEG quality setting for the saved event files during an alarm (1-100)", - help => "This value is equivalent to the regular jpeg file quality setting above except that it only applies to images saved while in an alarm state and then only if this value is set to a higher quality setting than the ordinary file setting. If set to a lower value then it is ignored. Thus leaving it at the default of 0 effectively means to use the regular file quality setting for all saved images. This is to prevent acccidentally saving important images at a worse quality setting.", - type => $types{integer}, - category => "images", - }, - # Deprecated, now stream quality - { - name => "ZM_JPEG_IMAGE_QUALITY", - default => "70", - description => "Set the JPEG quality setting for the streamed 'live' images (1-100)", - help => "When viewing a 'live' stream for a monitor ZoneMinder will grab an image from the buffer and encode it into JPEG format before sending it. This option specifies what image quality should be used to encode these images. A higher number means better quality but less compression so will take longer to view over a slow connection. By contrast a low number means quicker to view images but at the price of lower quality images. This option does not apply when viewing events or still images as these are usually just read from disk and so will be encoded at the quality specified by the previous options.", - type => $types{integer}, - category => "hidden", - }, - { - name => "ZM_JPEG_STREAM_QUALITY", - default => "70", - description => "Set the JPEG quality setting for the streamed 'live' images (1-100)", - help => "When viewing a 'live' stream for a monitor ZoneMinder will grab an image from the buffer and encode it into JPEG format before sending it. This option specifies what image quality should be used to encode these images. A higher number means better quality but less compression so will take longer to view over a slow connection. By contrast a low number means quicker to view images but at the price of lower quality images. This option does not apply when viewing events or still images as these are usually just read from disk and so will be encoded at the quality specified by the previous options.", - type => $types{integer}, - category => "images", - }, - { - name => "ZM_MPEG_TIMED_FRAMES", - default => "yes", - description => "Tag video frames with a timestamp for more realistic streaming", - help => "When using streamed MPEG based video, either for live monitor streams or events, ZoneMinder can send the streams in two ways. If this option is selected then the timestamp for each frame, taken from it's capture time, is included in the stream. This means that where the frame rate varies, for instance around an alarm, the stream will still maintain it's 'real' timing. If this option is not selected then an approximate frame rate is calculated and that is used to schedule frames instead. This option should be selected unless you encounter problems with your preferred streaming method.", - type => $types{boolean}, - category => "images", - }, - { - name => "ZM_MPEG_LIVE_FORMAT", - default => "swf", - description => "What format 'live' video streams are played in", - help => "When using MPEG mode ZoneMinder can output live video. However what formats are handled by the browser varies greatly between machines. This option allows you to specify a video format using a file extension format, so you would just enter the extension of the file type you would like and the rest is determined from that. The default of 'asf' works well under Windows with Windows Media Player but I'm currently not sure what, if anything, works on a Linux platform. If you find out please let me know! If this option is left blank then live streams will revert to being in motion jpeg format", - type => $types{string}, - category => "images", - }, - { - name => "ZM_MPEG_REPLAY_FORMAT", - default => "swf", - description => "What format 'replay' video streams are played in", - help => "When using MPEG mode ZoneMinder can replay events in encoded video format. However what formats are handled by the browser varies greatly between machines. This option allows you to specify a video format using a file extension format, so you would just enter the extension of the file type you would like and the rest is determined from that. The default of 'asf' works well under Windows with Windows Media Player and 'mpg', or 'avi' etc should work under Linux. If you know any more then please let me know! If this option is left blank then live streams will revert to being in motion jpeg format", - type => $types{string}, - category => "images", - }, - { - name => "ZM_RAND_STREAM", - default => "yes", - description => "Add a random string to prevent caching of streams", - help => "Some browsers can cache the streams used by ZoneMinder. In order to prevent his a harmless random string can be appended to the url to make each invocation of the stream appear unique.", - type => $types{boolean}, - category => "images", - }, - { - name => "ZM_OPT_CAMBOZOLA", - default => "no", - description => "Is the (optional) cambozola java streaming client installed", - help => "Cambozola is a handy low fat cheese flavoured Java applet that ZoneMinder uses to view image streams on browsers such as Internet Explorer that don't natively support this format. If you use this browser it is highly recommended to install this from http://www.charliemouse.com/code/cambozola/ however if it is not installed still images at a lower refresh rate can still be viewed.", - type => $types{boolean}, - category => "images", - }, - { - name => "ZM_PATH_CAMBOZOLA", - default => "cambozola.jar", - description => "Web path to (optional) cambozola java streaming client", - help => "Cambozola is a handy low fat cheese flavoured Java applet that ZoneMinder uses to view image streams on browsers such as Internet Explorer that don't natively support this format. If you use this browser it is highly recommended to install this from http://www.charliemouse.com/code/cambozola/ however if it is not installed still images at a lower refresh rate can still be viewed. Leave this as 'cambozola.jar' if cambozola is installed in the same directory as the ZoneMinder web client files.", - requires => [ { name=>"ZM_OPT_CAMBOZOLA", value=>"yes" } ], - type => $types{rel_path}, - category => "images", - }, - { - name => "ZM_RELOAD_CAMBOZOLA", - default => "0", - description => "After how many seconds should Cambozola be reloaded in live view", - help => "Cambozola allows for the viewing of streaming MJPEG however it caches the entire stream into cache space on the computer, setting this to a number > 0 will cause it to automatically reload after that many seconds to avoid filling up a hard drive.", - type => $types{integer}, - category => "images", - }, - { - name => "ZM_TIMESTAMP_ON_CAPTURE", - default => "yes", - description => "Timestamp images as soon as they are captured", - help => "ZoneMinder can add a timestamp to images in two ways. The default method, when this option is set, is that each image is timestamped immediately when captured and so the image held in memory is marked right away. The second method does not timestamp the images until they are either saved as part of an event or accessed over the web. The timestamp used in both methods will contain the same time as this is preserved along with the image. The first method ensures that an image is timestamped regardless of any other circumstances but will result in all images being timestamped even those never saved or viewed. The second method necessitates that saved images are copied before being saved otherwise two timestamps perhaps at different scales may be applied. This has the (perhaps) desirable side effect that the timestamp is always applied at the same resolution so an image that has scaling applied will still have a legible and correctly scaled timestamp.", - type => $types{boolean}, - category => "config", - }, - { - name => "ZM_CPU_EXTENSIONS", - default => "yes", - description => "Use advanced CPU extensions to increase performance", - help => "When advanced processor extensions such as SSE2 or SSSE3 are available, ZoneMinder can use them, which should increase performance and reduce system load. Enabling this option on processors that do not support the advanced processors extensions used by ZoneMinder is harmless and will have no effect.", - type => $types{boolean}, - category => "config", - }, - { - name => "ZM_FAST_IMAGE_BLENDS", - default => "yes", - description => "Use a fast algorithm to blend the reference image", - help => "To detect alarms ZoneMinder needs to blend the captured image with the stored reference image to update it for comparison with the next image. The reference blend percentage specified for the monitor controls how much the new image affects the reference image. There are two methods that are available for this. If this option is set then fast calculation which does not use any multiplication or division is used. This calculation is extremely fast, however it limits the possible blend percentages to 50%, 25%, 12.5%, 6.25%, 3.25% and 1.5%. Any other blend percentage will be rounded to the nearest possible one. The alternative is to switch this option off and use standard blending instead, which is slower.", - type => $types{boolean}, - category => "config", - }, - { - name => "ZM_OPT_ADAPTIVE_SKIP", - default => "yes", - description => "Should frame analysis try and be efficient in skipping frames", - help => "In previous versions of ZoneMinder the analysis daemon would attempt to keep up with the capture daemon by processing the last captured frame on each pass. This would sometimes have the undesirable side-effect of missing a chunk of the initial activity that caused the alarm because the pre-alarm frames would all have to be written to disk and the database before processing the next frame, leading to some delay between the first and second event frames. Setting this option enables a newer adaptive algorithm where the analysis daemon attempts to process as many captured frames as possible, only skipping frames when in danger of the capture daemon overwriting yet to be processed frames. This skip is variable depending on the size of the ring buffer and the amount of space left in it. Enabling this option will give you much better coverage of the beginning of alarms whilst biasing out any skipped frames towards the middle or end of the event. However you should be aware that this will have the effect of making the analysis daemon run somewhat behind the capture daemon during events and for particularly fast rates of capture it is possible for the adaptive algorithm to be overwhelmed and not have time to react to a rapid build up of pending frames and thus for a buffer overrun condition to occur.", - type => $types{boolean}, - category => "config", - }, - { - name => "ZM_MAX_SUSPEND_TIME", - default => "30", - description => "Maximum time that a monitor may have motion detection suspended", - help => "ZoneMinder allows monitors to have motion detection to be suspended, for instance while panning a camera. Ordinarily this relies on the operator resuming motion detection afterwards as failure to do so can leave a monitor in a permanently suspended state. This setting allows you to set a maximum time which a camera may be suspended for before it automatically resumes motion detection. This time can be extended by subsequent suspend indications after the first so continuous camera movement will also occur while the monitor is suspended.", - type => $types{integer}, - category => "config", - }, - # Deprecated, really no longer necessary - { - name => "ZM_OPT_REMOTE_CAMERAS", - default => "no", - description => "Are you going to use remote/networked cameras", - help => "ZoneMinder can work with both local cameras, ie. those attached physically to your computer and remote or network cameras. If you will be using networked cameras select this option.", - type => $types{boolean}, - category => "hidden", - }, - # Deprecated, now set on a per monitor basis using the Method field - { - name => "ZM_NETCAM_REGEXPS", - default => "yes", - description => "Use regular expression matching with network cameras", - help => "Traditionally ZoneMinder has used complex regular regular expressions to handle the multitude of formats that network cameras produce. In versions from 1.21.1 the default is to use a simpler and faster built in pattern matching methodology. This works well with most networks cameras but if you have problems you can try the older, but more flexible, regular expression based method by selecting this option. Note, to use this method you must have libpcre installed on your system.", - requires => [ { name => "ZM_OPT_REMOTE_CAMERAS", value => "yes" } ], - type => $types{boolean}, - category => "hidden", - }, - { - name => "ZM_HTTP_VERSION", - default => "1.0", - description => "The version of HTTP that ZoneMinder will use to connect", - help => "ZoneMinder can communicate with network cameras using either of the HTTP/1.1 or HTTP/1.0 standard. A server will normally fall back to the version it supports with no problem so this should usually by left at the default. However it can be changed to HTTP/1.0 if necessary to resolve particular issues.", - type => { db_type=>"string", hint=>"1.1|1.0", pattern=>qr|^(1\.[01])$|, format=>q( $1?$1:"" ) }, - category => "network", - }, - { - name => "ZM_HTTP_UA", - default => "ZoneMinder", - description => "The user agent that ZoneMinder uses to identify itself", - help => "When ZoneMinder communicates with remote cameras it will identify itself using this string and it's version number. This is normally sufficient, however if a particular cameras expects only to communicate with certain browsers then this can be changed to a different string identifying ZoneMinder as Internet Explorer or Netscape etc.", - type => $types{string}, - category => "network", - }, - { - name => "ZM_HTTP_TIMEOUT", - default => "2500", - description => "How long ZoneMinder waits before giving up on images (milliseconds)", - help => "When retrieving remote images ZoneMinder will wait for this length of time before deciding that an image is not going to arrive and taking steps to retry. This timeout is in milliseconds (1000 per second) and will apply to each part of an image if it is not sent in one whole chunk.", - type => $types{integer}, - category => "network", - }, { - name => "ZM_MIN_RTP_PORT", - default => "40200", - description => "Minimum port that ZoneMinder will listen for RTP traffic on", - help => "When ZoneMinder communicates with MPEG4 capable cameras using RTP with the unicast method it must open ports for the camera to connect back to for control and streaming purposes. This setting specifies the minimum port number that ZoneMinder will use. Ordinarily two adjacent ports are used for each camera, one for control packets and one for data packets. This port should be set to an even number, you may also need to open up a hole in your firewall to allow cameras to connect back if you wish to use unicasting.", - type => $types{integer}, - category => "network", - }, - { - name => "ZM_MAX_RTP_PORT", - default => "40499", - description => "Maximum port that ZoneMinder will listen for RTP traffic on", - help => "When ZoneMinder communicates with MPEG4 capable cameras using RTP with the unicast method it must open ports for the camera to connect back to for control and streaming purposes. This setting specifies the maximum port number that ZoneMinder will use. Ordinarily two adjacent ports are used for each camera, one for control packets and one for data packets. This port should be set to an even number, you may also need to open up a hole in your firewall to allow cameras to connect back if you wish to use unicasting. You should also ensure that you have opened up at least two ports for each monitor that will be connecting to unicasting network cameras.", - type => $types{integer}, - category => "network", - }, - { - name => "ZM_OPT_FFMPEG", - default => "@OPT_FFMPEG@", - description => "Is the ffmpeg video encoder/decoder installed", - help => "ZoneMinder can optionally encode a series of video images into an MPEG encoded movie file for viewing, downloading or storage. This option allows you to specify whether you have the ffmpeg tools installed. Note that creating MPEG files can be fairly CPU and disk intensive and is not a required option as events can still be reviewed as video streams without it.", - type => $types{boolean}, - category => "images", - }, - { - name => "ZM_PATH_FFMPEG", - default => "@PATH_FFMPEG@", - description => "Path to (optional) ffmpeg mpeg encoder", - help => "This path should point to where ffmpeg has been installed.", - requires => [ { name=>"ZM_OPT_FFMPEG", value=>"yes" } ], - type => $types{abs_path}, - category => "images", - }, - { - name => "ZM_FFMPEG_INPUT_OPTIONS", - default => "", - description => "Additional input options to ffmpeg", - help => "Ffmpeg can take many options on the command line to control the quality of video produced. This option allows you to specify your own set that apply to the input to ffmpeg (options that are given before the -i option). Check the ffmpeg documentation for a full list of options which may be used here.", - requires => [ { name=>"ZM_OPT_FFMPEG", value=>"yes" } ], - type => $types{string}, - category => "images", - }, - { - name => "ZM_FFMPEG_OUTPUT_OPTIONS", - default => "-r 25", - description => "Additional output options to ffmpeg", - help => "Ffmpeg can take many options on the command line to control the quality of video produced. This option allows you to specify your own set that apply to the output from ffmpeg (options that are given after the -i option). Check the ffmpeg documentation for a full list of options which may be used here. The most common one will often be to force an output frame rate supported by the video encoder.", - requires => [ { name=>"ZM_OPT_FFMPEG", value=>"yes" } ], - type => $types{string}, - category => "images", - }, - { - name => "ZM_FFMPEG_FORMATS", - default => "mpg mpeg wmv asf avi* mov swf 3gp**", - description => "Formats to allow for ffmpeg video generation", - help => "Ffmpeg can generate video in many different formats. This option allows you to list the ones you want to be able to select. As new formats are supported by ffmpeg you can add them here and be able to use them immediately. Adding a '*' after a format indicates that this will be the default format used for web video, adding '**' defines the default format for phone video.", - requires => [ { name=>"ZM_OPT_FFMPEG", value=>"yes" } ], - type => $types{string}, - category => "images", - }, - { - name => "ZM_FFMPEG_OPEN_TIMEOUT", - default => "10", - description => "Timeout in seconds when opening a stream.", - help => "When Ffmpeg is opening a stream, it can take a long time before failing; certain circumstances even seem to be able to lock indefinitely. This option allows you to set a maximum time in seconds to pass before closing the stream and trying to reopen it again.", - requires => [ { name=>"ZM_OPT_FFMPEG", value=>"yes" } ], - type => $types{integer}, - category => "images", - }, - { - name => "ZM_LOG_LEVEL_SYSLOG", - default => "0", - description => "Save logging output to the system log", - help => "ZoneMinder logging is now more more integrated between components and allows you to specify the destination for logging output and the individual levels for each. This option lets you control the level of logging output that goes to the system log. ZoneMinder binaries have always logged to the system log but now scripts and web logging is also included. To preserve the previous behaviour you should ensure this value is set to Info or Warning. This option controls the maximum level of logging that will be written, so Info includes Warnings and Errors etc. To disable entirely, set this option to None. You should use caution when setting this option to Debug as it can affect severely affect system performance. If you want debug you will also need to set a level and component below", - type => { db_type=>"integer", hint=>"None=-5|Panic=-4|Fatal=-3|Error=-2|Warning=-1|Info=0|Debug=1", pattern=>qr|^(\d+)$|, format=>q( $1 ) }, - category => "logging", - }, - { - name => "ZM_LOG_LEVEL_FILE", - default => "-5", - description => "Save logging output to component files", - help => "ZoneMinder logging is now more more integrated between components and allows you to specify the destination for logging output and the individual levels for each. This option lets you control the level of logging output that goes to individual log files written by specific components. This is how logging worked previously and although useful for tracking down issues in specific components it also resulted in many disparate log files. To preserve this behaviour you should ensure this value is set to Info or Warning. This option controls the maximum level of logging that will be written, so Info includes Warnings and Errors etc. To disable entirely, set this option to None. You should use caution when setting this option to Debug as it can affect severely affect system performance though file output has less impact than the other options. If you want debug you will also need to set a level and component below", - type => { db_type=>"integer", hint=>"None=-5|Panic=-4|Fatal=-3|Error=-2|Warning=-1|Info=0|Debug=1", pattern=>qr|^(\d+)$|, format=>q( $1 ) }, - category => "logging", - }, - { - name => "ZM_LOG_LEVEL_WEBLOG", - default => "-5", - description => "Save logging output to the weblog", - help => "ZoneMinder logging is now more more integrated between components and allows you to specify the destination for logging output and the individual levels for each. This option lets you control the level of logging output from the web interface that goes to the httpd error log. Note that only web logging from PHP and JavaScript files is included and so this option is really only useful for investigating specific issues with those components. This option controls the maximum level of logging that will be written, so Info includes Warnings and Errors etc. To disable entirely, set this option to None. You should use caution when setting this option to Debug as it can affect severely affect system performance. If you want debug you will also need to set a level and component below", - type => { db_type=>"integer", hint=>"None=-5|Panic=-4|Fatal=-3|Error=-2|Warning=-1|Info=0|Debug=1", pattern=>qr|^(\d+)$|, format=>q( $1 ) }, - category => "logging", - }, - { - name => "ZM_LOG_LEVEL_DATABASE", - default => "0", - description => "Save logging output to the database", - help => "ZoneMinder logging is now more more integrated between components and allows you to specify the destination for logging output and the individual levels for each. This option lets you control the level of logging output that is written to the database. This is a new option which can make viewing logging output easier and more intuitive and also makes it easier to get an overall impression of how the system is performing. If you have a large or very busy system then it is possible that use of this option may slow your system down if the table becomes very large. Ensure you use the LOG_DATABASE_LIMIT option to keep the table to a manageable size. This option controls the maximum level of logging that will be written, so Info includes Warnings and Errors etc. To disable entirely, set this option to None. You should use caution when setting this option to Debug as it can affect severely affect system performance. If you want debug you will also need to set a level and component below", - type => { db_type=>"integer", hint=>"None=-5|Panic=-4|Fatal=-3|Error=-2|Warning=-1|Info=0|Debug=1", pattern=>qr|^(\d+)$|, format=>q( $1 ) }, - category => "logging", - }, - { - name => "ZM_LOG_DATABASE_LIMIT", - default => "7 day", - description => "Maximum number of log entries to retain", - help => "If you are using database logging then it is possible to quickly build up a large number of entries in the Logs table. This option allows you to specify how many of these entries are kept. If you set this option to a number greater than zero then that number is used to determine the maximum number of rows, less than or equal to zero indicates no limit and is not recommended. You can also set this value to time values such as ' day' which will limit the log entries to those newer than that time. You can specify 'hour', 'day', 'week', 'month' and 'year', note that the values should be singular (no 's' at the end). The Logs table is pruned periodically so it is possible for more than the expected number of rows to be present briefly in the meantime.", - type => $types{string}, - category => "logging", - }, - { - name => "ZM_LOG_DEBUG", - default => "no", - description => "Switch debugging on", - help => "ZoneMinder components usually support debug logging available to help with diagnosing problems. Binary components have several levels of debug whereas more other components have only one. Normally this is disabled to minimise performance penalties and avoid filling logs too quickly. This option lets you switch on other options that allow you to configure additional debug information to be output. Components will pick up this instruction when they are restarted.", - type => $types{boolean}, - category => "logging", - }, - { - name => "ZM_LOG_DEBUG_TARGET", - default => "", - description => "What components should have extra debug enabled", - help => "There are three scopes of debug available. Leaving this option blank means that all components will use extra debug (not recommended). Setting this option to '_', e.g. _zmc, will limit extra debug to that component only. Setting this option to '__', e.g. '_zmc_m1' will limit extra debug to that instance of the component only. This is ordinarily what you probably want to do. To debug scripts use their names without the .pl extension, e.g. '_zmvideo' and to debug issues with the web interface use '_web'. You can specify multiple targets by separating them with '|' characters.", - requires => [ { name => "ZM_LOG_DEBUG", value => "yes" } ], - type => $types{string}, - category => "logging", - }, - { - name => "ZM_LOG_DEBUG_LEVEL", - default => 1, - description => "What level of extra debug should be enabled", - help => "There are 9 levels of debug available, with higher numbers being more debug and level 0 being no debug. However not all levels are used by all components. Also if there is debug at a high level it is usually likely to be output at such a volume that it may obstruct normal operation. For this reason you should set the level carefully and cautiously until the degree of debug you wish to see is present. Scripts and the web interface only have one level so this is an on/off type option for them.", - requires => [ { name => "ZM_LOG_DEBUG", value => "yes" } ], - type => { db_type=>"integer", hint=>"1|2|3|4|5|6|7|8|9", pattern=>qr|^(\d+)$|, format=>q( $1 ) }, - category => "logging", - }, - { - name => "ZM_LOG_DEBUG_FILE", - default => "@ZM_LOGDIR@/zm_debug.log+", - description => "Where extra debug is output to", - help => "This option allows you to specify a different target for debug output. All components have a default log file which will norally be in /tmp or /var/log and this is where debug will be written to if this value is empty. Adding a path here will temporarily redirect debug, and other logging output, to this file. This option is a simple filename and you are debugging several components then they will all try and write to the same file with undesirable consequences. Appending a '+' to the filename will cause the file to be created with a '.' suffix containing your process id. In this way debug from each run of a component is kept separate. This is the recommended setting as it will also prevent subsequent runs from overwriting the same log. You should ensure that permissions are set up to allow writing to the file and directory specified here.", - requires => [ { name => "ZM_LOG_DEBUG", value => "yes" } ], - type => $types{string}, - category => "logging", - }, - { - name => "ZM_LOG_CHECK_PERIOD", - default => "900", - description => "Time period used when calculating overall system health", - help => "When ZoneMinder is logging events to the database it can retrospectively examine the number of warnings and errors that have occurred to calculate an overall state of system health. This option allows you to indicate what period of historical events are used in this calculation. This value is expressed in seconds and is ignored if LOG_LEVEL_DATABASE is set to None.", - type => $types{integer}, - category => "logging", - }, - { - name => "ZM_LOG_ALERT_WAR_COUNT", - default => "1", - description => "Number of warnings indicating system alert state", - help => "When ZoneMinder is logging events to the database it can retrospectively examine the number of warnings and errors that have occurred to calculate an overall state of system health. This option allows you to specify how many warnings must have occurred within the defined time period to generate an overall system alert state. A value of zero means warnings are not considered. This value is ignored if LOG_LEVEL_DATABASE is set to None.", - type => $types{integer}, - category => "logging", - }, - { - name => "ZM_LOG_ALERT_ERR_COUNT", - default => "1", - description => "Number of errors indicating system alert state", - help => "When ZoneMinder is logging events to the database it can retrospectively examine the number of warnings and errors that have occurred to calculate an overall state of system health. This option allows you to specify how many errors must have occurred within the defined time period to generate an overall system alert state. A value of zero means errors are not considered. This value is ignored if LOG_LEVEL_DATABASE is set to None.", - type => $types{integer}, - category => "logging", - }, - { - name => "ZM_LOG_ALERT_FAT_COUNT", - default => "0", - description => "Number of fatal error indicating system alert state", - help => "When ZoneMinder is logging events to the database it can retrospectively examine the number of warnings and errors that have occurred to calculate an overall state of system health. This option allows you to specify how many fatal errors (including panics) must have occurred within the defined time period to generate an overall system alert state. A value of zero means fatal errors are not considered. This value is ignored if LOG_LEVEL_DATABASE is set to None.", - type => $types{integer}, - category => "logging", - }, - { - name => "ZM_LOG_ALARM_WAR_COUNT", - default => "100", - description => "Number of warnings indicating system alarm state", - help => "When ZoneMinder is logging events to the database it can retrospectively examine the number of warnings and errors that have occurred to calculate an overall state of system health. This option allows you to specify how many warnings must have occurred within the defined time period to generate an overall system alarm state. A value of zero means warnings are not considered. This value is ignored if LOG_LEVEL_DATABASE is set to None.", - type => $types{integer}, - category => "logging", - }, - { - name => "ZM_LOG_ALARM_ERR_COUNT", - default => "10", - description => "Number of errors indicating system alarm state", - help => "When ZoneMinder is logging events to the database it can retrospectively examine the number of warnings and errors that have occurred to calculate an overall state of system health. This option allows you to specify how many errors must have occurred within the defined time period to generate an overall system alarm state. A value of zero means errors are not considered. This value is ignored if LOG_LEVEL_DATABASE is set to None.", - type => $types{integer}, - category => "logging", - }, - { - name => "ZM_LOG_ALARM_FAT_COUNT", - default => "1", - description => "Number of fatal error indicating system alarm state", - help => "When ZoneMinder is logging events to the database it can retrospectively examine the number of warnings and errors that have occurred to calculate an overall state of system health. This option allows you to specify how many fatal errors (including panics) must have occurred within the defined time period to generate an overall system alarm state. A value of zero means fatal errors are not considered. This value is ignored if LOG_LEVEL_DATABASE is set to None.", - type => $types{integer}, - category => "logging", - }, - { - name => "ZM_RECORD_EVENT_STATS", - default => "yes", - description => "Record event statistical information, switch off if too slow", - help => "This version of ZoneMinder records detailed information about events in the Stats table. This can help in profiling what the optimum settings are for Zones though this is tricky at present. However in future releases this will be done more easily and intuitively, especially with a large sample of events. The default option of 'yes' allows this information to be collected now in readiness for this but if you are concerned about performance you can switch this off in which case no Stats information will be saved.", - type => $types{boolean}, - category => "logging", - }, - { - name => "ZM_RECORD_DIAG_IMAGES", - default => "no", - description => "Record intermediate alarm diagnostic images, can be very slow", - help => "In addition to recording event statistics you can also record the intermediate diagnostic images that display the results of the various checks and processing that occur when trying to determine if an alarm event has taken place. There are several of these images generated for each frame and zone for each alarm or alert frame so this can have a massive impact on performance. Only switch this setting on for debug or analysis purposes and remember to switch it off again once no longer required.", - type => $types{boolean}, - category => "logging", - }, - { - name => "ZM_DUMP_CORES", - default => "no", - description => "Create core files on unexpected process failure.", - help => "When an unrecoverable error occurs in a ZoneMinder binary process is has traditionally been trapped and the details written to logs to aid in remote analysis. However in some cases it is easier to diagnose the error if a core file, which is a memory dump of the process at the time of the error, is created. This can be interactively analysed in the debugger and may reveal more or better information than that available from the logs. This option is recommended for advanced users only otherwise leave at the default. Note using this option to trigger core files will mean that there will be no indication in the binary logs that a process has died, they will just stop, however the zmdc log will still contain an entry. Also note that you may have to explicitly enable core file creation on your system via the 'ulimit -c' command or other means otherwise no file will be created regardless of the value of this option.", - type => $types{boolean}, - category => "logging", - }, - { - name => "ZM_PATH_MAP", - default => "/dev/shm", - description => "Path to the mapped memory files that that ZoneMinder can use", - help => "ZoneMinder has historically used IPC shared memory for shared data between processes. This has it's advantages and limitations. This version of ZoneMinder can use an alternate method, mapped memory, instead with can be enabled with the --enable--mmap directive to configure. This requires less system configuration and is generally more flexible. However it requires each shared data segment to map onto a filesystem file. This option indicates where those mapped files go. You should ensure that this location has sufficient space for these files and for the best performance it should be a tmpfs file system or ramdisk otherwise disk access may render this method slower than the regular shared memory one.", - type => $types{abs_path}, - category => "paths", - }, - { - name => "ZM_PATH_SOCKS", - default => "@ZM_SOCKDIR@", - description => "Path to the various Unix domain socket files that ZoneMinder uses", - help => "ZoneMinder generally uses Unix domain sockets where possible. This reduces the need for port assignments and prevents external applications from possibly compromising the daemons. However each Unix socket requires a .sock file to be created. This option indicates where those socket files go.", - type => $types{abs_path}, - category => "paths", - }, - { - name => "ZM_PATH_LOGS", - default => "@ZM_LOGDIR@", - description => "Path to the various logs that the ZoneMinder daemons generate", - help => "There are various daemons that are used by ZoneMinder to perform various tasks. Most generate helpful log files and this is where they go. They can be deleted if not required for debugging.", - type => $types{abs_path}, - category => "paths", - }, - { - name => "ZM_PATH_SWAP", - default => "@ZM_TMPDIR@", - description => "Path to location for temporary swap images used in streaming", - help => "Buffered playback requires temporary swap images to be stored for each instance of the streaming daemons. This option determines where these images will be stored. The images will actually be stored in sub directories beneath this location and will be automatically cleaned up after a period of time.", - type => $types{abs_path}, - category => "paths", - }, - { - name => "ZM_PATH_ARP", - default => "", - description => "Path to a supported ARP tool", - help => "The camera probe function uses Address Resolution Protocol in order to find known devices on the network. Optionally supply the full path to \"ip neigh\", \"arp -a\", or any other tool on your system that returns ip/mac address pairs. If this field is left empty, ZoneMinder will search for the command \"arp\" and attempt to use that.", - type => $types{abs_path}, - category => "paths", - }, - { - name => "ZM_WEB_TITLE_PREFIX", - default => "ZM", - description => "The title prefix displayed on each window", - help => "If you have more than one installation of ZoneMinder it can be helpful to display different titles for each one. Changing this option allows you to customise the window titles to include further information to aid identification.", - type => $types{string}, - category => "web", - }, - { - name => "ZM_WEB_RESIZE_CONSOLE", - default => "yes", - description => "Should the console window resize itself to fit", - help => "Traditionally the main ZoneMinder web console window has resized itself to shrink to a size small enough to list only the monitors that are actually present. This is intended to make the window more unobtrusize but may not be to everyones tastes, especially if opened in a tab in browsers which support this kind if layout. Switch this option off to have the console window size left to the users preference", - type => $types{boolean}, - category => "web", - }, - { - name => "ZM_WEB_POPUP_ON_ALARM", - default => "yes", - description => "Should the monitor window jump to the top if an alarm occurs", - help => "When viewing a live monitor stream you can specify whether you want the window to pop to the front if an alarm occurs when the window is minimised or behind another window. This is most useful if your monitors are over doors for example when they can pop up if someone comes to the doorway.", - type => $types{boolean}, - category => "web", - }, - { - name => "ZM_OPT_X10", - default => "no", - description => "Support interfacing with X10 devices", - help => "If you have an X10 Home Automation setup in your home you can use ZoneMinder to initiate or react to X10 signals if your computer has the appropriate interface controller. This option indicates whether X10 options will be available in the browser client.", - type => $types{boolean}, - category => "x10", - }, - { - name => "ZM_X10_DEVICE", - default => "/dev/ttyS0", - description => "What device is your X10 controller connected on", - requires => [ { name => "ZM_OPT_X10", value => "yes" } ], - help => "If you have an X10 controller device (e.g. XM10U) connected to your computer this option details which port it is conected on, the default of /dev/ttyS0 maps to serial or com port 1.", - type => $types{abs_path}, - category => "x10", - }, - { - name => "ZM_X10_HOUSE_CODE", - default => "A", - description => "What X10 house code should be used", - requires => [ { name => "ZM_OPT_X10", value => "yes" } ], - help => "X10 devices are grouped together by identifying them as all belonging to one House Code. This option details what that is. It should be a single letter between A and P.", - type => { db_type=>"string", hint=>"A-P", pattern=>qr|^([A-P])|i, format=>q( uc($1) ) }, - category => "x10", - }, - { - name => "ZM_X10_DB_RELOAD_INTERVAL", - default => "60", - description => "How often (in seconds) the X10 daemon reloads the monitors from the database", - requires => [ { name => "ZM_OPT_X10", value => "yes" } ], - help => "The zmx10 daemon periodically checks the database to find out what X10 events trigger, or result from, alarms. This option determines how frequently this check occurs, unless you change this area frequently this can be a fairly large value.", - type => $types{integer}, - category => "x10", - }, - { - name => "ZM_WEB_SOUND_ON_ALARM", - default => "no", - description => "Should the monitor window play a sound if an alarm occurs", - help => "When viewing a live monitor stream you can specify whether you want the window to play a sound to alert you if an alarm occurs.", - type => $types{boolean}, - category => "web", - }, - { - name => "ZM_WEB_ALARM_SOUND", - default => "", - description => "The sound to play on alarm, put this in the sounds directory", - help => "You can specify a sound file to play if an alarm occurs whilst you are watching a live monitor stream. So long as your browser understands the format it does not need to be any particular type. This file should be placed in the sounds directory defined earlier.", - type => $types{file}, - requires => [ { name => "ZM_WEB_SOUND_ON_ALARM", value => "yes" } ], - category => "web", - }, - { - name => "ZM_WEB_COMPACT_MONTAGE", - default => "no", - description => "Compact the montage view by removing extra detail", - help => "The montage view shows the output of all of your active monitors in one window. This include a small menu and status information for each one. This can increase the web traffic and make the window larger than may be desired. Setting this option on removes all this extraneous information and just displays the images.", - type => $types{boolean}, - category => "web", - }, - { - name => "ZM_OPT_FAST_DELETE", - default => "yes", - description => "Delete only event database records for speed", - help => "Normally an event created as the result of an alarm consists of entries in one or more database tables plus the various files associated with it. When deleting events in the browser it can take a long time to remove all of this if your are trying to do a lot of events at once. It is recommended that you set this option which means that the browser client only deletes the key entries in the events table, which means the events will no longer appear in the listing, and leaves the zmaudit daemon to clear up the rest later.", - type => $types{boolean}, - category => "system", - }, - { - name => "ZM_STRICT_VIDEO_CONFIG", - default => "yes", - description => "Allow errors in setting video config to be fatal", - help => "With some video devices errors can be reported in setting the various video attributes when in fact the operation was successful. Switching this option off will still allow these errors to be reported but will not cause them to kill the video capture daemon. Note however that doing this will cause all errors to be ignored including those which are genuine and which may cause the video capture to not function correctly. Use this option with caution.", - type => $types{boolean}, - category => "config", - }, - { - name => "ZM_SIGNAL_CHECK_POINTS", - default => "10", - description => "How many points in a captured image to check for signal loss", - help => "For locally attached video cameras ZoneMinder can check for signal loss by looking at a number of random points on each captured image. If all of these points are set to the same fixed colour then the camera is assumed to have lost signal. When this happens any open events are closed and a short one frame signal loss event is generated, as is another when the signal returns. This option defines how many points on each image to check. Note that this is a maximum, any points found to not have the check colour will abort any further checks so in most cases on a couple of points will actually be checked. Network and file based cameras are never checked.", - type => $types{integer}, - category => "config", - }, - { - name => "ZM_V4L_MULTI_BUFFER", - default => "yes", - description => "Use more than one buffer for Video 4 Linux devices", - help => "Performance when using Video 4 Linux devices is usually best if multiple buffers are used allowing the next image to be captured while the previous one is being processed. If you have multiple devices on a card sharing one input that requires switching then this approach can sometimes cause frames from one source to be mixed up with frames from another. Switching this option off prevents multi buffering resulting in slower but more stable image capture. This option is ignored for non-local cameras or if only one input is present on a capture chip. This option addresses a similar problem to the ZM_CAPTURES_PER_FRAME option and you should normally change the value of only one of the options at a time. If you have different capture cards that need different values you can ovveride them in each individual monitor on the source page.", - type => $types{boolean}, - category => "config", - }, - { - name => "ZM_CAPTURES_PER_FRAME", - default => "1", - description => "How many images are captured per returned frame, for shared local cameras", - help => "If you are using cameras attached to a video capture card which forces multiple inputs to share one capture chip, it can sometimes produce images with interlaced frames reversed resulting in poor image quality and a distinctive comb edge appearance. Increasing this setting allows you to force additional image captures before one is selected as the captured frame. This allows the capture hardware to 'settle down' and produce better quality images at the price of lesser capture rates. This option has no effect on (a) network cameras, or (b) where multiple inputs do not share a capture chip. This option addresses a similar problem to the ZM_V4L_MULTI_BUFFER option and you should normally change the value of only one of the options at a time. If you have different capture cards that need different values you can ovveride them in each individual monitor on the source page.", - type => $types{integer}, - category => "config", - }, - { - name => "ZM_FILTER_RELOAD_DELAY", - default => "300", - description => "How often (in seconds) filters are reloaded in zmfilter", - help => "ZoneMinder allows you to save filters to the database which allow events that match certain criteria to be emailed, deleted or uploaded to a remote machine etc. The zmfilter daemon loads these and does the actual operation. This option determines how often the filters are reloaded from the database to get the latest versions or new filters. If you don't change filters very often this value can be set to a large value.", - type => $types{integer}, - category => "system", - }, - { - name => "ZM_FILTER_EXECUTE_INTERVAL", - default => "60", - description => "How often (in seconds) to run automatic saved filters", - help => "ZoneMinder allows you to save filters to the database which allow events that match certain criteria to be emailed, deleted or uploaded to a remote machine etc. The zmfilter daemon loads these and does the actual operation. This option determines how often the filters are executed on the saved event in the database. If you want a rapid response to new events this should be a smaller value, however this may increase the overall load on the system and affect performance of other elements.", - type => $types{integer}, - category => "system", - }, - { - name => "ZM_OPT_UPLOAD", - default => "no", - description => "Should ZoneMinder support uploading events from filters", - help => "In ZoneMinder you can create event filters that specify whether events that match certain criteria should be uploaded to a remote server for archiving. This option specifies whether this functionality should be available", - type => $types{boolean}, - category => "upload", - }, - { - name => "ZM_UPLOAD_ARCH_FORMAT", - default => "tar", - description => "What format the uploaded events should be created in.", - requires => [ { name => "ZM_OPT_UPLOAD", value => "yes" } ], - help => "Uploaded events may be stored in either .tar or .zip format, this option specifies which. Note that to use this you will need to have the Archive::Tar and/or Archive::Zip perl modules installed.", - type => { db_type=>"string", hint=>"tar|zip", pattern=>qr|^([tz])|i, format=>q( $1 =~ /^t/ ? "tar" : "zip" ) }, - category => "upload", - }, - { - name => "ZM_UPLOAD_ARCH_COMPRESS", - default => "no", - description => "Should archive files be compressed", - help => "When the archive files are created they can be compressed. However in general since the images are compressed already this saves only a minimal amount of space versus utilising more CPU in their creation. Only enable if you have CPU to waste and are limited in disk space on your remote server or bandwidth.", - requires => [ { name => "ZM_OPT_UPLOAD", value => "yes" } ], - type => $types{boolean}, - category => "upload", - }, - { - name => "ZM_UPLOAD_ARCH_ANALYSE", - default => "no", - description => "Include the analysis files in the archive", - help => "When the archive files are created they can contain either just the captured frames or both the captured frames and, for frames that caused an alarm, the analysed image with the changed area highlighted. This option controls files are included. Only include analysed frames if you have a high bandwidth connection to the remote server or if you need help in figuring out what caused an alarm in the first place as archives with these files in can be considerably larger.", - requires => [ { name => "ZM_OPT_UPLOAD", value => "yes" } ], - type => $types{boolean}, - category => "upload", - }, - { - name => "ZM_UPLOAD_PROTOCOL", - default => "ftp", - description => "What protocol to use to upload events", - requires => [ { name => "ZM_OPT_UPLOAD", value => "yes" } ], - help => "ZoneMinder can upload events to a remote server using either FTP or SFTP. Regular FTP is widely supported but not necessarily very secure whereas SFTP (Secure FTP) runs over an ssh connection and so is encrypted and uses regular ssh ports. Note that to use this you will need to have the appropriate perl module, either Net::FTP or Net::SFTP installed depending on your choice.", - type => { db_type=>"string", hint=>"ftp|sftp", pattern=>qr|^([tz])|i, format=>q( $1 =~ /^f/ ? "ftp" : "sftp" ) }, - category => "upload", - }, - { - name => "ZM_UPLOAD_FTP_HOST", - default => "", - description => "The remote server to upload to", - help => "You can use filters to instruct ZoneMinder to upload events to a remote ftp server. This option indicates the name, or ip address, of the server to use.", - requires => [ { name => "ZM_OPT_UPLOAD", value => "yes" } ], - type => $types{hostname}, - category => "hidden", - }, - { - name => "ZM_UPLOAD_HOST", - default => "", - description => "The remote server to upload events to", - help => "You can use filters to instruct ZoneMinder to upload events to a remote server. This option indicates the name, or ip address, of the server to use.", - requires => [ { name => "ZM_OPT_UPLOAD", value => "yes" } ], - type => $types{hostname}, - category => "upload", - }, - { - name => "ZM_UPLOAD_PORT", - default => "", - description => "The port on the remote upload server, if not the default (SFTP only)", - help => "You can use filters to instruct ZoneMinder to upload events to a remote server. If you are using the SFTP protocol then this option allows you to specify a particular port to use for connection. If this option is left blank then the default, port 22, is used. This option is ignored for FTP uploads.", - requires => [ { name => "ZM_OPT_UPLOAD", value => "yes" } ], - type => $types{integer}, - category => "upload", - }, - { - name => "ZM_UPLOAD_FTP_USER", - default => "", - description => "Your ftp username", - help => "You can use filters to instruct ZoneMinder to upload events to a remote ftp server. This option indicates the username that ZoneMinder should use to log in for ftp transfer.", - requires => [ { name => "ZM_OPT_UPLOAD", value => "yes" } ], - type => $types{alphanum}, - category => "hidden", - }, - { - name => "ZM_UPLOAD_USER", - default => "", - description => "Remote server username", - help => "You can use filters to instruct ZoneMinder to upload events to a remote server. This option indicates the username that ZoneMinder should use to log in for transfer.", - requires => [ { name => "ZM_OPT_UPLOAD", value => "yes" } ], - type => $types{alphanum}, - category => "upload", - }, - { - name => "ZM_UPLOAD_FTP_PASS", - default => "", - description => "Your ftp password", - help => "You can use filters to instruct ZoneMinder to upload events to a remote ftp server. This option indicates the password that ZoneMinder should use to log in for ftp transfer.", - requires => [ { name => "ZM_OPT_UPLOAD", value => "yes" } ], - type => $types{string}, - category => "hidden", - }, - { - name => "ZM_UPLOAD_PASS", - default => "", - description => "Remote server password", - help => "You can use filters to instruct ZoneMinder to upload events to a remote server. This option indicates the password that ZoneMinder should use to log in for transfer. If you are using certicate based logins for SFTP servers you can leave this option blank.", - requires => [ { name => "ZM_OPT_UPLOAD", value => "yes" } ], - type => $types{string}, - category => "upload", - }, - { - name => "ZM_UPLOAD_FTP_LOC_DIR", - default => "@ZM_TMPDIR@", - description => "The local directory in which to create upload files", - help => "You can use filters to instruct ZoneMinder to upload events to a remote ftp server. This option indicates the local directory that ZoneMinder should use for temporary upload files. These are files that are created from events, uploaded and then deleted.", - requires => [ { name => "ZM_OPT_UPLOAD", value => "yes" } ], - type => $types{abs_path}, - category => "hidden", - }, - { - name => "ZM_UPLOAD_LOC_DIR", - default => "@ZM_TMPDIR@", - description => "The local directory in which to create upload files", - help => "You can use filters to instruct ZoneMinder to upload events to a remote server. This option indicates the local directory that ZoneMinder should use for temporary upload files. These are files that are created from events, uploaded and then deleted.", - requires => [ { name => "ZM_OPT_UPLOAD", value => "yes" } ], - type => $types{abs_path}, - category => "upload", - }, - { - name => "ZM_UPLOAD_FTP_REM_DIR", - default => "", - description => "The remote directory to upload to", - help => "You can use filters to instruct ZoneMinder to upload events to a remote ftp server. This option indicates the remote directory that ZoneMinder should use to upload event files to.", - requires => [ { name => "ZM_OPT_UPLOAD", value => "yes" } ], - type => $types{rel_path}, - category => "hidden", - }, - { - name => "ZM_UPLOAD_REM_DIR", - default => "", - description => "The remote directory to upload to", - help => "You can use filters to instruct ZoneMinder to upload events to a remote server. This option indicates the remote directory that ZoneMinder should use to upload event files to.", - requires => [ { name => "ZM_OPT_UPLOAD", value => "yes" } ], - type => $types{rel_path}, - category => "upload", - }, - { - name => "ZM_UPLOAD_FTP_TIMEOUT", - default => "120", - description => "How long to allow the transfer to take for each file", - help => "You can use filters to instruct ZoneMinder to upload events to a remote ftp server. This option indicates the maximum ftp inactivity timeout (in seconds) that should be tolerated before ZoneMinder determines that the transfer has failed and closes down the connection.", - requires => [ { name => "ZM_OPT_UPLOAD", value => "yes" } ], - type => $types{integer}, - category => "hidden", - }, - { - name => "ZM_UPLOAD_TIMEOUT", - default => "120", - description => "How long to allow the transfer to take for each file", - help => "You can use filters to instruct ZoneMinder to upload events to a remote server. This option indicates the maximum inactivity timeout (in seconds) that should be tolerated before ZoneMinder determines that the transfer has failed and closes down the connection.", - requires => [ { name => "ZM_OPT_UPLOAD", value => "yes" } ], - type => $types{integer}, - category => "upload", - }, - { - name => "ZM_UPLOAD_FTP_PASSIVE", - default => "yes", - description => "Use passive ftp when uploading", - help => "You can use filters to instruct ZoneMinder to upload events to a remote ftp server. This option indicates that ftp transfers should be done in passive mode. This uses a single connection for all ftp activity and, whilst slower than active transfers, is more robust and likely to work from behind filewalls. This option is ignored for SFTP transfers.", - requires => [ { name => "ZM_OPT_UPLOAD", value => "yes" } ], - help => "If your computer is behind a firewall or proxy you may need to set FTP to passive mode. In fact for simple transfers it makes little sense to do otherwise anyway but you can set this to 'No' if you wish.", - type => $types{boolean}, - category => "upload", - }, - { - name => "ZM_UPLOAD_FTP_DEBUG", - default => "no", - description => "Switch ftp debugging on", - help => "You can use filters to instruct ZoneMinder to upload events to a remote ftp server. If you are having (or expecting) troubles with uploading events then setting this to 'yes' permits additional information to be included in the zmfilter log file.", - requires => [ { name => "ZM_OPT_UPLOAD", value => "yes" } ], - type => $types{boolean}, - category => "hidden", - }, - { - name => "ZM_UPLOAD_DEBUG", - default => "no", - description => "Switch upload debugging on", - help => "You can use filters to instruct ZoneMinder to upload events to a remote server. If you are having (or expecting) troubles with uploading events then setting this to 'yes' permits additional information to be generated by the underlying transfer modules and included in the logs.", - requires => [ { name => "ZM_OPT_UPLOAD", value => "yes" } ], - type => $types{boolean}, - category => "upload", - }, - { - name => "ZM_OPT_EMAIL", - default => "no", - description => "Should ZoneMinder email you details of events that match corresponding filters", - help => "In ZoneMinder you can create event filters that specify whether events that match certain criteria should have their details emailed to you at a designated email address. This will allow you to be notified of events as soon as they occur and also to quickly view the events directly. This option specifies whether this functionality should be available. The email created with this option can be any size and is intended to be sent to a regular email reader rather than a mobile device.", - type => $types{boolean}, - category => "mail", - }, - { - name => "ZM_EMAIL_ADDRESS", - default => "", - description => "The email address to send matching event details to", - requires => [ { name => "ZM_OPT_EMAIL", value => "yes" } ], - help => "This option is used to define the email address that any events that match the appropriate filters will be sent to.", - type => $types{email}, - category => "mail", - }, - { - name => "ZM_EMAIL_TEXT", - default => 'subject = "ZoneMinder: Alarm - %MN%-%EI% (%ESM% - %ESA% %EFA%)" + name => "ZM_LANG_DEFAULT", + default => "en_gb", + description => "Default language used by web interface", + help => qqq(" + ZoneMinder allows the web interface to use languages other than + English if the appropriate language file has been created and + is present. This option allows you to change the default + language that is used from the shipped language, British + English, to another language + "), + type => $types{string}, + category => "system", + }, + { + name => "ZM_OPT_USE_AUTH", + default => "no", + description => "Authenticate user logins to ZoneMinder", + help => qqq(" + ZoneMinder can run in two modes. The simplest is an entirely + unauthenticated mode where anyone can access ZoneMinder and + perform all tasks. This is most suitable for installations + where the web server access is limited in other ways. The other + mode enables user accounts with varying sets of permissions. + Users must login or authenticate to access ZoneMinder and are + limited by their defined permissions. + "), + type => $types{boolean}, + category => "system", + }, + { + name => "ZM_AUTH_TYPE", + default => "builtin", + description => "What is used to authenticate ZoneMinder users", + help => qqq(" + ZoneMinder can use two methods to authenticate users when + running in authenticated mode. The first is a builtin method + where ZoneMinder provides facilities for users to log in and + maintains track of their identity. The second method allows + interworking with other methods such as http basic + authentication which passes an independently authentication + 'remote' user via http. In this case ZoneMinder would use the + supplied user without additional authentication provided such a + user is configured ion ZoneMinder. + "), + requires => [ { name=>"ZM_OPT_USE_AUTH", value=>"yes" } ], + type => { + db_type =>"string", + hint =>"builtin|remote", + pattern =>qr|^([br])|i, + format =>q( $1 =~ /^b/ ? "builtin" : "remote" ) + }, + category => "system", + }, + { + name => "ZM_AUTH_RELAY", + default => "hashed", + description => "Method used to relay authentication information", + help => qqq(" + When ZoneMinder is running in authenticated mode it can pass + user details between the web pages and the back end processes. + There are two methods for doing this. This first is to use a + time limited hashed string which contains no direct username or + password details, the second method is to pass the username and + passwords around in plaintext. This method is not recommend + except where you do not have the md5 libraries available on + your system or you have a completely isolated system with no + external access. You can also switch off authentication + relaying if your system is isolated in other ways. + "), + requires => [ { name=>"ZM_OPT_USE_AUTH", value=>"yes" } ], + type => { + db_type =>"string", + hint =>"hashed|plain|none", + pattern =>qr|^([hpn])|i, + format =>q( ($1 =~ /^h/) + ? "hashed" + : ($1 =~ /^p/ ? "plain" : "none" ) + ) + }, + category => "system", + }, + { + name => "ZM_AUTH_HASH_SECRET", + default => "...Change me to something unique...", + description => "Secret for encoding hashed authentication information", + help => qqq(" + When ZoneMinder is running in hashed authenticated mode it is + necessary to generate hashed strings containing encrypted + sensitive information such as usernames and password. Although + these string are reasonably secure the addition of a random + secret increases security substantially. + "), + requires => [ + { name=>"ZM_OPT_USE_AUTH", value=>"yes" }, + { name=>"ZM_AUTH_RELAY", value=>"hashed" } + ], + type => $types{string}, + category => "system", + }, + { + name => "ZM_AUTH_HASH_IPS", + default => "yes", + description => "Include IP addresses in the authentication hash", + help => qqq(" + When ZoneMinder is running in hashed authenticated mode it can + optionally include the requesting IP address in the resultant + hash. This adds an extra level of security as only requests + from that address may use that authentication key. However in + some circumstances, such as access over mobile networks, the + requesting address can change for each request which will cause + most requests to fail. This option allows you to control + whether IP addresses are included in the authentication hash on + your system. If you experience intermitent problems with + authentication, switching this option off may help. + "), + requires => [ + { name=>"ZM_OPT_USE_AUTH", value=>"yes" }, + { name=>"ZM_AUTH_RELAY", value=>"hashed" } + ], + type => $types{boolean}, + category => "system", + }, + { + name => "ZM_AUTH_HASH_LOGINS", + default => "no", + description => "Allow login by authentication hash", + help => qqq(" + The normal process for logging into ZoneMinder is via the login + screen with username and password. In some circumstances it may + be desirable to allow access directly to one or more pages, for + instance from a third party application. If this option is + enabled then adding an 'auth' parameter to any request will + include a shortcut login bypassing the login screen, if not + already logged in. As authentication hashes are time and, + optionally, IP limited this can allow short-term access to + ZoneMinder screens from other web pages etc. In order to use + this the calling application will hae to generate the + authentication hash itself and ensure it is valid. If you use + this option you should ensure that you have modified the + ZM_AUTH_HASH_SECRET to somethign unique to your system. + "), + requires => [ + { name=>"ZM_OPT_USE_AUTH", value=>"yes" }, + { name=>"ZM_AUTH_RELAY", value=>"hashed" } + ], + type => $types{boolean}, + category => "system", + }, + { + name => "ZM_DIR_EVENTS", + default => "events", + description => "Directory where events are stored", + help => qqq(" + This is the path to the events directory where all the event + images and other miscellaneous files are stored. CAUTION: The + directory you specify here cannot be outside the web root. This + is a common mistake. Most users should never change this value. + If you intend to record events to a second disk or network + share, then you should mount the drive or share directly to the + ZoneMinder events folder or follow the instructions in the + ZoneMinder Wiki titled Using a dedicated Hard Drive. + "), + type => $types{directory}, + category => "paths", + }, + { + name => "ZM_USE_DEEP_STORAGE", + default => "yes", + description => "Use a deep filesystem hierarchy for events", + help => qqq(" + This option is now the default for new ZoneMinder systems and + should not be changed. Previous versions of ZoneMinder stored + all events for a monitor under one folder. Enabling + USE_DEEP_STORAGE causes ZoneMinder to store events under a + folder structure that follows year/month/day/hour/min/second. + Storing events this way avoids the limitation of storing more + than 32k files in a single folder inherent in some filesystems. + It is important to note that you cannot simply change this + option. You must stop zoneminder, enable USE_DEEP_STORAGE, and + then run \"sudo zmupdate.pl --migrate-events\". FAILURE TO DO + SO WILL RESULT IN LOSS OF YOUR DATA! Consult the ZoneMinder + WiKi for further details. + "), + type => $types{boolean}, + category => "hidden", + }, + { + name => "ZM_DIR_IMAGES", + default => "images", + description => "Directory where the images that the ZoneMinder client generates are stored", + help => qqq(" + ZoneMinder generates a myriad of images, mostly of which are + associated with events. For those that aren't this is where + they go. CAUTION: The directory you specify here cannot be + outside the web root. This is a common mistake. Most users + should never change this value. If you intend to save images to + a second disk or network share, then you should mount the drive + or share directly to the ZoneMinder images folder or follow the + instructions in the ZoneMinder Wiki titled Using a dedicated + Hard Drive. + "), + type => $types{directory}, + category => "paths", + }, + { + name => "ZM_DIR_SOUNDS", + default => "sounds", + description => "Directory to the sounds that the ZoneMinder client can use", + help => qqq(" + ZoneMinder can optionally play a sound file when an alarm is + detected. This indicates where to look for this file. CAUTION: + The directory you specify here cannot be outside the web root. + Most users should never change this value. + "), + type => $types{directory}, + category => "paths", + }, + { + name => "ZM_PATH_ZMS", + default => "/cgi-bin/nph-zms", + description => "Web path to zms streaming server", + help => qqq(" + The ZoneMinder streaming server is required to send streamed + images to your browser. It will be installed into the cgi-bin + path given at configuration time. This option determines what + the web path to the server is rather than the local path on + your machine. Ordinarily the streaming server runs in + parser-header mode however if you experience problems with + streaming you can change this to non-parsed-header (nph) mode + by changing 'zms' to 'nph-zms'. + "), + type => $types{rel_path}, + category => "paths", + }, + { + name => "ZM_COLOUR_JPEG_FILES", + default => "no", + description => "Colourise greyscale JPEG files", + help => qqq(" + Cameras that capture in greyscale can write their captured + images to jpeg files with a corresponding greyscale colour + space. This saves a small amount of disk space over colour + ones. However some tools such as ffmpeg either fail to work + with this colour space or have to convert it beforehand. + Setting this option to yes uses up a little more space but + makes creation of MPEG files much faster. + "), + type => $types{boolean}, + category => "images", + }, + { + name => "ZM_ADD_JPEG_COMMENTS", + default => "no", + description => "Add jpeg timestamp annotations as file header comments", + help => qqq(" + JPEG files may have a number of extra fields added to the file + header. The comment field may have any kind of text added. This + options allows you to have the same text that is used to + annotate the image additionally included as a file header + comment. If you archive event images to other locations this + may help you locate images for particular events or times if + you use software that can read comment headers. + "), + type => $types{boolean}, + category => "images", + }, + { + name => "ZM_JPEG_FILE_QUALITY", + default => "70", + description => "Set the JPEG quality setting for the saved event files (1-100)", + help => qqq(" + When ZoneMinder detects an event it will save the images + associated with that event to files. These files are in the + JPEG format and can be viewed or streamed later. This option + specifies what image quality should be used to save these + files. A higher number means better quality but less + compression so will take up more disk space and take longer to + view over a slow connection. By contrast a low number means + smaller, quicker to view, files but at the price of lower + quality images. This setting applies to all images written + except if the capture image has caused an alarm and the alarm + file quality option is set at a higher value when that is used + instead. + "), + type => $types{integer}, + category => "images", + }, + { + name => "ZM_JPEG_ALARM_FILE_QUALITY", + default => "0", + description => "Set the JPEG quality setting for the saved event files during an alarm (1-100)", + help => qqq(" + This value is equivalent to the regular jpeg file quality + setting above except that it only applies to images saved while + in an alarm state and then only if this value is set to a + higher quality setting than the ordinary file setting. If set + to a lower value then it is ignored. Thus leaving it at the + default of 0 effectively means to use the regular file quality + setting for all saved images. This is to prevent acccidentally + saving important images at a worse quality setting. + "), + type => $types{integer}, + category => "images", + }, + # Deprecated, now stream quality + { + name => "ZM_JPEG_IMAGE_QUALITY", + default => "70", + description => "Set the JPEG quality setting for the streamed 'live' images (1-100)", + help => qqq(" + When viewing a 'live' stream for a monitor ZoneMinder will grab + an image from the buffer and encode it into JPEG format before + sending it. This option specifies what image quality should be + used to encode these images. A higher number means better + quality but less compression so will take longer to view over a + slow connection. By contrast a low number means quicker to view + images but at the price of lower quality images. This option + does not apply when viewing events or still images as these are + usually just read from disk and so will be encoded at the + quality specified by the previous options. + "), + type => $types{integer}, + category => "hidden", + }, + { + name => "ZM_JPEG_STREAM_QUALITY", + default => "70", + description => "Set the JPEG quality setting for the streamed 'live' images (1-100)", + help => qqq(" + When viewing a 'live' stream for a monitor ZoneMinder will grab + an image from the buffer and encode it into JPEG format before + sending it. This option specifies what image quality should be + used to encode these images. A higher number means better + quality but less compression so will take longer to view over a + slow connection. By contrast a low number means quicker to view + images but at the price of lower quality images. This option + does not apply when viewing events or still images as these are + usually just read from disk and so will be encoded at the + quality specified by the previous options. + "), + type => $types{integer}, + category => "images", + }, + { + name => "ZM_MPEG_TIMED_FRAMES", + default => "yes", + description => "Tag video frames with a timestamp for more realistic streaming", + help => qqq(" + When using streamed MPEG based video, either for live monitor + streams or events, ZoneMinder can send the streams in two ways. + If this option is selected then the timestamp for each frame, + taken from it's capture time, is included in the stream. This + means that where the frame rate varies, for instance around an + alarm, the stream will still maintain it's 'real' timing. If + this option is not selected then an approximate frame rate is + calculated and that is used to schedule frames instead. This + option should be selected unless you encounter problems with + your preferred streaming method. + "), + type => $types{boolean}, + category => "images", + }, + { + name => "ZM_MPEG_LIVE_FORMAT", + default => "swf", + description => "What format 'live' video streams are played in", + help => qqq(" + When using MPEG mode ZoneMinder can output live video. However + what formats are handled by the browser varies greatly between + machines. This option allows you to specify a video format + using a file extension format, so you would just enter the + extension of the file type you would like and the rest is + determined from that. The default of 'asf' works well under + Windows with Windows Media Player but I'm currently not sure + what, if anything, works on a Linux platform. If you find out + please let me know! If this option is left blank then live + streams will revert to being in motion jpeg format + "), + type => $types{string}, + category => "images", + }, + { + name => "ZM_MPEG_REPLAY_FORMAT", + default => "swf", + description => "What format 'replay' video streams are played in", + help => qqq(" + When using MPEG mode ZoneMinder can replay events in encoded + video format. However what formats are handled by the browser + varies greatly between machines. This option allows you to + specify a video format using a file extension format, so you + would just enter the extension of the file type you would like + and the rest is determined from that. The default of 'asf' + works well under Windows with Windows Media Player and 'mpg', + or 'avi' etc should work under Linux. If you know any more then + please let me know! If this option is left blank then live + streams will revert to being in motion jpeg format + "), + type => $types{string}, + category => "images", + }, + { + name => "ZM_RAND_STREAM", + default => "yes", + description => "Add a random string to prevent caching of streams", + help => qqq(" + Some browsers can cache the streams used by ZoneMinder. In + order to prevent his a harmless random string can be appended + to the url to make each invocation of the stream appear unique. + "), + type => $types{boolean}, + category => "images", + }, + { + name => "ZM_OPT_CAMBOZOLA", + default => "no", + description => "Is the (optional) cambozola java streaming client installed", + help => qqq(" + Cambozola is a handy low fat cheese flavoured Java applet that + ZoneMinder uses to view image streams on browsers such as + Internet Explorer that don't natively support this format. If + you use this browser it is highly recommended to install this + from http://www.charliemouse.com/code/cambozola/ however if it + is not installed still images at a lower refresh rate can still + be viewed. + "), + type => $types{boolean}, + category => "images", + }, + { + name => "ZM_PATH_CAMBOZOLA", + default => "cambozola.jar", + description => "Web path to (optional) cambozola java streaming client", + help => qqq(" + Cambozola is a handy low fat cheese flavoured Java applet that + ZoneMinder uses to view image streams on browsers such as + Internet Explorer that don't natively support this format. If + you use this browser it is highly recommended to install this + from http://www.charliemouse.com/code/cambozola/ however if it + is not installed still images at a lower refresh rate can still + be viewed. Leave this as 'cambozola.jar' if cambozola is + installed in the same directory as the ZoneMinder web client + files. + "), + requires => [ { name=>"ZM_OPT_CAMBOZOLA", value=>"yes" } ], + type => $types{rel_path}, + category => "images", + }, + { + name => "ZM_RELOAD_CAMBOZOLA", + default => "0", + description => "After how many seconds should Cambozola be reloaded in live view", + help => qqq(" + Cambozola allows for the viewing of streaming MJPEG however it + caches the entire stream into cache space on the computer, + setting this to a number > 0 will cause it to automatically + reload after that many seconds to avoid filling up a hard + drive. + "), + type => $types{integer}, + category => "images", + }, + { + name => "ZM_TIMESTAMP_ON_CAPTURE", + default => "yes", + description => "Timestamp images as soon as they are captured", + help => qqq(" + ZoneMinder can add a timestamp to images in two ways. The + default method, when this option is set, is that each image is + timestamped immediately when captured and so the image held in + memory is marked right away. The second method does not + timestamp the images until they are either saved as part of an + event or accessed over the web. The timestamp used in both + methods will contain the same time as this is preserved along + with the image. The first method ensures that an image is + timestamped regardless of any other circumstances but will + result in all images being timestamped even those never saved + or viewed. The second method necessitates that saved images are + copied before being saved otherwise two timestamps perhaps at + different scales may be applied. This has the (perhaps) + desirable side effect that the timestamp is always applied at + the same resolution so an image that has scaling applied will + still have a legible and correctly scaled timestamp. + "), + type => $types{boolean}, + category => "config", + }, + { + name => "ZM_CPU_EXTENSIONS", + default => "yes", + description => "Use advanced CPU extensions to increase performance", + help => qqq(" + When advanced processor extensions such as SSE2 or SSSE3 are + available, ZoneMinder can use them, which should increase + performance and reduce system load. Enabling this option on + processors that do not support the advanced processors + extensions used by ZoneMinder is harmless and will have no + effect. + "), + type => $types{boolean}, + category => "config", + }, + { + name => "ZM_FAST_IMAGE_BLENDS", + default => "yes", + description => "Use a fast algorithm to blend the reference image", + help => qqq(" + To detect alarms ZoneMinder needs to blend the captured image + with the stored reference image to update it for comparison + with the next image. The reference blend percentage specified + for the monitor controls how much the new image affects the + reference image. There are two methods that are available for + this. If this option is set then fast calculation which does + not use any multiplication or division is used. This + calculation is extremely fast, however it limits the possible + blend percentages to 50%, 25%, 12.5%, 6.25%, 3.25% and 1.5%. + Any other blend percentage will be rounded to the nearest + possible one. The alternative is to switch this option off + and use standard blending instead, which is slower. + "), + type => $types{boolean}, + category => "config", + }, + { + name => "ZM_OPT_ADAPTIVE_SKIP", + default => "yes", + description => "Should frame analysis try and be efficient in skipping frames", + help => qqq(" + In previous versions of ZoneMinder the analysis daemon would + attempt to keep up with the capture daemon by processing the + last captured frame on each pass. This would sometimes have the + undesirable side-effect of missing a chunk of the initial + activity that caused the alarm because the pre-alarm frames + would all have to be written to disk and the database before + processing the next frame, leading to some delay between the + first and second event frames. Setting this option enables a + newer adaptive algorithm where the analysis daemon attempts to + process as many captured frames as possible, only skipping + frames when in danger of the capture daemon overwriting yet to + be processed frames. This skip is variable depending on the + size of the ring buffer and the amount of space left in it. + Enabling this option will give you much better coverage of the + beginning of alarms whilst biasing out any skipped frames + towards the middle or end of the event. However you should be + aware that this will have the effect of making the analysis + daemon run somewhat behind the capture daemon during events and + for particularly fast rates of capture it is possible for the + adaptive algorithm to be overwhelmed and not have time to react + to a rapid build up of pending frames and thus for a buffer + overrun condition to occur. + "), + type => $types{boolean}, + category => "config", + }, + { + name => "ZM_MAX_SUSPEND_TIME", + default => "30", + description => "Maximum time that a monitor may have motion detection suspended", + help => qqq(" + ZoneMinder allows monitors to have motion detection to be + suspended, for instance while panning a camera. Ordinarily this + relies on the operator resuming motion detection afterwards as + failure to do so can leave a monitor in a permanently suspended + state. This setting allows you to set a maximum time which a + camera may be suspended for before it automatically resumes + motion detection. This time can be extended by subsequent + suspend indications after the first so continuous camera + movement will also occur while the monitor is suspended. + "), + type => $types{integer}, + category => "config", + }, + # Deprecated, really no longer necessary + { + name => "ZM_OPT_REMOTE_CAMERAS", + default => "no", + description => "Are you going to use remote/networked cameras", + help => qqq(" + ZoneMinder can work with both local cameras, ie. those attached + physically to your computer and remote or network cameras. If + you will be using networked cameras select this option. + "), + type => $types{boolean}, + category => "hidden", + }, + # Deprecated, now set on a per monitor basis using the Method field + { + name => "ZM_NETCAM_REGEXPS", + default => "yes", + description => "Use regular expression matching with network cameras", + help => qqq(" + Traditionally ZoneMinder has used complex regular regular + expressions to handle the multitude of formats that network + cameras produce. In versions from 1.21.1 the default is to use + a simpler and faster built in pattern matching methodology. + This works well with most networks cameras but if you have + problems you can try the older, but more flexible, regular + expression based method by selecting this option. Note, to use + this method you must have libpcre installed on your system. + "), + requires => [ { name => "ZM_OPT_REMOTE_CAMERAS", value => "yes" } ], + type => $types{boolean}, + category => "hidden", + }, + { + name => "ZM_HTTP_VERSION", + default => "1.0", + description => "The version of HTTP that ZoneMinder will use to connect", + help => qqq(" + ZoneMinder can communicate with network cameras using either of + the HTTP/1.1 or HTTP/1.0 standard. A server will normally fall + back to the version it supports with no problem so this should + usually by left at the default. However it can be changed to + HTTP/1.0 if necessary to resolve particular issues. + "), + type => { + db_type =>"string", + hint =>"1.1|1.0", + pattern =>qr|^(1\.[01])$|, + format =>q( $1?$1:"" ) + }, + category => "network", + }, + { + name => "ZM_HTTP_UA", + default => "ZoneMinder", + description => "The user agent that ZoneMinder uses to identify itself", + help => qqq(" + When ZoneMinder communicates with remote cameras it will + identify itself using this string and it's version number. This + is normally sufficient, however if a particular cameras expects + only to communicate with certain browsers then this can be + changed to a different string identifying ZoneMinder as + Internet Explorer or Netscape etc. + "), + type => $types{string}, + category => "network", + }, + { + name => "ZM_HTTP_TIMEOUT", + default => "2500", + description => "How long ZoneMinder waits before giving up on images (milliseconds)", + help => qqq(" + When retrieving remote images ZoneMinder will wait for this + length of time before deciding that an image is not going to + arrive and taking steps to retry. This timeout is in + milliseconds (1000 per second) and will apply to each part of + an image if it is not sent in one whole chunk. + "), + type => $types{integer}, + category => "network", + }, + { + name => "ZM_MIN_RTP_PORT", + default => "40200", + description => "Minimum port that ZoneMinder will listen for RTP traffic on", + help => qqq(" + When ZoneMinder communicates with MPEG4 capable cameras using + RTP with the unicast method it must open ports for the camera + to connect back to for control and streaming purposes. This + setting specifies the minimum port number that ZoneMinder will + use. Ordinarily two adjacent ports are used for each camera, + one for control packets and one for data packets. This port + should be set to an even number, you may also need to open up a + hole in your firewall to allow cameras to connect back if you + wish to use unicasting. + "), + type => $types{integer}, + category => "network", + }, + { + name => "ZM_MAX_RTP_PORT", + default => "40499", + description => "Maximum port that ZoneMinder will listen for RTP traffic on", + help => qqq(" + When ZoneMinder communicates with MPEG4 capable cameras using + RTP with the unicast method it must open ports for the camera + to connect back to for control and streaming purposes. This + setting specifies the maximum port number that ZoneMinder will + use. Ordinarily two adjacent ports are used for each camera, + one for control packets and one for data packets. This port + should be set to an even number, you may also need to open up a + hole in your firewall to allow cameras to connect back if you + wish to use unicasting. You should also ensure that you have + opened up at least two ports for each monitor that will be + connecting to unicasting network cameras. + "), + type => $types{integer}, + category => "network", + }, + { + name => "ZM_OPT_FFMPEG", + default => "@OPT_FFMPEG@", + description => "Is the ffmpeg video encoder/decoder installed", + help => qqq(" + ZoneMinder can optionally encode a series of video images into + an MPEG encoded movie file for viewing, downloading or storage. + This option allows you to specify whether you have the ffmpeg + tools installed. Note that creating MPEG files can be fairly + CPU and disk intensive and is not a required option as events + can still be reviewed as video streams without it. + "), + type => $types{boolean}, + category => "images", + }, + { + name => "ZM_PATH_FFMPEG", + default => "@PATH_FFMPEG@", + description => "Path to (optional) ffmpeg mpeg encoder", + help => "This path should point to where ffmpeg has been installed.", + requires => [ { name=>"ZM_OPT_FFMPEG", value=>"yes" } ], + type => $types{abs_path}, + category => "images", + }, + { + name => "ZM_FFMPEG_INPUT_OPTIONS", + default => "", + description => "Additional input options to ffmpeg", + help => qqq(" + Ffmpeg can take many options on the command line to control the + quality of video produced. This option allows you to specify + your own set that apply to the input to ffmpeg (options that + are given before the -i option). Check the ffmpeg documentation + for a full list of options which may be used here. + "), + requires => [ { name=>"ZM_OPT_FFMPEG", value=>"yes" } ], + type => $types{string}, + category => "images", + }, + { + name => "ZM_FFMPEG_OUTPUT_OPTIONS", + default => "-r 25", + description => "Additional output options to ffmpeg", + help => qqq(" + Ffmpeg can take many options on the command line to control the + quality of video produced. This option allows you to specify + your own set that apply to the output from ffmpeg (options that + are given after the -i option). Check the ffmpeg documentation + for a full list of options which may be used here. The most + common one will often be to force an output frame rate + supported by the video encoder. + "), + requires => [ { name=>"ZM_OPT_FFMPEG", value=>"yes" } ], + type => $types{string}, + category => "images", + }, + { + name => "ZM_FFMPEG_FORMATS", + default => "mpg mpeg wmv asf avi* mov swf 3gp**", + description => "Formats to allow for ffmpeg video generation", + help => qqq(" + Ffmpeg can generate video in many different formats. This + option allows you to list the ones you want to be able to + select. As new formats are supported by ffmpeg you can add them + here and be able to use them immediately. Adding a '*' after a + format indicates that this will be the default format used for + web video, adding '**' defines the default format for phone + video. + "), + requires => [ { name=>"ZM_OPT_FFMPEG", value=>"yes" } ], + type => $types{string}, + category => "images", + }, + { + name => "ZM_FFMPEG_OPEN_TIMEOUT", + default => "10", + description => "Timeout in seconds when opening a stream.", + help => qqq(" + When Ffmpeg is opening a stream, it can take a long time before + failing; certain circumstances even seem to be able to lock + indefinitely. This option allows you to set a maximum time in + seconds to pass before closing the stream and trying to reopen + it again. + "), + requires => [ { name=>"ZM_OPT_FFMPEG", value=>"yes" } ], + type => $types{integer}, + category => "images", + }, + { + name => "ZM_LOG_LEVEL_SYSLOG", + default => "0", + description => "Save logging output to the system log", + help => qqq(" + ZoneMinder logging is now more more integrated between + components and allows you to specify the destination for + logging output and the individual levels for each. This option + lets you control the level of logging output that goes to the + system log. ZoneMinder binaries have always logged to the + system log but now scripts and web logging is also included. To + preserve the previous behaviour you should ensure this value is + set to Info or Warning. This option controls the maximum level + of logging that will be written, so Info includes Warnings and + Errors etc. To disable entirely, set this option to None. You + should use caution when setting this option to Debug as it can + affect severely affect system performance. If you want debug + you will also need to set a level and component below + "), + type => { + db_type =>"integer", + hint =>"None=-5|Panic=-4|Fatal=-3|Error=-2|Warning=-1|Info=0|Debug=1", + pattern =>qr|^(\d+)$|, + format =>q( $1 ) + }, + category => "logging", + }, + { + name => "ZM_LOG_LEVEL_FILE", + default => "-5", + description => "Save logging output to component files", + help => qqq(" + ZoneMinder logging is now more more integrated between + components and allows you to specify the destination for + logging output and the individual levels for each. This option + lets you control the level of logging output that goes to + individual log files written by specific components. This is + how logging worked previously and although useful for tracking + down issues in specific components it also resulted in many + disparate log files. To preserve this behaviour you should + ensure this value is set to Info or Warning. This option + controls the maximum level of logging that will be written, so + Info includes Warnings and Errors etc. To disable entirely, set + this option to None. You should use caution when setting this + option to Debug as it can affect severely affect system + performance though file output has less impact than the other + options. If you want debug you will also need to set a level + and component below + "), + type => { + db_type =>"integer", + hint =>"None=-5|Panic=-4|Fatal=-3|Error=-2|Warning=-1|Info=0|Debug=1", + pattern =>qr|^(\d+)$|, + format =>q( $1 ) + }, + category => "logging", + }, + { + name => "ZM_LOG_LEVEL_WEBLOG", + default => "-5", + description => "Save logging output to the weblog", + help => qqq(" + ZoneMinder logging is now more more integrated between + components and allows you to specify the destination for + logging output and the individual levels for each. This option + lets you control the level of logging output from the web + interface that goes to the httpd error log. Note that only web + logging from PHP and JavaScript files is included and so this + option is really only useful for investigating specific issues + with those components. This option controls the maximum level + of logging that will be written, so Info includes Warnings and + Errors etc. To disable entirely, set this option to None. You + should use caution when setting this option to Debug as it can + affect severely affect system performance. If you want debug + you will also need to set a level and component below + "), + type => { + db_type =>"integer", + hint =>"None=-5|Panic=-4|Fatal=-3|Error=-2|Warning=-1|Info=0|Debug=1", + pattern =>qr|^(\d+)$|, + format =>q( $1 ) + }, + category => "logging", + }, + { + name => "ZM_LOG_LEVEL_DATABASE", + default => "0", + description => "Save logging output to the database", + help => qqq(" + ZoneMinder logging is now more more integrated between + components and allows you to specify the destination for + logging output and the individual levels for each. This option + lets you control the level of logging output that is written to + the database. This is a new option which can make viewing + logging output easier and more intuitive and also makes it + easier to get an overall impression of how the system is + performing. If you have a large or very busy system then it is + possible that use of this option may slow your system down if + the table becomes very large. Ensure you use the + LOG_DATABASE_LIMIT option to keep the table to a manageable + size. This option controls the maximum level of logging that + will be written, so Info includes Warnings and Errors etc. To + disable entirely, set this option to None. You should use + caution when setting this option to Debug as it can affect + severely affect system performance. If you want debug you will + also need to set a level and component below + "), + type => { + db_type =>"integer", + hint =>"None=-5|Panic=-4|Fatal=-3|Error=-2|Warning=-1|Info=0|Debug=1", + pattern =>qr|^(\d+)$|, + format =>q( $1 ) + }, + category => "logging", + }, + { + name => "ZM_LOG_DATABASE_LIMIT", + default => "7 day", + description => "Maximum number of log entries to retain", + help => qqq(" + If you are using database logging then it is possible to + quickly build up a large number of entries in the Logs table. + This option allows you to specify how many of these entries are + kept. If you set this option to a number greater than zero then + that number is used to determine the maximum number of rows, + less than or equal to zero indicates no limit and is not + recommended. You can also set this value to time values such as + ' day' which will limit the log entries to those newer than + that time. You can specify 'hour', 'day', 'week', 'month' and + 'year', note that the values should be singular (no 's' at the + end). The Logs table is pruned periodically so it is possible + for more than the expected number of rows to be present briefly + in the meantime. + "), + type => $types{string}, + category => "logging", + }, + { + name => "ZM_LOG_DEBUG", + default => "no", + description => "Switch debugging on", + help => qqq(" + ZoneMinder components usually support debug logging available + to help with diagnosing problems. Binary components have + several levels of debug whereas more other components have only + one. Normally this is disabled to minimise performance + penalties and avoid filling logs too quickly. This option lets + you switch on other options that allow you to configure + additional debug information to be output. Components will pick + up this instruction when they are restarted. + "), + type => $types{boolean}, + category => "logging", + }, + { + name => "ZM_LOG_DEBUG_TARGET", + default => "", + description => "What components should have extra debug enabled", + help => qqq(" + There are three scopes of debug available. Leaving this option + blank means that all components will use extra debug (not + recommended). Setting this option to '_', e.g. _zmc, + will limit extra debug to that component only. Setting this + option to '__', e.g. '_zmc_m1' will limit + extra debug to that instance of the component only. This is + ordinarily what you probably want to do. To debug scripts use + their names without the .pl extension, e.g. '_zmvideo' and to + debug issues with the web interface use '_web'. You can specify + multiple targets by separating them with '|' characters. + "), + requires => [ { name => "ZM_LOG_DEBUG", value => "yes" } ], + type => $types{string}, + category => "logging", + }, + { + name => "ZM_LOG_DEBUG_LEVEL", + default => 1, + description => "What level of extra debug should be enabled", + help => qqq(" + There are 9 levels of debug available, with higher numbers + being more debug and level 0 being no debug. However not all + levels are used by all components. Also if there is debug at a + high level it is usually likely to be output at such a volume + that it may obstruct normal operation. For this reason you + should set the level carefully and cautiously until the degree + of debug you wish to see is present. Scripts and the web + interface only have one level so this is an on/off type option + for them. + "), + requires => [ { name => "ZM_LOG_DEBUG", value => "yes" } ], + type => { + db_type =>"integer", + hint =>"1|2|3|4|5|6|7|8|9", + pattern =>qr|^(\d+)$|, + format =>q( $1 ) + }, + category => "logging", + }, + { + name => "ZM_LOG_DEBUG_FILE", + default => "@ZM_LOGDIR@/zm_debug.log+", + description => "Where extra debug is output to", + help => qqq(" + This option allows you to specify a different target for debug + output. All components have a default log file which will + norally be in /tmp or /var/log and this is where debug will be + written to if this value is empty. Adding a path here will + temporarily redirect debug, and other logging output, to this + file. This option is a simple filename and you are debugging + several components then they will all try and write to the same + file with undesirable consequences. Appending a '+' to the + filename will cause the file to be created with a '.' + suffix containing your process id. In this way debug from each + run of a component is kept separate. This is the recommended + setting as it will also prevent subsequent runs from + overwriting the same log. You should ensure that permissions + are set up to allow writing to the file and directory specified + here. + "), + requires => [ { name => "ZM_LOG_DEBUG", value => "yes" } ], + type => $types{string}, + category => "logging", + }, + { + name => "ZM_LOG_CHECK_PERIOD", + default => "900", + description => "Time period used when calculating overall system health", + help => qqq(" + When ZoneMinder is logging events to the database it can + retrospectively examine the number of warnings and errors that + have occurred to calculate an overall state of system health. + This option allows you to indicate what period of historical + events are used in this calculation. This value is expressed in + seconds and is ignored if LOG_LEVEL_DATABASE is set to None. + "), + type => $types{integer}, + category => "logging", + }, + { + name => "ZM_LOG_ALERT_WAR_COUNT", + default => "1", + description => "Number of warnings indicating system alert state", + help => qqq(" + When ZoneMinder is logging events to the database it can + retrospectively examine the number of warnings and errors that + have occurred to calculate an overall state of system health. + This option allows you to specify how many warnings must have + occurred within the defined time period to generate an overall + system alert state. A value of zero means warnings are not + considered. This value is ignored if LOG_LEVEL_DATABASE is set + to None. + "), + type => $types{integer}, + category => "logging", + }, + { + name => "ZM_LOG_ALERT_ERR_COUNT", + default => "1", + description => "Number of errors indicating system alert state", + help => qqq(" + When ZoneMinder is logging events to the database it can + retrospectively examine the number of warnings and errors that + have occurred to calculate an overall state of system health. + This option allows you to specify how many errors must have + occurred within the defined time period to generate an overall + system alert state. A value of zero means errors are not + considered. This value is ignored if LOG_LEVEL_DATABASE is set + to None. + "), + type => $types{integer}, + category => "logging", + }, + { + name => "ZM_LOG_ALERT_FAT_COUNT", + default => "0", + description => "Number of fatal error indicating system alert state", + help => qqq(" + When ZoneMinder is logging events to the database it can + retrospectively examine the number of warnings and errors that + have occurred to calculate an overall state of system health. + This option allows you to specify how many fatal errors + (including panics) must have occurred within the defined time + period to generate an overall system alert state. A value of + zero means fatal errors are not considered. This value is + ignored if LOG_LEVEL_DATABASE is set to None. + "), + type => $types{integer}, + category => "logging", + }, + { + name => "ZM_LOG_ALARM_WAR_COUNT", + default => "100", + description => "Number of warnings indicating system alarm state", + help => qqq(" + When ZoneMinder is logging events to the database it can + retrospectively examine the number of warnings and errors that + have occurred to calculate an overall state of system health. + This option allows you to specify how many warnings must have + occurred within the defined time period to generate an overall + system alarm state. A value of zero means warnings are not + considered. This value is ignored if LOG_LEVEL_DATABASE is set + to None. + "), + type => $types{integer}, + category => "logging", + }, + { + name => "ZM_LOG_ALARM_ERR_COUNT", + default => "10", + description => "Number of errors indicating system alarm state", + help => qqq(" + When ZoneMinder is logging events to the database it can + retrospectively examine the number of warnings and errors that + have occurred to calculate an overall state of system health. + This option allows you to specify how many errors must have + occurred within the defined time period to generate an overall + system alarm state. A value of zero means errors are not + considered. This value is ignored if LOG_LEVEL_DATABASE is set + to None. + "), + type => $types{integer}, + category => "logging", + }, + { + name => "ZM_LOG_ALARM_FAT_COUNT", + default => "1", + description => "Number of fatal error indicating system alarm state", + help => qqq(" + When ZoneMinder is logging events to the database it can + retrospectively examine the number of warnings and errors that + have occurred to calculate an overall state of system health. + This option allows you to specify how many fatal errors + (including panics) must have occurred within the defined time + period to generate an overall system alarm state. A value of + zero means fatal errors are not considered. This value is + ignored if LOG_LEVEL_DATABASE is set to None. + "), + type => $types{integer}, + category => "logging", + }, + { + name => "ZM_RECORD_EVENT_STATS", + default => "yes", + description => "Record event statistical information, switch off if too slow", + help => qqq(" + This version of ZoneMinder records detailed information about + events in the Stats table. This can help in profiling what the + optimum settings are for Zones though this is tricky at + present. However in future releases this will be done more + easily and intuitively, especially with a large sample of + events. The default option of 'yes' allows this information to + be collected now in readiness for this but if you are concerned + about performance you can switch this off in which case no + Stats information will be saved. + "), + type => $types{boolean}, + category => "logging", + }, + { + name => "ZM_RECORD_DIAG_IMAGES", + default => "no", + description => "Record intermediate alarm diagnostic images, can be very slow", + help => qqq(" + In addition to recording event statistics you can also record + the intermediate diagnostic images that display the results of + the various checks and processing that occur when trying to + determine if an alarm event has taken place. There are several + of these images generated for each frame and zone for each + alarm or alert frame so this can have a massive impact on + performance. Only switch this setting on for debug or analysis + purposes and remember to switch it off again once no longer + required. + "), + type => $types{boolean}, + category => "logging", + }, + { + name => "ZM_DUMP_CORES", + default => "no", + description => "Create core files on unexpected process failure.", + help => qqq(" + When an unrecoverable error occurs in a ZoneMinder binary + process is has traditionally been trapped and the details + written to logs to aid in remote analysis. However in some + cases it is easier to diagnose the error if a core file, which + is a memory dump of the process at the time of the error, is + created. This can be interactively analysed in the debugger and + may reveal more or better information than that available from + the logs. This option is recommended for advanced users only + otherwise leave at the default. Note using this option to + trigger core files will mean that there will be no indication + in the binary logs that a process has died, they will just + stop, however the zmdc log will still contain an entry. Also + note that you may have to explicitly enable core file creation + on your system via the 'ulimit -c' command or other means + otherwise no file will be created regardless of the value of + this option. + "), + type => $types{boolean}, + category => "logging", + }, + { + name => "ZM_PATH_MAP", + default => "/dev/shm", + description => "Path to the mapped memory files that that ZoneMinder can use", + help => qqq(" + ZoneMinder has historically used IPC shared memory for shared + data between processes. This has it's advantages and + limitations. This version of ZoneMinder can use an alternate + method, mapped memory, instead with can be enabled with the + --enable--mmap directive to configure. This requires less + system configuration and is generally more flexible. However it + requires each shared data segment to map onto a filesystem + file. This option indicates where those mapped files go. You + should ensure that this location has sufficient space for these + files and for the best performance it should be a tmpfs file + system or ramdisk otherwise disk access may render this method + slower than the regular shared memory one. + "), + type => $types{abs_path}, + category => "paths", + }, + { + name => "ZM_PATH_SOCKS", + default => "@ZM_SOCKDIR@", + description => "Path to the various Unix domain socket files that ZoneMinder uses", + help => qqq(" + ZoneMinder generally uses Unix domain sockets where possible. + This reduces the need for port assignments and prevents + external applications from possibly compromising the daemons. + However each Unix socket requires a .sock file to be created. + This option indicates where those socket files go. + "), + type => $types{abs_path}, + category => "paths", + }, + { + name => "ZM_PATH_LOGS", + default => "@ZM_LOGDIR@", + description => "Path to the various logs that the ZoneMinder daemons generate", + help => qqq(" + There are various daemons that are used by ZoneMinder to + perform various tasks. Most generate helpful log files and this + is where they go. They can be deleted if not required for + debugging. + "), + type => $types{abs_path}, + category => "paths", + }, + { + name => "ZM_PATH_SWAP", + default => "@ZM_TMPDIR@", + description => "Path to location for temporary swap images used in streaming", + help => qqq(" + Buffered playback requires temporary swap images to be stored + for each instance of the streaming daemons. This option + determines where these images will be stored. The images will + actually be stored in sub directories beneath this location and + will be automatically cleaned up after a period of time. + "), + type => $types{abs_path}, + category => "paths", + }, + { + name => "ZM_PATH_ARP", + default => "", + description => "Path to a supported ARP tool", + help => qqq(" + The camera probe function uses Address Resolution Protocol in + order to find known devices on the network. Optionally supply + the full path to \"ip neigh\", \"arp -a\", or any other tool on + your system that returns ip/mac address pairs. If this field is + left empty, ZoneMinder will search for the command \"arp\" and + attempt to use that. + "), + type => $types{abs_path}, + category => "paths", + }, + { + name => "ZM_WEB_TITLE_PREFIX", + default => "ZM", + description => "The title prefix displayed on each window", + help => qqq(" + If you have more than one installation of ZoneMinder it can be + helpful to display different titles for each one. Changing this + option allows you to customise the window titles to include + further information to aid identification. + "), + type => $types{string}, + category => "web", + }, + { + name => "ZM_WEB_RESIZE_CONSOLE", + default => "yes", + description => "Should the console window resize itself to fit", + help => qqq(" + Traditionally the main ZoneMinder web console window has + resized itself to shrink to a size small enough to list only + the monitors that are actually present. This is intended to + make the window more unobtrusize but may not be to everyones + tastes, especially if opened in a tab in browsers which support + this kind if layout. Switch this option off to have the console + window size left to the users preference + "), + type => $types{boolean}, + category => "web", + }, + { + name => "ZM_WEB_POPUP_ON_ALARM", + default => "yes", + description => "Should the monitor window jump to the top if an alarm occurs", + help => qqq(" + When viewing a live monitor stream you can specify whether you + want the window to pop to the front if an alarm occurs when the + window is minimised or behind another window. This is most + useful if your monitors are over doors for example when they + can pop up if someone comes to the doorway. + "), + type => $types{boolean}, + category => "web", + }, + { + name => "ZM_OPT_X10", + default => "no", + description => "Support interfacing with X10 devices", + help => qqq(" + If you have an X10 Home Automation setup in your home you can + use ZoneMinder to initiate or react to X10 signals if your + computer has the appropriate interface controller. This option + indicates whether X10 options will be available in the browser + client. + "), + type => $types{boolean}, + category => "x10", + }, + { + name => "ZM_X10_DEVICE", + default => "/dev/ttyS0", + description => "What device is your X10 controller connected on", + requires => [ { name => "ZM_OPT_X10", value => "yes" } ], + help => qqq(" + If you have an X10 controller device (e.g. XM10U) connected to + your computer this option details which port it is connected on, + the default of /dev/ttyS0 maps to serial or com port 1. + "), + type => $types{abs_path}, + category => "x10", + }, + { + name => "ZM_X10_HOUSE_CODE", + default => "A", + description => "What X10 house code should be used", + requires => [ { name => "ZM_OPT_X10", value => "yes" } ], + help => qqq(" + X10 devices are grouped together by identifying them as all + belonging to one House Code. This option details what that is. + It should be a single letter between A and P. + "), + type => { db_type=>"string", hint=>"A-P", pattern=>qr|^([A-P])|i, format=>q( uc($1) ) }, + category => "x10", + }, + { + name => "ZM_X10_DB_RELOAD_INTERVAL", + default => "60", + description => "How often (in seconds) the X10 daemon reloads the monitors from the database", + requires => [ { name => "ZM_OPT_X10", value => "yes" } ], + help => qqq(" + The zmx10 daemon periodically checks the database to find out + what X10 events trigger, or result from, alarms. This option + determines how frequently this check occurs, unless you change + this area frequently this can be a fairly large value. + "), + type => $types{integer}, + category => "x10", + }, + { + name => "ZM_WEB_SOUND_ON_ALARM", + default => "no", + description => "Should the monitor window play a sound if an alarm occurs", + help => qqq(" + When viewing a live monitor stream you can specify whether you + want the window to play a sound to alert you if an alarm + occurs. + "), + type => $types{boolean}, + category => "web", + }, + { + name => "ZM_WEB_ALARM_SOUND", + default => "", + description => "The sound to play on alarm, put this in the sounds directory", + help => qqq(" + You can specify a sound file to play if an alarm occurs whilst + you are watching a live monitor stream. So long as your browser + understands the format it does not need to be any particular + type. This file should be placed in the sounds directory + defined earlier. + "), + type => $types{file}, + requires => [ { name => "ZM_WEB_SOUND_ON_ALARM", value => "yes" } ], + category => "web", + }, + { + name => "ZM_WEB_COMPACT_MONTAGE", + default => "no", + description => "Compact the montage view by removing extra detail", + help => qqq(" + The montage view shows the output of all of your active + monitors in one window. This include a small menu and status + information for each one. This can increase the web traffic and + make the window larger than may be desired. Setting this option + on removes all this extraneous information and just displays + the images. + "), + type => $types{boolean}, + category => "web", + }, + { + name => "ZM_OPT_FAST_DELETE", + default => "yes", + description => "Delete only event database records for speed", + help => qqq(" + Normally an event created as the result of an alarm consists of + entries in one or more database tables plus the various files + associated with it. When deleting events in the browser it can + take a long time to remove all of this if your are trying to do + a lot of events at once. It is recommended that you set this + option which means that the browser client only deletes the key + entries in the events table, which means the events will no + longer appear in the listing, and leaves the zmaudit daemon to + clear up the rest later. + "), + type => $types{boolean}, + category => "system", + }, + { + name => "ZM_STRICT_VIDEO_CONFIG", + default => "yes", + description => "Allow errors in setting video config to be fatal", + help => qqq(" + With some video devices errors can be reported in setting the + various video attributes when in fact the operation was + successful. Switching this option off will still allow these + errors to be reported but will not cause them to kill the video + capture daemon. Note however that doing this will cause all + errors to be ignored including those which are genuine and + which may cause the video capture to not function correctly. + Use this option with caution. + "), + type => $types{boolean}, + category => "config", + }, + { + name => "ZM_SIGNAL_CHECK_POINTS", + default => "10", + description => "How many points in a captured image to check for signal loss", + help => qqq(" + For locally attached video cameras ZoneMinder can check for + signal loss by looking at a number of random points on each + captured image. If all of these points are set to the same + fixed colour then the camera is assumed to have lost signal. + When this happens any open events are closed and a short one + frame signal loss event is generated, as is another when the + signal returns. This option defines how many points on each + image to check. Note that this is a maximum, any points found + to not have the check colour will abort any further checks so + in most cases on a couple of points will actually be checked. + Network and file based cameras are never checked. + "), + type => $types{integer}, + category => "config", + }, + { + name => "ZM_V4L_MULTI_BUFFER", + default => "yes", + description => "Use more than one buffer for Video 4 Linux devices", + help => qqq(" + Performance when using Video 4 Linux devices is usually best if + multiple buffers are used allowing the next image to be + captured while the previous one is being processed. If you have + multiple devices on a card sharing one input that requires + switching then this approach can sometimes cause frames from + one source to be mixed up with frames from another. Switching + this option off prevents multi buffering resulting in slower + but more stable image capture. This option is ignored for + non-local cameras or if only one input is present on a capture + chip. This option addresses a similar problem to the + ZM_CAPTURES_PER_FRAME option and you should normally change the + value of only one of the options at a time. If you have + different capture cards that need different values you can + ovveride them in each individual monitor on the source page. + "), + type => $types{boolean}, + category => "config", + }, + { + name => "ZM_CAPTURES_PER_FRAME", + default => "1", + description => "How many images are captured per returned frame, for shared local cameras", + help => qqq(" + If you are using cameras attached to a video capture card which + forces multiple inputs to share one capture chip, it can + sometimes produce images with interlaced frames reversed + resulting in poor image quality and a distinctive comb edge + appearance. Increasing this setting allows you to force + additional image captures before one is selected as the + captured frame. This allows the capture hardware to 'settle + down' and produce better quality images at the price of lesser + capture rates. This option has no effect on (a) network + cameras, or (b) where multiple inputs do not share a capture + chip. This option addresses a similar problem to the + ZM_V4L_MULTI_BUFFER option and you should normally change the + value of only one of the options at a time. If you have + different capture cards that need different values you can + ovveride them in each individual monitor on the source page. + "), + type => $types{integer}, + category => "config", + }, + { + name => "ZM_FILTER_RELOAD_DELAY", + default => "300", + description => "How often (in seconds) filters are reloaded in zmfilter", + help => qqq(" + ZoneMinder allows you to save filters to the database which + allow events that match certain criteria to be emailed, deleted + or uploaded to a remote machine etc. The zmfilter daemon loads + these and does the actual operation. This option determines how + often the filters are reloaded from the database to get the + latest versions or new filters. If you don't change filters + very often this value can be set to a large value. + "), + type => $types{integer}, + category => "system", + }, + { + name => "ZM_FILTER_EXECUTE_INTERVAL", + default => "60", + description => "How often (in seconds) to run automatic saved filters", + help => qqq(" + ZoneMinder allows you to save filters to the database which + allow events that match certain criteria to be emailed, deleted + or uploaded to a remote machine etc. The zmfilter daemon loads + these and does the actual operation. This option determines how + often the filters are executed on the saved event in the + database. If you want a rapid response to new events this + should be a smaller value, however this may increase the + overall load on the system and affect performance of other + elements. + "), + type => $types{integer}, + category => "system", + }, + { + name => "ZM_OPT_UPLOAD", + default => "no", + description => "Should ZoneMinder support uploading events from filters", + help => qqq(" + In ZoneMinder you can create event filters that specify whether + events that match certain criteria should be uploaded to a + remote server for archiving. This option specifies whether this + functionality should be available + "), + type => $types{boolean}, + category => "upload", + }, + { + name => "ZM_UPLOAD_ARCH_FORMAT", + default => "tar", + description => "What format the uploaded events should be created in.", + requires => [ { name => "ZM_OPT_UPLOAD", value => "yes" } ], + help => qqq(" + Uploaded events may be stored in either .tar or .zip format, + this option specifies which. Note that to use this you will + need to have the Archive::Tar and/or Archive::Zip perl modules + installed. + "), + type => { + db_type =>"string", + hint =>"tar|zip", + pattern =>qr|^([tz])|i, + format =>q( $1 =~ /^t/ ? "tar" : "zip" ) + }, + category => "upload", + }, + { + name => "ZM_UPLOAD_ARCH_COMPRESS", + default => "no", + description => "Should archive files be compressed", + help => qqq(" + When the archive files are created they can be compressed. + However in general since the images are compressed already this + saves only a minimal amount of space versus utilising more CPU + in their creation. Only enable if you have CPU to waste and are + limited in disk space on your remote server or bandwidth. + "), + requires => [ { name => "ZM_OPT_UPLOAD", value => "yes" } ], + type => $types{boolean}, + category => "upload", + }, + { + name => "ZM_UPLOAD_ARCH_ANALYSE", + default => "no", + description => "Include the analysis files in the archive", + help => qqq(" + When the archive files are created they can contain either just + the captured frames or both the captured frames and, for frames + that caused an alarm, the analysed image with the changed area + highlighted. This option controls files are included. Only + include analysed frames if you have a high bandwidth connection + to the remote server or if you need help in figuring out what + caused an alarm in the first place as archives with these files + in can be considerably larger. + "), + requires => [ { name => "ZM_OPT_UPLOAD", value => "yes" } ], + type => $types{boolean}, + category => "upload", + }, + { + name => "ZM_UPLOAD_PROTOCOL", + default => "ftp", + description => "What protocol to use to upload events", + requires => [ { name => "ZM_OPT_UPLOAD", value => "yes" } ], + help => qqq(" + ZoneMinder can upload events to a remote server using either + FTP or SFTP. Regular FTP is widely supported but not + necessarily very secure whereas SFTP (Secure FTP) runs over an + ssh connection and so is encrypted and uses regular ssh ports. + Note that to use this you will need to have the appropriate + perl module, either Net::FTP or Net::SFTP installed depending + on your choice. + "), + type => { + db_type =>"string", + hint =>"ftp|sftp", + pattern =>qr|^([tz])|i, + format =>q( $1 =~ /^f/ ? "ftp" : "sftp" ) + }, + category => "upload", + }, + { + name => "ZM_UPLOAD_FTP_HOST", + default => "", + description => "The remote server to upload to", + help => qqq(" + You can use filters to instruct ZoneMinder to upload events to + a remote ftp server. This option indicates the name, or ip + address, of the server to use. + "), + requires => [ { name => "ZM_OPT_UPLOAD", value => "yes" } ], + type => $types{hostname}, + category => "hidden", + }, + { + name => "ZM_UPLOAD_HOST", + default => "", + description => "The remote server to upload events to", + help => qqq(" + You can use filters to instruct ZoneMinder to upload events to + a remote server. This option indicates the name, or ip address, + of the server to use. + "), + requires => [ { name => "ZM_OPT_UPLOAD", value => "yes" } ], + type => $types{hostname}, + category => "upload", + }, + { + name => "ZM_UPLOAD_PORT", + default => "", + description => "The port on the remote upload server, if not the default (SFTP only)", + help => qqq(" + You can use filters to instruct ZoneMinder to upload events to + a remote server. If you are using the SFTP protocol then this + option allows you to specify a particular port to use for + connection. If this option is left blank then the default, port + 22, is used. This option is ignored for FTP uploads. + "), + requires => [ { name => "ZM_OPT_UPLOAD", value => "yes" } ], + type => $types{integer}, + category => "upload", + }, + { + name => "ZM_UPLOAD_FTP_USER", + default => "", + description => "Your ftp username", + help => qqq(" + You can use filters to instruct ZoneMinder to upload events to + a remote ftp server. This option indicates the username that + ZoneMinder should use to log in for ftp transfer. + "), + requires => [ { name => "ZM_OPT_UPLOAD", value => "yes" } ], + type => $types{alphanum}, + category => "hidden", + }, + { + name => "ZM_UPLOAD_USER", + default => "", + description => "Remote server username", + help => qqq(" + You can use filters to instruct ZoneMinder to upload events to + a remote server. This option indicates the username that + ZoneMinder should use to log in for transfer. + "), + requires => [ { name => "ZM_OPT_UPLOAD", value => "yes" } ], + type => $types{alphanum}, + category => "upload", + }, + { + name => "ZM_UPLOAD_FTP_PASS", + default => "", + description => "Your ftp password", + help => qqq(" + You can use filters to instruct ZoneMinder to upload events to + a remote ftp server. This option indicates the password that + ZoneMinder should use to log in for ftp transfer. + "), + requires => [ { name => "ZM_OPT_UPLOAD", value => "yes" } ], + type => $types{string}, + category => "hidden", + }, + { + name => "ZM_UPLOAD_PASS", + default => "", + description => "Remote server password", + help => qqq(" + You can use filters to instruct ZoneMinder to upload events to + a remote server. This option indicates the password that + ZoneMinder should use to log in for transfer. If you are using + certicate based logins for SFTP servers you can leave this + option blank. + "), + requires => [ { name => "ZM_OPT_UPLOAD", value => "yes" } ], + type => $types{string}, + category => "upload", + }, + { + name => "ZM_UPLOAD_FTP_LOC_DIR", + default => "@ZM_TMPDIR@", + description => "The local directory in which to create upload files", + help => qqq(" + You can use filters to instruct ZoneMinder to upload events to + a remote ftp server. This option indicates the local directory + that ZoneMinder should use for temporary upload files. These + are files that are created from events, uploaded and then + deleted. + "), + requires => [ { name => "ZM_OPT_UPLOAD", value => "yes" } ], + type => $types{abs_path}, + category => "hidden", + }, + { + name => "ZM_UPLOAD_LOC_DIR", + default => "@ZM_TMPDIR@", + description => "The local directory in which to create upload files", + help => qqq(" + You can use filters to instruct ZoneMinder to upload events to + a remote server. This option indicates the local directory that + ZoneMinder should use for temporary upload files. These are + files that are created from events, uploaded and then deleted. + "), + requires => [ { name => "ZM_OPT_UPLOAD", value => "yes" } ], + type => $types{abs_path}, + category => "upload", + }, + { + name => "ZM_UPLOAD_FTP_REM_DIR", + default => "", + description => "The remote directory to upload to", + help => qqq(" + You can use filters to instruct ZoneMinder to upload events to + a remote ftp server. This option indicates the remote directory + that ZoneMinder should use to upload event files to. + "), + requires => [ { name => "ZM_OPT_UPLOAD", value => "yes" } ], + type => $types{rel_path}, + category => "hidden", + }, + { + name => "ZM_UPLOAD_REM_DIR", + default => "", + description => "The remote directory to upload to", + help => qqq(" + You can use filters to instruct ZoneMinder to upload events to + a remote server. This option indicates the remote directory + that ZoneMinder should use to upload event files to. + "), + requires => [ { name => "ZM_OPT_UPLOAD", value => "yes" } ], + type => $types{rel_path}, + category => "upload", + }, + { + name => "ZM_UPLOAD_FTP_TIMEOUT", + default => "120", + description => "How long to allow the transfer to take for each file", + help => qqq(" + You can use filters to instruct ZoneMinder to upload events to + a remote ftp server. This option indicates the maximum ftp + inactivity timeout (in seconds) that should be tolerated before + ZoneMinder determines that the transfer has failed and closes + down the connection. + "), + requires => [ { name => "ZM_OPT_UPLOAD", value => "yes" } ], + type => $types{integer}, + category => "hidden", + }, + { + name => "ZM_UPLOAD_TIMEOUT", + default => "120", + description => "How long to allow the transfer to take for each file", + help => qqq(" + You can use filters to instruct ZoneMinder to upload events to + a remote server. This option indicates the maximum inactivity + timeout (in seconds) that should be tolerated before ZoneMinder + determines that the transfer has failed and closes down the + connection. + "), + requires => [ { name => "ZM_OPT_UPLOAD", value => "yes" } ], + type => $types{integer}, + category => "upload", + }, + { + name => "ZM_UPLOAD_FTP_PASSIVE", + default => "yes", + description => "Use passive ftp when uploading", + help => qqq(" + You can use filters to instruct ZoneMinder to upload events to + a remote ftp server. This option indicates that ftp transfers + should be done in passive mode. This uses a single connection + for all ftp activity and, whilst slower than active transfers, + is more robust and likely to work from behind filewalls. This + option is ignored for SFTP transfers. + "), + requires => [ { name => "ZM_OPT_UPLOAD", value => "yes" } ], + help => qqq(" + If your computer is behind a firewall or proxy you may need to + set FTP to passive mode. In fact for simple transfers it makes + little sense to do otherwise anyway but you can set this to + 'No' if you wish. + "), + type => $types{boolean}, + category => "upload", + }, + { + name => "ZM_UPLOAD_FTP_DEBUG", + default => "no", + description => "Switch ftp debugging on", + help => qqq(" + You can use filters to instruct ZoneMinder to upload events to + a remote ftp server. If you are having (or expecting) troubles + with uploading events then setting this to 'yes' permits + additional information to be included in the zmfilter log file. + "), + requires => [ { name => "ZM_OPT_UPLOAD", value => "yes" } ], + type => $types{boolean}, + category => "hidden", + }, + { + name => "ZM_UPLOAD_DEBUG", + default => "no", + description => "Switch upload debugging on", + help => qqq(" + You can use filters to instruct ZoneMinder to upload events to + a remote server. If you are having (or expecting) troubles with + uploading events then setting this to 'yes' permits additional + information to be generated by the underlying transfer modules + and included in the logs. + "), + requires => [ { name => "ZM_OPT_UPLOAD", value => "yes" } ], + type => $types{boolean}, + category => "upload", + }, + { + name => "ZM_OPT_EMAIL", + default => "no", + description => "Should ZoneMinder email you details of events that match corresponding filters", + help => qqq(" + In ZoneMinder you can create event filters that specify whether + events that match certain criteria should have their details + emailed to you at a designated email address. This will allow + you to be notified of events as soon as they occur and also to + quickly view the events directly. This option specifies whether + this functionality should be available. The email created with + this option can be any size and is intended to be sent to a + regular email reader rather than a mobile device. + "), + type => $types{boolean}, + category => "mail", + }, + { + name => "ZM_EMAIL_ADDRESS", + default => "", + description => "The email address to send matching event details to", + requires => [ { name => "ZM_OPT_EMAIL", value => "yes" } ], + help => qqq(" + This option is used to define the email address that any events + that match the appropriate filters will be sent to. + "), + type => $types{email}, + category => "mail", + }, + { + name => "ZM_EMAIL_TEXT", + default => 'subject = "ZoneMinder: Alarm - %MN%-%EI% (%ESM% - %ESA% %EFA%)" body = " Hello, @@ -1027,24 +2105,30 @@ The details are as follows :- This alarm was matched by the %FN% filter and can be viewed at %EPS% ZoneMinder"', - description => "The text of the email used to send matching event details", - requires => [ { name => "ZM_OPT_EMAIL", value => "yes" } ], - help => "This option is used to define the content of the email that is sent for any events that match the appropriate filters.", - type => $types{text}, - category => "hidden", - }, - { - name => "ZM_EMAIL_SUBJECT", - default => "ZoneMinder: Alarm - %MN%-%EI% (%ESM% - %ESA% %EFA%)", - description => "The subject of the email used to send matching event details", - requires => [ { name => "ZM_OPT_EMAIL", value => "yes" } ], - help => "This option is used to define the subject of the email that is sent for any events that match the appropriate filters.", - type => $types{string}, - category => "mail", - }, - { - name => "ZM_EMAIL_BODY", - default => " + description => "The text of the email used to send matching event details", + requires => [ { name => "ZM_OPT_EMAIL", value => "yes" } ], + help => qqq(" + This option is used to define the content of the email that is + sent for any events that match the appropriate filters. + "), + type => $types{text}, + category => "hidden", + }, + { + name => "ZM_EMAIL_SUBJECT", + default => "ZoneMinder: Alarm - %MN%-%EI% (%ESM% - %ESA% %EFA%)", + description => "The subject of the email used to send matching event details", + requires => [ { name => "ZM_OPT_EMAIL", value => "yes" } ], + help => qqq(" + This option is used to define the subject of the email that is + sent for any events that match the appropriate filters. + "), + type => $types{string}, + category => "mail", + }, + { + name => "ZM_EMAIL_BODY", + default => " Hello, An alarm has been detected on your installation of the ZoneMinder. @@ -1060,944 +2144,1893 @@ The details are as follows :- This alarm was matched by the %FN% filter and can be viewed at %EPS% ZoneMinder", - description => "The body of the email used to send matching event details", - requires => [ { name => "ZM_OPT_EMAIL", value => "yes" } ], - help => "This option is used to define the content of the email that is sent for any events that match the appropriate filters.", - type => $types{text}, - category => "mail", - }, - { - name => "ZM_OPT_MESSAGE", - default => "no", - description => "Should ZoneMinder message you with details of events that match corresponding filters", - help => "In ZoneMinder you can create event filters that specify whether events that match certain criteria should have their details sent to you at a designated short message email address. This will allow you to be notified of events as soon as they occur. This option specifies whether this functionality should be available. The email created by this option will be brief and is intended to be sent to an SMS gateway or a minimal mail reader such as a mobile device or phone rather than a regular email reader.", - type => $types{boolean}, - category => "mail", - }, - { - name => "ZM_MESSAGE_ADDRESS", - default => "", - description => "The email address to send matching event details to", - requires => [ { name => "ZM_OPT_MESSAGE", value => "yes" } ], - help => "This option is used to define the short message email address that any events that match the appropriate filters will be sent to.", - type => $types{email}, - category => "mail", - }, - { - name => "ZM_MESSAGE_TEXT", - default => 'subject = "ZoneMinder: Alarm - %MN%-%EI%" + description => "The body of the email used to send matching event details", + requires => [ { name => "ZM_OPT_EMAIL", value => "yes" } ], + help => qqq(" + This option is used to define the content of the email that is + sent for any events that match the appropriate filters. + "), + type => $types{text}, + category => "mail", + }, + { + name => "ZM_OPT_MESSAGE", + default => "no", + description => "Should ZoneMinder message you with details of events that match corresponding filters", + help => qqq(" + In ZoneMinder you can create event filters that specify whether + events that match certain criteria should have their details + sent to you at a designated short message email address. This + will allow you to be notified of events as soon as they occur. + This option specifies whether this functionality should be + available. The email created by this option will be brief and + is intended to be sent to an SMS gateway or a minimal mail + reader such as a mobile device or phone rather than a regular + email reader. + "), + type => $types{boolean}, + category => "mail", + }, + { + name => "ZM_MESSAGE_ADDRESS", + default => "", + description => "The email address to send matching event details to", + requires => [ { name => "ZM_OPT_MESSAGE", value => "yes" } ], + help => qqq(" + This option is used to define the short message email address + that any events that match the appropriate filters will be sent + to. + "), + type => $types{email}, + category => "mail", + }, + { + name => "ZM_MESSAGE_TEXT", + default => 'subject = "ZoneMinder: Alarm - %MN%-%EI%" body = "ZM alarm detected - %EL% secs, %EF%/%EFA% frames, t%EST%/m%ESM%/a%ESA% score."', - description => "The text of the message used to send matching event details", - requires => [ { name => "ZM_OPT_MESSAGE", value => "yes" } ], - help => "This option is used to define the content of the message that is sent for any events that match the appropriate filters.", - type => $types{text}, - category => "hidden", - }, - { - name => "ZM_MESSAGE_SUBJECT", - default => "ZoneMinder: Alarm - %MN%-%EI%", - description => "The subject of the message used to send matching event details", - requires => [ { name => "ZM_OPT_MESSAGE", value => "yes" } ], - help => "This option is used to define the subject of the message that is sent for any events that match the appropriate filters.", - type => $types{string}, - category => "mail", - }, - { - name => "ZM_MESSAGE_BODY", - default => "ZM alarm detected - %EL% secs, %EF%/%EFA% frames, t%EST%/m%ESM%/a%ESA% score.", - description => "The body of the message used to send matching event details", - requires => [ { name => "ZM_OPT_MESSAGE", value => "yes" } ], - help => "This option is used to define the content of the message that is sent for any events that match the appropriate filters.", - type => $types{text}, - category => "mail", - }, - { - name => "ZM_NEW_MAIL_MODULES", - default => "no", - description => "Use a newer perl method to send emails", - requires => [ { name => "ZM_OPT_EMAIL", value => "yes" }, { name => "ZM_OPT_MESSAGE", value => "yes" } ], - help => "Traditionally ZoneMinder has used the MIME::Entity perl module to construct and send notification emails and messages. Some people have reported problems with this module not being present at all or flexible enough for their needs. If you are one of those people this option allows you to select a new mailing method using MIME::Lite and Net::SMTP instead. This method was contributed by Ross Melin and should work for everyone but has not been extensively tested so currently is not selected by default.", - type => $types{boolean}, - category => "mail", - }, - { - name => "ZM_EMAIL_HOST", - default => "localhost", - description => "The host address of your SMTP mail server", - requires => [ { name => "ZM_OPT_EMAIL", value => "yes" }, { name => "ZM_OPT_MESSAGE", value => "yes" } ], - help => "If you have chosen SMTP as the method by which to send notification emails or messages then this option allows you to choose which SMTP server to use to send them. The default of localhost may work if you have the sendmail, exim or a similar daemon running however you may wish to enter your ISP's SMTP mail server here.", - type => $types{hostname}, - category => "mail", - }, - { - name => "ZM_FROM_EMAIL", - default => "", - description => "The email address you wish your event notifications to originate from", - requires => [ { name => "ZM_OPT_EMAIL", value => "yes" }, { name => "ZM_OPT_MESSAGE", value => "yes" } ], - help => "The emails or messages that will be sent to you informing you of events can appear to come from a designated email address to help you with mail filtering etc. An address of something like ZoneMinder\@your.domain is recommended.", - type => $types{email}, - category => "mail", - }, - { - name => "ZM_URL", - default => "", - description => "The URL of your ZoneMinder installation", - requires => [ { name => "ZM_OPT_EMAIL", value => "yes" }, { name => "ZM_OPT_MESSAGE", value => "yes" } ], - help => "The emails or messages that will be sent to you informing you of events can include a link to the events themselves for easy viewing. If you intend to use this feature then set this option to the url of your installation as it would appear from where you read your email, e.g. http://host.your.domain/zm.php.", - type => $types{url}, - category => "mail", - }, - { - name => "ZM_MAX_RESTART_DELAY", - default => "600", - description => "Maximum delay (in seconds) for daemon restart attempts.", - help => "The zmdc (zm daemon control) process controls when processeses are started or stopped and will attempt to restart any that fail. If a daemon fails frequently then a delay is introduced between each restart attempt. If the daemon stills fails then this delay is increased to prevent extra load being placed on the system by continual restarts. This option controls what this maximum delay is.", - type => $types{integer}, - category => "system", - }, - { - name => "ZM_WATCH_CHECK_INTERVAL", - default => "10", - description => "How often to check the capture daemons have not locked up", - help => "The zmwatch daemon checks the image capture performance of the capture daemons to ensure that they have not locked up (rarely a sync error may occur which blocks indefinately). This option determines how often the daemons are checked.", - type => $types{integer}, - category => "system", - }, - { - name => "ZM_WATCH_MAX_DELAY", - default => "5", - description => "The maximum delay allowed since the last captured image", - help => "The zmwatch daemon checks the image capture performance of the capture daemons to ensure that they have not locked up (rarely a sync error may occur which blocks indefinately). This option determines the maximum delay to allow since the last captured frame. The daemon will be restarted if it has not captured any images after this period though the actual restart may take slightly longer in conjunction with the check interval value above.", - type => $types{decimal}, - category => "system", - }, - { + description => "The text of the message used to send matching event details", + requires => [ { name => "ZM_OPT_MESSAGE", value => "yes" } ], + help => qqq(" + This option is used to define the content of the message that + is sent for any events that match the appropriate filters. + "), + type => $types{text}, + category => "hidden", + }, + { + name => "ZM_MESSAGE_SUBJECT", + default => "ZoneMinder: Alarm - %MN%-%EI%", + description => "The subject of the message used to send matching event details", + requires => [ { name => "ZM_OPT_MESSAGE", value => "yes" } ], + help => qqq(" + This option is used to define the subject of the message that + is sent for any events that match the appropriate filters. + "), + type => $types{string}, + category => "mail", + }, + { + name => "ZM_MESSAGE_BODY", + default => "ZM alarm detected - %EL% secs, %EF%/%EFA% frames, t%EST%/m%ESM%/a%ESA% score.", + description => "The body of the message used to send matching event details", + requires => [ { name => "ZM_OPT_MESSAGE", value => "yes" } ], + help => qqq(" + This option is used to define the content of the message that + is sent for any events that match the appropriate filters. + "), + type => $types{text}, + category => "mail", + }, + { + name => "ZM_NEW_MAIL_MODULES", + default => "no", + description => "Use a newer perl method to send emails", + requires => [ + { name => "ZM_OPT_EMAIL", value => "yes" }, + { name => "ZM_OPT_MESSAGE", value => "yes" } + ], + help => qqq(" + Traditionally ZoneMinder has used the MIME::Entity perl module + to construct and send notification emails and messages. Some + people have reported problems with this module not being + present at all or flexible enough for their needs. If you are + one of those people this option allows you to select a new + mailing method using MIME::Lite and Net::SMTP instead. This + method was contributed by Ross Melin and should work for + everyone but has not been extensively tested so currently is + not selected by default. + "), + type => $types{boolean}, + category => "mail", + }, + { + name => "ZM_EMAIL_HOST", + default => "localhost", + description => "The host address of your SMTP mail server", + requires => [ + { name => "ZM_OPT_EMAIL", value => "yes" }, + { name => "ZM_OPT_MESSAGE", value => "yes" } + ], + help => qqq(" + If you have chosen SMTP as the method by which to send + notification emails or messages then this option allows you to + choose which SMTP server to use to send them. The default of + localhost may work if you have the sendmail, exim or a similar + daemon running however you may wish to enter your ISP's SMTP + mail server here. + "), + type => $types{hostname}, + category => "mail", + }, + { + name => "ZM_FROM_EMAIL", + default => "", + description => "The email address you wish your event notifications to originate from", + requires => [ + { name => "ZM_OPT_EMAIL", value => "yes" }, + { name => "ZM_OPT_MESSAGE", value => "yes" } + ], + help => qqq(" + The emails or messages that will be sent to you informing you + of events can appear to come from a designated email address to + help you with mail filtering etc. An address of something like + ZoneMinder\@your.domain is recommended. + "), + type => $types{email}, + category => "mail", + }, + { + name => "ZM_URL", + default => "", + description => "The URL of your ZoneMinder installation", + requires => [ + { name => "ZM_OPT_EMAIL", value => "yes" }, + { name => "ZM_OPT_MESSAGE", value => "yes" } + ], + help => qqq(" + The emails or messages that will be sent to you informing you + of events can include a link to the events themselves for easy + viewing. If you intend to use this feature then set this option + to the url of your installation as it would appear from where + you read your email, e.g. http://host.your.domain/zm.php. + "), + type => $types{url}, + category => "mail", + }, + { + name => "ZM_MAX_RESTART_DELAY", + default => "600", + description => "Maximum delay (in seconds) for daemon restart attempts.", + help => qqq(" + The zmdc (zm daemon control) process controls when processeses + are started or stopped and will attempt to restart any that + fail. If a daemon fails frequently then a delay is introduced + between each restart attempt. If the daemon stills fails then + this delay is increased to prevent extra load being placed on + the system by continual restarts. This option controls what + this maximum delay is. + "), + type => $types{integer}, + category => "system", + }, + { + name => "ZM_WATCH_CHECK_INTERVAL", + default => "10", + description => "How often to check the capture daemons have not locked up", + help => qqq(" + The zmwatch daemon checks the image capture performance of the + capture daemons to ensure that they have not locked up (rarely + a sync error may occur which blocks indefinitely). This option + determines how often the daemons are checked. + "), + type => $types{integer}, + category => "system", + }, + { + name => "ZM_WATCH_MAX_DELAY", + default => "5", + description => "The maximum delay allowed since the last captured image", + help => qqq(" + The zmwatch daemon checks the image capture performance of the + capture daemons to ensure that they have not locked up (rarely + a sync error may occur which blocks indefinitely). This option + determines the maximum delay to allow since the last captured + frame. The daemon will be restarted if it has not captured any + images after this period though the actual restart may take + slightly longer in conjunction with the check interval value + above. + "), + type => $types{decimal}, + category => "system", + }, + { - name => "ZM_RUN_AUDIT", - default => "yes", - description => "Run zmaudit to check data consistency", - help => "The zmaudit daemon exists to check that the saved information in the database and on the filesystem match and are consistent with each other. If an error occurs or if you are using 'fast deletes' it may be that database records are deleted but files remain. In this case, and similar, zmaudit will remove redundant information to synchronise the two data stores. This option controls whether zmaudit is run in the background and performs these checks and fixes continuously. This is recommended for most systems however if you have a very large number of events the process of scanning the database and filesystem may take a long time and impact performance. In this case you may prefer to not have zmaudit running unconditionally and schedule occasional checks at other, more convenient, times.", - type => $types{boolean}, - category => "system", - }, - { + name => "ZM_RUN_AUDIT", + default => "yes", + description => "Run zmaudit to check data consistency", + help => qqq(" + The zmaudit daemon exists to check that the saved information + in the database and on the filesystem match and are consistent + with each other. If an error occurs or if you are using 'fast + deletes' it may be that database records are deleted but files + remain. In this case, and similar, zmaudit will remove + redundant information to synchronise the two data stores. This + option controls whether zmaudit is run in the background and + performs these checks and fixes continuously. This is + recommended for most systems however if you have a very large + number of events the process of scanning the database and + filesystem may take a long time and impact performance. In this + case you may prefer to not have zmaudit running unconditionally + and schedule occasional checks at other, more convenient, + times. + "), + type => $types{boolean}, + category => "system", + }, + { - name => "ZM_AUDIT_CHECK_INTERVAL", - default => "900", - description => "How often to check database and filesystem consistency", - help => "The zmaudit daemon exists to check that the saved information in the database and on the filesystem match and are consistent with each other. If an error occurs or if you are using 'fast deletes' it may be that database records are deleted but files remain. In this case, and similar, zmaudit will remove redundant information to synchronise the two data stores. The default check interval of 900 seconds (15 minutes) is fine for most systems however if you have a very large number of events the process of scanning the database and filesystem may take a long time and impact performance. In this case you may prefer to make this interval much larger to reduce the impact on your system. This option determines how often these checks are performed.", - type => $types{integer}, - category => "system", - }, - { - name => "ZM_FORCED_ALARM_SCORE", - default => "255", - description => "Score to give forced alarms", - help => "The 'zmu' utility can be used to force an alarm on a monitor rather than rely on the motion detection algorithms. This option determines what score to give these alarms to distinguish them from regular ones. It must be 255 or less.", - type => $types{integer}, - category => "config", - }, - { - name => "ZM_BULK_FRAME_INTERVAL", - default => "100", - description => "How often a bulk frame should be written to the database", - help => "Traditionally ZoneMinder writes an entry into the Frames database table for each frame that is captured and saved. This works well in motion detection scenarios but when in a DVR situation ('Record' or 'Mocord' mode) this results in a huge number of frame writes and a lot of database and disk bandwidth for very little additional information. Setting this to a non-zero value will enabled ZoneMinder to group these non-alarm frames into one 'bulk' frame entry which saves a lot of bandwidth and space. The only disadvantage of this is that timing information for individual frames is lost but in constant frame rate situations this is usually not significant. This setting is ignored in Modect mode and individual frames are still written if an alarm occurs in Mocord mode also.", - type => $types{integer}, - category => "config", - }, - { - name => "ZM_EVENT_CLOSE_MODE", - default => "idle", - description => "When continuous events are closed.", - help => "When a monitor is running in a continuous recording mode (Record or Mocord) events are usually closed after a fixed period of time (the section length). However in Mocord mode it is possible that motion detection may occur near the end of a section. This option controls what happens when an alarm occurs in Mocord mode. The 'time' setting means that the event will be closed at the end of the section regardless of alarm activity. The 'idle' setting means that the event will be closed at the end of the section if there is no alarm activity occuring at the time otherwise it will be closed once the alarm is over meaning the event may end up being longer than the normal section length. The 'alarm' setting means that if an alarm occurs during the event, the event will be closed once the alarm is over regardless of when this occurs. This has the effect of limiting the number of alarms to one per event and the events will be shorter than the section length if an alarm has occurred.", - type => $types{boolean}, - type => { db_type=>"string", hint=>"time|idle|alarm", pattern=>qr|^([tia])|i, format=>q( ($1 =~ /^t/) ? "time" : ($1 =~ /^i/ ? "idle" : "time" ) ) }, - category => "config", - }, + name => "ZM_AUDIT_CHECK_INTERVAL", + default => "900", + description => "How often to check database and filesystem consistency", + help => qqq(" + The zmaudit daemon exists to check that the saved information + in the database and on the filesystem match and are consistent + with each other. If an error occurs or if you are using 'fast + deletes' it may be that database records are deleted but files + remain. In this case, and similar, zmaudit will remove + redundant information to synchronise the two data stores. The + default check interval of 900 seconds (15 minutes) is fine for + most systems however if you have a very large number of events + the process of scanning the database and filesystem may take a + long time and impact performance. In this case you may prefer + to make this interval much larger to reduce the impact on your + system. This option determines how often these checks are + performed. + "), + type => $types{integer}, + category => "system", + }, + { + name => "ZM_FORCED_ALARM_SCORE", + default => "255", + description => "Score to give forced alarms", + help => qqq(" + The 'zmu' utility can be used to force an alarm on a monitor + rather than rely on the motion detection algorithms. This + option determines what score to give these alarms to + distinguish them from regular ones. It must be 255 or less. + "), + type => $types{integer}, + category => "config", + }, + { + name => "ZM_BULK_FRAME_INTERVAL", + default => "100", + description => "How often a bulk frame should be written to the database", + help => qqq(" + Traditionally ZoneMinder writes an entry into the Frames + database table for each frame that is captured and saved. This + works well in motion detection scenarios but when in a DVR + situation ('Record' or 'Mocord' mode) this results in a huge + number of frame writes and a lot of database and disk bandwidth + for very little additional information. Setting this to a + non-zero value will enabled ZoneMinder to group these non-alarm + frames into one 'bulk' frame entry which saves a lot of + bandwidth and space. The only disadvantage of this is that + timing information for individual frames is lost but in + constant frame rate situations this is usually not significant. + This setting is ignored in Modect mode and individual frames + are still written if an alarm occurs in Mocord mode also. + "), + type => $types{integer}, + category => "config", + }, + { + name => "ZM_EVENT_CLOSE_MODE", + default => "idle", + description => "When continuous events are closed.", + help => qqq(" + When a monitor is running in a continuous recording mode + (Record or Mocord) events are usually closed after a fixed + period of time (the section length). However in Mocord mode it + is possible that motion detection may occur near the end of a + section. This option controls what happens when an alarm occurs + in Mocord mode. The 'time' setting means that the event will be + closed at the end of the section regardless of alarm activity. + The 'idle' setting means that the event will be closed at the + end of the section if there is no alarm activity occurring at + the time otherwise it will be closed once the alarm is over + meaning the event may end up being longer than the normal + section length. The 'alarm' setting means that if an alarm + occurs during the event, the event will be closed once the + alarm is over regardless of when this occurs. This has the + effect of limiting the number of alarms to one per event and + the events will be shorter than the section length if an alarm + has occurred. + "), + type => $types{boolean}, + type => { + db_type =>"string", + hint =>"time|idle|alarm", + pattern =>qr|^([tia])|i, + format =>q( ($1 =~ /^t/) + ? "time" + : ($1 =~ /^i/ ? "idle" : "time" ) + ) + }, + category => "config", + }, # Deprecated, superseded by event close mode - { - name => "ZM_FORCE_CLOSE_EVENTS", - default => "no", - description => "Close events at section ends.", - help => "When a monitor is running in a continuous recording mode (Record or Mocord) events are usually closed after a fixed period of time (the section length). However in Mocord mode it is possible that motion detection may occur near the end of a section and ordinarily this will prevent the event being closed until the motion has ceased. Switching this option on will force the event closed at the specified time regardless of any motion activity.", - type => $types{boolean}, - category => "hidden", - }, - { - name => "ZM_CREATE_ANALYSIS_IMAGES", - default => "yes", - description => "Create analysed alarm images with motion outlined", - help => "By default during an alarm ZoneMinder records both the raw captured image and one that has been analysed and had areas where motion was detected outlined. This can be very useful during zone configuration or in analysing why events occured. However it also incurs some overhead and in a stable system may no longer be necessary. This parameter allows you to switch the generation of these images off.", - type => $types{boolean}, - category => "config", - }, - { - name => "ZM_WEIGHTED_ALARM_CENTRES", - default => "no", - description => "Use a weighted algorithm to calculate the centre of an alarm", - help => "ZoneMinder will always calculate the centre point of an alarm in a zone to give some indication of where on the screen it is. This can be used by the experimental motion tracking feature or your own custom extensions. In the alarmed or filtered pixels mode this is a simple midpoint between the extents of the detected pxiesl. However in the blob method this can instead be calculated using weighted pixel locations to give more accurate positioning for irregularly shaped blobs. This method, while more precise is also slower and so is turned off by default.", - type => $types{boolean}, - category => "config", - }, - { - name => "ZM_EVENT_IMAGE_DIGITS", - default => "5", - description => "How many significant digits are used in event image numbering", - help => "As event images are captured they are stored to the filesystem with a numerical index. By default this index has three digits so the numbers start 001, 002 etc. This works works for most scenarios as events with more than 999 frames are rarely captured. However if you have extremely long events and use external applications then you may wish to increase this to ensure correct sorting of images in listings etc. Warning, increasing this value on a live system may render existing events unviewable as the event will have been saved with the previous scheme. Decreasing this value should have no ill effects.", - type => $types{integer}, - category => "config", - }, - { - name => "ZM_DEFAULT_ASPECT_RATIO", - default => "4:3", - description => "The default width:height aspect ratio used in monitors", - help => "When specifying the dimensions of monitors you can click a checkbox to ensure that the width stays in the correct ratio to the height, or vice versa. This setting allows you to indicate what the ratio of these settings should be. This should be specified in the format : and the default of 4:3 normally be acceptable but 11:9 is another common setting. If the checkbox is not clicked when specifying monitor dimensions this setting has no effect.", - type => $types{string}, - category => "config", - }, - { - name => "ZM_USER_SELF_EDIT", - default => "no", - description => "Allow unprivileged users to change their details", - help => "Ordinarily only users with system edit privilege are able to change users details. Switching this option on allows ordinary users to change their passwords and their language settings", - type => $types{boolean}, - category => "config", - }, - { - name => "ZM_OPT_FRAME_SERVER", - default => "no", - description => "Should analysis farm out the writing of images to disk", - #requires => [ { name => "ZM_OPT_ADAPTIVE_SKIP", value => "yes" } ], - help => "In some circumstances it is possible for a slow disk to take so long writing images to disk that it causes the analysis daemon to fall behind especially during high frame rate events. Setting this option to yes enables a frame server daemon (zmf) which will be sent the images from the analysis daemon and will do the actual writing of images itself freeing up the analysis daemon to get on with other things. Should this transmission fail or other permanent or transient error occur, this function will fall back to the analysis daemon.", - type => $types{boolean}, - category => "system", - }, - { - name => "ZM_FRAME_SOCKET_SIZE", - default => "0", - description => "Specify the frame server socket buffer size if non-standard", - requires => [ { name => "ZM_OPT_FRAME_SERVER", value => "yes" } ], - help => "For large captured images it is possible for the writes from the analysis daemon to the frame server to fail as the amount to be written exceeds the default buffer size. While the images are then written by the analysis daemon so no data is lost, it defeats the object of the frame server daemon in the first place. You can use this option to indicate that a larger buffer size should be used. Note that you may have to change the existing maximum socket buffer size on your system via sysctl (or in /proc/sys/net/core/wmem_max) to allow this new size to be set. Alternatively you can change the default buffer size on your system in the same way in which case that will be used with no change necessary in this option", - type => $types{integer}, - category => "system", - }, - { - name => "ZM_OPT_CONTROL", - default => "no", - description => "Support controllable (e.g. PTZ) cameras", - help => "ZoneMinder includes limited support for controllable cameras. A number of sample protocols are included and others can easily be added. If you wish to control your cameras via ZoneMinder then select this option otherwise if you only have static cameras or use other control methods then leave this option off.", - type => $types{boolean}, - category => "system", - }, - { - name => "ZM_OPT_TRIGGERS", - default => "no", - description => "Interface external event triggers via socket or device files", - help => "ZoneMinder can interact with external systems which prompt or cancel alarms. This is done via the zmtrigger.pl script. This option indicates whether you want to use these external triggers. Most people will say no here.", - type => $types{boolean}, - category => "system", - }, - { - name => "ZM_CHECK_FOR_UPDATES", - default => "yes", - description => "Check with zoneminder.com for updated versions", - help => "From ZoneMinder version 1.17.0 onwards new versions are expected to be more frequent. To save checking manually for each new version ZoneMinder can check with the zoneminder.com website to determine the most recent release. These checks are infrequent, about once per week, and no personal or system information is transmitted other than your current version number. If you do not wish these checks to take place or your ZoneMinder system has no internet access you can switch these check off with this configuration variable", - type => $types{boolean}, - category => "system", - }, - { - name => "ZM_UPDATE_CHECK_PROXY", - default => "", - description => "Proxy url if required to access zoneminder.com", - help => "If you use a proxy to access the internet then ZoneMinder needs to know so it can access zoneminder.com to check for updates. If you do use a proxy enter the full proxy url here in the form of http://:/", - type => $types{string}, - category => "system", - }, - { - name => "ZM_SHM_KEY", - default => "0x7a6d0000", - description => "Shared memory root key to use", - help => "ZoneMinder uses shared memory to speed up communication between modules. To identify the right area to use shared memory keys are used. This option controls what the base key is, each monitor will have it's Id or'ed with this to get the actual key used. You will not normally need to change this value unless it clashes with another instance of ZoneMinder on the same machine. Only the first four hex digits are used, the lower four will be masked out and ignored.", - type => $types{hexadecimal}, - category => "system", - }, + { + name => "ZM_FORCE_CLOSE_EVENTS", + default => "no", + description => "Close events at section ends.", + help => qqq(" + When a monitor is running in a continuous recording mode + (Record or Mocord) events are usually closed after a fixed + period of time (the section length). However in Mocord mode it + is possible that motion detection may occur near the end of a + section and ordinarily this will prevent the event being closed + until the motion has ceased. Switching this option on will + force the event closed at the specified time regardless of any + motion activity. + "), + type => $types{boolean}, + category => "hidden", + }, + { + name => "ZM_CREATE_ANALYSIS_IMAGES", + default => "yes", + description => "Create analysed alarm images with motion outlined", + help => qqq(" + By default during an alarm ZoneMinder records both the raw + captured image and one that has been analysed and had areas + where motion was detected outlined. This can be very useful + during zone configuration or in analysing why events occurred. + However it also incurs some overhead and in a stable system may + no longer be necessary. This parameter allows you to switch the + generation of these images off. + "), + type => $types{boolean}, + category => "config", + }, + { + name => "ZM_WEIGHTED_ALARM_CENTRES", + default => "no", + description => "Use a weighted algorithm to calculate the centre of an alarm", + help => qqq(" + ZoneMinder will always calculate the centre point of an alarm + in a zone to give some indication of where on the screen it is. + This can be used by the experimental motion tracking feature or + your own custom extensions. In the alarmed or filtered pixels + mode this is a simple midpoint between the extents of the + detected pxiesl. However in the blob method this can instead be + calculated using weighted pixel locations to give more accurate + positioning for irregularly shaped blobs. This method, while + more precise is also slower and so is turned off by default. + "), + type => $types{boolean}, + category => "config", + }, + { + name => "ZM_EVENT_IMAGE_DIGITS", + default => "5", + description => "How many significant digits are used in event image numbering", + help => qqq(" + As event images are captured they are stored to the filesystem + with a numerical index. By default this index has three digits + so the numbers start 001, 002 etc. This works works for most + scenarios as events with more than 999 frames are rarely + captured. However if you have extremely long events and use + external applications then you may wish to increase this to + ensure correct sorting of images in listings etc. Warning, + increasing this value on a live system may render existing + events unviewable as the event will have been saved with the + previous scheme. Decreasing this value should have no ill + effects. + "), + type => $types{integer}, + category => "config", + }, + { + name => "ZM_DEFAULT_ASPECT_RATIO", + default => "4:3", + description => "The default width:height aspect ratio used in monitors", + help => qqq(" + When specifying the dimensions of monitors you can click a + checkbox to ensure that the width stays in the correct ratio to + the height, or vice versa. This setting allows you to indicate + what the ratio of these settings should be. This should be + specified in the format : and the + default of 4:3 normally be acceptable but 11:9 is another + common setting. If the checkbox is not clicked when specifying + monitor dimensions this setting has no effect. + "), + type => $types{string}, + category => "config", + }, + { + name => "ZM_USER_SELF_EDIT", + default => "no", + description => "Allow unprivileged users to change their details", + help => qqq(" + Ordinarily only users with system edit privilege are able to + change users details. Switching this option on allows ordinary + users to change their passwords and their language settings + "), + type => $types{boolean}, + category => "config", + }, + { + name => "ZM_OPT_FRAME_SERVER", + default => "no", + description => "Should analysis farm out the writing of images to disk", + #requires => [ { name => "ZM_OPT_ADAPTIVE_SKIP", value => "yes" } ], + help => qqq(" + In some circumstances it is possible for a slow disk to take so + long writing images to disk that it causes the analysis daemon + to fall behind especially during high frame rate events. + Setting this option to yes enables a frame server daemon (zmf) + which will be sent the images from the analysis daemon and will + do the actual writing of images itself freeing up the analysis + daemon to get on with other things. Should this transmission + fail or other permanent or transient error occur, this function + will fall back to the analysis daemon. + "), + type => $types{boolean}, + category => "system", + }, + { + name => "ZM_FRAME_SOCKET_SIZE", + default => "0", + description => "Specify the frame server socket buffer size if non-standard", + requires => [ { name => "ZM_OPT_FRAME_SERVER", value => "yes" } ], + help => qqq(" + For large captured images it is possible for the writes from + the analysis daemon to the frame server to fail as the amount + to be written exceeds the default buffer size. While the images + are then written by the analysis daemon so no data is lost, it + defeats the object of the frame server daemon in the first + place. You can use this option to indicate that a larger buffer + size should be used. Note that you may have to change the + existing maximum socket buffer size on your system via sysctl + (or in /proc/sys/net/core/wmem_max) to allow this new size to + be set. Alternatively you can change the default buffer size on + your system in the same way in which case that will be used + with no change necessary in this option + "), + type => $types{integer}, + category => "system", + }, + { + name => "ZM_OPT_CONTROL", + default => "no", + description => "Support controllable (e.g. PTZ) cameras", + help => qqq(" + ZoneMinder includes limited support for controllable cameras. A + number of sample protocols are included and others can easily + be added. If you wish to control your cameras via ZoneMinder + then select this option otherwise if you only have static + cameras or use other control methods then leave this option + off. + "), + type => $types{boolean}, + category => "system", + }, + { + name => "ZM_OPT_TRIGGERS", + default => "no", + description => "Interface external event triggers via socket or device files", + help => qqq(" + ZoneMinder can interact with external systems which prompt or + cancel alarms. This is done via the zmtrigger.pl script. This + option indicates whether you want to use these external + triggers. Most people will say no here. + "), + type => $types{boolean}, + category => "system", + }, + { + name => "ZM_CHECK_FOR_UPDATES", + default => "yes", + description => "Check with zoneminder.com for updated versions", + help => qqq(" + From ZoneMinder version 1.17.0 onwards new versions are + expected to be more frequent. To save checking manually for + each new version ZoneMinder can check with the zoneminder.com + website to determine the most recent release. These checks are + infrequent, about once per week, and no personal or system + information is transmitted other than your current version + number. If you do not wish these checks to take place or your + ZoneMinder system has no internet access you can switch these + check off with this configuration variable + "), + type => $types{boolean}, + category => "system", + }, + { + name => "ZM_UPDATE_CHECK_PROXY", + default => "", + description => "Proxy url if required to access zoneminder.com", + help => qqq(" + If you use a proxy to access the internet then ZoneMinder needs + to know so it can access zoneminder.com to check for updates. + If you do use a proxy enter the full proxy url here in the form + of http://:/ + "), + type => $types{string}, + category => "system", + }, + { + name => "ZM_SHM_KEY", + default => "0x7a6d0000", + description => "Shared memory root key to use", + help => qqq(" + ZoneMinder uses shared memory to speed up communication between + modules. To identify the right area to use shared memory keys + are used. This option controls what the base key is, each + monitor will have it's Id or'ed with this to get the actual key + used. You will not normally need to change this value unless it + clashes with another instance of ZoneMinder on the same + machine. Only the first four hex digits are used, the lower + four will be masked out and ignored. + "), + type => $types{hexadecimal}, + category => "system", + }, # Deprecated, really no longer necessary - { - name => "ZM_WEB_REFRESH_METHOD", - default => "javascript", - description => "What method windows should use to refresh themselves", - help => "Many windows in Javascript need to refresh themselves to keep their information current. This option determines what method they should use to do this. Choosing 'javascript' means that each window will have a short JavaScript statement in with a timer to prompt the refresh. This is the most compatible method. Choosing 'http' means the refresh instruction is put in the HTTP header. This is a cleaner method but refreshes are interrupted or cancelled when a link in the window is clicked meaning that the window will no longer refresh and this would have to be done manually.", - type => { db_type=>"string", hint=>"javascript|http", pattern=>qr|^([jh])|i, format=>q( $1 =~ /^j/ ? "javascript" : "http" ) }, - category => "hidden", - }, - { - name => "ZM_WEB_EVENT_SORT_FIELD", - default => "DateTime", - description => "Default field the event lists are sorted by", - help => "Events in lists can be initially ordered in any way you want. This option controls what field is used to sort them. You can modify this ordering from filters or by clicking on headings in the lists themselves. Bear in mind however that the 'Prev' and 'Next' links, when scrolling through events, relate to the ordering in the lists and so not always to time based ordering.", - type => { db_type=>"string", hint=>"Id|Name|Cause|MonitorName|DateTime|Length|Frames|AlarmFrames|TotScore|AvgScore|MaxScore", pattern=>qr|.|, format=>q( $1 ) }, - category => "web", - }, - { - name => "ZM_WEB_EVENT_SORT_ORDER", - default => "asc", - description => "Default order the event lists are sorted by", - help => "Events in lists can be initially ordered in any way you want. This option controls what order (ascending or descending) is used to sort them. You can modify this ordering from filters or by clicking on headings in the lists themselves. Bear in mind however that the 'Prev' and 'Next' links, when scrolling through events, relate to the ordering in the lists and so not always to time based ordering.", - type => { db_type=>"string", hint=>"asc|desc", pattern=>qr|^([ad])|i, format=>q( $1 =~ /^a/i ? "asc" : "desc" ) }, - category => "web", - }, - { - name => "ZM_WEB_EVENTS_PER_PAGE", - default => "25", - description => "How many events to list per page in paged mode", - help => "In the event list view you can either list all events or just a page at a time. This option controls how many events are listed per page in paged mode and how often to repeat the column headers in non-paged mode.", - type => $types{integer}, - category => "web", - }, - { - name => "ZM_WEB_LIST_THUMBS", - default => "no", - description => "Display mini-thumbnails of event images in event lists", - help => "Ordinarily the event lists just display text details of the events to save space and time. By switching this option on you can also display small thumbnails to help you identify events of interest. The size of these thumbnails is controlled by the following two options.", - type => $types{boolean}, - category => "web", - }, - { - name => "ZM_WEB_LIST_THUMB_WIDTH", - default => "48", - description => "The width of the thumbnails that appear in the event lists", - help => "This options controls the width of the thumbnail images that appear in the event lists. It should be fairly small to fit in with the rest of the table. If you prefer you can specify a height instead in the next option but you should only use one of the width or height and the other option should be set to zero. If both width and height are specified then width will be used and height ignored.", - type => $types{integer}, - requires => [ { name => "ZM_WEB_LIST_THUMBS", value => "yes" } ], - category => "web", - }, - { - name => "ZM_WEB_LIST_THUMB_HEIGHT", - default => "0", - description => "The height of the thumbnails that appear in the event lists", - help => "This options controls the height of the thumbnail images that appear in the event lists. It should be fairly small to fit in with the rest of the table. If you prefer you can specify a width instead in the previous option but you should only use one of the width or height and the other option should be set to zero. If both width and height are specified then width will be used and height ignored.", - type => $types{integer}, - requires => [ { name => "ZM_WEB_LIST_THUMBS", value => "yes" } ], - category => "web", - }, - { - name => "ZM_WEB_USE_OBJECT_TAGS", - default => "yes", - description => "Wrap embed in object tags for media content", - help => "There are two methods of including media content in web pages. The most common way is use the EMBED tag which is able to give some indication of the type of content. However this is not a standard part of HTML. The official method is to use OBJECT tags which are able to give more information allowing the correct media viewers etc to be loaded. However these are less widely supported and content may be specifically tailored to a particular platform or player. This option controls whether media content is enclosed in EMBED tags only or whether, where appropriate, it is additionally wrapped in OBJECT tags. Currently OBJECT tags are only used in a limited number of circumstances but they may become more widespread in the future. It is suggested that you leave this option on unless you encounter problems playing some content.", - type => $types{boolean}, - category => "web", - }, - { - name => "ZM_WEB_H_REFRESH_MAIN", - default => "60", - introduction => "There are now a number of options that are grouped into bandwidth categories, this allows you to configure the ZoneMinder client to work optimally over the various access methods you might to access the client.\n\nThe next few options control what happens when the client is running in 'high' bandwidth mode. You should set these options for when accessing the ZoneMinder client over a local network or high speed link. In most cases the default values will be suitable as a starting point.", - description => "How often (in seconds) the main console window should refresh itself", - help => "The main console window lists a general status and the event totals for all monitors. This is not a trivial task and should not be repeated too frequently or it may affect the performance of the rest of the system.", - type => $types{integer}, - category => "highband", - }, - { - name => "ZM_WEB_H_REFRESH_CYCLE", - default => "10", - description => "How often (in seconds) the cycle watch window swaps to the next monitor", - help => "The cycle watch window is a method of continuously cycling between images from all of your monitors. This option determines how often to refresh with a new image.", - type => $types{integer}, - category => "highband", - }, - { - name => "ZM_WEB_H_REFRESH_IMAGE", - default => "3", - description => "How often (in seconds) the watched image is refreshed (if not streaming)", - help => "The live images from a monitor can be viewed in either streamed or stills mode. This option determines how often a stills image is refreshed, it has no effect if streaming is selected.", - type => $types{integer}, - category => "highband", - }, - { - name => "ZM_WEB_H_REFRESH_STATUS", - default => "1", - description => "How often (in seconds) the status refreshes itself in the watch window", - help => "The monitor window is actually made from several frames. The one in the middle merely contains a monitor status which needs to refresh fairly frequently to give a true indication. This option determines that frequency.", - type => $types{integer}, - category => "highband", - }, - { - name => "ZM_WEB_H_REFRESH_EVENTS", - default => "5", - description => "How often (in seconds) the event listing is refreshed in the watch window", - help => "The monitor window is actually made from several frames. The lower framme contains a listing of the last few events for easy access. This option determines how often this is refreshed.", - type => $types{integer}, - category => "highband", - }, - { - name => "ZM_WEB_H_CAN_STREAM", - default => "auto", - description => "Override the automatic detection of browser streaming capability", - help => "If you know that your browser can handle image streams of the type 'multipart/x-mixed-replace' but ZoneMinder does not detect this correctly you can set this option to ensure that the stream is delivered with or without the use of the Cambozola plugin. Selecting 'yes' will tell ZoneMinder that your browser can handle the streams natively, 'no' means that it can't and so the plugin will be used while 'auto' lets ZoneMinder decide.", - type => $types{tristate}, - category => "highband", - }, - { - name => "ZM_WEB_H_STREAM_METHOD", - default => "jpeg", - description => "Which method should be used to send video streams to your browser.", - help => "ZoneMinder can be configured to use either mpeg encoded video or a series or still jpeg images when sending video streams. This option defines which is used. If you choose mpeg you should ensure that you have the appropriate plugins available on your browser whereas choosing jpeg will work natively on Mozilla and related browsers and with a Java applet on Internet Explorer", - type => { db_type=>"string", hint=>"mpeg|jpeg", pattern=>qr|^([mj])|i, format=>q( $1 =~ /^m/ ? "mpeg" : "jpeg" ) }, - category => "highband", - }, - { - name => "ZM_WEB_H_DEFAULT_SCALE", - default => "100", - description => "What the default scaling factor applied to 'live' or 'event' views is (%)", - help => "Normally ZoneMinder will display 'live' or 'event' streams in their native size. However if you have monitors with large dimensions or a slow link you may prefer to reduce this size, alternatively for small monitors you can enlarge it. This options lets you specify what the default scaling factor will be. It is expressed as a percentage so 100 is normal size, 200 is double size etc.", - type => { db_type=>"integer", hint=>"25|33|50|75|100|150|200|300|400", pattern=>qr|^(\d+)$|, format=>q( $1 ) }, - category => "highband", - }, - { - name => "ZM_WEB_H_DEFAULT_RATE", - default => "100", - description => "What the default replay rate factor applied to 'event' views is (%)", - help => "Normally ZoneMinder will display 'event' streams at their native rate, i.e. as close to real-time as possible. However if you have long events it is often convenient to replay them at a faster rate for review. This option lets you specify what the default replay rate will be. It is expressed as a percentage so 100 is normal rate, 200 is double speed etc.", - type => { db_type=>"integer", hint=>"25|50|100|150|200|400|1000|2500|5000|10000", pattern=>qr|^(\d+)$|, format=>q( $1 ) }, - category => "highband", - }, - { - name => "ZM_WEB_H_VIDEO_BITRATE", - default => "150000", - description => "What the bitrate of the video encoded stream should be set to", - help => "When encoding real video via the ffmpeg library a bit rate can be specified which roughly corresponds to the available bandwidth used for the stream. This setting effectively corresponds to a 'quality' setting for the video. A low value will result in a blocky image whereas a high value will produce a clearer view. Note that this setting does not control the frame rate of the video however the quality of the video produced is affected both by this setting and the frame rate that the video is produced at. A higher frame rate at a particular bit rate result in individual frames being at a lower quality.", - type => $types{integer}, - category => "highband", - }, - { - name => "ZM_WEB_H_VIDEO_MAXFPS", - default => "30", - description => "What the maximum frame rate for streamed video should be", - help => "When using streamed video the main control is the bitrate which determines how much data can be transmitted. However a lower bitrate at high frame rates results in a lower quality image. This option allows you to limit the maximum frame rate to ensure that video quality is maintained. An additional advantage is that encoding video at high frame rates is a processor intensive task when for the most part a very high frame rate offers little perceptible improvement over one that has a more manageable resource requirement. Note, this option is implemented as a cap beyond which binary reduction takes place. So if you have a device capturing at 15fps and set this option to 10fps then the video is not produced at 10fps, but rather at 7.5fps (15 divided by 2) as the final frame rate must be the original divided by a power of 2.", - type => $types{integer}, - category => "highband", - }, - { - name => "ZM_WEB_H_SCALE_THUMBS", - default => "no", - description => "Scale thumbnails in events, bandwidth versus cpu in rescaling", - help => "If unset, this option sends the whole image to the browser which resizes it in the window. If set the image is scaled down on the server before sending a reduced size image to the browser to conserve bandwidth at the cost of cpu on the server. Note that ZM can only perform the resizing if the appropriate PHP graphics functionality is installed. This is usually available in the php-gd package.", - type => $types{boolean}, - category => "highband", - }, - { - name => "ZM_WEB_H_EVENTS_VIEW", - default => "events", - description => "What the default view of multiple events should be.", - help => "Stored events can be viewed in either an events list format or in a timeline based one. This option sets the default view that will be used. Choosing one view here does not prevent the other view being used as it will always be selectable from whichever view is currently being used.", - type => { db_type=>"string", hint=>"events|timeline", pattern=>qr|^([lt])|i, format=>q( $1 =~ /^e/ ? "events" : "timeline" ) }, - category => "highband", - }, - { - name => "ZM_WEB_H_SHOW_PROGRESS", - default => "yes", - description => "Show the progress of replay in event view.", - help => "When viewing events an event navigation panel and progress bar is shown below the event itself. This allows you to jump to specific points in the event, but can can also dynamically update to display the current progress of the event replay itself. This progress is calculated from the actual event duration and is not directly linked to the replay itself, so on limited bandwidth connections may be out of step with the replay. This option allows you to turn off the progress display, whilst still keeping the navigation aspect, where bandwidth prevents it functioning effectively.", - type => $types{boolean}, - category => "highband", - }, - { - name => "ZM_WEB_H_AJAX_TIMEOUT", - default => "3000", - description => "How long to wait for Ajax request responses (ms)", - help => "The newer versions of the live feed and event views use Ajax to request information from the server and populate the views dynamically. This option allows you to specify a timeout if required after which requests are abandoned. A timeout may be necessary if requests would overwise hang such as on a slow connection. This would tend to consume a lot of browser memory and make the interface unresponsive. Ordinarily no requests should timeout so this setting should be set to a value greater than the slowest expected response. This value is in milliseconds but if set to zero then no timeout will be used.", - type => $types{integer}, - category => "highband", - }, - { - name => "ZM_WEB_M_REFRESH_MAIN", - default => "300", - description => "How often (in seconds) the main console window should refresh itself", - help => "The main console window lists a general status and the event totals for all monitors. This is not a trivial task and should not be repeated too frequently or it may affect the performance of the rest of the system.", - type => $types{integer}, - introduction => "The next few options control what happens when the client is running in 'medium' bandwidth mode. You should set these options for when accessing the ZoneMinder client over a slower cable or DSL link. In most cases the default values will be suitable as a starting point.", - category => "medband", - }, - { - name => "ZM_WEB_M_REFRESH_CYCLE", - default => "20", - description => "How often (in seconds) the cycle watch window swaps to the next monitor", - help => "The cycle watch window is a method of continuously cycling between images from all of your monitors. This option determines how often to refresh with a new image.", - type => $types{integer}, - category => "medband", - }, - { - name => "ZM_WEB_M_REFRESH_IMAGE", - default => "10", - description => "How often (in seconds) the watched image is refreshed (if not streaming)", - help => "The live images from a monitor can be viewed in either streamed or stills mode. This option determines how often a stills image is refreshed, it has no effect if streaming is selected.", - type => $types{integer}, - category => "medband", - }, - { - name => "ZM_WEB_M_REFRESH_STATUS", - default => "5", - description => "How often (in seconds) the status refreshes itself in the watch window", - help => "The monitor window is actually made from several frames. The one in the middle merely contains a monitor status which needs to refresh fairly frequently to give a true indication. This option determines that frequency.", - type => $types{integer}, - category => "medband", - }, - { - name => "ZM_WEB_M_REFRESH_EVENTS", - default => "60", - description => "How often (in seconds) the event listing is refreshed in the watch window", - help => "The monitor window is actually made from several frames. The lower framme contains a listing of the last few events for easy access. This option determines how often this is refreshed.", - type => $types{integer}, - category => "medband", - }, - { - name => "ZM_WEB_M_CAN_STREAM", - default => "auto", - description => "Override the automatic detection of browser streaming capability", - help => "If you know that your browser can handle image streams of the type 'multipart/x-mixed-replace' but ZoneMinder does not detect this correctly you can set this option to ensure that the stream is delivered with or without the use of the Cambozola plugin. Selecting 'yes' will tell ZoneMinder that your browser can handle the streams natively, 'no' means that it can't and so the plugin will be used while 'auto' lets ZoneMinder decide.", - type => $types{tristate}, - category => "medband", - }, - { - name => "ZM_WEB_M_STREAM_METHOD", - default => "jpeg", - description => "Which method should be used to send video streams to your browser.", - help => "ZoneMinder can be configured to use either mpeg encoded video or a series or still jpeg images when sending video streams. This option defines which is used. If you choose mpeg you should ensure that you have the appropriate plugins available on your browser whereas choosing jpeg will work natively on Mozilla and related browsers and with a Java applet on Internet Explorer", - type => { db_type=>"string", hint=>"mpeg|jpeg", pattern=>qr|^([mj])|i, format=>q( $1 =~ /^m/ ? "mpeg" : "jpeg" ) }, - category => "medband", - }, - { - name => "ZM_WEB_M_DEFAULT_SCALE", - default => "100", - description => "What the default scaling factor applied to 'live' or 'event' views is (%)", - help => "Normally ZoneMinder will display 'live' or 'event' streams in their native size. However if you have monitors with large dimensions or a slow link you may prefer to reduce this size, alternatively for small monitors you can enlarge it. This options lets you specify what the default scaling factor will be. It is expressed as a percentage so 100 is normal size, 200 is double size etc.", - type => { db_type=>"integer", hint=>"25|33|50|75|100|150|200|300|400", pattern=>qr|^(\d+)$|, format=>q( $1 ) }, - category => "medband", - }, - { - name => "ZM_WEB_M_DEFAULT_RATE", - default => "100", - description => "What the default replay rate factor applied to 'event' views is (%)", - help => "Normally ZoneMinder will display 'event' streams at their native rate, i.e. as close to real-time as possible. However if you have long events it is often convenient to replay them at a faster rate for review. This option lets you specify what the default replay rate will be. It is expressed as a percentage so 100 is normal rate, 200 is double speed etc.", - type => { db_type=>"integer", hint=>"25|50|100|150|200|400|1000|2500|5000|10000", pattern=>qr|^(\d+)$|, format=>q( $1 ) }, - category => "medband", - }, - { - name => "ZM_WEB_M_VIDEO_BITRATE", - default => "75000", - description => "What the bitrate of the video encoded stream should be set to", - help => "When encoding real video via the ffmpeg library a bit rate can be specified which roughly corresponds to the available bandwidth used for the stream. This setting effectively corresponds to a 'quality' setting for the video. A low value will result in a blocky image whereas a high value will produce a clearer view. Note that this setting does not control the frame rate of the video however the quality of the video produced is affected both by this setting and the frame rate that the video is produced at. A higher frame rate at a particular bit rate result in individual frames being at a lower quality.", - type => $types{integer}, - category => "medband", - }, - { - name => "ZM_WEB_M_VIDEO_MAXFPS", - default => "10", - description => "What the maximum frame rate for streamed video should be", - help => "When using streamed video the main control is the bitrate which determines how much data can be transmitted. However a lower bitrate at high frame rates results in a lower quality image. This option allows you to limit the maximum frame rate to ensure that video quality is maintained. An additional advantage is that encoding video at high frame rates is a processor intensive task when for the most part a very high frame rate offers little perceptible improvement over one that has a more manageable resource requirement. Note, this option is implemented as a cap beyond which binary reduction takes place. So if you have a device capturing at 15fps and set this option to 10fps then the video is not produced at 10fps, but rather at 7.5fps (15 divided by 2) as the final frame rate must be the original divided by a power of 2.", - type => $types{integer}, - category => "medband", - }, - { - name => "ZM_WEB_M_SCALE_THUMBS", - default => "yes", - description => "Scale thumbnails in events, bandwidth versus cpu in rescaling", - help => "If unset, this option sends the whole image to the browser which resizes it in the window. If set the image is scaled down on the server before sending a reduced size image to the browser to conserve bandwidth at the cost of cpu on the server. Note that ZM can only perform the resizing if the appropriate PHP graphics functionality is installed. This is usually available in the php-gd package.", - type => $types{boolean}, - category => "medband", - }, - { - name => "ZM_WEB_M_EVENTS_VIEW", - default => "events", - description => "What the default view of multiple events should be.", - help => "Stored events can be viewed in either an events list format or in a timeline based one. This option sets the default view that will be used. Choosing one view here does not prevent the other view being used as it will always be selectable from whichever view is currently being used.", - type => { db_type=>"string", hint=>"events|timeline", pattern=>qr|^([lt])|i, format=>q( $1 =~ /^e/ ? "events" : "timeline" ) }, - category => "medband", - }, - { - name => "ZM_WEB_M_SHOW_PROGRESS", - default => "yes", - description => "Show the progress of replay in event view.", - help => "When viewing events an event navigation panel and progress bar is shown below the event itself. This allows you to jump to specific points in the event, but can can also dynamically update to display the current progress of the event replay itself. This progress is calculated from the actual event duration and is not directly linked to the replay itself, so on limited bandwidth connections may be out of step with the replay. This option allows you to turn off the progress display, whilst still keeping the navigation aspect, where bandwidth prevents it functioning effectively.", - type => $types{boolean}, - category => "medband", - }, - { - name => "ZM_WEB_M_AJAX_TIMEOUT", - default => "5000", - description => "How long to wait for Ajax request responses (ms)", - help => "The newer versions of the live feed and event views use Ajax to request information from the server and populate the views dynamically. This option allows you to specify a timeout if required after which requests are abandoned. A timeout may be necessary if requests would overwise hang such as on a slow connection. This would tend to consume a lot of browser memory and make the interface unresponsive. Ordinarily no requests should timeout so this setting should be set to a value greater than the slowest expected response. This value is in milliseconds but if set to zero then no timeout will be used.", - type => $types{integer}, - category => "medband", - }, - { - name => "ZM_WEB_L_REFRESH_MAIN", - default => "300", - description => "How often (in seconds) the main console window should refresh itself", - introduction => "The next few options control what happens when the client is running in 'low' bandwidth mode. You should set these options for when accessing the ZoneMinder client over a modem or slow link. In most cases the default values will be suitable as a starting point.", - help => "The main console window lists a general status and the event totals for all monitors. This is not a trivial task and should not be repeated too frequently or it may affect the performance of the rest of the system.", - type => $types{integer}, - category => "lowband", - }, - { - name => "ZM_WEB_L_REFRESH_CYCLE", - default => "30", - description => "How often (in seconds) the cycle watch window swaps to the next monitor", - help => "The cycle watch window is a method of continuously cycling between images from all of your monitors. This option determines how often to refresh with a new image.", - type => $types{integer}, - category => "lowband", - }, - { - name => "ZM_WEB_L_REFRESH_IMAGE", - default => "15", - description => "How often (in seconds) the watched image is refreshed (if not streaming)", - help => "The live images from a monitor can be viewed in either streamed or stills mode. This option determines how often a stills image is refreshed, it has no effect if streaming is selected.", - type => $types{integer}, - category => "lowband", - }, - { - name => "ZM_WEB_L_REFRESH_STATUS", - default => "10", - description => "How often (in seconds) the status refreshes itself in the watch window", - help => "The monitor window is actually made from several frames. The one in the middle merely contains a monitor status which needs to refresh fairly frequently to give a true indication. This option determines that frequency.", - type => $types{integer}, - category => "lowband", - }, - { - name => "ZM_WEB_L_REFRESH_EVENTS", - default => "180", - description => "How often (in seconds) the event listing is refreshed in the watch window", - help => "The monitor window is actually made from several frames. The lower framme contains a listing of the last few events for easy access. This option determines how often this is refreshed.", - type => $types{integer}, - category => "lowband", - }, - { - name => "ZM_WEB_L_CAN_STREAM", - default => "auto", - description => "Override the automatic detection of browser streaming capability", - help => "If you know that your browser can handle image streams of the type 'multipart/x-mixed-replace' but ZoneMinder does not detect this correctly you can set this option to ensure that the stream is delivered with or without the use of the Cambozola plugin. Selecting 'yes' will tell ZoneMinder that your browser can handle the streams natively, 'no' means that it can't and so the plugin will be used while 'auto' lets ZoneMinder decide.", - type => $types{tristate}, - category => "lowband", - }, - { - name => "ZM_WEB_L_STREAM_METHOD", - default => "jpeg", - description => "Which method should be used to send video streams to your browser.", - help => "ZoneMinder can be configured to use either mpeg encoded video or a series or still jpeg images when sending video streams. This option defines which is used. If you choose mpeg you should ensure that you have the appropriate plugins available on your browser whereas choosing jpeg will work natively on Mozilla and related browsers and with a Java applet on Internet Explorer", - type => { db_type=>"string", hint=>"mpeg|jpeg", pattern=>qr|^([mj])|i, format=>q( $1 =~ /^m/ ? "mpeg" : "jpeg" ) }, - category => "lowband", - }, - { - name => "ZM_WEB_L_DEFAULT_SCALE", - default => "100", - description => "What the default scaling factor applied to 'live' or 'event' views is (%)", - help => "Normally ZoneMinder will display 'live' or 'event' streams in their native size. However if you have monitors with large dimensions or a slow link you may prefer to reduce this size, alternatively for small monitors you can enlarge it. This options lets you specify what the default scaling factor will be. It is expressed as a percentage so 100 is normal size, 200 is double size etc.", - type => { db_type=>"integer", hint=>"25|33|50|75|100|150|200|300|400", pattern=>qr|^(\d+)$|, format=>q( $1 ) }, - category => "lowband", - }, - { - name => "ZM_WEB_L_DEFAULT_RATE", - default => "100", - description => "What the default replay rate factor applied to 'event' views is (%)", - help => "Normally ZoneMinder will display 'event' streams at their native rate, i.e. as close to real-time as possible. However if you have long events it is often convenient to replay them at a faster rate for review. This option lets you specify what the default replay rate will be. It is expressed as a percentage so 100 is normal rate, 200 is double speed etc.", - type => { db_type=>"integer", hint=>"25|50|100|150|200|400|1000|2500|5000|10000", pattern=>qr|^(\d+)$|, format=>q( $1 ) }, - category => "lowband", - }, - { - name => "ZM_WEB_L_VIDEO_BITRATE", - default => "25000", - description => "What the bitrate of the video encoded stream should be set to", - help => "When encoding real video via the ffmpeg library a bit rate can be specified which roughly corresponds to the available bandwidth used for the stream. This setting effectively corresponds to a 'quality' setting for the video. A low value will result in a blocky image whereas a high value will produce a clearer view. Note that this setting does not control the frame rate of the video however the quality of the video produced is affected both by this setting and the frame rate that the video is produced at. A higher frame rate at a particular bit rate result in individual frames being at a lower quality.", - type => $types{integer}, - category => "lowband", - }, - { - name => "ZM_WEB_L_VIDEO_MAXFPS", - default => "5", - description => "What the maximum frame rate for streamed video should be", - help => "When using streamed video the main control is the bitrate which determines how much data can be transmitted. However a lower bitrate at high frame rates results in a lower quality image. This option allows you to limit the maximum frame rate to ensure that video quality is maintained. An additional advantage is that encoding video at high frame rates is a processor intensive task when for the most part a very high frame rate offers little perceptible improvement over one that has a more manageable resource requirement. Note, this option is implemented as a cap beyond which binary reduction takes place. So if you have a device capturing at 15fps and set this option to 10fps then the video is not produced at 10fps, but rather at 7.5fps (15 divided by 2) as the final frame rate must be the original divided by a power of 2.", - type => $types{integer}, - category => "lowband", - }, - { - name => "ZM_WEB_L_SCALE_THUMBS", - default => "yes", - description => "Scale thumbnails in events, bandwidth versus cpu in rescaling", - help => "If unset, this option sends the whole image to the browser which resizes it in the window. If set the image is scaled down on the server before sending a reduced size image to the browser to conserve bandwidth at the cost of cpu on the server. Note that ZM can only perform the resizing if the appropriate PHP graphics functionality is installed. This is usually available in the php-gd package.", - type => $types{boolean}, - category => "lowband", - }, - { - name => "ZM_WEB_L_EVENTS_VIEW", - default => "events", - description => "What the default view of multiple events should be.", - help => "Stored events can be viewed in either an events list format or in a timeline based one. This option sets the default view that will be used. Choosing one view here does not prevent the other view being used as it will always be selectable from whichever view is currently being used.", - type => { db_type=>"string", hint=>"events|timeline", pattern=>qr|^([lt])|i, format=>q( $1 =~ /^e/ ? "events" : "timeline" ) }, - category => "lowband", - }, - { - name => "ZM_WEB_L_SHOW_PROGRESS", - default => "no", - description => "Show the progress of replay in event view.", - help => "When viewing events an event navigation panel and progress bar is shown below the event itself. This allows you to jump to specific points in the event, but can can also dynamically update to display the current progress of the event replay itself. This progress is calculated from the actual event duration and is not directly linked to the replay itself, so on limited bandwidth connections may be out of step with the replay. This option allows you to turn off the progress display, whilst still keeping the navigation aspect, where bandwidth prevents it functioning effectively.", - type => $types{boolean}, - category => "lowband", - }, - { - name => "ZM_WEB_L_AJAX_TIMEOUT", - default => "10000", - description => "How long to wait for Ajax request responses (ms)", - help => "The newer versions of the live feed and event views use Ajax to request information from the server and populate the views dynamically. This option allows you to specify a timeout if required after which requests are abandoned. A timeout may be necessary if requests would overwise hang such as on a slow connection. This would tend to consume a lot of browser memory and make the interface unresponsive. Ordinarily no requests should timeout so this setting should be set to a value greater than the slowest expected response. This value is in milliseconds but if set to zero then no timeout will be used.", - type => $types{integer}, - category => "lowband", - }, - { - name => "ZM_WEB_P_CAN_STREAM", - default => "auto", - description => "Override the automatic detection of browser streaming capability", - help => "If you know that your browser can handle image streams of the type 'multipart/x-mixed-replace' but ZoneMinder does not detect this correctly you can set this option to ensure that the stream is delivered with or without the use of the Cambozola plugin. Selecting 'yes' will tell ZoneMinder that your browser can handle the streams natively, 'no' means that it can't and so the plugin will be used while 'auto' lets ZoneMinder decide.", - type => $types{tristate}, - category => "phoneband", - }, - { - name => "ZM_WEB_P_STREAM_METHOD", - default => "jpeg", - description => "Which method should be used to send video streams to your browser.", - help => "ZoneMinder can be configured to use either mpeg encoded video or a series or still jpeg images when sending video streams. This option defines which is used. If you choose mpeg you should ensure that you have the appropriate plugins available on your browser whereas choosing jpeg will work natively on Mozilla and related browsers and with a Java applet on Internet Explorer", - type => { db_type=>"string", hint=>"mpeg|jpeg", pattern=>qr|^([mj])|i, format=>q( $1 =~ /^m/ ? "mpeg" : "jpeg" ) }, - category => "phoneband", - }, - { - name => "ZM_WEB_P_DEFAULT_SCALE", - default => "100", - description => "What the default scaling factor applied to 'live' or 'event' views is (%)", - help => "Normally ZoneMinder will display 'live' or 'event' streams in their native size. However if you have monitors with large dimensions or a slow link you may prefer to reduce this size, alternatively for small monitors you can enlarge it. This options lets you specify what the default scaling factor will be. It is expressed as a percentage so 100 is normal size, 200 is double size etc.", - type => { db_type=>"integer", hint=>"25|33|50|75|100|150|200|300|400", pattern=>qr|^(\d+)$|, format=>q( $1 ) }, - category => "phoneband", - }, - { - name => "ZM_WEB_P_DEFAULT_RATE", - default => "100", - description => "What the default replay rate factor applied to 'event' views is (%)", - help => "Normally ZoneMinder will display 'event' streams at their native rate, i.e. as close to real-time as possible. However if you have long events it is often convenient to replay them at a faster rate for review. This option lets you specify what the default replay rate will be. It is expressed as a percentage so 100 is normal rate, 200 is double speed etc.", - type => { db_type=>"integer", hint=>"25|50|100|150|200|400|1000|2500|5000|10000", pattern=>qr|^(\d+)$|, format=>q( $1 ) }, - category => "phoneband", - }, - { - name => "ZM_WEB_P_VIDEO_BITRATE", - default => "8000", - description => "What the bitrate of the video encoded stream should be set to", - help => "When encoding real video via the ffmpeg library a bit rate can be specified which roughly corresponds to the available bandwidth used for the stream. This setting effectively corresponds to a 'quality' setting for the video. A low value will result in a blocky image whereas a high value will produce a clearer view. Note that this setting does not control the frame rate of the video however the quality of the video produced is affected both by this setting and the frame rate that the video is produced at. A higher frame rate at a particular bit rate result in individual frames being at a lower quality.", - type => $types{integer}, - category => "phoneband", - }, - { - name => "ZM_WEB_P_VIDEO_MAXFPS", - default => "5", - description => "What the maximum frame rate for streamed video should be", - help => "When using streamed video the main control is the bitrate which determines how much data can be transmitted. However a lower bitrate at high frame rates results in a lower quality image. This option allows you to limit the maximum frame rate to ensure that video quality is maintained. An additional advantage is that encoding video at high frame rates is a processor intensive task when for the most part a very high frame rate offers little perceptible improvement over one that has a more manageable resource requirement. Note, this option is implemented as a cap beyond which binary reduction takes place. So if you have a device capturing at 15fps and set this option to 10fps then the video is not produced at 10fps, but rather at 7.5fps (15 divided by 2) as the final frame rate must be the original divided by a power of 2.", - type => $types{integer}, - category => "phoneband", - }, - { - name => "ZM_WEB_P_SCALE_THUMBS", - default => "yes", - description => "Scale thumbnails in events, bandwidth versus cpu in rescaling", - help => "If unset, this option sends the whole image to the browser which resizes it in the window. If set the image is scaled down on the server before sending a reduced size image to the browser to conserve bandwidth at the cost of cpu on the server. Note that ZM can only perform the resizing if the appropriate PHP graphics functionality is installed. This is usually available in the php-gd package.", - type => $types{boolean}, - category => "phoneband", - }, - { - name => "ZM_WEB_P_AJAX_TIMEOUT", - default => "10000", - description => "How long to wait for Ajax request responses (ms)", - help => "The newer versions of the live feed and event views use Ajax to request information from the server and populate the views dynamically. This option allows you to specify a timeout if required after which requests are abandoned. A timeout may be necessary if requests would overwise hang such as on a slow connection. This would tend to consume a lot of browser memory and make the interface unresponsive. Ordinarily no requests should timeout so this setting should be set to a value greater than the slowest expected response. This value is in milliseconds but if set to zero then no timeout will be used.", - type => $types{integer}, - category => "phoneband", - }, - { - name => "ZM_DYN_LAST_VERSION", - default => "", - description => "What the last version of ZoneMinder recorded from zoneminder.com is", - help => "", - type => $types{string}, - readonly => 1, - category => "dynamic", - }, - { - name => "ZM_DYN_CURR_VERSION", - default => "@VERSION@", - description => "What the effective current version of ZoneMinder is, might be different from actual if versions ignored", - help => "", - type => $types{string}, - readonly => 1, - category => "dynamic", - }, - { - name => "ZM_DYN_DB_VERSION", - default => "@VERSION@", - description => "What the version of the database is, from zmupdate", - help => "", - type => $types{string}, - readonly => 1, - category => "dynamic", - }, - { - name => "ZM_DYN_LAST_CHECK", - default => "", - description => "When the last check for version from zoneminder.com was", - help => "", - type => $types{integer}, - readonly => 1, - category => "dynamic", - }, - { - name => "ZM_DYN_NEXT_REMINDER", - default => "", - description => "When the earliest time to remind about versions will be", - help => "", - type => $types{string}, - readonly => 1, - category => "dynamic", - }, - { - name => "ZM_DYN_DONATE_REMINDER_TIME", - default => 0, - description => "When the earliest time to remind about donations will be", - help => "", - type => $types{integer}, - readonly => 1, - category => "dynamic", - }, - { - name => "ZM_DYN_SHOW_DONATE_REMINDER", - default => "yes", - description => "Remind about donations or not", - help => "", - type => $types{boolean}, - readonly => 1, - category => "dynamic", - }, - { - name => "ZM_EYEZM_DEBUG", - default => "no", - description => "Switch additional debugging on for eyeZm Plugin", - help => "Enable or Disable extra debugging from the eyeZm Plugin. Extra debugging information will be displayed in it's own file (EYEZM_LOG_TO_FILE is set), or your Apache error log", - type => $types{boolean}, - category => "eyeZm", - }, - { - name => "ZM_EYEZM_LOG_TO_FILE", - default => "yes", - description => "When eyeZm Debugging is enabled, enabling this logs output to it's own file", - help => "When EYEZM_DEBUG is on and EYEZM_LOG_TO_FILE is on, output generated from the eyeZm Plugin will go to it's own file. Otherwise it will go to the apache error log.", - type => $types{boolean}, - category => "eyeZm", - }, - { - name => "ZM_EYEZM_LOG_FILE", - default => "@ZM_LOGDIR@/zm_xml.log", - description => "Default filename to use when logging eyeZm Output and EYEZM_LOG_TO_FILE is enabled", - help => "This file will contain it's own output from the eyeZm Plugin when EYEZM_LOG_TO_FILE and EYEZM_DEBUG are both enabled", - type => $types{string}, - category => "eyeZm", - }, - { - name => "ZM_EYEZM_EVENT_VCODEC", - default => "mpeg4", - description => "Default video-codec to use for encoding events", - help => "The eyeZm Plugin calls FFMPEG externally to encode the captured images. If your FFMPEG is not built with support for H264, change this to MPEG-4. If using H264, please check http://www.eyezm.com for H264 requirements and that your eyeZm version supports H264 (v1.2+).", - type => { db_type=>"string", hint=>"mpeg4|h264", pattern=>qr|^([mh])|i, format=>q( $1 =~ /^m/ ? "mpeg4" : "h264" ) }, - category => "eyeZm", - }, - { - name => "ZM_EYEZM_FEED_VCODEC", - default => "mjpeg", - description => "Default video-codec to use for streaming the live feed", - help => "Determines whether the live stream is generated using native MJPEG streaming with ZoneMinder, or H264 using FFMPEG and HTML-5 streaming. If using H264, please check http://www.eyezm.com for H264 requirements and that your eyeZm version supports H264 (v1.2+). This is just a default parameter, and can be overridden with eyeZm.", - type => { db_type=>"string", hint=>"mjpeg|h264", pattern=>qr|^([mh])|i, format=>q( $1 =~ /^m/ ? "mjpeg" : "h264" ) }, - category => "eyeZm", - }, - { - name => "ZM_EYEZM_H264_DEFAULT_BR", - default => "96k", - description => "Default bit-rate to use with FFMPEG for H264 streaming", - help => "When using the eyeZm Plugin to stream H264 data, FFMPEG requires a bitrate to control the quality and bandwidth of the video. This should be specified in a format acceptable to FFMPEG. The default value is sufficient for most installations. This is just a default parameter, and can be overridden with eyeZm.", - type => $types{string}, - category => "eyeZm", - }, - { - name => "ZM_EYEZM_H264_DEFAULT_EVBR", - default => "128k", - description => "Default bit-rate to use with FFMPEG for H264 event viewing", - help => "When using the eyeZm Plugin to view events in H264, FFMPEG requires a bitrate to control the quality and bandwidth of the video. This should be specified in a format acceptable to FFMPEG. The default value is sufficient for most installations. This is just a default parameter, and can be overridden with eyeZm.", - type => $types{string}, - category => "eyeZm", - }, - { - name => "ZM_EYEZM_H264_TIMEOUT", - default => "20", - description => "Timeout (sec) to wait for H264 stream to start before terminating", - help => "The eyeZm Plugin will attempt to spawn an H264 stream when requested, and require that it complete within the timeout specified. If you have a slow system or find through the logs that the H264 stream is not starting because the timeout is expiring, even though FFMPEG is running, try increasing this value. If you have a fast system, decreasing this value can improve the responsiveness when there are issues starting H264 streams", - type => $types{string}, - category => "eyeZm", - }, - { - name => "ZM_EYEZM_SEG_DURATION", - default => "3", - description => "Segment duration used for streaming using HTTP-5 Streaming protocol", - help => "The HTTP-5 Live Streaming Protocol segments the input video stream into small chunks of a duration specified by this parameter. Increasing the segment duration will help with choppy connections on the other end, but will increase the latency in starting a stream.", - type => $types{string}, - category => "eyeZm", - }, - { - name => "ZM_PATH_PLUGINS", - default => "@PLUGINSLIBDIR@", - 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 => "@PLUGINSEXT@", - description => "Default extension of plugins to found.", - help => "Default extension of plugins to found.", - type => $types{rel_path}, - category => "paths", - }, - { - name => "ZM_PLUGINS_CONFIG_PATH", - default => "@SYSCONFDIR@/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_PLUGINS_CONFIG_DIR", - default => "@PLUGINSCONFDIR@", - description => "Path to the config folder for plugins.", - help => "Path to the config folder 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_WEB_REFRESH_METHOD", + default => "javascript", + description => "What method windows should use to refresh themselves", + help => qqq(" + Many windows in Javascript need to refresh themselves to keep + their information current. This option determines what method + they should use to do this. Choosing 'javascript' means that + each window will have a short JavaScript statement in with a + timer to prompt the refresh. This is the most compatible + method. Choosing 'http' means the refresh instruction is put in + the HTTP header. This is a cleaner method but refreshes are + interrupted or cancelled when a link in the window is clicked + meaning that the window will no longer refresh and this would + have to be done manually. + "), + type => { + db_type =>"string", + hint =>"javascript|http", + pattern =>qr|^([jh])|i, + format =>q( $1 =~ /^j/ + ? "javascript" + : "http" + ) + }, + category => "hidden", + }, + { + name => "ZM_WEB_EVENT_SORT_FIELD", + default => "DateTime", + description => "Default field the event lists are sorted by", + help => qqq(" + Events in lists can be initially ordered in any way you want. + This option controls what field is used to sort them. You can + modify this ordering from filters or by clicking on headings in + the lists themselves. Bear in mind however that the 'Prev' and + 'Next' links, when scrolling through events, relate to the + ordering in the lists and so not always to time based ordering. + "), + type => { + db_type =>"string", + hint =>"Id|Name|Cause|MonitorName|DateTime|Length|Frames|AlarmFrames|TotScore|AvgScore|MaxScore", + pattern =>qr|.|, + format =>q( $1 ) + }, + category => "web", + }, + { + name => "ZM_WEB_EVENT_SORT_ORDER", + default => "asc", + description => "Default order the event lists are sorted by", + help => qqq(" + Events in lists can be initially ordered in any way you want. + This option controls what order (ascending or descending) is + used to sort them. You can modify this ordering from filters or + by clicking on headings in the lists themselves. Bear in mind + however that the 'Prev' and 'Next' links, when scrolling + through events, relate to the ordering in the lists and so not + always to time based ordering. + "), + type => { + db_type =>"string", + hint =>"asc|desc", + pattern =>qr|^([ad])|i, + format =>q( $1 =~ /^a/i ? "asc" : "desc" ) + }, + category => "web", + }, + { + name => "ZM_WEB_EVENTS_PER_PAGE", + default => "25", + description => "How many events to list per page in paged mode", + help => qqq(" + In the event list view you can either list all events or just a + page at a time. This option controls how many events are listed + per page in paged mode and how often to repeat the column + headers in non-paged mode. + "), + type => $types{integer}, + category => "web", + }, + { + name => "ZM_WEB_LIST_THUMBS", + default => "no", + description => "Display mini-thumbnails of event images in event lists", + help => qqq(" + Ordinarily the event lists just display text details of the + events to save space and time. By switching this option on you + can also display small thumbnails to help you identify events + of interest. The size of these thumbnails is controlled by the + following two options. + "), + type => $types{boolean}, + category => "web", + }, + { + name => "ZM_WEB_LIST_THUMB_WIDTH", + default => "48", + description => "The width of the thumbnails that appear in the event lists", + help => qqq(" + This options controls the width of the thumbnail images that + appear in the event lists. It should be fairly small to fit in + with the rest of the table. If you prefer you can specify a + height instead in the next option but you should only use one + of the width or height and the other option should be set to + zero. If both width and height are specified then width will be + used and height ignored. + "), + type => $types{integer}, + requires => [ { name => "ZM_WEB_LIST_THUMBS", value => "yes" } ], + category => "web", + }, + { + name => "ZM_WEB_LIST_THUMB_HEIGHT", + default => "0", + description => "The height of the thumbnails that appear in the event lists", + help => qqq(" + This options controls the height of the thumbnail images that + appear in the event lists. It should be fairly small to fit in + with the rest of the table. If you prefer you can specify a + width instead in the previous option but you should only use + one of the width or height and the other option should be set + to zero. If both width and height are specified then width will + be used and height ignored. + "), + type => $types{integer}, + requires => [ { name => "ZM_WEB_LIST_THUMBS", value => "yes" } ], + category => "web", + }, + { + name => "ZM_WEB_USE_OBJECT_TAGS", + default => "yes", + description => "Wrap embed in object tags for media content", + help => qqq(" + There are two methods of including media content in web pages. + The most common way is use the EMBED tag which is able to give + some indication of the type of content. However this is not a + standard part of HTML. The official method is to use OBJECT + tags which are able to give more information allowing the + correct media viewers etc to be loaded. However these are less + widely supported and content may be specifically tailored to a + particular platform or player. This option controls whether + media content is enclosed in EMBED tags only or whether, where + appropriate, it is additionally wrapped in OBJECT tags. + Currently OBJECT tags are only used in a limited number of + circumstances but they may become more widespread in the + future. It is suggested that you leave this option on unless + you encounter problems playing some content. + "), + type => $types{boolean}, + category => "web", + }, + { + name => "ZM_WEB_H_REFRESH_MAIN", + default => "60", + introduction => qqq(" + There are now a number of options that are grouped into + bandwidth categories, this allows you to configure the + ZoneMinder client to work optimally over the various access + methods you might to access the client.\n\nThe next few options + control what happens when the client is running in 'high' + bandwidth mode. You should set these options for when accessing + the ZoneMinder client over a local network or high speed link. + In most cases the default values will be suitable as a starting + point. + "), + description => "How often (in seconds) the main console window should refresh itself", + help => qqq(" + The main console window lists a general status and the event + totals for all monitors. This is not a trivial task and should + not be repeated too frequently or it may affect the performance + of the rest of the system. + "), + type => $types{integer}, + category => "highband", + }, + { + name => "ZM_WEB_H_REFRESH_CYCLE", + default => "10", + description => "How often (in seconds) the cycle watch window swaps to the next monitor", + help => qqq(" + The cycle watch window is a method of continuously cycling + between images from all of your monitors. This option + determines how often to refresh with a new image. + "), + type => $types{integer}, + category => "highband", + }, + { + name => "ZM_WEB_H_REFRESH_IMAGE", + default => "3", + description => "How often (in seconds) the watched image is refreshed (if not streaming)", + help => qqq(" + The live images from a monitor can be viewed in either streamed + or stills mode. This option determines how often a stills image + is refreshed, it has no effect if streaming is selected. + "), + type => $types{integer}, + category => "highband", + }, + { + name => "ZM_WEB_H_REFRESH_STATUS", + default => "1", + description => "How often (in seconds) the status refreshes itself in the watch window", + help => qqq(" + The monitor window is actually made from several frames. The + one in the middle merely contains a monitor status which needs + to refresh fairly frequently to give a true indication. This + option determines that frequency. + "), + type => $types{integer}, + category => "highband", + }, + { + name => "ZM_WEB_H_REFRESH_EVENTS", + default => "5", + description => "How often (in seconds) the event listing is refreshed in the watch window", + help => qqq(" + The monitor window is actually made from several frames. The + lower framme contains a listing of the last few events for easy + access. This option determines how often this is refreshed. + "), + type => $types{integer}, + category => "highband", + }, + { + name => "ZM_WEB_H_CAN_STREAM", + default => "auto", + description => "Override the automatic detection of browser streaming capability", + help => qqq(" + If you know that your browser can handle image streams of the + type 'multipart/x-mixed-replace' but ZoneMinder does not detect + this correctly you can set this option to ensure that the + stream is delivered with or without the use of the Cambozola + plugin. Selecting 'yes' will tell ZoneMinder that your browser + can handle the streams natively, 'no' means that it can't and + so the plugin will be used while 'auto' lets ZoneMinder decide. + "), + type => $types{tristate}, + category => "highband", + }, + { + name => "ZM_WEB_H_STREAM_METHOD", + default => "jpeg", + description => "Which method should be used to send video streams to your browser.", + help => qqq(" + ZoneMinder can be configured to use either mpeg encoded video + or a series or still jpeg images when sending video streams. + This option defines which is used. If you choose mpeg you + should ensure that you have the appropriate plugins available + on your browser whereas choosing jpeg will work natively on + Mozilla and related browsers and with a Java applet on Internet + Explorer + "), + type => { + db_type =>"string", + hint =>"mpeg|jpeg", + pattern =>qr|^([mj])|i, + format =>q( $1 =~ /^m/ ? "mpeg" : "jpeg" ) + }, + category => "highband", + }, + { + name => "ZM_WEB_H_DEFAULT_SCALE", + default => "100", + description => "What the default scaling factor applied to 'live' or 'event' views is (%)", + help => qqq(" + Normally ZoneMinder will display 'live' or 'event' streams in + their native size. However if you have monitors with large + dimensions or a slow link you may prefer to reduce this size, + alternatively for small monitors you can enlarge it. This + options lets you specify what the default scaling factor will + be. It is expressed as a percentage so 100 is normal size, 200 + is double size etc. + "), + type => { + db_type =>"integer", + hint =>"25|33|50|75|100|150|200|300|400", + pattern =>qr|^(\d+)$|, + format =>q( $1 ) + }, + category => "highband", + }, + { + name => "ZM_WEB_H_DEFAULT_RATE", + default => "100", + description => "What the default replay rate factor applied to 'event' views is (%)", + help => qqq(" + Normally ZoneMinder will display 'event' streams at their + native rate, i.e. as close to real-time as possible. However if + you have long events it is often convenient to replay them at a + faster rate for review. This option lets you specify what the + default replay rate will be. It is expressed as a percentage so + 100 is normal rate, 200 is double speed etc. + "), + type => { + db_type =>"integer", + hint =>"25|50|100|150|200|400|1000|2500|5000|10000", + pattern =>qr|^(\d+)$|, + format =>q( $1 ) + }, + category => "highband", + }, + { + name => "ZM_WEB_H_VIDEO_BITRATE", + default => "150000", + description => "What the bitrate of the video encoded stream should be set to", + help => qqq(" + When encoding real video via the ffmpeg library a bit rate can + be specified which roughly corresponds to the available + bandwidth used for the stream. This setting effectively + corresponds to a 'quality' setting for the video. A low value + will result in a blocky image whereas a high value will produce + a clearer view. Note that this setting does not control the + frame rate of the video however the quality of the video + produced is affected both by this setting and the frame rate + that the video is produced at. A higher frame rate at a + particular bit rate result in individual frames being at a + lower quality. + "), + type => $types{integer}, + category => "highband", + }, + { + name => "ZM_WEB_H_VIDEO_MAXFPS", + default => "30", + description => "What the maximum frame rate for streamed video should be", + help => qqq(" + When using streamed video the main control is the bitrate which + determines how much data can be transmitted. However a lower + bitrate at high frame rates results in a lower quality image. + This option allows you to limit the maximum frame rate to + ensure that video quality is maintained. An additional + advantage is that encoding video at high frame rates is a + processor intensive task when for the most part a very high + frame rate offers little perceptible improvement over one that + has a more manageable resource requirement. Note, this option + is implemented as a cap beyond which binary reduction takes + place. So if you have a device capturing at 15fps and set this + option to 10fps then the video is not produced at 10fps, but + rather at 7.5fps (15 divided by 2) as the final frame rate must + be the original divided by a power of 2. + "), + type => $types{integer}, + category => "highband", + }, + { + name => "ZM_WEB_H_SCALE_THUMBS", + default => "no", + description => "Scale thumbnails in events, bandwidth versus cpu in rescaling", + help => qqq(" + If unset, this option sends the whole image to the browser + which resizes it in the window. If set the image is scaled down + on the server before sending a reduced size image to the + browser to conserve bandwidth at the cost of cpu on the server. + Note that ZM can only perform the resizing if the appropriate + PHP graphics functionality is installed. This is usually + available in the php-gd package. + "), + type => $types{boolean}, + category => "highband", + }, + { + name => "ZM_WEB_H_EVENTS_VIEW", + default => "events", + description => "What the default view of multiple events should be.", + help => qqq(" + Stored events can be viewed in either an events list format or + in a timeline based one. This option sets the default view that + will be used. Choosing one view here does not prevent the other + view being used as it will always be selectable from whichever + view is currently being used. + "), + type => { + db_type =>"string", + hint =>"events|timeline", + pattern =>qr|^([lt])|i, + format =>q( $1 =~ /^e/ ? "events" : "timeline" ) + }, + category => "highband", + }, + { + name => "ZM_WEB_H_SHOW_PROGRESS", + default => "yes", + description => "Show the progress of replay in event view.", + help => qqq(" + When viewing events an event navigation panel and progress bar + is shown below the event itself. This allows you to jump to + specific points in the event, but can can also dynamically + update to display the current progress of the event replay + itself. This progress is calculated from the actual event + duration and is not directly linked to the replay itself, so on + limited bandwidth connections may be out of step with the + replay. This option allows you to turn off the progress + display, whilst still keeping the navigation aspect, where + bandwidth prevents it functioning effectively. + "), + type => $types{boolean}, + category => "highband", + }, + { + name => "ZM_WEB_H_AJAX_TIMEOUT", + default => "3000", + description => "How long to wait for Ajax request responses (ms)", + help => qqq(" + The newer versions of the live feed and event views use Ajax to + request information from the server and populate the views + dynamically. This option allows you to specify a timeout if + required after which requests are abandoned. A timeout may be + necessary if requests would overwise hang such as on a slow + connection. This would tend to consume a lot of browser memory + and make the interface unresponsive. Ordinarily no requests + should timeout so this setting should be set to a value greater + than the slowest expected response. This value is in + milliseconds but if set to zero then no timeout will be used. + "), + type => $types{integer}, + category => "highband", + }, + { + name => "ZM_WEB_M_REFRESH_MAIN", + default => "300", + description => "How often (in seconds) the main console window should refresh itself", + help => qqq(" + The main console window lists a general status and the event + totals for all monitors. This is not a trivial task and should + not be repeated too frequently or it may affect the performance + of the rest of the system. + "), + type => $types{integer}, + introduction => qqq(" + The next few options control what happens when the client is + running in 'medium' bandwidth mode. You should set these + options for when accessing the ZoneMinder client over a slower + cable or DSL link. In most cases the default values will be + suitable as a starting point. + "), + category => "medband", + }, + { + name => "ZM_WEB_M_REFRESH_CYCLE", + default => "20", + description => "How often (in seconds) the cycle watch window swaps to the next monitor", + help => qqq(" + The cycle watch window is a method of continuously cycling + between images from all of your monitors. This option + determines how often to refresh with a new image. + "), + type => $types{integer}, + category => "medband", + }, + { + name => "ZM_WEB_M_REFRESH_IMAGE", + default => "10", + description => "How often (in seconds) the watched image is refreshed (if not streaming)", + help => qqq(" + The live images from a monitor can be viewed in either streamed + or stills mode. This option determines how often a stills image + is refreshed, it has no effect if streaming is selected. + "), + type => $types{integer}, + category => "medband", + }, + { + name => "ZM_WEB_M_REFRESH_STATUS", + default => "5", + description => "How often (in seconds) the status refreshes itself in the watch window", + help => qqq(" + The monitor window is actually made from several frames. The + one in the middle merely contains a monitor status which needs + to refresh fairly frequently to give a true indication. This + option determines that frequency. + "), + type => $types{integer}, + category => "medband", + }, + { + name => "ZM_WEB_M_REFRESH_EVENTS", + default => "60", + description => "How often (in seconds) the event listing is refreshed in the watch window", + help => qqq(" + The monitor window is actually made from several frames. The + lower framme contains a listing of the last few events for easy + access. This option determines how often this is refreshed. + "), + type => $types{integer}, + category => "medband", + }, + { + name => "ZM_WEB_M_CAN_STREAM", + default => "auto", + description => "Override the automatic detection of browser streaming capability", + help => qqq(" + If you know that your browser can handle image streams of the + type 'multipart/x-mixed-replace' but ZoneMinder does not detect + this correctly you can set this option to ensure that the + stream is delivered with or without the use of the Cambozola + plugin. Selecting 'yes' will tell ZoneMinder that your browser + can handle the streams natively, 'no' means that it can't and + so the plugin will be used while 'auto' lets ZoneMinder decide. + "), + type => $types{tristate}, + category => "medband", + }, + { + name => "ZM_WEB_M_STREAM_METHOD", + default => "jpeg", + description => "Which method should be used to send video streams to your browser.", + help => qqq(" + ZoneMinder can be configured to use either mpeg encoded video + or a series or still jpeg images when sending video streams. + This option defines which is used. If you choose mpeg you + should ensure that you have the appropriate plugins available + on your browser whereas choosing jpeg will work natively on + Mozilla and related browsers and with a Java applet on Internet + Explorer + "), + type => { + db_type =>"string", + hint =>"mpeg|jpeg", + pattern =>qr|^([mj])|i, + format =>q( $1 =~ /^m/ ? "mpeg" : "jpeg" ) + }, + category => "medband", + }, + { + name => "ZM_WEB_M_DEFAULT_SCALE", + default => "100", + description => "What the default scaling factor applied to 'live' or 'event' views is (%)", + help => qqq(" + Normally ZoneMinder will display 'live' or 'event' streams in + their native size. However if you have monitors with large + dimensions or a slow link you may prefer to reduce this size, + alternatively for small monitors you can enlarge it. This + options lets you specify what the default scaling factor will + be. It is expressed as a percentage so 100 is normal size, 200 + is double size etc. + "), + type => { + db_type =>"integer", + hint =>"25|33|50|75|100|150|200|300|400", + pattern =>qr|^(\d+)$|, + format =>q( $1 ) + }, + category => "medband", + }, + { + name => "ZM_WEB_M_DEFAULT_RATE", + default => "100", + description => "What the default replay rate factor applied to 'event' views is (%)", + help => qqq(" + Normally ZoneMinder will display 'event' streams at their + native rate, i.e. as close to real-time as possible. However if + you have long events it is often convenient to replay them at a + faster rate for review. This option lets you specify what the + default replay rate will be. It is expressed as a percentage so + 100 is normal rate, 200 is double speed etc. + "), + type => { + db_type =>"integer", + hint =>"25|50|100|150|200|400|1000|2500|5000|10000", + pattern =>qr|^(\d+)$|, + format =>q( $1 ) + }, + category => "medband", + }, + { + name => "ZM_WEB_M_VIDEO_BITRATE", + default => "75000", + description => "What the bitrate of the video encoded stream should be set to", + help => qqq(" + When encoding real video via the ffmpeg library a bit rate can + be specified which roughly corresponds to the available + bandwidth used for the stream. This setting effectively + corresponds to a 'quality' setting for the video. A low value + will result in a blocky image whereas a high value will produce + a clearer view. Note that this setting does not control the + frame rate of the video however the quality of the video + produced is affected both by this setting and the frame rate + that the video is produced at. A higher frame rate at a + particular bit rate result in individual frames being at a + lower quality. + "), + type => $types{integer}, + category => "medband", + }, + { + name => "ZM_WEB_M_VIDEO_MAXFPS", + default => "10", + description => "What the maximum frame rate for streamed video should be", + help => qqq(" + When using streamed video the main control is the bitrate which + determines how much data can be transmitted. However a lower + bitrate at high frame rates results in a lower quality image. + This option allows you to limit the maximum frame rate to + ensure that video quality is maintained. An additional + advantage is that encoding video at high frame rates is a + processor intensive task when for the most part a very high + frame rate offers little perceptible improvement over one that + has a more manageable resource requirement. Note, this option + is implemented as a cap beyond which binary reduction takes + place. So if you have a device capturing at 15fps and set this + option to 10fps then the video is not produced at 10fps, but + rather at 7.5fps (15 divided by 2) as the final frame rate must + be the original divided by a power of 2. + "), + type => $types{integer}, + category => "medband", + }, + { + name => "ZM_WEB_M_SCALE_THUMBS", + default => "yes", + description => "Scale thumbnails in events, bandwidth versus cpu in rescaling", + help => qqq(" + If unset, this option sends the whole image to the browser + which resizes it in the window. If set the image is scaled down + on the server before sending a reduced size image to the + browser to conserve bandwidth at the cost of cpu on the server. + Note that ZM can only perform the resizing if the appropriate + PHP graphics functionality is installed. This is usually + available in the php-gd package. + "), + type => $types{boolean}, + category => "medband", + }, + { + name => "ZM_WEB_M_EVENTS_VIEW", + default => "events", + description => "What the default view of multiple events should be.", + help => qqq(" + Stored events can be viewed in either an events list format or + in a timeline based one. This option sets the default view that + will be used. Choosing one view here does not prevent the other + view being used as it will always be selectable from whichever + view is currently being used. + "), + type => { + db_type =>"string", + hint =>"events|timeline", + pattern =>qr|^([lt])|i, + format =>q( $1 =~ /^e/ ? "events" : "timeline" ) + }, + category => "medband", + }, + { + name => "ZM_WEB_M_SHOW_PROGRESS", + default => "yes", + description => "Show the progress of replay in event view.", + help => qqq(" + When viewing events an event navigation panel and progress bar + is shown below the event itself. This allows you to jump to + specific points in the event, but can can also dynamically + update to display the current progress of the event replay + itself. This progress is calculated from the actual event + duration and is not directly linked to the replay itself, so on + limited bandwidth connections may be out of step with the + replay. This option allows you to turn off the progress + display, whilst still keeping the navigation aspect, where + bandwidth prevents it functioning effectively. + "), + type => $types{boolean}, + category => "medband", + }, + { + name => "ZM_WEB_M_AJAX_TIMEOUT", + default => "5000", + description => "How long to wait for Ajax request responses (ms)", + help => qqq(" + The newer versions of the live feed and event views use Ajax to + request information from the server and populate the views + dynamically. This option allows you to specify a timeout if + required after which requests are abandoned. A timeout may be + necessary if requests would overwise hang such as on a slow + connection. This would tend to consume a lot of browser memory + and make the interface unresponsive. Ordinarily no requests + should timeout so this setting should be set to a value greater + than the slowest expected response. This value is in + milliseconds but if set to zero then no timeout will be used. + "), + type => $types{integer}, + category => "medband", + }, + { + name => "ZM_WEB_L_REFRESH_MAIN", + default => "300", + description => "How often (in seconds) the main console window should refresh itself", + introduction => qqq(" + The next few options control what happens when the client is + running in 'low' bandwidth mode. You should set these options + for when accessing the ZoneMinder client over a modem or slow + link. In most cases the default values will be suitable as a + starting point. + "), + help => qqq(" + The main console window lists a general status and the event + totals for all monitors. This is not a trivial task and should + not be repeated too frequently or it may affect the performance + of the rest of the system. + "), + type => $types{integer}, + category => "lowband", + }, + { + name => "ZM_WEB_L_REFRESH_CYCLE", + default => "30", + description => "How often (in seconds) the cycle watch window swaps to the next monitor", + help => qqq(" + The cycle watch window is a method of continuously cycling + between images from all of your monitors. This option + determines how often to refresh with a new image. + "), + type => $types{integer}, + category => "lowband", + }, + { + name => "ZM_WEB_L_REFRESH_IMAGE", + default => "15", + description => "How often (in seconds) the watched image is refreshed (if not streaming)", + help => qqq(" + The live images from a monitor can be viewed in either streamed + or stills mode. This option determines how often a stills image + is refreshed, it has no effect if streaming is selected. + "), + type => $types{integer}, + category => "lowband", + }, + { + name => "ZM_WEB_L_REFRESH_STATUS", + default => "10", + description => "How often (in seconds) the status refreshes itself in the watch window", + help => qqq(" + The monitor window is actually made from several frames. The + one in the middle merely contains a monitor status which needs + to refresh fairly frequently to give a true indication. This + option determines that frequency. + "), + type => $types{integer}, + category => "lowband", + }, + { + name => "ZM_WEB_L_REFRESH_EVENTS", + default => "180", + description => "How often (in seconds) the event listing is refreshed in the watch window", + help => qqq(" + The monitor window is actually made from several frames. The + lower framme contains a listing of the last few events for easy + access. This option determines how often this is refreshed. + "), + type => $types{integer}, + category => "lowband", + }, + { + name => "ZM_WEB_L_CAN_STREAM", + default => "auto", + description => "Override the automatic detection of browser streaming capability", + help => qqq(" + If you know that your browser can handle image streams of the + type 'multipart/x-mixed-replace' but ZoneMinder does not detect + this correctly you can set this option to ensure that the + stream is delivered with or without the use of the Cambozola + plugin. Selecting 'yes' will tell ZoneMinder that your browser + can handle the streams natively, 'no' means that it can't and + so the plugin will be used while 'auto' lets ZoneMinder decide. + "), + type => $types{tristate}, + category => "lowband", + }, + { + name => "ZM_WEB_L_STREAM_METHOD", + default => "jpeg", + description => "Which method should be used to send video streams to your browser.", + help => qqq(" + ZoneMinder can be configured to use either mpeg encoded video + or a series or still jpeg images when sending video streams. + This option defines which is used. If you choose mpeg you + should ensure that you have the appropriate plugins available + on your browser whereas choosing jpeg will work natively on + Mozilla and related browsers and with a Java applet on Internet + Explorer + "), + type => { + db_type =>"string", + hint =>"mpeg|jpeg", + pattern =>qr|^([mj])|i, + format =>q( $1 =~ /^m/ ? "mpeg" : "jpeg" ) + }, + category => "lowband", + }, + { + name => "ZM_WEB_L_DEFAULT_SCALE", + default => "100", + description => "What the default scaling factor applied to 'live' or 'event' views is (%)", + help => qqq(" + Normally ZoneMinder will display 'live' or 'event' streams in + their native size. However if you have monitors with large + dimensions or a slow link you may prefer to reduce this size, + alternatively for small monitors you can enlarge it. This + options lets you specify what the default scaling factor will + be. It is expressed as a percentage so 100 is normal size, 200 + is double size etc. + "), + type => { + db_type =>"integer", + hint =>"25|33|50|75|100|150|200|300|400", + pattern =>qr|^(\d+)$|, + format =>q( $1 ) + }, + category => "lowband", + }, + { + name => "ZM_WEB_L_DEFAULT_RATE", + default => "100", + description => "What the default replay rate factor applied to 'event' views is (%)", + help => qqq(" + Normally ZoneMinder will display 'event' streams at their + native rate, i.e. as close to real-time as possible. However if + you have long events it is often convenient to replay them at a + faster rate for review. This option lets you specify what the + default replay rate will be. It is expressed as a percentage so + 100 is normal rate, 200 is double speed etc. + "), + type => { + db_type =>"integer", + hint =>"25|50|100|150|200|400|1000|2500|5000|10000", + pattern =>qr|^(\d+)$|, format=>q( $1 ) + }, + category => "lowband", + }, + { + name => "ZM_WEB_L_VIDEO_BITRATE", + default => "25000", + description => "What the bitrate of the video encoded stream should be set to", + help => qqq(" + When encoding real video via the ffmpeg library a bit rate can + be specified which roughly corresponds to the available + bandwidth used for the stream. This setting effectively + corresponds to a 'quality' setting for the video. A low value + will result in a blocky image whereas a high value will produce + a clearer view. Note that this setting does not control the + frame rate of the video however the quality of the video + produced is affected both by this setting and the frame rate + that the video is produced at. A higher frame rate at a + particular bit rate result in individual frames being at a + lower quality. + "), + type => $types{integer}, + category => "lowband", + }, + { + name => "ZM_WEB_L_VIDEO_MAXFPS", + default => "5", + description => "What the maximum frame rate for streamed video should be", + help => qqq(" + When using streamed video the main control is the bitrate which + determines how much data can be transmitted. However a lower + bitrate at high frame rates results in a lower quality image. + This option allows you to limit the maximum frame rate to + ensure that video quality is maintained. An additional + advantage is that encoding video at high frame rates is a + processor intensive task when for the most part a very high + frame rate offers little perceptible improvement over one that + has a more manageable resource requirement. Note, this option + is implemented as a cap beyond which binary reduction takes + place. So if you have a device capturing at 15fps and set this + option to 10fps then the video is not produced at 10fps, but + rather at 7.5fps (15 divided by 2) as the final frame rate must + be the original divided by a power of 2. + "), + type => $types{integer}, + category => "lowband", + }, + { + name => "ZM_WEB_L_SCALE_THUMBS", + default => "yes", + description => "Scale thumbnails in events, bandwidth versus cpu in rescaling", + help => qqq(" + If unset, this option sends the whole image to the browser + which resizes it in the window. If set the image is scaled down + on the server before sending a reduced size image to the + browser to conserve bandwidth at the cost of cpu on the server. + Note that ZM can only perform the resizing if the appropriate + PHP graphics functionality is installed. This is usually + available in the php-gd package. + "), + type => $types{boolean}, + category => "lowband", + }, + { + name => "ZM_WEB_L_EVENTS_VIEW", + default => "events", + description => "What the default view of multiple events should be.", + help => qqq(" + Stored events can be viewed in either an events list format or + in a timeline based one. This option sets the default view that + will be used. Choosing one view here does not prevent the other + view being used as it will always be selectable from whichever + view is currently being used. + "), + type => { + db_type =>"string", + hint =>"events|timeline", + pattern =>qr|^([lt])|i, + format =>q( $1 =~ /^e/ ? "events" : "timeline" ) + }, + category => "lowband", + }, + { + name => "ZM_WEB_L_SHOW_PROGRESS", + default => "no", + description => "Show the progress of replay in event view.", + help => qqq(" + When viewing events an event navigation panel and progress bar + is shown below the event itself. This allows you to jump to + specific points in the event, but can can also dynamically + update to display the current progress of the event replay + itself. This progress is calculated from the actual event + duration and is not directly linked to the replay itself, so on + limited bandwidth connections may be out of step with the + replay. This option allows you to turn off the progress + display, whilst still keeping the navigation aspect, where + bandwidth prevents it functioning effectively. + "), + type => $types{boolean}, + category => "lowband", + }, + { + name => "ZM_WEB_L_AJAX_TIMEOUT", + default => "10000", + description => "How long to wait for Ajax request responses (ms)", + help => qqq(" + The newer versions of the live feed and event views use Ajax to + request information from the server and populate the views + dynamically. This option allows you to specify a timeout if + required after which requests are abandoned. A timeout may be + necessary if requests would overwise hang such as on a slow + connection. This would tend to consume a lot of browser memory + and make the interface unresponsive. Ordinarily no requests + should timeout so this setting should be set to a value greater + than the slowest expected response. This value is in + milliseconds but if set to zero then no timeout will be used. + "), + type => $types{integer}, + category => "lowband", + }, + { + name => "ZM_WEB_P_CAN_STREAM", + default => "auto", + description => "Override the automatic detection of browser streaming capability", + help => qqq(" + If you know that your browser can handle image streams of the + type 'multipart/x-mixed-replace' but ZoneMinder does not detect + this correctly you can set this option to ensure that the + stream is delivered with or without the use of the Cambozola + plugin. Selecting 'yes' will tell ZoneMinder that your browser + can handle the streams natively, 'no' means that it can't and + so the plugin will be used while 'auto' lets ZoneMinder decide. + "), + type => $types{tristate}, + category => "phoneband", + }, + { + name => "ZM_WEB_P_STREAM_METHOD", + default => "jpeg", + description => "Which method should be used to send video streams to your browser.", + help => qqq(" + ZoneMinder can be configured to use either mpeg encoded video + or a series or still jpeg images when sending video streams. + This option defines which is used. If you choose mpeg you + should ensure that you have the appropriate plugins available + on your browser whereas choosing jpeg will work natively on + Mozilla and related browsers and with a Java applet on Internet + Explorer + "), + type => { + db_type =>"string", + hint =>"mpeg|jpeg", + pattern =>qr|^([mj])|i, + format =>q( $1 =~ /^m/ ? "mpeg" : "jpeg" ) + }, + category => "phoneband", + }, + { + name => "ZM_WEB_P_DEFAULT_SCALE", + default => "100", + description => "What the default scaling factor applied to 'live' or 'event' views is (%)", + help => qqq(" + Normally ZoneMinder will display 'live' or 'event' streams in + their native size. However if you have monitors with large + dimensions or a slow link you may prefer to reduce this size, + alternatively for small monitors you can enlarge it. This + options lets you specify what the default scaling factor will + be. It is expressed as a percentage so 100 is normal size, 200 + is double size etc. + "), + type => { + db_type =>"integer", + hint =>"25|33|50|75|100|150|200|300|400", + pattern =>qr|^(\d+)$|, format=>q( $1 ) + }, + category => "phoneband", + }, + { + name => "ZM_WEB_P_DEFAULT_RATE", + default => "100", + description => "What the default replay rate factor applied to 'event' views is (%)", + help => qqq(" + Normally ZoneMinder will display 'event' streams at their + native rate, i.e. as close to real-time as possible. However if + you have long events it is often convenient to replay them at a + faster rate for review. This option lets you specify what the + default replay rate will be. It is expressed as a percentage so + 100 is normal rate, 200 is double speed etc. + "), + type => { + db_type =>"integer", + hint =>"25|50|100|150|200|400|1000|2500|5000|10000", + pattern =>qr|^(\d+)$|, + format =>q( $1 ) + }, + category => "phoneband", + }, + { + name => "ZM_WEB_P_VIDEO_BITRATE", + default => "8000", + description => "What the bitrate of the video encoded stream should be set to", + help => qqq(" + When encoding real video via the ffmpeg library a bit rate can + be specified which roughly corresponds to the available + bandwidth used for the stream. This setting effectively + corresponds to a 'quality' setting for the video. A low value + will result in a blocky image whereas a high value will produce + a clearer view. Note that this setting does not control the + frame rate of the video however the quality of the video + produced is affected both by this setting and the frame rate + that the video is produced at. A higher frame rate at a + particular bit rate result in individual frames being at a + lower quality. + "), + type => $types{integer}, + category => "phoneband", + }, + { + name => "ZM_WEB_P_VIDEO_MAXFPS", + default => "5", + description => "What the maximum frame rate for streamed video should be", + help => qqq(" + When using streamed video the main control is the bitrate which + determines how much data can be transmitted. However a lower + bitrate at high frame rates results in a lower quality image. + This option allows you to limit the maximum frame rate to + ensure that video quality is maintained. An additional + advantage is that encoding video at high frame rates is a + processor intensive task when for the most part a very high + frame rate offers little perceptible improvement over one that + has a more manageable resource requirement. Note, this option + is implemented as a cap beyond which binary reduction takes + place. So if you have a device capturing at 15fps and set this + option to 10fps then the video is not produced at 10fps, but + rather at 7.5fps (15 divided by 2) as the final frame rate must + be the original divided by a power of 2. + "), + type => $types{integer}, + category => "phoneband", + }, + { + name => "ZM_WEB_P_SCALE_THUMBS", + default => "yes", + description => "Scale thumbnails in events, bandwidth versus cpu in rescaling", + help => qqq(" + If unset, this option sends the whole image to the browser + which resizes it in the window. If set the image is scaled down + on the server before sending a reduced size image to the + browser to conserve bandwidth at the cost of cpu on the server. + Note that ZM can only perform the resizing if the appropriate + PHP graphics functionality is installed. This is usually + available in the php-gd package. + "), + type => $types{boolean}, + category => "phoneband", + }, + { + name => "ZM_WEB_P_AJAX_TIMEOUT", + default => "10000", + description => "How long to wait for Ajax request responses (ms)", + help => qqq(" + The newer versions of the live feed and event views use Ajax to + request information from the server and populate the views + dynamically. This option allows you to specify a timeout if + required after which requests are abandoned. A timeout may be + necessary if requests would overwise hang such as on a slow + connection. This would tend to consume a lot of browser memory + and make the interface unresponsive. Ordinarily no requests + should timeout so this setting should be set to a value greater + than the slowest expected response. This value is in + milliseconds but if set to zero then no timeout will be used. + "), + type => $types{integer}, + category => "phoneband", + }, + { + name => "ZM_DYN_LAST_VERSION", + default => "", + description => "What the last version of ZoneMinder recorded from zoneminder.com is", + help => "", + type => $types{string}, + readonly => 1, + category => "dynamic", + }, + { + name => "ZM_DYN_CURR_VERSION", + default => "@VERSION@", + description => qqq(" + What the effective current version of ZoneMinder is, might be + different from actual if versions ignored + "), + help => "", + type => $types{string}, + readonly => 1, + category => "dynamic", + }, + { + name => "ZM_DYN_DB_VERSION", + default => "@VERSION@", + description => "What the version of the database is, from zmupdate", + help => "", + type => $types{string}, + readonly => 1, + category => "dynamic", + }, + { + name => "ZM_DYN_LAST_CHECK", + default => "", + description => "When the last check for version from zoneminder.com was", + help => "", + type => $types{integer}, + readonly => 1, + category => "dynamic", + }, + { + name => "ZM_DYN_NEXT_REMINDER", + default => "", + description => "When the earliest time to remind about versions will be", + help => "", + type => $types{string}, + readonly => 1, + category => "dynamic", + }, + { + name => "ZM_DYN_DONATE_REMINDER_TIME", + default => 0, + description => "When the earliest time to remind about donations will be", + help => "", + type => $types{integer}, + readonly => 1, + category => "dynamic", + }, + { + name => "ZM_DYN_SHOW_DONATE_REMINDER", + default => "yes", + description => "Remind about donations or not", + help => "", + type => $types{boolean}, + readonly => 1, + category => "dynamic", + }, + { + name => "ZM_EYEZM_DEBUG", + default => "no", + description => "Switch additional debugging on for eyeZm Plugin", + help => qqq(" + Enable or Disable extra debugging from the eyeZm Plugin. Extra + debugging information will be displayed in it's own file + (EYEZM_LOG_TO_FILE is set), or your Apache error log + "), + type => $types{boolean}, + category => "eyeZm", + }, + { + name => "ZM_EYEZM_LOG_TO_FILE", + default => "yes", + description => "When eyeZm Debugging is enabled, enabling this logs output to it's own file", + help => qqq(" + When EYEZM_DEBUG is on and EYEZM_LOG_TO_FILE is on, output + generated from the eyeZm Plugin will go to it's own file. + Otherwise it will go to the apache error log. + "), + type => $types{boolean}, + category => "eyeZm", + }, + { + name => "ZM_EYEZM_LOG_FILE", + default => "@ZM_LOGDIR@/zm_xml.log", + description => "Default filename to use when logging eyeZm Output and EYEZM_LOG_TO_FILE is enabled", + help => qqq(" + This file will contain it's own output from the eyeZm Plugin + when EYEZM_LOG_TO_FILE and EYEZM_DEBUG are both enabled + "), + type => $types{string}, + category => "eyeZm", + }, + { + name => "ZM_EYEZM_EVENT_VCODEC", + default => "mpeg4", + description => "Default video-codec to use for encoding events", + help => qqq(" + The eyeZm Plugin calls FFMPEG externally to encode the captured + images. If your FFMPEG is not built with support for H264, + change this to MPEG-4. If using H264, please check + http://www.eyezm.com for H264 requirements and that your eyeZm + version supports H264 (v1.2+). + "), + type => { + db_type =>"string", + hint =>"mpeg4|h264", + pattern =>qr|^([mh])|i, + format =>q( $1 =~ /^m/ ? "mpeg4" : "h264" ) + }, + category => "eyeZm", + }, + { + name => "ZM_EYEZM_FEED_VCODEC", + default => "mjpeg", + description => "Default video-codec to use for streaming the live feed", + help => qqq(" + Determines whether the live stream is generated using native + MJPEG streaming with ZoneMinder, or H264 using FFMPEG and + HTML-5 streaming. If using H264, please check + http://www.eyezm.com for H264 requirements and that your eyeZm + version supports H264 (v1.2+). This is just a default + parameter, and can be overridden with eyeZm. + "), + type => { + db_type =>"string", + hint =>"mjpeg|h264", + pattern =>qr|^([mh])|i, + format =>q( $1 =~ /^m/ ? "mjpeg" : "h264" ) + }, + category => "eyeZm", + }, + { + name => "ZM_EYEZM_H264_DEFAULT_BR", + default => "96k", + description => "Default bit-rate to use with FFMPEG for H264 streaming", + help => qqq(" + When using the eyeZm Plugin to stream H264 data, FFMPEG + requires a bitrate to control the quality and bandwidth of the + video. This should be specified in a format acceptable to + FFMPEG. The default value is sufficient for most installations. + This is just a default parameter, and can be overridden with + eyeZm. + "), + type => $types{string}, + category => "eyeZm", + }, + { + name => "ZM_EYEZM_H264_DEFAULT_EVBR", + default => "128k", + description => "Default bit-rate to use with FFMPEG for H264 event viewing", + help => qqq(" + When using the eyeZm Plugin to view events in H264, FFMPEG + requires a bitrate to control the quality and bandwidth of the + video. This should be specified in a format acceptable to + FFMPEG. The default value is sufficient for most installations. + This is just a default parameter, and can be overridden with + eyeZm. + "), + type => $types{string}, + category => "eyeZm", + }, + { + name => "ZM_EYEZM_H264_TIMEOUT", + default => "20", + description => "Timeout (sec) to wait for H264 stream to start before terminating", + help => qqq(" + The eyeZm Plugin will attempt to spawn an H264 stream when + requested, and require that it complete within the timeout + specified. If you have a slow system or find through the logs + that the H264 stream is not starting because the timeout is + expiring, even though FFMPEG is running, try increasing this + value. If you have a fast system, decreasing this value can + improve the responsiveness when there are issues starting H264 + streams + "), + type => $types{string}, + category => "eyeZm", + }, + { + name => "ZM_EYEZM_SEG_DURATION", + default => "3", + description => "Segment duration used for streaming using HTTP-5 Streaming protocol", + help => qqq(" + The HTTP-5 Live Streaming Protocol segments the input video + stream into small chunks of a duration specified by this + parameter. Increasing the segment duration will help with + choppy connections on the other end, but will increase the + latency in starting a stream. + "), + type => $types{string}, + category => "eyeZm", + }, + { + name => "ZM_PATH_PLUGINS", + default => "@PLUGINSLIBDIR@", + 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 => "@PLUGINSEXT@", + description => "Default extension of plugins to found.", + help => "Default extension of plugins to found.", + type => $types{rel_path}, + category => "paths", + }, + { + name => "ZM_PLUGINS_CONFIG_PATH", + default => "@SYSCONFDIR@/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_PLUGINS_CONFIG_DIR", + default => "@PLUGINSCONFDIR@", + description => "Path to the config folder for plugins.", + help => "Path to the config folder 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 => qqq(" + 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", + }, ); our %options_hash = map { ( $_->{name}, $_ ) } @options; @@ -2008,22 +4041,22 @@ sub initialiseConfig { return if ( $configInitialised ); - # Do some initial data munging to finish the data structures - # Create option ids - my $option_id = 0; - foreach my $option ( @options ) - { - if ( defined($option->{default}) ) - { - $option->{value} = $option->{default} - } - else - { - $option->{value} = ''; - } - #next if ( $option->{category} eq 'hidden' ); - $option->{id} = $option_id++; - } + # Do some initial data munging to finish the data structures + # Create option ids + my $option_id = 0; + foreach my $option ( @options ) + { + if ( defined($option->{default}) ) + { + $option->{value} = $option->{default} + } + else + { + $option->{value} = ''; + } + #next if ( $option->{category} eq 'hidden' ); + $option->{id} = $option_id++; + } $configInitialised = 1; } @@ -2044,9 +4077,15 @@ ZoneMinder::ConfigData - ZoneMinder Configuration Data module =head1 DESCRIPTION -The ZoneMinder:ConfigData module contains the master definition of the ZoneMinder configuration options as well as helper methods. This module is intended for specialist confguration management and would not normally be used by end users. +The ZoneMinder:ConfigData module contains the master definition of the +ZoneMinder configuration options as well as helper methods. This module is +intended for specialist confguration management and would not normally be +used by end users. -The configuration held in this module, which was previously in zmconfig.pl, includes the name, default value, description, help text, type and category for each option, as well as a number of additional fields in a small number of cases. +The configuration held in this module, which was previously in zmconfig.pl, +includes the name, default value, description, help text, type and category +for each option, as well as a number of additional fields in a small number +of cases. =head1 METHODS @@ -2054,11 +4093,17 @@ The configuration held in this module, which was previously in zmconfig.pl, incl =item loadConfigFromDB (); -Loads existing configuration from the database (if any) and merges it with the definitions held in this module. This results in the merging of any new configuration and the removal of any deprecated configuration while preserving the existing values of every else. +Loads existing configuration from the database (if any) and merges it with +the definitions held in this module. This results in the merging of any new +configuration and the removal of any deprecated configuration while +preserving the existing values of every else. =item saveConfigToDB (); -Saves configuration held in memory to the database. The act of loading and saving configuration is a convenient way to ensure that the configuration held in the database corresponds with the most recent definitions and that all components are using the same set of configuration. +Saves configuration held in memory to the database. The act of loading and +saving configuration is a convenient way to ensure that the configuration +held in the database corresponds with the most recent definitions and that +all components are using the same set of configuration. =back diff --git a/scripts/ZoneMinder/lib/ZoneMinder/Control.pm b/scripts/ZoneMinder/lib/ZoneMinder/Control.pm index 2e93d4f93..0822dc3d3 100644 --- a/scripts/ZoneMinder/lib/ZoneMinder/Control.pm +++ b/scripts/ZoneMinder/lib/ZoneMinder/Control.pm @@ -19,7 +19,7 @@ # # ========================================================================== # -# This module contains the base class definitions for the camera control +# This module contains the base class definitions for the camera control # protocol implementations # package ZoneMinder::Control; @@ -45,17 +45,17 @@ our $AUTOLOAD; sub new { - my $class = shift; - my $id = shift; - my $self = {}; - $self->{name} = "PelcoD"; + my $class = shift; + my $id = shift; + my $self = {}; + $self->{name} = "PelcoD"; if ( !defined($id) ) { Fatal( "No monitor defined when invoking protocol ".$self->{name} ); } - $self->{id} = $id; - bless( $self, $class ); - return $self; + $self->{id} = $id; + bless( $self, $class ); + return $self; } sub DESTROY @@ -64,32 +64,32 @@ sub DESTROY sub AUTOLOAD { - my $self = shift; - my $class = ref($self) || croak( "$self not object" ); - my $name = $AUTOLOAD; - $name =~ s/.*://; - if ( exists($self->{$name}) ) - { - return( $self->{$name} ); - } - croak( "Can't access $name member of object of class $class" ); + my $self = shift; + my $class = ref($self) || croak( "$self not object" ); + my $name = $AUTOLOAD; + $name =~ s/.*://; + if ( exists($self->{$name}) ) + { + return( $self->{$name} ); + } + croak( "Can't access $name member of object of class $class" ); } sub getKey { - my $self = shift; + my $self = shift; return( $self->{id} ); } sub open { - my $self = shift; + my $self = shift; Fatal( "No open method defined for protocol ".$self->{name} ); } sub close { - my $self = shift; + my $self = shift; Fatal( "No close method defined for protocol ".$self->{name} ); } @@ -147,7 +147,7 @@ sub executeCommand sub printMsg { - my $self = shift; + my $self = shift; Fatal( "No printMsg method defined for protocol ".$self->{name} ); } diff --git a/scripts/ZoneMinder/lib/ZoneMinder/Control/3S.pm b/scripts/ZoneMinder/lib/ZoneMinder/Control/3S.pm index f825af109..47d783bff 100644 --- a/scripts/ZoneMinder/lib/ZoneMinder/Control/3S.pm +++ b/scripts/ZoneMinder/lib/ZoneMinder/Control/3S.pm @@ -21,10 +21,10 @@ # # This module contains the implementation of the 3S camera control # protocol -#Model: N5071 -#Hardware Version: 00 -#Firmware Version: V1.03_STD-1 -#Firmware Build Time: Jun 19 2012 15:28:17 +#Model: N5071 +#Hardware Version: 00 +#Firmware Version: V1.03_STD-1 +#Firmware Build Time: Jun 19 2012 15:28:17 package ZoneMinder::Control::3S; diff --git a/scripts/ZoneMinder/lib/ZoneMinder/Control/FI8608W_Y2k.pm b/scripts/ZoneMinder/lib/ZoneMinder/Control/FI8608W_Y2k.pm index b12f42021..2e5b21f76 100644 --- a/scripts/ZoneMinder/lib/ZoneMinder/Control/FI8608W_Y2k.pm +++ b/scripts/ZoneMinder/lib/ZoneMinder/Control/FI8608W_Y2k.pm @@ -53,7 +53,7 @@ our @ISA = qw(ZoneMinder::Control); # of the position of your mouse on the arrow. # Extremity of arrow equal to fastest speed of movement # Close the base of arrow to lowest speed of movement -# for diagonaly you can click before the begining of the arrow for low speed +# for diagonaly you can click before the beginning of the arrow for low speed # In round center equal to stop to move and switch of latest OSD # -You can clic directly on the image that equal to click on arrow (for the left there is a bug in zoneminder speed is inverted) # -Zoom Tele switch ON InfraRed LED and stay to manual IR MODE @@ -63,7 +63,7 @@ our @ISA = qw(ZoneMinder::Control); # -8 Preset PTZ are implemented and functionnal # -This Script use for login "admin" this hardcoded and your password must setup in "Control Device" section # -This script is compatible with the basic authentification method used by mostly new camera based with hi3510 chipset -# -AutoStop function is active and you must set up value (in sec exemple 0.7) under AutoStop section +# -AutoStop function is active and you must set up value (in sec example 0.7) under AutoStop section # or you can set up to 0 for disable it (in this case you need to click to the circle center for stop) # -"White In" to control Brightness, "auto" for restore the original value of Brightness # -"White Out" to control Contrast, "man" for restore the original value of Contrast @@ -129,7 +129,7 @@ sub printMsg } sub sendCmd -{ +{ my $self = shift; my $cmd = shift; my $result = undef; @@ -211,7 +211,7 @@ sub moveConUp if ( $tiltspeed < 10 ) { $tiltspeed = 1; } - Debug( "Move Up" ); + Debug( "Move Up" ); if ( $osd eq "on" ) { my $cmd = "param.cgi?cmd=setoverlayattr&-region=1&-show=1&-name=Move Up $tiltspeed"; diff --git a/scripts/ZoneMinder/lib/ZoneMinder/Control/FI8620_Y2k.pm b/scripts/ZoneMinder/lib/ZoneMinder/Control/FI8620_Y2k.pm index ece4736e4..3e2addf85 100644 --- a/scripts/ZoneMinder/lib/ZoneMinder/Control/FI8620_Y2k.pm +++ b/scripts/ZoneMinder/lib/ZoneMinder/Control/FI8620_Y2k.pm @@ -57,7 +57,7 @@ our @ISA = qw(ZoneMinder::Control); # of the position of your mouse on the arrow. # Extremity of arrow equal to fastest speed of movement # Close the base of arrow to lowest speed of movement -# for diagonaly you can click before the begining of the arrow for low speed +# for diagonaly you can click before the beginning of the arrow for low speed # In round center equal to stop to move # -You can clic directly on the image that equal to click on arrow (for the left there is a bug in zoneminder speed is inverted) # -Zoom Tele/Wide with time control to simulate speed because speed value do not work (buggy firmware or not implemented on this cam) @@ -67,7 +67,7 @@ our @ISA = qw(ZoneMinder::Control); # You Need to configure ZoneMinder PANSPEED & TILTSEPPED & ZOOMSPEED 1 to 63 by 1 step # -This Script use for login "admin" this hardcoded and your password must setup in "Control Device" section # -This script is compatible with the basic authentification method used by mostly new camera -# -AutoStop function is active and you must set up value (in sec exemple 0.5) under AutoStop section +# -AutoStop function is active and you must set up value (in sec example 0.5) under AutoStop section # or you can set up to 0 for disable it but the camera never stop to move and trust me, she can move all the night... # (you need to click to the center arrow for stop) # -"White In" to control Brightness, "auto" for restore the original value of Brightness diff --git a/scripts/ZoneMinder/lib/ZoneMinder/Control/FI8908W.pm b/scripts/ZoneMinder/lib/ZoneMinder/Control/FI8908W.pm index cd925f72b..dd30484c3 100644 --- a/scripts/ZoneMinder/lib/ZoneMinder/Control/FI8908W.pm +++ b/scripts/ZoneMinder/lib/ZoneMinder/Control/FI8908W.pm @@ -43,176 +43,176 @@ use ZoneMinder::Config qw(:all); use Time::HiRes qw( usleep ); sub new -{ - my $class = shift; - my $id = shift; - my $self = ZoneMinder::Control->new( $id ); - bless( $self, $class ); - srand( time() ); - return $self; +{ + my $class = shift; + my $id = shift; + my $self = ZoneMinder::Control->new( $id ); + bless( $self, $class ); + srand( time() ); + return $self; } our $AUTOLOAD; sub AUTOLOAD { - my $self = shift; - my $class = ref($self) || croak( "$self not object" ); - my $name = $AUTOLOAD; - $name =~ s/.*://; - if ( exists($self->{$name}) ) - { - return( $self->{$name} ); - } - Fatal( "Can't access $name member of object of class $class" ); + my $self = shift; + my $class = ref($self) || croak( "$self not object" ); + my $name = $AUTOLOAD; + $name =~ s/.*://; + if ( exists($self->{$name}) ) + { + return( $self->{$name} ); + } + Fatal( "Can't access $name member of object of class $class" ); } sub open { - my $self = shift; + my $self = shift; - $self->loadMonitor(); + $self->loadMonitor(); - use LWP::UserAgent; - $self->{ua} = LWP::UserAgent->new; - $self->{ua}->agent( "ZoneMinder Control Agent/".ZoneMinder::Base::ZM_VERSION ); + use LWP::UserAgent; + $self->{ua} = LWP::UserAgent->new; + $self->{ua}->agent( "ZoneMinder Control Agent/".ZoneMinder::Base::ZM_VERSION ); - $self->{state} = 'open'; + $self->{state} = 'open'; } sub close { - my $self = shift; - $self->{state} = 'closed'; + my $self = shift; + $self->{state} = 'closed'; } sub printMsg { - my $self = shift; - my $msg = shift; - my $msg_len = length($msg); + my $self = shift; + my $msg = shift; + my $msg_len = length($msg); - Debug( $msg."[".$msg_len."]" ); + Debug( $msg."[".$msg_len."]" ); } sub sendCmd { - my $self = shift; - my $cmd = shift; - my $result = undef; + my $self = shift; + my $cmd = shift; + my $result = undef; - my ($user, $password) = split /:/, $self->{Monitor}->{ControlDevice}; + my ($user, $password) = split /:/, $self->{Monitor}->{ControlDevice}; - if ( !defined $password ) { - # If value of "Control device" does not consist of two parts, then only password is given and we fallback to default user: - $password = $user; - $user = 'admin'; - } + if ( !defined $password ) { + # If value of "Control device" does not consist of two parts, then only password is given and we fallback to default user: + $password = $user; + $user = 'admin'; + } - $cmd .= "user=$user&pwd=$password"; + $cmd .= "user=$user&pwd=$password"; - printMsg( $cmd, "Tx" ); + printMsg( $cmd, "Tx" ); - my $req = HTTP::Request->new( GET=>"http://".$self->{Monitor}->{ControlAddress}."/$cmd" ); - my $res = $self->{ua}->request($req); + my $req = HTTP::Request->new( GET=>"http://".$self->{Monitor}->{ControlAddress}."/$cmd" ); + my $res = $self->{ua}->request($req); - if ( $res->is_success ) - { - $result = !undef; - } - else - { - Error( "Error check failed: '".$res->status_line()."' for URL ".$req->uri() ); - } + if ( $res->is_success ) + { + $result = !undef; + } + else + { + Error( "Error check failed: '".$res->status_line()."' for URL ".$req->uri() ); + } - return( $result ); + return( $result ); } sub reset { - my $self = shift; - Debug( "Camera Reset" ); - $self->sendCmd( 'reboot.cgi?' ); + my $self = shift; + Debug( "Camera Reset" ); + $self->sendCmd( 'reboot.cgi?' ); } #Up Arrow sub moveConUp { - my $self = shift; - Debug( "Move Up" ); - $self->sendCmd( 'decoder_control.cgi?command=0&' ); + my $self = shift; + Debug( "Move Up" ); + $self->sendCmd( 'decoder_control.cgi?command=0&' ); } #Down Arrow sub moveConDown { - my $self = shift; - Debug( "Move Down" ); - $self->sendCmd( 'decoder_control.cgi?command=2&' ); + my $self = shift; + Debug( "Move Down" ); + $self->sendCmd( 'decoder_control.cgi?command=2&' ); } #Left Arrow sub moveConLeft { - my $self = shift; - Debug( "Move Left" ); - $self->sendCmd( 'decoder_control.cgi?command=6&' ); + my $self = shift; + Debug( "Move Left" ); + $self->sendCmd( 'decoder_control.cgi?command=6&' ); } #Right Arrow sub moveConRight { - my $self = shift; - Debug( "Move Right" ); - $self->sendCmd( 'decoder_control.cgi?command=4&' ); + my $self = shift; + Debug( "Move Right" ); + $self->sendCmd( 'decoder_control.cgi?command=4&' ); } #Diagonally Up Right Arrow sub moveConUpRight { - my $self = shift; - Debug( "Move Diagonally Up Right" ); - $self->sendCmd( 'decoder_control.cgi?command=90&' ); + my $self = shift; + Debug( "Move Diagonally Up Right" ); + $self->sendCmd( 'decoder_control.cgi?command=90&' ); } #Diagonally Down Right Arrow sub moveConDownRight { - my $self = shift; - Debug( "Move Diagonally Down Right" ); - $self->sendCmd( 'decoder_control.cgi?command=92&' ); + my $self = shift; + Debug( "Move Diagonally Down Right" ); + $self->sendCmd( 'decoder_control.cgi?command=92&' ); } #Diagonally Up Left Arrow sub moveConUpLeft { - my $self = shift; - Debug( "Move Diagonally Up Left" ); - $self->sendCmd( 'decoder_control.cgi?command=91&' ); + my $self = shift; + Debug( "Move Diagonally Up Left" ); + $self->sendCmd( 'decoder_control.cgi?command=91&' ); } #Diagonally Down Left Arrow sub moveConDownLeft { - my $self = shift; - Debug( "Move Diagonally Down Left" ); - $self->sendCmd( 'decoder_control.cgi?command=93&' ); + my $self = shift; + Debug( "Move Diagonally Down Left" ); + $self->sendCmd( 'decoder_control.cgi?command=93&' ); } #Stop sub moveStop { - my $self = shift; - Debug( "Move Stop" ); - $self->sendCmd( 'decoder_control.cgi?command=1&' ); + my $self = shift; + Debug( "Move Stop" ); + $self->sendCmd( 'decoder_control.cgi?command=1&' ); } #Move Camera to Home Position sub presetHome { - my $self = shift; - Debug( "Home Preset" ); - $self->sendCmd( 'decoder_control.cgi?command=25&' ); + my $self = shift; + Debug( "Home Preset" ); + $self->sendCmd( 'decoder_control.cgi?command=25&' ); } 1; @@ -226,10 +226,11 @@ ZoneMinder::Control::FI8908W - Foscam FI8908W camera control =head1 DESCRIPTION -This module contains the implementation of the Foscam FI8908W / FI8918W IP camera control -protocol. +This module contains the implementation of the Foscam FI8908W / FI8918W IP +camera control protocol. + +The module uses "Control Device" value to retrieve user and password. User +and password should be separated by colon, e.g. user:password. If colon is +not provided, then "admin" is used as a fallback value for the user. -The module uses "Control Device" value to retrieve user and password. User and password should -be separated by colon, e.g. user:password. If colon is not provided, then "admin" is used -as a fallback value for the user. =cut diff --git a/scripts/ZoneMinder/lib/ZoneMinder/Control/FI9821W_Y2k.pm b/scripts/ZoneMinder/lib/ZoneMinder/Control/FI9821W_Y2k.pm index e31ab0052..dd73a04e6 100644 --- a/scripts/ZoneMinder/lib/ZoneMinder/Control/FI9821W_Y2k.pm +++ b/scripts/ZoneMinder/lib/ZoneMinder/Control/FI9821W_Y2k.pm @@ -102,7 +102,6 @@ sub close sub printMsg { - my $self = shift; my $msg = shift; my $msg_len = length($msg); Debug( $msg."[".$msg_len."]" ); @@ -113,9 +112,28 @@ sub sendCmd my $self = shift; my $cmd = shift; my $result = undef; + + my ($user, $password) = split /:/, $self->{Monitor}->{ControlDevice}; + if ( ! $password ) { + $password = $user; + $user = 'admin'; + } + $user = 'admin' if ! $user; + $password = 'pwd' if ! $password; + + $cmd .= "&usr=$user&pwd=$password"; + printMsg( $cmd, "Tx" ); - my $temps = time(); - my $req = HTTP::Request->new( GET=>"http://".$self->{Monitor}->{ControlAddress}."/cgi-bin/CGIProxy.fcgi?usr%3Dadmin%26pwd%3D".$self->{Monitor}->{ControlDevice}."%26cmd%3D".$cmd."%26".$temps ); + my $url; + if ( $self->{Monitor}->{ControlAddress} =~ /^http/ ) { + $url = $self->{Monitor}->{ControlAddress}; + } else { + $url = "http://".$self->{Monitor}->{ControlAddress}; + } + $url .= "/cgi-bin/CGIProxy.fcgi?cmd=$cmd%26".time; + printMsg( $url, "Tx" ); + + my $req = HTTP::Request->new( GET=>$url ); my $res = $self->{ua}->request($req); if ( $res->is_success ) { @@ -134,7 +152,7 @@ sub reset # Setup OSD my $cmd = "setOSDSetting%26isEnableTimeStamp%3D0%26isEnableDevName%3D1%26dispPos%3D0%26isEnabledOSDMask%3D0"; $self->sendCmd( $cmd ); - # Setup For Stream=0 Resolution=720p Bandwith=4M FPS=30 KeyFrameInterval/GOP=100 VBR=ON + # Setup For Stream=0 Resolution=720p Bandwidth=4M FPS=30 KeyFrameInterval/GOP=100 VBR=ON $cmd = "setVideoStreamParam%26streamType%3D0%26resolution%3D0%26bitRate%3D4194304%26frameRate%3D30%26GOP%3D100%26isVBR%3D1"; $self->sendCmd( $cmd ); # Setup For Infrared AUTO diff --git a/scripts/ZoneMinder/lib/ZoneMinder/Control/M8640.pm b/scripts/ZoneMinder/lib/ZoneMinder/Control/M8640.pm index 584e04dd1..10bbea5de 100644 --- a/scripts/ZoneMinder/lib/ZoneMinder/Control/M8640.pm +++ b/scripts/ZoneMinder/lib/ZoneMinder/Control/M8640.pm @@ -107,14 +107,18 @@ sub sendCmd { printMsg( $cmd, "Tx" ); #print( "http://$address/$cmd\n" ); #my $req = HTTP::Request->new( GET=>"http://".$self->{Monitor}->{ControlAddress}."/$cmd" ); - - my $url; - if ( $self->{Monitor}->{ControlAddress} =~ /^http/ ) { - $url = $self->{Monitor}->{ControlAddress}.'/cgi-bin/setGPIO.cgi?preventCache='.time; - } else { - $url = 'http://'.$self->{Monitor}->{ControlAddress}.'/cgi-bin/setGPIO.cgi?preventCache='.time; - } # en dif - Error("Url: $url $cmd"); + + my $url; + if ( $self->{Monitor}->{ControlAddress} =~ /^http/ ) { + $url = $self->{Monitor}->{ControlAddress} + .'/cgi-bin/setGPIO.cgi?preventCache='.time + ; + } else { + $url = 'http://'.$self->{Monitor}->{ControlAddress} + .'/cgi-bin/setGPIO.cgi?preventCache='.time + ; + } # en dif + Error("Url: $url $cmd"); my $uri = URI::Encode->new( { encode_reserved => 0 } ); my $encoded = $uri->encode( $cmd ); my $res = $self->{ua}->post( $url, Content=>"data=$encoded" ); @@ -203,7 +207,11 @@ sub moveMap my $xcoord = $self->getParam( $params, 'xcoord' ); my $ycoord = $self->getParam( $params, 'ycoord' ); Debug( "Move Map to $xcoord,$ycoord" ); - my $cmd = "/axis-cgi/com/ptz.cgi?center=$xcoord,$ycoord&imagewidth=".$self->{Monitor}->{Width}."&imageheight=".$self->{Monitor}->{Height}; + my $cmd = "/axis-cgi/com/ptz.cgi?center=$xcoord,$ycoord&imagewidth=" + .$self->{Monitor}->{Width} + ."&imageheight=" + .$self->{Monitor}->{Height} + ; $self->sendCmd( $cmd ); } diff --git a/scripts/ZoneMinder/lib/ZoneMinder/Control/TVIP862.pm b/scripts/ZoneMinder/lib/ZoneMinder/Control/TVIP862.pm index 7f5058dec..050e2bb75 100644 --- a/scripts/ZoneMinder/lib/ZoneMinder/Control/TVIP862.pm +++ b/scripts/ZoneMinder/lib/ZoneMinder/Control/TVIP862.pm @@ -60,16 +60,16 @@ our @ISA = qw(ZoneMinder::Control); # # ******** YOU MUST CHANGE THE FOLLOWING LINES TO MATCH YOUR CAMERA! ********** -# +# # I assume that "TV-IP672WI" would work for the TV-IP672WI, but can't test since I don't own one. -# +# # TV-IP672PI works for the PI version, of course. # # Finally, the username is the username you'd like to authenticate as. # our $REALM = 'TV-IP862IC'; our $USERNAME = 'admin'; -our $PASSWORD = ''; +our $PASSWORD = ''; our $ADDRESS = ''; # ========================================================================== @@ -111,26 +111,32 @@ sub open my $self = shift; $self->loadMonitor(); - my ( $protocol, $username, $password, $address ) = $self->{Monitor}->{ControlAddress} =~ /^(https?:\/\/)?([^:]+):([^\/@]+)@(.*)$/; - if ( $username ) { - $USERNAME = $username; - $PASSWORD = $password; - $ADDRESS = $address; - } else { - Error( "Failed to parse auth from address"); - $ADDRESS = $self->{Monitor}->{ControlAddress}; - } - if ( ! $ADDRESS =~ /:/ ) { - Error( "You generally need to also specify the port. I will append :80" ); - $ADDRESS .= ':80'; - } + my ( $protocol, $username, $password, $address ) + = $self->{Monitor}->{ControlAddress} =~ /^(https?:\/\/)?([^:]+):([^\/@]+)@(.*)$/; + if ( $username ) { + $USERNAME = $username; + $PASSWORD = $password; + $ADDRESS = $address; + } else { + Error( "Failed to parse auth from address"); + $ADDRESS = $self->{Monitor}->{ControlAddress}; + } + if ( ! $ADDRESS =~ /:/ ) { + Error( "You generally need to also specify the port. I will append :80" ); + $ADDRESS .= ':80'; + } use LWP::UserAgent; $self->{ua} = LWP::UserAgent->new; $self->{ua}->agent( "ZoneMinder Control Agent/".$ZoneMinder::Base::ZM_VERSION ); $self->{state} = 'open'; -# credentials: ("ip:port" (no prefix!), realm (string), username (string), password (string) - Debug ( "sendCmd credentials control address:'".$ADDRESS."' realm:'" . $REALM . "' username:'" . $USERNAME . "' password:'".$PASSWORD."'"); +# credentials: ("ip:port" (no prefix!), realm (string), username (string), password (string) + Debug ( "sendCmd credentials control address:'".$ADDRESS + ."' realm:'" . $REALM + . "' username:'" . $USERNAME + . "' password:'".$PASSWORD + ."'" + ); $self->{ua}->credentials($ADDRESS,$REALM,$USERNAME,$PASSWORD); } @@ -159,29 +165,29 @@ sub sendCmd my $result = undef; - my $url = "http://".$ADDRESS."/cgi/ptdc.cgi?command=".$cmd; + my $url = "http://".$ADDRESS."/cgi/ptdc.cgi?command=".$cmd; my $req = HTTP::Request->new( GET=>$url ); Debug ("sendCmd command: " . $url ); - + my $res = $self->{ua}->request($req); if ( $res->is_success ) { $result = !undef; } else { - if ( $res->status_line() eq '401 Unauthorized' ) { - Error( "Error check failed, trying again: USERNAME: $USERNAME realm: $REALM password: " . $PASSWORD ); - Error("Content was " . $res->content() ); - my $res = $self->{ua}->request($req); - if ( $res->is_success ) { - $result = !undef; - } else { - Error("Content was " . $res->content() ); - } - } - if ( ! $result ) { - Error( "Error check failed: '".$res->status_line()."' cmd:'".$cmd."'" ); - } + if ( $res->status_line() eq '401 Unauthorized' ) { + Error( "Error check failed, trying again: USERNAME: $USERNAME realm: $REALM password: " . $PASSWORD ); + Error("Content was " . $res->content() ); + my $res = $self->{ua}->request($req); + if ( $res->is_success ) { + $result = !undef; + } else { + Error("Content was " . $res->content() ); + } + } + if ( ! $result ) { + Error( "Error check failed: '".$res->status_line()."' cmd:'".$cmd."'" ); + } } return( $result ); @@ -203,10 +209,10 @@ sub sendCmdPost my $result = undef; if ($url eq undef) - { - Error ("url passed to sendCmdPost is undefined."); - return(-1); - } + { + Error ("url passed to sendCmdPost is undefined."); + return(-1); + } Debug ("sendCmdPost url: " . $url . " cmd: " . $cmd); @@ -215,7 +221,7 @@ sub sendCmdPost $req->content($cmd); Debug ( "sendCmdPost credentials control address:'".$ADDRESS."' realm:'" . $REALM . "' username:'" . $USERNAME . "' password:'".$PASSWORD."'"); - + my $res = $self->{ua}->request($req); if ( $res->is_success ) @@ -225,11 +231,11 @@ sub sendCmdPost else { Error( "sendCmdPost Error check failed: '".$res->status_line()."' cmd:'".$cmd."'" ); - if ( $res->status_line() eq '401 Unauthorized' ) { - Error( "sendCmdPost Error check failed: USERNAME: $USERNAME realm: $REALM password: " . $PASSWORD ); - } else { - Error( "sendCmdPost Error check failed: USERNAME: $USERNAME realm: $REALM password: " . $PASSWORD ); - } # endif + if ( $res->status_line() eq '401 Unauthorized' ) { + Error( "sendCmdPost Error check failed: USERNAME: $USERNAME realm: $REALM password: " . $PASSWORD ); + } else { + Error( "sendCmdPost Error check failed: USERNAME: $USERNAME realm: $REALM password: " . $PASSWORD ); + } # endif } return( $result ); diff --git a/scripts/ZoneMinder/lib/ZoneMinder/Control/Wanscam.pm b/scripts/ZoneMinder/lib/ZoneMinder/Control/Wanscam.pm index b2ed3e2b5..f419aacfc 100644 --- a/scripts/ZoneMinder/lib/ZoneMinder/Control/Wanscam.pm +++ b/scripts/ZoneMinder/lib/ZoneMinder/Control/Wanscam.pm @@ -16,8 +16,8 @@ # Rename to Wanscam # Pan Left/Right switched # IR On/Off switched -# Brightness Increase/Decrease in 16 steps -# +# Brightness Increase/Decrease in 16 steps +# # # This program is free software; you can redistribute it and/or # modify it under the terms of the GNU General Public License diff --git a/scripts/ZoneMinder/lib/ZoneMinder/Control/mjpgStreamer.pm b/scripts/ZoneMinder/lib/ZoneMinder/Control/mjpgStreamer.pm index 255dac056..18a73cae8 100644 --- a/scripts/ZoneMinder/lib/ZoneMinder/Control/mjpgStreamer.pm +++ b/scripts/ZoneMinder/lib/ZoneMinder/Control/mjpgStreamer.pm @@ -126,32 +126,32 @@ sub sendCmd sub Up { my $self = shift; - $self->moveConUp(); + $self->moveConUp(); } sub Down { my $self = shift; - $self->moveConDown(); + $self->moveConDown(); } sub Left { my $self = shift; - $self->moveConLeft(); + $self->moveConLeft(); } sub Right { my $self = shift; - $self->moveConRight(); + $self->moveConRight(); } sub reset { my $self = shift; - $self->cameraReset(); + $self->cameraReset(); } diff --git a/scripts/ZoneMinder/lib/ZoneMinder/Control/onvif.pm b/scripts/ZoneMinder/lib/ZoneMinder/Control/onvif.pm index 09ef59c8e..76b161582 100644 --- a/scripts/ZoneMinder/lib/ZoneMinder/Control/onvif.pm +++ b/scripts/ZoneMinder/lib/ZoneMinder/Control/onvif.pm @@ -36,7 +36,7 @@ our %CamParams = (); # ========================================================================== # # ONVIF Control Protocol -# +# # On ControlAddress use the format : # USERNAME:PASSWORD@ADDRESS:PORT # eg : admin:@10.1.2.1:80 @@ -50,7 +50,7 @@ use ZoneMinder::Config qw(:all); use Time::HiRes qw( usleep ); sub new -{ +{ my $class = shift; my $id = shift; @@ -90,7 +90,7 @@ sub open } sub close -{ +{ my $self = shift; $self->{state} = 'closed'; } @@ -133,7 +133,7 @@ sub getCamParams my $req = HTTP::Request->new( GET=>"http://".$self->{Monitor}->{ControlAddress}."/get_camera_params.cgi" ); my $res = $self->{ua}->request($req); - if ( $res->is_success ) + if ( $res->is_success ) { # Parse results setting values in %FCParams my $content = $res->decoded_content; @@ -141,7 +141,7 @@ sub getCamParams while ($content =~ s/var\s+([^=]+)=([^;]+);//ms) { $CamParams{$1} = $2; } - } + } else { Error( "Error check failed:'".$res->status_line()."'" ); diff --git a/scripts/ZoneMinder/lib/ZoneMinder/Database.pm b/scripts/ZoneMinder/lib/ZoneMinder/Database.pm index 94e82da4c..7dfe0654b 100644 --- a/scripts/ZoneMinder/lib/ZoneMinder/Database.pm +++ b/scripts/ZoneMinder/lib/ZoneMinder/Database.pm @@ -19,7 +19,7 @@ # # ========================================================================== # -# This module contains the common definitions and functions used by the rest +# This module contains the common definitions and functions used by the rest # of the ZoneMinder scripts # package ZoneMinder::Database; @@ -37,17 +37,17 @@ our @ISA = qw(Exporter ZoneMinder::Base); # names by default without a very good reason. Use EXPORT_OK instead. # Do not simply export all your public functions/methods/constants. -# This allows declaration use ZoneMinder ':all'; +# This allows declaration use ZoneMinder ':all'; # If you do not need this, moving things directly into @EXPORT or @EXPORT_OK # will save memory. our %EXPORT_TAGS = ( 'functions' => [ qw( - zmDbConnect - zmDbDisconnect - zmDbGetMonitors - zmDbGetMonitor - zmDbGetMonitorAndControl - ) ] + zmDbConnect + zmDbDisconnect + zmDbGetMonitors + zmDbGetMonitor + zmDbGetMonitorAndControl + ) ] ); push( @{$EXPORT_TAGS{all}}, @{$EXPORT_TAGS{$_}} ) foreach keys %EXPORT_TAGS; @@ -72,35 +72,44 @@ our $dbh = undef; sub zmDbConnect { - my $force = shift; - if ( $force ) - { - zmDbDisconnect(); - } - if ( !defined( $dbh ) ) - { + my $force = shift; + if ( $force ) + { + zmDbDisconnect(); + } + if ( !defined( $dbh ) ) + { my ( $host, $port ) = ( $Config{ZM_DB_HOST} =~ /^([^:]+)(?::(.+))?$/ ); if ( defined($port) ) { - $dbh = DBI->connect( "DBI:mysql:database=".$Config{ZM_DB_NAME}.";host=".$host.";port=".$port, $Config{ZM_DB_USER}, $Config{ZM_DB_PASS} ); + $dbh = DBI->connect( "DBI:mysql:database=".$Config{ZM_DB_NAME} + .";host=".$host + .";port=".$port + , $Config{ZM_DB_USER} + , $Config{ZM_DB_PASS} + ); } else { - $dbh = DBI->connect( "DBI:mysql:database=".$Config{ZM_DB_NAME}.";host=".$Config{ZM_DB_HOST}, $Config{ZM_DB_USER}, $Config{ZM_DB_PASS} ); + $dbh = DBI->connect( "DBI:mysql:database=".$Config{ZM_DB_NAME} + .";host=".$Config{ZM_DB_HOST} + , $Config{ZM_DB_USER} + , $Config{ZM_DB_PASS} + ); } $dbh->trace( 0 ); - } - return( $dbh ); + } + return( $dbh ); } sub zmDbDisconnect { - if ( defined( $dbh ) ) - { - $dbh->disconnect(); - $dbh = undef; - } + if ( defined( $dbh ) ) + { + $dbh->disconnect(); + $dbh = undef; + } } use constant DB_MON_ALL => 0; # All monitors @@ -112,76 +121,86 @@ use constant DB_MON_PASSIVE => 5; # All monitors that are in nodect state sub zmDbGetMonitors { - zmDbConnect(); + zmDbConnect(); - my $function = shift || DB_MON_ALL; - my $sql = "select * from Monitors"; + my $function = shift || DB_MON_ALL; + my $sql = "select * from Monitors"; - if ( $function ) - { - if ( $function == DB_MON_CAPT ) - { - $sql .= " where Function >= 'Monitor'"; - } - elsif ( $function == DB_MON_ACTIVE ) - { - $sql .= " where Function > 'Monitor'"; - } - elsif ( $function == DB_MON_MOTION ) - { - $sql .= " where Function = 'Modect' or Function = 'Mocord'"; - } - elsif ( $function == DB_MON_RECORD ) - { - $sql .= " where Function = 'Record' or Function = 'Mocord'"; - } - elsif ( $function == DB_MON_PASSIVE ) - { - $sql .= " where Function = 'Nodect'"; - } - } - my $sth = $dbh->prepare_cached( $sql ) or croak( "Can't prepare '$sql': ".$dbh->errstr() ); - my $res = $sth->execute() or croak( "Can't execute '$sql': ".$sth->errstr() ); + if ( $function ) + { + if ( $function == DB_MON_CAPT ) + { + $sql .= " where Function >= 'Monitor'"; + } + elsif ( $function == DB_MON_ACTIVE ) + { + $sql .= " where Function > 'Monitor'"; + } + elsif ( $function == DB_MON_MOTION ) + { + $sql .= " where Function = 'Modect' or Function = 'Mocord'"; + } + elsif ( $function == DB_MON_RECORD ) + { + $sql .= " where Function = 'Record' or Function = 'Mocord'"; + } + elsif ( $function == DB_MON_PASSIVE ) + { + $sql .= " where Function = 'Nodect'"; + } + } + my $sth = $dbh->prepare_cached( $sql ) + or croak( "Can't prepare '$sql': ".$dbh->errstr() ); + my $res = $sth->execute() + or croak( "Can't execute '$sql': ".$sth->errstr() ); - my @monitors; + my @monitors; while( my $monitor = $sth->fetchrow_hashref() ) { - push( @monitors, $monitor ); - } - $sth->finish(); - return( \@monitors ); + push( @monitors, $monitor ); + } + $sth->finish(); + return( \@monitors ); } sub zmDbGetMonitor { - zmDbConnect(); + zmDbConnect(); - my $id = shift; + my $id = shift; - return( undef ) if ( !defined($id) ); + return( undef ) if ( !defined($id) ); - my $sql = "select * from Monitors where Id = ?"; - my $sth = $dbh->prepare_cached( $sql ) or croak( "Can't prepare '$sql': ".$dbh->errstr() ); - my $res = $sth->execute( $id ) or croak( "Can't execute '$sql': ".$sth->errstr() ); + my $sql = "select * from Monitors where Id = ?"; + my $sth = $dbh->prepare_cached( $sql ) + or croak( "Can't prepare '$sql': ".$dbh->errstr() ); + my $res = $sth->execute( $id ) + or croak( "Can't execute '$sql': ".$sth->errstr() ); my $monitor = $sth->fetchrow_hashref(); - return( $monitor ); + return( $monitor ); } sub zmDbGetMonitorAndControl { - zmDbConnect(); + zmDbConnect(); - my $id = shift; + my $id = shift; - return( undef ) if ( !defined($id) ); + return( undef ) if ( !defined($id) ); - my $sql = "select C.*,M.*,C.Protocol from Monitors as M inner join Controls as C on (M.ControlId = C.Id) where M.Id = ?"; - my $sth = $dbh->prepare_cached( $sql ) or Fatal( "Can't prepare '$sql': ".$dbh->errstr() ); - my $res = $sth->execute( $id ) or Fatal( "Can't execute '$sql': ".$sth->errstr() ); + my $sql = "SELECT C.*,M.*,C.Protocol + FROM Monitors as M + INNER JOIN Controls as C on (M.ControlId = C.Id) + WHERE M.Id = ?" + ; + my $sth = $dbh->prepare_cached( $sql ) + or Fatal( "Can't prepare '$sql': ".$dbh->errstr() ); + my $res = $sth->execute( $id ) + or Fatal( "Can't execute '$sql': ".$sth->errstr() ); my $monitor = $sth->fetchrow_hashref(); - return( $monitor ); + return( $monitor ); } 1; diff --git a/scripts/ZoneMinder/lib/ZoneMinder/General.pm b/scripts/ZoneMinder/lib/ZoneMinder/General.pm index 0be45e34d..195bd265f 100644 --- a/scripts/ZoneMinder/lib/ZoneMinder/General.pm +++ b/scripts/ZoneMinder/lib/ZoneMinder/General.pm @@ -19,7 +19,7 @@ # # ========================================================================== # -# This module contains the common definitions and functions used by the rest +# This module contains the common definitions and functions used by the rest # of the ZoneMinder scripts # package ZoneMinder::General; @@ -203,13 +203,26 @@ sub getEventPath my $event_path = ""; if ( $Config{ZM_USE_DEEP_STORAGE} ) { - $event_path = $Config{ZM_DIR_EVENTS}.'/'.$event->{MonitorId}.'/'.strftime( "%y/%m/%d/%H/%M/%S", localtime($event->{Time}) ); + $event_path = $Config{ZM_DIR_EVENTS} + .'/'.$event->{MonitorId} + .'/'.strftime( "%y/%m/%d/%H/%M/%S", + localtime($event->{Time}) + ) + ; } else { - $event_path = $Config{ZM_DIR_EVENTS}.'/'.$event->{MonitorId}.'/'.$event->{Id}; + $event_path = $Config{ZM_DIR_EVENTS} + .'/'.$event->{MonitorId} + .'/'.$event->{Id} + ; + } + + if ( index($Config{ZM_DIR_EVENTS},'/') != 0 ){ + $event_path = $Config{ZM_PATH_WEB} + .'/'.$event_path + ; } - $event_path = $Config{ZM_PATH_WEB}.'/'.$event_path if ( index($Config{ZM_DIR_EVENTS},'/') != 0 ); return( $event_path ); } @@ -219,7 +232,9 @@ sub createEventPath # WARNING assumes running from events directory # my $event = shift; - my $eventRootPath = ($Config{ZM_DIR_EVENTS}=~m|/|)?$Config{ZM_DIR_EVENTS}:($Config{ZM_PATH_WEB}.'/'.$Config{ZM_DIR_EVENTS}); + my $eventRootPath = ($Config{ZM_DIR_EVENTS}=~m|/|) + ? $Config{ZM_DIR_EVENTS} + : ($Config{ZM_PATH_WEB}.'/'.$Config{ZM_DIR_EVENTS}); my $eventPath = $eventRootPath.'/'.$event->{MonitorId}; if ( $Config{ZM_USE_DEEP_STORAGE} ) @@ -242,7 +257,8 @@ sub createEventPath # Create event id symlink my $idFile = sprintf( "%s/.%d", $eventPath, $event->{Id} ); - symlink( $timePath, $idFile ) or Fatal( "Can't symlink $idFile -> $eventPath: $!" ); + symlink( $timePath, $idFile ) + or Fatal( "Can't symlink $idFile -> $eventPath: $!" ); makePath( $timePath, $eventPath ); $eventPath .= '/'.$timePath; @@ -281,8 +297,13 @@ sub _checkProcessOwner my ( $processOwner ) = getpwuid( $> ); if ( $processOwner ne $Config{ZM_WEB_USER} ) { - # Not running as web user, so should be root in whch case chown the temporary directory - ( my $ownerName, my $ownerPass, $_ownerUid, $_ownerGid ) = getpwnam( $Config{ZM_WEB_USER} ) or Fatal( "Can't get user details for web user '".$Config{ZM_WEB_USER}."': $!" ); + # Not running as web user, so should be root in which case chown + # the temporary directory + ( my $ownerName, my $ownerPass, $_ownerUid, $_ownerGid ) + = getpwnam( $Config{ZM_WEB_USER} ) + or Fatal( "Can't get user details for web user '" + .$Config{ZM_WEB_USER}."': $!" + ); $_setFileOwner = 1; } else @@ -299,7 +320,10 @@ sub setFileOwner if ( _checkProcessOwner() ) { - chown( $_ownerUid, $_ownerGid, $file ) or Fatal( "Can't change ownership of file '$file' to '".$Config{ZM_WEB_USER}.":".$Config{ZM_WEB_GROUP}."': $!" ); + chown( $_ownerUid, $_ownerGid, $file ) + or Fatal( "Can't change ownership of file '$file' to '" + .$Config{ZM_WEB_USER}.":".$Config{ZM_WEB_GROUP}."': $!" + ); } } @@ -337,9 +361,14 @@ sub createEvent elsif ( $event->{MonitorId} ) { my $sql = "select * from Monitors where Id = ?"; - my $sth = $dbh->prepare_cached( $sql ) or Fatal( "Can't prepare sql '$sql': ".$dbh->errstr() ); - my $res = $sth->execute( $event->{MonitorId} ) or Fatal( "Can't execute sql '$sql': ".$sth->errstr() ); - $event->{monitor} = $sth->fetchrow_hashref() or Fatal( "Unable to create event, can't load monitor with id '".$event->{MonitorId}."'" ); + my $sth = $dbh->prepare_cached( $sql ) + or Fatal( "Can't prepare sql '$sql': ".$dbh->errstr() ); + my $res = $sth->execute( $event->{MonitorId} ) + or Fatal( "Can't execute sql '$sql': ".$sth->errstr() ); + $event->{monitor} = $sth->fetchrow_hashref() + or Fatal( "Unable to create event, can't load monitor with id '" + .$event->{MonitorId}."'" + ); $sth->finish(); } else @@ -360,7 +389,9 @@ sub createEvent my $imageInfo = Image::Info::image_info( $frame->{imagePath} ); if ( $imageInfo->{error} ) { - Error( "Unable to extract image info from '".$frame->{imagePath}."': ".$imageInfo->{error} ); + Error( "Unable to extract image info from '" + .$frame->{imagePath}."': ".$imageInfo->{error} + ); } else { @@ -396,18 +427,25 @@ sub createEvent push( @values, $event->{$field} ); } - my $sql = "insert into Events (".join(',',@fields).") values (".join(',',@formats).")"; - my $sth = $dbh->prepare_cached( $sql ) or Fatal( "Can't prepare sql '$sql': ".$dbh->errstr() ); - my $res = $sth->execute( @values ) or Fatal( "Can't execute sql '$sql': ".$sth->errstr() ); + my $sql = "INSERT INTO Events (".join(',',@fields) + .") VALUES (".join(',',@formats).")" + ; + my $sth = $dbh->prepare_cached( $sql ) + or Fatal( "Can't prepare sql '$sql': ".$dbh->errstr() ); + my $res = $sth->execute( @values ) + or Fatal( "Can't execute sql '$sql': ".$sth->errstr() ); $event->{Id} = $dbh->{mysql_insertid}; Info( "Created event ".$event->{Id} ); if ( $event->{EndTime} ) { - $event->{Name} = $event->{monitor}->{EventPrefix}.$event->{Id} if ( $event->{Name} eq 'New Event' ); + $event->{Name} = $event->{monitor}->{EventPrefix}.$event->{Id} + if ( $event->{Name} eq 'New Event' ); my $sql = "update Events set Name = ? where Id = ?"; - my $sth = $dbh->prepare_cached( $sql ) or Fatal( "Can't prepare sql '$sql': ".$dbh->errstr() ); - my $res = $sth->execute( $event->{Name}, $event->{Id} ) or Fatal( "Can't execute sql '$sql': ".$sth->errstr() ); + my $sth = $dbh->prepare_cached( $sql ) + or Fatal( "Can't prepare sql '$sql': ".$dbh->errstr() ); + my $res = $sth->execute( $event->{Name}, $event->{Id} ) + or Fatal( "Can't execute sql '$sql': ".$sth->errstr() ); } my $eventPath = createEventPath( $event ); @@ -430,19 +468,39 @@ sub createEvent push( @values, $frame->{$field} ); } - my $sql = "insert into Frames (".join(',',@fields).") values (".join(',',@formats).")"; - my $sth = $dbh->prepare_cached( $sql ) or Fatal( "Can't prepare sql '$sql': ".$dbh->errstr() ); - my $res = $sth->execute( @values ) or Fatal( "Can't execute sql '$sql': ".$sth->errstr() ); + my $sql = "insert into Frames (".join(',',@fields) + .") values (".join(',',@formats).")" + ; + my $sth = $dbh->prepare_cached( $sql ) + or Fatal( "Can't prepare sql '$sql': ".$dbh->errstr() ); + my $res = $sth->execute( @values ) + or Fatal( "Can't execute sql '$sql': ".$sth->errstr() ); #$frame->{FrameId} = $dbh->{mysql_insertid}; if ( $frame->{imagePath} ) { - $frame->{capturePath} = sprintf( "%s/%0".$Config{ZM_EVENT_IMAGE_DIGITS}."d-capture.jpg", $eventPath, $frame->{FrameId} ); - rename( $frame->{imagePath}, $frame->{capturePath} ) or Fatal( "Can't copy ".$frame->{imagePath}." to ".$frame->{capturePath}.": $!" ); + $frame->{capturePath} = sprintf( + "%s/%0".$Config{ZM_EVENT_IMAGE_DIGITS} + ."d-capture.jpg" + , $eventPath + , $frame->{FrameId} + ); + rename( $frame->{imagePath}, $frame->{capturePath} ) + or Fatal( "Can't copy ".$frame->{imagePath} + ." to ".$frame->{capturePath}.": $!" + ); setFileOwner( $frame->{capturePath} ); if ( 0 && $Config{ZM_CREATE_ANALYSIS_IMAGES} ) { - $frame->{analysePath} = sprintf( "%s/%0".$Config{ZM_EVENT_IMAGE_DIGITS}."d-analyse.jpg", $eventPath, $frame->{FrameId} ); - link( $frame->{capturePath}, $frame->{analysePath} ) or Fatal( "Can't link ".$frame->{capturePath}." to ".$frame->{analysePath}.": $!" ); + $frame->{analysePath} = sprintf( + "%s/%0".$Config{ZM_EVENT_IMAGE_DIGITS} + ."d-analyse.jpg" + , $eventPath + , $frame->{FrameId} + ); + link( $frame->{capturePath}, $frame->{analysePath} ) + or Fatal( "Can't link ".$frame->{capturePath} + ." to ".$frame->{analysePath}.": $!" + ); setFileOwner( $frame->{analysePath} ); } } @@ -469,7 +527,8 @@ sub updateEvent my $dbh = zmDbConnect(); - $event->{Name} = $event->{monitor}->{EventPrefix}.$event->{Id} if ( $event->{Name} eq 'New Event' ); + $event->{Name} = $event->{monitor}->{EventPrefix}.$event->{Id} + if ( $event->{Name} eq 'New Event' ); my %formats = ( StartTime => 'from_unixtime(?)', @@ -486,8 +545,10 @@ sub updateEvent my $sql = "update Events set ".join(',',@sets)." where Id = ?"; push( @values, $event->{Id} ); - my $sth = $dbh->prepare_cached( $sql ) or Fatal( "Can't prepare sql '$sql': ".$dbh->errstr() ); - my $res = $sth->execute( @values ) or Fatal( "Can't execute sql '$sql': ".$sth->errstr() ); + my $sth = $dbh->prepare_cached( $sql ) + or Fatal( "Can't prepare sql '$sql': ".$dbh->errstr() ); + my $res = $sth->execute( @values ) + or Fatal( "Can't execute sql '$sql': ".$sth->errstr() ); } sub deleteEventFiles diff --git a/scripts/ZoneMinder/lib/ZoneMinder/Logger.pm b/scripts/ZoneMinder/lib/ZoneMinder/Logger.pm index e10c18a96..a6a82db87 100644 --- a/scripts/ZoneMinder/lib/ZoneMinder/Logger.pm +++ b/scripts/ZoneMinder/lib/ZoneMinder/Logger.pm @@ -19,7 +19,7 @@ # # ========================================================================== # -# This module contains the debug definitions and functions used by the rest +# This module contains the debug definitions and functions used by the rest # of the ZoneMinder scripts # package ZoneMinder::Logger; @@ -258,7 +258,12 @@ sub initialise( @ ) { foreach my $target ( split( /\|/, $Config{ZM_LOG_DEBUG_TARGET} ) ) { - if ( $target eq $this->{id} || $target eq "_".$this->{id} || $target eq $this->{idRoot} || $target eq "_".$this->{idRoot} || $target eq "" ) + if ( $target eq $this->{id} + || $target eq "_".$this->{id} + || $target eq $this->{idRoot} + || $target eq "_".$this->{idRoot} + || $target eq "" + ) { if ( $Config{ZM_LOG_DEBUG_LEVEL} > NOLOG ) { @@ -287,8 +292,15 @@ sub initialise( @ ) $this->{autoFlush} = $ENV{'LOG_FLUSH'}?1:0 if ( defined($ENV{'LOG_FLUSH'}) ); $this->{initialised} = !undef; - - Debug( "LogOpts: level=".$codes{$this->{level}}."/".$codes{$this->{effectiveLevel}}.", screen=".$codes{$this->{termLevel}}.", database=".$codes{$this->{databaseLevel}}.", logfile=".$codes{$this->{fileLevel}}."->".$this->{logFile}.", syslog=".$codes{$this->{syslogLevel}} ); + + Debug( "LogOpts: level=".$codes{$this->{level}} + ."/".$codes{$this->{effectiveLevel}} + .", screen=".$codes{$this->{termLevel}} + .", database=".$codes{$this->{databaseLevel}} + .", logfile=".$codes{$this->{fileLevel}} + ."->".$this->{logFile} + .", syslog=".$codes{$this->{syslogLevel}} + ); } sub terminate @@ -452,23 +464,39 @@ sub databaseLevel if ( defined($port) ) { - $this->{dbh} = DBI->connect( "DBI:mysql:database=".$Config{ZM_DB_NAME}.";host=".$host.";port=".$port, $Config{ZM_DB_USER}, $Config{ZM_DB_PASS} ); + $this->{dbh} = DBI->connect( "DBI:mysql:database=".$Config{ZM_DB_NAME} + .";host=".$host + .";port=".$port + , $Config{ZM_DB_USER} + , $Config{ZM_DB_PASS} + ); } else { - $this->{dbh} = DBI->connect( "DBI:mysql:database=".$Config{ZM_DB_NAME}.";host=".$Config{ZM_DB_HOST}, $Config{ZM_DB_USER}, $Config{ZM_DB_PASS} ); + $this->{dbh} = DBI->connect( "DBI:mysql:database=".$Config{ZM_DB_NAME} + .";host=".$Config{ZM_DB_HOST} + , $Config{ZM_DB_USER} + , $Config{ZM_DB_PASS} + ); } if ( !$this->{dbh} ) { $databaseLevel = NOLOG; - Error( "Unable to write log entries to DB, can't connect to database '".$Config{ZM_DB_NAME}."' on host '".$Config{ZM_DB_HOST}."'" ); + Error( "Unable to write log entries to DB, can't connect to database '" + .$Config{ZM_DB_NAME} + ."' on host '" + .$Config{ZM_DB_HOST} + ."'" + ); } else { $this->{dbh}->{AutoCommit} = 1; - Fatal( "Can't set AutoCommit on in database connection" ) unless( $this->{dbh}->{AutoCommit} ); + Fatal( "Can't set AutoCommit on in database connection" ) + unless( $this->{dbh}->{AutoCommit} ); $this->{dbh}->{mysql_auto_reconnect} = 1; - Fatal( "Can't set mysql_auto_reconnect on in database connection" ) unless( $this->{dbh}->{mysql_auto_reconnect} ); + Fatal( "Can't set mysql_auto_reconnect on in database connection" ) + unless( $this->{dbh}->{mysql_auto_reconnect} ); $this->{dbh}->trace( 0 ); } } @@ -559,7 +587,9 @@ sub openFile if ( $> == 0 ) { chown( $webUid, $webGid, $this->{logFile} ) - or Fatal( "Can't change permissions on log file '".$this->{logFile}."': $!" ) + or Fatal( "Can't change permissions on log file '" + .$this->{logFile}."': $!" + ) } } else @@ -588,7 +618,17 @@ sub logPrint my $code = $codes{$level}; my ($seconds, $microseconds) = gettimeofday(); - my $message = sprintf( "%s.%06d %s[%d].%s [%s]", strftime( "%x %H:%M:%S", localtime( $seconds ) ), $microseconds, $this->{id}, $$, $code, $string ); + my $message = sprintf( + "%s.%06d %s[%d].%s [%s]" + , strftime( "%x %H:%M:%S" + ,localtime( $seconds ) + ) + , $microseconds + , $this->{id} + , $$ + , $code + , $string + ); if ( $this->{trace} ) { $message = Carp::shortmess( $message ); @@ -597,7 +637,8 @@ sub logPrint { $message = $message."\n"; } - syslog( $priorities{$level}, $code." [%s]", $string ) if ( $level <= $this->{syslogLevel} ); + syslog( $priorities{$level}, $code." [%s]", $string ) + if ( $level <= $this->{syslogLevel} ); print( $LOGFILE $message ) if ( $level <= $this->{fileLevel} ); if ( $level <= $this->{databaseLevel} ) { @@ -608,7 +649,14 @@ sub logPrint $this->{databaseLevel} = NOLOG; Fatal( "Can't prepare log entry '$sql': ".$this->{dbh}->errstr() ); } - my $res = $this->{sth}->execute( $seconds+($microseconds/1000000.0), $this->{id}, $$, $level, $code, $string, $this->{fileName} ); + my $res = $this->{sth}->execute( $seconds+($microseconds/1000000.0) + , $this->{id} + , $$ + , $level + , $code + , $string + , $this->{fileName} + ); if ( !$res ) { $this->{databaseLevel} = NOLOG; @@ -758,11 +806,19 @@ ZoneMinder::Logger - ZoneMinder Logger module =head1 DESCRIPTION -The ZoneMinder:Logger module contains the common debug and error reporting routines used by the ZoneMinder scripts. +The ZoneMinder:Logger module contains the common debug and error reporting +routines used by the ZoneMinder scripts. -To use debug in your scripts you need to include this module, and call logInit. Thereafter you can sprinkle Debug or Error calls etc throughout the code safe in the knowledge that they will be reported to your error log, and possibly the syslogger, in a meaningful and consistent format. +To use debug in your scripts you need to include this module, and call +logInit. Thereafter you can sprinkle Debug or Error calls etc throughout +the code safe in the knowledge that they will be reported to your error +log, and possibly the syslogger, in a meaningful and consistent format. -Debug is discussed in terms of levels where 1 and above (currently only 1 for scripts) is considered debug, 0 is considered as informational, -1 is a warning, -2 is an error and -3 is a fatal error or panic. Where levels are mentioned below as thresholds the value given and anything with a lower level (ie. more serious) will be included. +Debug is discussed in terms of levels where 1 and above (currently only 1 +for scripts) is considered debug, 0 is considered as informational, -1 is a +warning, -2 is an error and -3 is a fatal error or panic. Where levels are +mentioned below as thresholds the value given and anything with a lower +level (ie. more serious) will be included. =head1 METHODS @@ -770,7 +826,12 @@ Debug is discussed in terms of levels where 1 and above (currently only 1 for sc =item logInit ( $id, %options ); -Initialises the debug and prepares the logging for forthcoming operations. If not called explicitly it will be called by the first debug call in your script, but with default (and probably meaningless) options. The only compulsory arguments are $id which must be a string that will identify debug coming from this script in mixed logs. Other options may be provided as below, +Initialises the debug and prepares the logging for forthcoming operations. +If not called explicitly it will be called by the first debug call in your +script, but with default (and probably meaningless) options. The only +compulsory arguments are $id which must be a string that will identify +debug coming from this script in mixed logs. Other options may be provided +as below, Option Default Description --------- --------- ----------- @@ -807,27 +868,39 @@ These methods can be used to get and set the current settings as defined in logI =item Debug( $string ); -This method will output a debug message if the current debug level permits it, otherwise does nothing. This message will be tagged with the DBG string in the logs. +This method will output a debug message if the current debug level permits +it, otherwise does nothing. This message will be tagged with the DBG string +in the logs. =item Info( $string ); -This method will output an informational message if the current debug level permits it, otherwise does nothing. This message will be tagged with the INF string in the logs. +This method will output an informational message if the current debug level +permits it, otherwise does nothing. This message will be tagged with the +INF string in the logs. =item Warning( $string ); -This method will output a warning message if the current debug level permits it, otherwise does nothing. This message will be tagged with the WAR string in the logs. +This method will output a warning message if the current debug level +permits it, otherwise does nothing. This message will be tagged with the +WAR string in the logs. =item Error( $string ); -This method will output an error message if the current debug level permits it, otherwise does nothing. This message will be tagged with the ERR string in the logs. +This method will output an error message if the current debug level permits +it, otherwise does nothing. This message will be tagged with the ERR string +in the logs. =item Fatal( $string ); -This method will output a fatal error message and then die if the current debug level permits it, otherwise does nothing. This message will be tagged with the FAT string in the logs. +This method will output a fatal error message and then die if the current +debug level permits it, otherwise does nothing. This message will be tagged +with the FAT string in the logs. =item Panic( $string ); -This method will output a panic error message and then die with a stack trace if the current debug level permits it, otherwise does nothing. This message will be tagged with the PNC string in the logs. +This method will output a panic error message and then die with a stack +trace if the current debug level permits it, otherwise does nothing. This +message will be tagged with the PNC string in the logs. =back @@ -845,7 +918,8 @@ The :all tag will export all above symbols. Carp Sys::Syslog -The ZoneMinder README file Troubleshooting section for an extended discussion on the use and configuration of syslog with ZoneMinder. +The ZoneMinder README file Troubleshooting section for an extended +discussion on the use and configuration of syslog with ZoneMinder. http://www.zoneminder.com diff --git a/scripts/ZoneMinder/lib/ZoneMinder/Memory.pm.in b/scripts/ZoneMinder/lib/ZoneMinder/Memory.pm.in index b2e0fb448..8e7b9228e 100644 --- a/scripts/ZoneMinder/lib/ZoneMinder/Memory.pm.in +++ b/scripts/ZoneMinder/lib/ZoneMinder/Memory.pm.in @@ -19,7 +19,7 @@ # # ========================================================================== # -# This module contains the common definitions and functions used by the rest +# This module contains the common definitions and functions used by the rest # of the ZoneMinder scripts # package ZoneMinder::Memory; @@ -37,48 +37,48 @@ our @ISA = qw(Exporter ZoneMinder::Base); # names by default without a very good reason. Use EXPORT_OK instead. # Do not simply export all your public functions/methods/constants. -# This allows declaration use ZoneMinder ':all'; +# This allows declaration use ZoneMinder ':all'; # If you do not need this, moving things directly into @EXPORT or @EXPORT_OK # will save memory. our %EXPORT_TAGS = ( - 'constants' => [ qw( - STATE_IDLE - STATE_PREALARM - STATE_ALARM - STATE_ALERT - STATE_TAPE - ACTION_GET - ACTION_SET - ACTION_RELOAD - ACTION_SUSPEND - ACTION_RESUME - TRIGGER_CANCEL - TRIGGER_ON - TRIGGER_OFF - ) ], - 'functions' => [ qw( - zmMemVerify - zmMemInvalidate - zmMemRead - zmMemWrite - zmMemTidy - zmGetMonitorState - zmGetAlarmLocation - zmIsAlarmed - zmInAlarm - zmHasAlarmed - zmGetLastEvent - zmGetLastWriteTime - zmGetLastReadTime - zmMonitorEnable - zmMonitorDisable - zmMonitorSuspend - zmMonitorResume - zmTriggerEventOn - zmTriggerEventOff - zmTriggerEventCancel - zmTriggerShowtext - ) ], + 'constants' => [ qw( + STATE_IDLE + STATE_PREALARM + STATE_ALARM + STATE_ALERT + STATE_TAPE + ACTION_GET + ACTION_SET + ACTION_RELOAD + ACTION_SUSPEND + ACTION_RESUME + TRIGGER_CANCEL + TRIGGER_ON + TRIGGER_OFF + ) ], + 'functions' => [ qw( + zmMemVerify + zmMemInvalidate + zmMemRead + zmMemWrite + zmMemTidy + zmGetMonitorState + zmGetAlarmLocation + zmIsAlarmed + zmInAlarm + zmHasAlarmed + zmGetLastEvent + zmGetLastWriteTime + zmGetLastReadTime + zmMonitorEnable + zmMonitorDisable + zmMonitorSuspend + zmMonitorResume + zmTriggerEventOn + zmTriggerEventOff + zmTriggerEventCancel + zmTriggerShowtext + ) ], ); push( @{$EXPORT_TAGS{all}}, @{$EXPORT_TAGS{$_}} ) foreach keys %EXPORT_TAGS; @@ -144,42 +144,42 @@ our $mem_seq = 0; our $mem_data = { - "shared_data" => { "type"=>"SharedData", "seq"=>$mem_seq++, "contents"=> { - "size" => { "type"=>"uint32", "seq"=>$mem_seq++ }, - "last_write_index" => { "type"=>"uint32", "seq"=>$mem_seq++ }, - "last_read_index" => { "type"=>"uint32", "seq"=>$mem_seq++ }, - "state" => { "type"=>"uint32", "seq"=>$mem_seq++ }, - "last_event" => { "type"=>"uint32", "seq"=>$mem_seq++ }, - "action" => { "type"=>"uint32", "seq"=>$mem_seq++ }, - "brightness" => { "type"=>"int32", "seq"=>$mem_seq++ }, - "hue" => { "type"=>"int32", "seq"=>$mem_seq++ }, - "colour" => { "type"=>"int32", "seq"=>$mem_seq++ }, - "contrast" => { "type"=>"int32", "seq"=>$mem_seq++ }, - "alarm_x" => { "type"=>"int32", "seq"=>$mem_seq++ }, - "alarm_y" => { "type"=>"int32", "seq"=>$mem_seq++ }, - "valid" => { "type"=>"uint8", "seq"=>$mem_seq++ }, - "active" => { "type"=>"uint8", "seq"=>$mem_seq++ }, - "signal" => { "type"=>"uint8", "seq"=>$mem_seq++ }, - "format" => { "type"=>"uint8", "seq"=>$mem_seq++ }, - "imagesize" => { "type"=>"uint32", "seq"=>$mem_seq++ }, - "epadding1" => { "type"=>"uint32", "seq"=>$mem_seq++ }, - "epadding2" => { "type"=>"uint32", "seq"=>$mem_seq++ }, - "last_write_time" => { "type"=>"time_t64", "seq"=>$mem_seq++ }, - "last_read_time" => { "type"=>"time_t64", "seq"=>$mem_seq++ }, - "control_state" => { "type"=>"uint8[256]", "seq"=>$mem_seq++ }, - } - }, - "trigger_data" => { "type"=>"TriggerData", "seq"=>$mem_seq++, "contents"=> { - "size" => { "type"=>"uint32", "seq"=>$mem_seq++ }, - "trigger_state" => { "type"=>"uint32", "seq"=>$mem_seq++ }, - "trigger_score" => { "type"=>"uint32", "seq"=>$mem_seq++ }, - "padding" => { "type"=>"uint32", "seq"=>$mem_seq++ }, - "trigger_cause" => { "type"=>"int8[32]", "seq"=>$mem_seq++ }, - "trigger_text" => { "type"=>"int8[256]", "seq"=>$mem_seq++ }, - "trigger_showtext" => { "type"=>"int8[256]", "seq"=>$mem_seq++ }, - } - }, - "end" => { "seq"=>$mem_seq++, "size"=> 0 } + "shared_data" => { "type"=>"SharedData", "seq"=>$mem_seq++, "contents"=> { + "size" => { "type"=>"uint32", "seq"=>$mem_seq++ }, + "last_write_index" => { "type"=>"uint32", "seq"=>$mem_seq++ }, + "last_read_index" => { "type"=>"uint32", "seq"=>$mem_seq++ }, + "state" => { "type"=>"uint32", "seq"=>$mem_seq++ }, + "last_event" => { "type"=>"uint32", "seq"=>$mem_seq++ }, + "action" => { "type"=>"uint32", "seq"=>$mem_seq++ }, + "brightness" => { "type"=>"int32", "seq"=>$mem_seq++ }, + "hue" => { "type"=>"int32", "seq"=>$mem_seq++ }, + "colour" => { "type"=>"int32", "seq"=>$mem_seq++ }, + "contrast" => { "type"=>"int32", "seq"=>$mem_seq++ }, + "alarm_x" => { "type"=>"int32", "seq"=>$mem_seq++ }, + "alarm_y" => { "type"=>"int32", "seq"=>$mem_seq++ }, + "valid" => { "type"=>"uint8", "seq"=>$mem_seq++ }, + "active" => { "type"=>"uint8", "seq"=>$mem_seq++ }, + "signal" => { "type"=>"uint8", "seq"=>$mem_seq++ }, + "format" => { "type"=>"uint8", "seq"=>$mem_seq++ }, + "imagesize" => { "type"=>"uint32", "seq"=>$mem_seq++ }, + "epadding1" => { "type"=>"uint32", "seq"=>$mem_seq++ }, + "epadding2" => { "type"=>"uint32", "seq"=>$mem_seq++ }, + "last_write_time" => { "type"=>"time_t64", "seq"=>$mem_seq++ }, + "last_read_time" => { "type"=>"time_t64", "seq"=>$mem_seq++ }, + "control_state" => { "type"=>"uint8[256]", "seq"=>$mem_seq++ }, + } + }, + "trigger_data" => { "type"=>"TriggerData", "seq"=>$mem_seq++, "contents"=> { + "size" => { "type"=>"uint32", "seq"=>$mem_seq++ }, + "trigger_state" => { "type"=>"uint32", "seq"=>$mem_seq++ }, + "trigger_score" => { "type"=>"uint32", "seq"=>$mem_seq++ }, + "padding" => { "type"=>"uint32", "seq"=>$mem_seq++ }, + "trigger_cause" => { "type"=>"int8[32]", "seq"=>$mem_seq++ }, + "trigger_text" => { "type"=>"int8[256]", "seq"=>$mem_seq++ }, + "trigger_showtext" => { "type"=>"int8[256]", "seq"=>$mem_seq++ }, + } + }, + "end" => { "seq"=>$mem_seq++, "size"=> 0 } }; our $mem_size = 0; @@ -187,209 +187,248 @@ our $mem_verified = {}; sub zmMemInit { - my $offset = 0; + my $offset = 0; - foreach my $section_data ( sort { $a->{seq} <=> $b->{seq} } values( %$mem_data ) ) - { - $section_data->{offset} = $offset; - $section_data->{align} = 0; + foreach my $section_data ( sort { $a->{seq} <=> $b->{seq} } values( %$mem_data ) ) + { + $section_data->{offset} = $offset; + $section_data->{align} = 0; - if ( $section_data->{align} > 1 ) - { - my $rem = $offset % $section_data->{align}; - if ( $rem > 0 ) - { - $offset += ($section_data->{align} - $rem); - } - } - foreach my $member_data ( sort { $a->{seq} <=> $b->{seq} } values( %{$section_data->{contents}} ) ) - { - if ( $member_data->{type} eq "long" || $member_data->{type} eq "ulong" || $member_data->{type} eq "size_t") - { - $member_data->{size} = $member_data->{align} = $native; - } - elsif( $member_data->{type} eq "int64" || $member_data->{type} eq "uint64" || $member_data->{type} eq "time_t64") - { - $member_data->{size} = $member_data->{align} = 8; - } - elsif ( $member_data->{type} eq "int32" || $member_data->{type} eq "uint32" || $member_data->{type} eq "bool4" ) - { - $member_data->{size} = $member_data->{align} = 4; - } - elsif ($member_data->{type} eq "int16" || $member_data->{type} eq "uint16") - { - $member_data->{size} = $member_data->{align} = 2; - } - elsif ( $member_data->{type} eq "int8" || $member_data->{type} eq "uint8" || $member_data->{type} eq "bool1" ) - { - $member_data->{size} = $member_data->{align} = 1; - } - elsif ( $member_data->{type} =~ /^u?int8\[(\d+)\]$/ ) - { - $member_data->{size} = $1; - $member_data->{align} = 1; - } - else - { - Fatal( "Unexpected type '".$member_data->{type}."' found in shared data definition." ); - } + if ( $section_data->{align} > 1 ) + { + my $rem = $offset % $section_data->{align}; + if ( $rem > 0 ) + { + $offset += ($section_data->{align} - $rem); + } + } + foreach my $member_data ( sort { $a->{seq} <=> $b->{seq} } values( %{$section_data->{contents}} ) ) + { + if ( $member_data->{type} eq "long" + || $member_data->{type} eq "ulong" + || $member_data->{type} eq "size_t" + ) + { + $member_data->{size} = $member_data->{align} = $native; + } + elsif( $member_data->{type} eq "int64" + || $member_data->{type} eq "uint64" + || $member_data->{type} eq "time_t64" + ) + { + $member_data->{size} = $member_data->{align} = 8; + } + elsif ( $member_data->{type} eq "int32" + || $member_data->{type} eq "uint32" + || $member_data->{type} eq "bool4" + ) + { + $member_data->{size} = $member_data->{align} = 4; + } + elsif ($member_data->{type} eq "int16" + || $member_data->{type} eq "uint16" + ) + { + $member_data->{size} = $member_data->{align} = 2; + } + elsif ( $member_data->{type} eq "int8" + || $member_data->{type} eq "uint8" + || $member_data->{type} eq "bool1" + ) + { + $member_data->{size} = $member_data->{align} = 1; + } + elsif ( $member_data->{type} =~ /^u?int8\[(\d+)\]$/ ) + { + $member_data->{size} = $1; + $member_data->{align} = 1; + } + else + { + Fatal( "Unexpected type '".$member_data->{type} + ."' found in shared data definition." + ); + } - if ( $member_data->{align} > 1 && ($offset%$member_data->{align}) > 0 ) - { - $offset += ($member_data->{align} - ($offset%$member_data->{align})); - } - $member_data->{offset} = $offset; - $offset += $member_data->{size} - } - $section_data->{size} = $offset - $section_data->{offset}; - } + if ( $member_data->{align} > 1 && ($offset%$member_data->{align}) > 0 ) + { + $offset += ($member_data->{align} - ($offset%$member_data->{align})); + } + $member_data->{offset} = $offset; + $offset += $member_data->{size} + } + $section_data->{size} = $offset - $section_data->{offset}; + } - $mem_size = $offset; + $mem_size = $offset; } &zmMemInit(); sub zmMemVerify { - my $monitor = shift; - if ( !zmMemAttach( $monitor, $mem_size ) ) - { - return( undef ); - } + my $monitor = shift; + if ( !zmMemAttach( $monitor, $mem_size ) ) + { + return( undef ); + } my $mem_key = zmMemKey( $monitor ); - if ( !defined($mem_verified->{$mem_key}) ) - { - my $sd_size = zmMemRead( $monitor, "shared_data:size", 1 ); - if ( $sd_size != $mem_data->{shared_data}->{size} ) - { - if ( $sd_size ) - { - Error( "Shared data size conflict in shared_data for monitor ".$monitor->{Name}.", expected ".$mem_data->{shared_data}->{size}.", got ".$sd_size ); - } - else - { - Debug( "Shared data size conflict in shared_data for monitor ".$monitor->{Name}.", expected ".$mem_data->{shared_data}->{size}.", got ".$sd_size ); - } - return( undef ); - } - my $td_size = zmMemRead( $monitor, "trigger_data:size", 1 ); - if ( $td_size != $mem_data->{trigger_data}->{size} ) - { - if ( $td_size ) - { - Error( "Shared data size conflict in trigger_data for monitor ".$monitor->{Name}.", expected ".$mem_data->{triggger_data}->{size}.", got ".$td_size ); - } - else - { - Debug( "Shared data size conflict in trigger_data for monitor ".$monitor->{Name}.", expected ".$mem_data->{triggger_data}->{size}.", got ".$td_size ); - } - return( undef ); - } - $mem_verified->{$mem_key} = !undef; - } - return( !undef ); + if ( !defined($mem_verified->{$mem_key}) ) + { + my $sd_size = zmMemRead( $monitor, "shared_data:size", 1 ); + if ( $sd_size != $mem_data->{shared_data}->{size} ) + { + if ( $sd_size ) + { + Error( "Shared data size conflict in shared_data for monitor " + .$monitor->{Name} + .", expected " + .$mem_data->{shared_data}->{size} + .", got " + .$sd_size + ); + } + else + { + Debug( "Shared data size conflict in shared_data for monitor " + .$monitor->{Name} + .", expected " + .$mem_data->{shared_data}->{size} + .", got ".$sd_size + ); + } + return( undef ); + } + my $td_size = zmMemRead( $monitor, "trigger_data:size", 1 ); + if ( $td_size != $mem_data->{trigger_data}->{size} ) + { + if ( $td_size ) + { + Error( "Shared data size conflict in trigger_data for monitor " + .$monitor->{Name} + .", expected " + .$mem_data->{triggger_data}->{size} + .", got " + .$td_size + ); + } + else + { + Debug( "Shared data size conflict in trigger_data for monitor " + .$monitor->{Name} + .", expected " + .$mem_data->{triggger_data}->{size} + .", got " + .$td_size + ); + } + return( undef ); + } + $mem_verified->{$mem_key} = !undef; + } + return( !undef ); } sub zmMemRead { - my $monitor = shift; - my $fields = shift; - my $nocheck = shift; + my $monitor = shift; + my $fields = shift; + my $nocheck = shift; - if ( !($nocheck || zmMemVerify( $monitor )) ) - { - return( undef ); - } + if ( !($nocheck || zmMemVerify( $monitor )) ) + { + return( undef ); + } - if ( !ref($fields) ) - { - $fields = [ $fields ]; - } - my @values; - foreach my $field ( @$fields ) - { - my ( $section, $element ) = split( /[\/:.]/, $field ); - Fatal( "Invalid shared data selector '$field'" ) if ( !$section || !$element ); + if ( !ref($fields) ) + { + $fields = [ $fields ]; + } + my @values; + foreach my $field ( @$fields ) + { + my ( $section, $element ) = split( /[\/:.]/, $field ); + Fatal( "Invalid shared data selector '$field'" ) if ( !$section || !$element ); - my $offset = $mem_data->{$section}->{contents}->{$element}->{offset}; - my $type = $mem_data->{$section}->{contents}->{$element}->{type}; - my $size = $mem_data->{$section}->{contents}->{$element}->{size}; + my $offset = $mem_data->{$section}->{contents}->{$element}->{offset}; + my $type = $mem_data->{$section}->{contents}->{$element}->{type}; + my $size = $mem_data->{$section}->{contents}->{$element}->{size}; - my $data = zmMemGet( $monitor, $offset, $size ); + my $data = zmMemGet( $monitor, $offset, $size ); if ( !defined($data) ) { Error( "Unable to read '$field' from memory for monitor ".$monitor->{Id} ); zmMemInvalidate( $monitor ); return( undef ); } - my $value; - if ( $type eq "long" ) - { - ( $value ) = unpack( "l!", $data ); - } - elsif ( $type eq "ulong" || $type eq "size_t" ) - { - ( $value ) = unpack( "L!", $data ); - } - elsif ( $type eq "int64" || $type eq "time_t64" ) - { - # The "q" type is only available on 64bit platforms, so use native. - ( $value ) = unpack( "l!", $data ); - } - elsif ( $type eq "uint64" ) - { - # The "q" type is only available on 64bit platforms, so use native. - ( $value ) = unpack( "L!", $data ); - } - elsif ( $type eq "int32" ) - { - ( $value ) = unpack( "l", $data ); - } - elsif ( $type eq "uint32" || $type eq "bool4" ) - { - ( $value ) = unpack( "L", $data ); - } - elsif ( $type eq "int16" ) - { - ( $value ) = unpack( "s", $data ); - } - elsif ( $type eq "uint16" ) - { - ( $value ) = unpack( "S", $data ); - } - elsif ( $type eq "int8" ) - { - ( $value ) = unpack( "c", $data ); - } - elsif ( $type eq "uint8" || $type eq "bool1" ) - { - ( $value ) = unpack( "C", $data ); - } - elsif ( $type =~ /^int8\[\d+\]$/ ) - { - ( $value ) = unpack( "Z".$size, $data ); - } - elsif ( $type =~ /^uint8\[\d+\]$/ ) - { - ( $value ) = unpack( "C".$size, $data ); - } - else - { - Fatal( "Unexpected type '".$type."' found for '".$field."'" ); - } - push( @values, $value ); - } - if ( wantarray() ) - { - return( @values ) - } - return( $values[0] ); + my $value; + if ( $type eq "long" ) + { + ( $value ) = unpack( "l!", $data ); + } + elsif ( $type eq "ulong" || $type eq "size_t" ) + { + ( $value ) = unpack( "L!", $data ); + } + elsif ( $type eq "int64" || $type eq "time_t64" ) + { + # The "q" type is only available on 64bit platforms, so use native. + ( $value ) = unpack( "l!", $data ); + } + elsif ( $type eq "uint64" ) + { + # The "q" type is only available on 64bit platforms, so use native. + ( $value ) = unpack( "L!", $data ); + } + elsif ( $type eq "int32" ) + { + ( $value ) = unpack( "l", $data ); + } + elsif ( $type eq "uint32" || $type eq "bool4" ) + { + ( $value ) = unpack( "L", $data ); + } + elsif ( $type eq "int16" ) + { + ( $value ) = unpack( "s", $data ); + } + elsif ( $type eq "uint16" ) + { + ( $value ) = unpack( "S", $data ); + } + elsif ( $type eq "int8" ) + { + ( $value ) = unpack( "c", $data ); + } + elsif ( $type eq "uint8" || $type eq "bool1" ) + { + ( $value ) = unpack( "C", $data ); + } + elsif ( $type =~ /^int8\[\d+\]$/ ) + { + ( $value ) = unpack( "Z".$size, $data ); + } + elsif ( $type =~ /^uint8\[\d+\]$/ ) + { + ( $value ) = unpack( "C".$size, $data ); + } + else + { + Fatal( "Unexpected type '".$type."' found for '".$field."'" ); + } + push( @values, $value ); + } + if ( wantarray() ) + { + return( @values ) + } + return( $values[0] ); } sub zmMemInvalidate { - my $monitor = shift; + my $monitor = shift; my $mem_key = zmMemKey($monitor); if ( $mem_key ) { @@ -405,300 +444,306 @@ sub zmMemTidy sub zmMemWrite { - my $monitor = shift; - my $field_values = shift; - my $nocheck = shift; + my $monitor = shift; + my $field_values = shift; + my $nocheck = shift; - if ( !($nocheck || zmMemVerify( $monitor )) ) - { - return( undef ); - } + if ( !($nocheck || zmMemVerify( $monitor )) ) + { + return( undef ); + } - while ( my ( $field, $value ) = each( %$field_values ) ) - { - my ( $section, $element ) = split( /[\/:.]/, $field ); - Fatal( "Invalid shared data selector '$field'" ) if ( !$section || !$element ); + while ( my ( $field, $value ) = each( %$field_values ) ) + { + my ( $section, $element ) = split( /[\/:.]/, $field ); + Fatal( "Invalid shared data selector '$field'" ) + if ( !$section || !$element ); - my $offset = $mem_data->{$section}->{contents}->{$element}->{offset}; - my $type = $mem_data->{$section}->{contents}->{$element}->{type}; - my $size = $mem_data->{$section}->{contents}->{$element}->{size}; + my $offset = $mem_data->{$section}->{contents}->{$element}->{offset}; + my $type = $mem_data->{$section}->{contents}->{$element}->{type}; + my $size = $mem_data->{$section}->{contents}->{$element}->{size}; - my $data; - if ( $type eq "long" ) - { - $data = pack( "l!", $value ); - } - elsif ( $type eq "ulong" || $type eq "size_t" ) - { - $data = pack( "L!", $value ); - } - elsif ( $type eq "int64" || $type eq "time_t64" ) - { - # The "q" type is only available on 64bit platforms, so use native. - $data = pack( "l!", $value ); - } - elsif ( $type eq "uint64" ) - { - # The "q" type is only available on 64bit platforms, so use native. - $data = pack( "L!", $value ); - } - elsif ( $type eq "int32" ) - { - $data = pack( "l", $value ); - } - elsif ( $type eq "uint32" || $type eq "bool4" ) - { - $data = pack( "L", $value ); - } - elsif ( $type eq "int16" ) - { - $data = pack( "s", $value ); - } - elsif ( $type eq "uint16" ) - { - $data = pack( "S", $value ); - } - elsif ( $type eq "int8" ) - { - $data = pack( "c", $value ); - } - elsif ( $type eq "uint8" || $type eq "bool1" ) - { - $data = pack( "C", $value ); - } - elsif ( $type =~ /^int8\[\d+\]$/ ) - { - $data = pack( "Z".$size, $value ); - } - elsif ( $type =~ /^uint8\[\d+\]$/ ) - { - $data = pack( "C".$size, $value ); - } - else - { - Fatal( "Unexpected type '".$type."' found for '".$field."'" ); - } + my $data; + if ( $type eq "long" ) + { + $data = pack( "l!", $value ); + } + elsif ( $type eq "ulong" || $type eq "size_t" ) + { + $data = pack( "L!", $value ); + } + elsif ( $type eq "int64" || $type eq "time_t64" ) + { + # The "q" type is only available on 64bit platforms, so use native. + $data = pack( "l!", $value ); + } + elsif ( $type eq "uint64" ) + { + # The "q" type is only available on 64bit platforms, so use native. + $data = pack( "L!", $value ); + } + elsif ( $type eq "int32" ) + { + $data = pack( "l", $value ); + } + elsif ( $type eq "uint32" || $type eq "bool4" ) + { + $data = pack( "L", $value ); + } + elsif ( $type eq "int16" ) + { + $data = pack( "s", $value ); + } + elsif ( $type eq "uint16" ) + { + $data = pack( "S", $value ); + } + elsif ( $type eq "int8" ) + { + $data = pack( "c", $value ); + } + elsif ( $type eq "uint8" || $type eq "bool1" ) + { + $data = pack( "C", $value ); + } + elsif ( $type =~ /^int8\[\d+\]$/ ) + { + $data = pack( "Z".$size, $value ); + } + elsif ( $type =~ /^uint8\[\d+\]$/ ) + { + $data = pack( "C".$size, $value ); + } + else + { + Fatal( "Unexpected type '".$type."' found for '".$field."'" ); + } if ( !zmMemPut( $monitor, $offset, $size, $data ) ) { - Error( "Unable to write '$value' to '$field' in memory for monitor ".$monitor->{Id} ); + Error( "Unable to write '$value' to '$field' in memory for monitor " + .$monitor->{Id} + ); zmMemInvalidate( $monitor ); return( undef ); } - } - return( !undef ); + } + return( !undef ); } sub zmGetMonitorState { - my $monitor = shift; + my $monitor = shift; - return( zmMemRead( $monitor, "shared_data:state" ) ); + return( zmMemRead( $monitor, "shared_data:state" ) ); } sub zmGetAlarmLocation { - my $monitor = shift; + my $monitor = shift; - return( zmMemRead( $monitor, [ "shared_data:alarm_x", "shared_data:alarm_y" ] ) ); + return( zmMemRead( $monitor, [ "shared_data:alarm_x", "shared_data:alarm_y" ] ) ); } sub zmSetControlState { - my $monitor = shift; - my $control_state = shift; + my $monitor = shift; + my $control_state = shift; - zmMemWrite( $monitor, { "shared_data:control_state" => $control_state } ); + zmMemWrite( $monitor, { "shared_data:control_state" => $control_state } ); } sub zmGetControlState { - my $monitor = shift; + my $monitor = shift; - return( zmMemRead( $monitor, "shared_data:control_state" ) ); + return( zmMemRead( $monitor, "shared_data:control_state" ) ); } sub zmSaveControlState { - my $monitor = shift; - my $control_state = shift; + my $monitor = shift; + my $control_state = shift; - zmSetControlState( $monitor, freeze( $control_state ) ); + zmSetControlState( $monitor, freeze( $control_state ) ); } sub zmRestoreControlState { - my $monitor = shift; + my $monitor = shift; - return( thaw( zmGetControlState( $monitor ) ) ); + return( thaw( zmGetControlState( $monitor ) ) ); } sub zmIsAlarmed { - my $monitor = shift; + my $monitor = shift; - my $state = zmGetMonitorState( $monitor ); + my $state = zmGetMonitorState( $monitor ); - return( $state == STATE_ALARM ); + return( $state == STATE_ALARM ); } sub zmInAlarm { - my $monitor = shift; + my $monitor = shift; - my $state = zmGetMonitorState( $monitor ); + my $state = zmGetMonitorState( $monitor ); - return( $state == STATE_ALARM || $state == STATE_ALERT ); + return( $state == STATE_ALARM || $state == STATE_ALERT ); } sub zmHasAlarmed { - my $monitor = shift; - my $last_event_id = shift; + my $monitor = shift; + my $last_event_id = shift; - my ( $state, $last_event ) = zmMemRead( $monitor, [ "shared_data:state", "shared_data:last_event" ] ); + my ( $state, $last_event ) = zmMemRead( $monitor, [ "shared_data:state" + ,"shared_data:last_event" + ] + ); - if ( $state == STATE_ALARM || $state == STATE_ALERT ) - { - return( $last_event ); - } - elsif( $last_event != $last_event_id ) - { - return( $last_event ); - } - return( undef ); + if ( $state == STATE_ALARM || $state == STATE_ALERT ) + { + return( $last_event ); + } + elsif( $last_event != $last_event_id ) + { + return( $last_event ); + } + return( undef ); } sub zmGetLastEvent { - my $monitor = shift; + my $monitor = shift; - return( zmMemRead( $monitor, "shared_data:last_event" ) ); + return( zmMemRead( $monitor, "shared_data:last_event" ) ); } sub zmGetLastWriteTime { - my $monitor = shift; + my $monitor = shift; - return( zmMemRead( $monitor, "shared_data:last_write_time" ) ); + return( zmMemRead( $monitor, "shared_data:last_write_time" ) ); } sub zmGetLastReadTime { - my $monitor = shift; + my $monitor = shift; - return( zmMemRead( $monitor, "shared_data:last_read_time" ) ); + return( zmMemRead( $monitor, "shared_data:last_read_time" ) ); } sub zmGetMonitorActions { - my $monitor = shift; + my $monitor = shift; - return( zmMemRead( $monitor, "shared_data:action" ) ); + return( zmMemRead( $monitor, "shared_data:action" ) ); } sub zmMonitorEnable { - my $monitor = shift; + my $monitor = shift; - my $action = zmMemRead( $monitor, "shared_data:action" ); - $action |= ACTION_SUSPEND; - zmMemWrite( $monitor, { "shared_data:action" => $action } ); + my $action = zmMemRead( $monitor, "shared_data:action" ); + $action |= ACTION_SUSPEND; + zmMemWrite( $monitor, { "shared_data:action" => $action } ); } sub zmMonitorDisable { - my $monitor = shift; + my $monitor = shift; - my $action = zmMemRead( $monitor, "shared_data:action" ); - $action |= ACTION_RESUME; - zmMemWrite( $monitor, { "shared_data:action" => $action } ); + my $action = zmMemRead( $monitor, "shared_data:action" ); + $action |= ACTION_RESUME; + zmMemWrite( $monitor, { "shared_data:action" => $action } ); } sub zmMonitorSuspend { - my $monitor = shift; + my $monitor = shift; - my $action = zmMemRead( $monitor, "shared_data:action" ); - $action |= ACTION_SUSPEND; - zmMemWrite( $monitor, { "shared_data:action" => $action } ); + my $action = zmMemRead( $monitor, "shared_data:action" ); + $action |= ACTION_SUSPEND; + zmMemWrite( $monitor, { "shared_data:action" => $action } ); } sub zmMonitorResume { - my $monitor = shift; + my $monitor = shift; - my $action = zmMemRead( $monitor, "shared_data:action" ); - $action |= ACTION_RESUME; - zmMemWrite( $monitor, { "shared_data:action" => $action } ); + my $action = zmMemRead( $monitor, "shared_data:action" ); + $action |= ACTION_RESUME; + zmMemWrite( $monitor, { "shared_data:action" => $action } ); } sub zmGetTriggerState { - my $monitor = shift; + my $monitor = shift; - return( zmMemRead( $monitor, "trigger_data:trigger_state" ) ); + return( zmMemRead( $monitor, "trigger_data:trigger_state" ) ); } sub zmTriggerEventOn { - my $monitor = shift; - my $score = shift; - my $cause = shift; - my $text = shift; - my $showtext = shift; + my $monitor = shift; + my $score = shift; + my $cause = shift; + my $text = shift; + my $showtext = shift; - my $values = { - "trigger_data:trigger_score" => $score, - "trigger_data:trigger_cause" => $cause, - }; - $values->{"trigger_data:trigger_text"} = $text if ( defined($text) ); - $values->{"trigger_data:trigger_showtext"} = $showtext if ( defined($showtext) ); - $values->{"trigger_data:trigger_state"} = TRIGGER_ON; # Write state last so event not read incomplete + my $values = { + "trigger_data:trigger_score" => $score, + "trigger_data:trigger_cause" => $cause, + }; + $values->{"trigger_data:trigger_text"} = $text if ( defined($text) ); + $values->{"trigger_data:trigger_showtext"} = $showtext if ( defined($showtext) ); + $values->{"trigger_data:trigger_state"} = TRIGGER_ON; # Write state last so event not read incomplete - zmMemWrite( $monitor, $values ); + zmMemWrite( $monitor, $values ); } sub zmTriggerEventOff { - my $monitor = shift; + my $monitor = shift; - my $values = { - "trigger_data:trigger_state" => TRIGGER_OFF, - "trigger_data:trigger_score" => 0, - "trigger_data:trigger_cause" => "", - "trigger_data:trigger_text" => "", - "trigger_data:trigger_showtext" => "", - }; + my $values = { + "trigger_data:trigger_state" => TRIGGER_OFF, + "trigger_data:trigger_score" => 0, + "trigger_data:trigger_cause" => "", + "trigger_data:trigger_text" => "", + "trigger_data:trigger_showtext" => "", + }; - zmMemWrite( $monitor, $values ); + zmMemWrite( $monitor, $values ); } sub zmTriggerEventCancel { - my $monitor = shift; + my $monitor = shift; - my $values = { - "trigger_data:trigger_state" => TRIGGER_CANCEL, - "trigger_data:trigger_score" => 0, - "trigger_data:trigger_cause" => "", - "trigger_data:trigger_text" => "", - "trigger_data:trigger_showtext" => "", - }; + my $values = { + "trigger_data:trigger_state" => TRIGGER_CANCEL, + "trigger_data:trigger_score" => 0, + "trigger_data:trigger_cause" => "", + "trigger_data:trigger_text" => "", + "trigger_data:trigger_showtext" => "", + }; - zmMemWrite( $monitor, $values ); + zmMemWrite( $monitor, $values ); } sub zmTriggerShowtext { - my $monitor = shift; - my $showtext = shift; + my $monitor = shift; + my $showtext = shift; - my $values = { - "trigger_data:trigger_showtext" => $showtext, - }; + my $values = { + "trigger_data:trigger_showtext" => $showtext, + }; - zmMemWrite( $monitor, $values ); + zmMemWrite( $monitor, $values ); } 1; @@ -722,16 +767,29 @@ ZoneMinder::MappedMem - ZoneMinder Mapped Memory access module } } - ( $lri, $lwi ) = zmMemRead( $monitor, [ "shared_data:last_read_index", "shared_data:last_write_index" ] ); + ( $lri, $lwi ) = zmMemRead( $monitor, [ "shared_data:last_read_index", + "shared_data:last_write_index" + ] + ); zmMemWrite( $monitor, { "trigger_data:trigger_showtext" => "Some Text" } ); =head1 DESCRIPTION -The ZoneMinder:MappedMem module contains methods for accessing and writing to mapped memory as well as helper methods for common operations. +The ZoneMinder:MappedMem module contains methods for accessing and writing +to mapped memory as well as helper methods for common operations. -The core elements of ZoneMinder used mapped memory to allow multiple access to resources. Although ZoneMinder scripts have used this information before, up until now it was difficult to access and prone to errors. This module introduces a common API for mapped memory access (both reading and writing) making it a lot easier to customise scripts or even create your own. +The core elements of ZoneMinder used mapped memory to allow multiple access +to resources. Although ZoneMinder scripts have used this information +before, up until now it was difficult to access and prone to errors. This +module introduces a common API for mapped memory access (both reading and +writing) making it a lot easier to customise scripts or even create your +own. -All the methods listed below require a 'monitor' parameter. This must be a reference to a hash with at least the 'Id' field set to the monitor id of the mapped memory you wish to access. Using database methods to select the monitor details will also return this kind of data. Some of the mapped memory methods will add and amend new fields to this hash. +All the methods listed below require a 'monitor' parameter. This must be a +reference to a hash with at least the 'Id' field set to the monitor id of +the mapped memory you wish to access. Using database methods to select the +monitor details will also return this kind of data. Some of the mapped +memory methods will add and amend new fields to this hash. =head1 METHODS @@ -739,27 +797,46 @@ All the methods listed below require a 'monitor' parameter. This must be a refer =item zmMemVerify ( $monitor ); -Verify that the mapped memory of the monitor given exists and is valid. It will return an undefined value if it is not valid. You should generally call this method first before using any of the other methods, but most of the remaining methods will also do so if the memory has not already been verified. +Verify that the mapped memory of the monitor given exists and is valid. It +will return an undefined value if it is not valid. You should generally +call this method first before using any of the other methods, but most of +the remaining methods will also do so if the memory has not already been +verified. =item zmMemInvalidate ( $monitor ); -Following an error, reset the mapped memory ids and attempt to reverify on the next operation. This is mostly used when a mapped memory segment has gone away and been recreated with a different id. +Following an error, reset the mapped memory ids and attempt to reverify on +the next operation. This is mostly used when a mapped memory segment has +gone away and been recreated with a different id. =item zmMemRead ( $monitor, $readspec ); -This method is used to read data from mapped memory attached to the given monitor. The mapped memory will be verified if it has not already been. The 'readspec' must either be a string of the form "
:" or a reference to an array of strings of the same format. In the first case a single value is returned, in the latter case a list of values is return. Errors will cause undefined to be returned. The allowable sections and field names are described below. +This method is used to read data from mapped memory attached to the given +monitor. The mapped memory will be verified if it has not already been. The +'readspec' must either be a string of the form "
:" or a +reference to an array of strings of the same format. In the first case a +single value is returned, in the latter case a list of values is return. +Errors will cause undefined to be returned. The allowable sections and +field names are described below. =item zmMemWrite ( $monitor, $writespec ); -This method is used to write data to mapped memory attached to the given monitor. The mapped memory will be verified if it has not already been. The 'writespec' must be a reference to a hash with keys of the form "
:" and values as the data to be written. Errors will cause undefined to be returned, otherwise a non-undefined value will be returned. The allowable sections and field names are described below. +This method is used to write data to mapped memory attached to the given +monitor. The mapped memory will be verified if it has not already been. The +'writespec' must be a reference to a hash with keys of the form +"
:" and values as the data to be written. Errors will cause +undefined to be returned, otherwise a non-undefined value will be returned. +The allowable sections and field names are described below. =item $state = zmGetMonitorState ( $monitor ); -Return the current state of the given monitor. This is an integer value and can be compared with the STATE constants given below. +Return the current state of the given monitor. This is an integer value and +can be compared with the STATE constants given below. =item $event_id = zmGetLastEvent ( $monitor ); -Return the event id of the last event that the monitor generated, or 0 if no event has been generated by the current monitor process. +Return the event id of the last event that the monitor generated, or 0 if +no event has been generated by the current monitor process. =item zmIsAlarmed ( $monitor ); @@ -767,27 +844,38 @@ Return 1 if the monitor given is currently in an alarm state, 0 otherwise. =item zmInAlarm ( $monitor ); -Return 1 if the monitor given is currently in an alarm or alerted state, 0 otherwise. +Return 1 if the monitor given is currently in an alarm or alerted state, 0 +otherwise. =item zmHasAlarmed ( $monitor ); -Return 1 if the given monitor is in an alarm state, or has been in an alarm state since the last call to this method. +Return 1 if the given monitor is in an alarm state, or has been in an alarm +state since the last call to this method. =item ( $x, $y ) = zmGetAlarmLocation ( $monitor ); -Return an x,y pair indicating the image co-ordinates of the centre of the last motion event generated by the given monitor. If no event has been generated by the current monitor process, or the alarm was not motion related, returns -1,-1. +Return an x,y pair indicating the image co-ordinates of the centre of the +last motion event generated by the given monitor. If no event has been +generated by the current monitor process, or the alarm was not motion +related, returns -1,-1. =item zmGetLastWriteTime ( $monitor ); -Returns the time (in utc seconds) since the last image was captured by the given monitor and written to shared memory, or 0 otherwise. +Returns the time (in utc seconds) since the last image was captured by the +given monitor and written to shared memory, or 0 otherwise. =item zmGetLastReadTime ( $monitor ); -Returns the time (in utc seconds) since the last image was read from shared memory by the analysis daemon of the given monitor, or 0 otherwise or if the monitor is in monitor only mode. +Returns the time (in utc seconds) since the last image was read from shared +memory by the analysis daemon of the given monitor, or 0 otherwise or if +the monitor is in monitor only mode. =item zmMonitorSuspend ( $monitor ); -Suspend the given monitor from generating events caused by motion. This method can be used to prevent camera actions such as panning or zooming from causing events. If configured to do so, the monitor may automatically resume after a defined period. +Suspend the given monitor from generating events caused by motion. This +method can be used to prevent camera actions such as panning or zooming +from causing events. If configured to do so, the monitor may automatically +resume after a defined period. =item zmMonitorResume ( $monitor ); @@ -795,25 +883,43 @@ Allow the given monitor to resume generating events caused by motion. =item zmTriggerEventOn ( $monitor, $score, $cause [, $text, $showtext ] ); -Trigger the given monitor to generate an event. You must supply an event score and a cause string indicating the reason for the event. You may also supply a text string containing further details about the event and a showtext string which may be included in the timestamp annotation on any images captured during the event, if configured to do so. +Trigger the given monitor to generate an event. You must supply an event +score and a cause string indicating the reason for the event. You may also +supply a text string containing further details about the event and a +showtext string which may be included in the timestamp annotation on any +images captured during the event, if configured to do so. =item zmTriggerEventOff ( $monitor ); -Trigger the given monitor to not generate any events. This method does not cancel zmTriggerEventOn, but is exclusive to it. This method is intended to allow external triggers to prevent normal events being generated by monitors in the same way as zmMonitorSuspend but applies to all events and not just motion, and is intended for longer timescales than are appropriate for suspension. +Trigger the given monitor to not generate any events. This method does not +cancel zmTriggerEventOn, but is exclusive to it. This method is intended to +allow external triggers to prevent normal events being generated by +monitors in the same way as zmMonitorSuspend but applies to all events and +not just motion, and is intended for longer timescales than are appropriate +for suspension. =item zmTriggerEventCancel ( $monitor ); -Cancel any previous trigger on or off requests. This stops a triggered alarm if it exists from a previous 'on' and allows events to be generated once more following a previous 'off'. +Cancel any previous trigger on or off requests. This stops a triggered +alarm if it exists from a previous 'on' and allows events to be generated +once more following a previous 'off'. =item zmTriggerShowtext ( $monitor, $showtest ); -Indicate that the given text should be displayed in the timestamp annotation on any images captured, if the format of the annotation string defined for the monitor permits. +Indicate that the given text should be displayed in the timestamp +annotation on any images captured, if the format of the annotation string +defined for the monitor permits. =back =head1 DATA -The data fields in mapped memory that may be accessed are as follows. There are two main sections, shared_data which is general data and trigger_data which is used for event triggering. Whilst reading from these fields is harmless, extreme care must be taken when writing to mapped memory, especially in the shared_data section as this is normally written to only by monitor capture and analysis processes. +The data fields in mapped memory that may be accessed are as follows. There +are two main sections, shared_data which is general data and trigger_data +which is used for event triggering. Whilst reading from these fields is +harmless, extreme care must be taken when writing to mapped memory, +especially in the shared_data section as this is normally written to only +by monitor capture and analysis processes. shared_data The general mapped memory section size The size, in bytes, of this section @@ -844,21 +950,38 @@ The data fields in mapped memory that may be accessed are as follows. There are =head1 CONSTANTS -The following constants are used by the methods above, but can also be used by user scripts if required. +The following constants are used by the methods above, but can also be used +by user scripts if required. =over 4 =item STATE_IDLE STATE_PREALARM STATE_ALARM STATE_ALERT STATE_TAPE -These constants define the state of the monitor with respect to alarms and events. They are used in the shared_data:state field. +These constants define the state of the monitor with respect to alarms and +events. They are used in the shared_data:state field. =item ACTION_GET ACTION_SET ACTION_RELOAD ACTION_SUSPEND ACTION_RESUME -These constants defines the various values that can exist in the shared_data:action field. This is a bitmask which when non-zero defines an action that an executing monitor process should take. ACTION_GET requires that the current values of brightness, contrast, colour and hue are taken from the camera and written to the equivalent mapped memory fields. ACTION_SET implies the reverse, that the values in mapped memory should be written to the camera. ACTION_RELOAD signal that the monitor process should reload itself from the database in case any settings have changed there. ACTION_SUSPEND signals that a monitor should stop exaiming images for motion, though other alarms may still occur. ACTION_RESUME sigansl that a monitor should resume motion detectiom. +These constants defines the various values that can exist in the +shared_data:action field. This is a bitmask which when non-zero defines an +action that an executing monitor process should take. ACTION_GET requires +that the current values of brightness, contrast, colour and hue are taken +from the camera and written to the equivalent mapped memory fields. +ACTION_SET implies the reverse, that the values in mapped memory should be +written to the camera. ACTION_RELOAD signal that the monitor process should +reload itself from the database in case any settings have changed there. +ACTION_SUSPEND signals that a monitor should stop exaiming images for +motion, though other alarms may still occur. ACTION_RESUME sigansl that a +monitor should resume motion detectiom. =item TRIGGER_CANCEL TRIGGER_ON TRIGGER_OFF -These constants are used in the definition of external triggers. TRIGGER_CANCEL is used to indicated that any previous trigger settings should be cancelled, TRIGGER_ON signals that an alarm should be created (or continued)) as a result of the current trigger and TRIGGER_OFF signals that the trigger should prevent any alarms from being generated. See the trigger methods above for further details. +These constants are used in the definition of external triggers. +TRIGGER_CANCEL is used to indicated that any previous trigger settings +should be cancelled, TRIGGER_ON signals that an alarm should be created (or +continued)) as a result of the current trigger and TRIGGER_OFF signals that +the trigger should prevent any alarms from being generated. See the trigger +methods above for further details. =back diff --git a/scripts/ZoneMinder/lib/ZoneMinder/Memory/Mapped.pm b/scripts/ZoneMinder/lib/ZoneMinder/Memory/Mapped.pm index 7b5f41a1c..017b5aa8c 100644 --- a/scripts/ZoneMinder/lib/ZoneMinder/Memory/Mapped.pm +++ b/scripts/ZoneMinder/lib/ZoneMinder/Memory/Mapped.pm @@ -36,18 +36,18 @@ our @ISA = qw(Exporter ZoneMinder::Base); # names by default without a very good reason. Use EXPORT_OK instead. # Do not simply export all your public functions/methods/constants. -# This allows declaration use ZoneMinder ':all'; +# This allows declaration use ZoneMinder ':all'; # If you do not need this, moving things directly into @EXPORT or @EXPORT_OK # will save memory. our %EXPORT_TAGS = ( - 'functions' => [ qw( - zmMemKey - zmMemAttach - zmMemDetach - zmMemGet - zmMemPut - zmMemClean - ) ], + 'functions' => [ qw( + zmMemKey + zmMemAttach + zmMemDetach + zmMemGet + zmMemPut + zmMemClean + ) ], ); push( @{$EXPORT_TAGS{all}}, @{$EXPORT_TAGS{$_}} ) foreach keys %EXPORT_TAGS; @@ -70,115 +70,129 @@ use Sys::Mmap; sub zmMemKey { - my $monitor = shift; + my $monitor = shift; return( defined($monitor->{MMapAddr})?$monitor->{MMapAddr}:undef ); } sub zmMemAttach { - my ( $monitor, $size ) = @_; - if ( ! $size ) { - Error( "No size passed to zmMemAttach for monitor $$monitor{Id}\n" ); - return( undef ); - } - if ( !defined($monitor->{MMapAddr}) ) - { + my ( $monitor, $size ) = @_; + if ( ! $size ) { + Error( "No size passed to zmMemAttach for monitor $$monitor{Id}\n" ); + return( undef ); + } + if ( !defined($monitor->{MMapAddr}) ) + { my $mmap_file = $Config{ZM_PATH_MAP}."/zm.mmap.".$monitor->{Id}; - if ( ! -e $mmap_file ) { - Error( sprintf( "Memory map file '%s' does not exist. zmc might not be running.", $mmap_file ) ); - return ( undef ); - } + if ( ! -e $mmap_file ) { + Error( sprintf( "Memory map file '%s' does not exist. zmc might not be running." + , $mmap_file + ) + ); + return ( undef ); + } - my $mmap_file_size = -s $mmap_file; + my $mmap_file_size = -s $mmap_file; - if ( $mmap_file_size < $size ) { - Error( sprintf( "Memory map file '%s' should have been %d but was instead %d", $mmap_file, $size, $mmap_file_size ) ); - return ( undef ); - } + if ( $mmap_file_size < $size ) { + Error( sprintf( "Memory map file '%s' should have been %d but was instead %d" + , $mmap_file + , $size + , $mmap_file_size + ) + ); + return ( undef ); + } if ( !open( MMAP, "+<", $mmap_file ) ) { - Error( sprintf( "Can't open memory map file '%s': $!\n", $mmap_file ) ); - return( undef ); + Error( sprintf( "Can't open memory map file '%s': $!\n", $mmap_file ) ); + return( undef ); } my $mmap = undef; my $mmap_addr = mmap( $mmap, $size, PROT_READ|PROT_WRITE, MAP_SHARED, \*MMAP ); if ( !$mmap_addr || !$mmap ) { - Error( sprintf( "Can't mmap to file '%s': $!\n", $mmap_file ) ); - close( MMAP ); - return( undef ); + Error( sprintf( "Can't mmap to file '%s': $!\n", $mmap_file ) ); + close( MMAP ); + return( undef ); } - $monitor->{MMapHandle} = \*MMAP; - $monitor->{MMapAddr} = $mmap_addr; - $monitor->{MMap} = \$mmap; - } - return( !undef ); + $monitor->{MMapHandle} = \*MMAP; + $monitor->{MMapAddr} = $mmap_addr; + $monitor->{MMap} = \$mmap; + } + return( !undef ); } sub zmMemDetach { - my $monitor = shift; + my $monitor = shift; if ( $monitor->{MMap} ) { if ( ! munmap( ${$monitor->{MMap}} ) ) { - Warn( "Unable to munmap for monitor $$monitor{Id}\n"); - } - delete $monitor->{MMap}; + Warn( "Unable to munmap for monitor $$monitor{Id}\n"); + } + delete $monitor->{MMap}; } if ( $monitor->{MMapAddr} ) { - delete $monitor->{MMapAddr}; + delete $monitor->{MMapAddr}; } if ( $monitor->{MMapHandle} ) { close( $monitor->{MMapHandle} ); - delete $monitor->{MMapHandle}; + delete $monitor->{MMapHandle}; } } sub zmMemGet { - my $monitor = shift; - my $offset = shift; - my $size = shift; + my $monitor = shift; + my $offset = shift; + my $size = shift; - my $mmap = $monitor->{MMap}; + my $mmap = $monitor->{MMap}; if ( !$mmap || !$$mmap ) { - Error( sprintf( "Can't read from mapped memory for monitor '%d', gone away?", $monitor->{Id} ) ); + Error( sprintf( "Can't read from mapped memory for monitor '%d', gone away?" + , $monitor->{Id} + ) + ); return( undef ); } - my $data = substr( $$mmap, $offset, $size ); + my $data = substr( $$mmap, $offset, $size ); return( $data ); } sub zmMemPut { - my $monitor = shift; - my $offset = shift; - my $size = shift; - my $data = shift; + my $monitor = shift; + my $offset = shift; + my $size = shift; + my $data = shift; - my $mmap = $monitor->{MMap}; + my $mmap = $monitor->{MMap}; if ( !$mmap || !$$mmap ) { - Error( sprintf( "Can't write mapped memory for monitor '%d', gone away?", $monitor->{Id} ) ); + Error( sprintf( "Can't write mapped memory for monitor '%d', gone away?" + , $monitor->{Id} + ) + ); return( undef ); } - substr( $$mmap, $offset, $size ) = $data; - return( !undef ); + substr( $$mmap, $offset, $size ) = $data; + return( !undef ); } sub zmMemClean { - Debug( "Removing memory map files\n" ); + Debug( "Removing memory map files\n" ); my $mapPath = $Config{ZM_PATH_MAP}."/zm.mmap.*"; foreach my $mapFile( glob( $mapPath ) ) { ( $mapFile ) = $mapFile =~ /^(.+)$/; - Debug( "Removing memory map file '$mapFile'\n" ); + Debug( "Removing memory map file '$mapFile'\n" ); unlink( $mapFile ); } } diff --git a/scripts/ZoneMinder/lib/ZoneMinder/Memory/Shared.pm b/scripts/ZoneMinder/lib/ZoneMinder/Memory/Shared.pm index 2b8bde5ba..301327095 100644 --- a/scripts/ZoneMinder/lib/ZoneMinder/Memory/Shared.pm +++ b/scripts/ZoneMinder/lib/ZoneMinder/Memory/Shared.pm @@ -19,7 +19,7 @@ # # ========================================================================== # -# This module contains the common definitions and functions used by the rest +# This module contains the common definitions and functions used by the rest # of the ZoneMinder scripts # package ZoneMinder::Memory::Shared; @@ -39,18 +39,18 @@ eval 'sub IPC_CREAT {0001000}' unless defined &IPC_CREAT; # names by default without a very good reason. Use EXPORT_OK instead. # Do not simply export all your public functions/methods/constants. -# This allows declaration use ZoneMinder ':all'; +# This allows declaration use ZoneMinder ':all'; # If you do not need this, moving things directly into @EXPORT or @EXPORT_OK # will save memory. our %EXPORT_TAGS = ( - 'functions' => [ qw( + 'functions' => [ qw( zmMemKey zmMemAttach zmMemDetach zmMemGet zmMemPut zmMemClean - ) ], + ) ], ); push( @{$EXPORT_TAGS{all}}, @{$EXPORT_TAGS{$_}} ) foreach keys %EXPORT_TAGS; @@ -71,77 +71,92 @@ use ZoneMinder::Logger qw(:all); sub zmMemKey { - my $monitor = shift; - return( defined($monitor->{ShmKey})?$monitor->{ShmKey}:undef ); + my $monitor = shift; + return( defined($monitor->{ShmKey})?$monitor->{ShmKey}:undef ); } sub zmMemAttach { - my $monitor = shift; - my $size = shift; - if ( !defined($monitor->{ShmId}) ) - { - my $shm_key = (hex($Config{ZM_SHM_KEY})&0xffff0000)|$monitor->{Id}; - my $shm_id = shmget( $shm_key, $size, &IPC_CREAT | 0777 ); - if ( !defined($shm_id) ) - { - Error( sprintf( "Can't get shared memory id '%x', %d: $!\n", $shm_key, $monitor->{Id} ) ); - return( undef ); - } - $monitor->{ShmKey} = $shm_key; - $monitor->{ShmId} = $shm_id; - } - return( !undef ); + my $monitor = shift; + my $size = shift; + if ( !defined($monitor->{ShmId}) ) + { + my $shm_key = (hex($Config{ZM_SHM_KEY})&0xffff0000)|$monitor->{Id}; + my $shm_id = shmget( $shm_key, $size, &IPC_CREAT | 0777 ); + if ( !defined($shm_id) ) + { + Error( sprintf( "Can't get shared memory id '%x', %d: $!\n" + , $shm_key + , $monitor->{Id} + ) + ); + return( undef ); + } + $monitor->{ShmKey} = $shm_key; + $monitor->{ShmId} = $shm_id; + } + return( !undef ); } sub zmMemDetach { - my $monitor = shift; + my $monitor = shift; - delete $monitor->{ShmId}; + delete $monitor->{ShmId}; } sub zmMemGet { - my $monitor = shift; - my $offset = shift; - my $size = shift; + my $monitor = shift; + my $offset = shift; + my $size = shift; + + my $shm_key = $monitor->{ShmKey}; + my $shm_id = $monitor->{ShmId}; - my $shm_key = $monitor->{ShmKey}; - my $shm_id = $monitor->{ShmId}; - my $data; if ( !shmread( $shm_id, $data, $offset, $size ) ) { - Error( sprintf( "Can't read from shared memory '%x/%d': $!", $shm_key, $shm_id ) ); + Error( sprintf( "Can't read from shared memory '%x/%d': $!" + , $shm_key + , $shm_id + ) + ); return( undef ); } - return( $data ); + return( $data ); } sub zmMemPut { - my $monitor = shift; - my $offset = shift; - my $size = shift; - my $data = shift; + my $monitor = shift; + my $offset = shift; + my $size = shift; + my $data = shift; + + my $shm_key = $monitor->{ShmKey}; + my $shm_id = $monitor->{ShmId}; - my $shm_key = $monitor->{ShmKey}; - my $shm_id = $monitor->{ShmId}; - if ( !shmwrite( $shm_id, $data, $offset, $size ) ) { - Error( sprintf( "Can't write to shared memory '%x/%d': $!", $shm_key, $shm_id ) ); + Error( sprintf( "Can't write to shared memory '%x/%d': $!" + , $shm_key + , $shm_id + ) + ); return( undef ); } - return( !undef ); + return( !undef ); } sub zmMemClean { Debug( "Removing shared memory\n" ); # Find ZoneMinder shared memory - my $command = "ipcs -m | grep '^".substr( sprintf( "0x%x", hex($Config{ZM_SHM_KEY}) ), 0, -2 )."'"; + my $command = "ipcs -m | grep '^" + .substr( sprintf( "0x%x", hex($Config{ZM_SHM_KEY}) ), 0, -2 ) + ."'" + ; Debug( "Checking for shared memory with '$command'\n" ); open( my $CMD, '<', "$command |" ) or Fatal( "Can't execute '$command': $!" ); diff --git a/scripts/ZoneMinder/lib/ZoneMinder/Trigger/Channel.pm b/scripts/ZoneMinder/lib/ZoneMinder/Trigger/Channel.pm index 31b4cbe03..8b746ac3d 100644 --- a/scripts/ZoneMinder/lib/ZoneMinder/Trigger/Channel.pm +++ b/scripts/ZoneMinder/lib/ZoneMinder/Trigger/Channel.pm @@ -46,53 +46,53 @@ our $AUTOLOAD; sub new { - my $class = shift; - my $self = {}; - $self->{readable} = !undef; - $self->{writeable} = !undef; - $self->{selectable} = undef; - $self->{state} = 'closed'; - bless( $self, $class ); - return $self; + my $class = shift; + my $self = {}; + $self->{readable} = !undef; + $self->{writeable} = !undef; + $self->{selectable} = undef; + $self->{state} = 'closed'; + bless( $self, $class ); + return $self; } sub clone { - my $self = shift; - my $clone = { %$self }; - bless $clone, ref $self; + my $self = shift; + my $clone = { %$self }; + bless $clone, ref $self; } sub open { - my $self = shift; - my $class = ref($self) or croak( "Can't get class for non object $self" ); - croak( "Abstract base class method called for object of class $class" ); + my $self = shift; + my $class = ref($self) or croak( "Can't get class for non object $self" ); + croak( "Abstract base class method called for object of class $class" ); } sub close { - my $self = shift; - my $class = ref($self) or croak( "Can't get class for non object $self" ); - croak( "Abstract base class method called for object of class $class" ); + my $self = shift; + my $class = ref($self) or croak( "Can't get class for non object $self" ); + croak( "Abstract base class method called for object of class $class" ); } sub getState { - my $self = shift; - return( $self->{state} ); + my $self = shift; + return( $self->{state} ); } sub isOpen { - my $self = shift; - return( $self->{state} eq "open" ); + my $self = shift; + return( $self->{state} eq "open" ); } sub isConnected { - my $self = shift; - return( $self->{state} eq "connected" ); + my $self = shift; + return( $self->{state} eq "connected" ); } sub DESTROY @@ -101,15 +101,15 @@ sub DESTROY sub AUTOLOAD { - my $self = shift; - my $class = ref($self) || croak( "$self not object" ); - my $name = $AUTOLOAD; - $name =~ s/.*://; - if ( !exists($self->{$name}) ) - { - croak( "Can't access $name member of object of class $class" ); - } - return( $self->{$name} ); + my $self = shift; + my $class = ref($self) || croak( "$self not object" ); + my $name = $AUTOLOAD; + $name =~ s/.*://; + if ( !exists($self->{$name}) ) + { + croak( "Can't access $name member of object of class $class" ); + } + return( $self->{$name} ); } 1; diff --git a/scripts/ZoneMinder/lib/ZoneMinder/Trigger/Channel/File.pm b/scripts/ZoneMinder/lib/ZoneMinder/Trigger/Channel/File.pm index c0f4ef1a4..6c4254a7e 100644 --- a/scripts/ZoneMinder/lib/ZoneMinder/Trigger/Channel/File.pm +++ b/scripts/ZoneMinder/lib/ZoneMinder/Trigger/Channel/File.pm @@ -48,23 +48,23 @@ use Fcntl; sub new { - my $class = shift; - my %params = @_; - my $self = ZoneMinder::Trigger::Channel::Handle->new; - $self->{path} = $params{path}; - bless( $self, $class ); - return $self; + my $class = shift; + my %params = @_; + my $self = ZoneMinder::Trigger::Channel::Handle->new; + $self->{path} = $params{path}; + bless( $self, $class ); + return $self; } sub open { - my $self = shift; - local *sfh; - #sysopen( *sfh, $conn->{path}, O_NONBLOCK|O_RDONLY ) or croak( "Can't sysopen: $!" ); - #open( *sfh, "<".$conn->{path} ) or croak( "Can't open: $!" ); - open( *sfh, "+<", $self->{path} ) or croak( "Can't open: $!" ); - $self->{state} = 'open'; - $self->{handle} = *sfh; + my $self = shift; + local *sfh; + #sysopen( *sfh, $conn->{path}, O_NONBLOCK|O_RDONLY ) or croak( "Can't sysopen: $!" ); + #open( *sfh, "<".$conn->{path} ) or croak( "Can't open: $!" ); + open( *sfh, "+<", $self->{path} ) or croak( "Can't open: $!" ); + $self->{state} = 'open'; + $self->{handle} = *sfh; } 1; diff --git a/scripts/ZoneMinder/lib/ZoneMinder/Trigger/Channel/Handle.pm b/scripts/ZoneMinder/lib/ZoneMinder/Trigger/Channel/Handle.pm index 0781150e2..d26924476 100644 --- a/scripts/ZoneMinder/lib/ZoneMinder/Trigger/Channel/Handle.pm +++ b/scripts/ZoneMinder/lib/ZoneMinder/Trigger/Channel/Handle.pm @@ -46,12 +46,12 @@ use POSIX; sub new { - my $class = shift; - my $port = shift; - my $self = ZoneMinder::Trigger::Channel->new(); - $self->{handle} = undef; - bless( $self, $class ); - return $self; + my $class = shift; + my $port = shift; + my $self = ZoneMinder::Trigger::Channel->new(); + $self->{handle} = undef; + bless( $self, $class ); + return $self; } sub spawns @@ -61,43 +61,49 @@ sub spawns sub close { - my $self = shift; - close( $self->{handle} ); - $self->{state} = 'closed'; - $self->{handle} = undef; + my $self = shift; + close( $self->{handle} ); + $self->{state} = 'closed'; + $self->{handle} = undef; } sub read { - my $self = shift; - my $buffer; - my $nbytes = sysread( $self->{handle}, $buffer, POSIX::BUFSIZ ); - if ( !$nbytes ) - { - return( undef ); - } - Debug( "Read '$buffer' ($nbytes bytes)\n" ); - return( $buffer ); + my $self = shift; + my $buffer; + my $nbytes = sysread( $self->{handle}, $buffer, POSIX::BUFSIZ ); + if ( !$nbytes ) + { + return( undef ); + } + Debug( "Read '$buffer' ($nbytes bytes)\n" ); + return( $buffer ); } sub write { - my $self = shift; - my $buffer = shift; - my $nbytes = syswrite( $self->{handle}, $buffer ); - if ( !defined( $nbytes) || $nbytes < length($buffer) ) - { - Error( "Unable to write buffer '".$buffer.", expected ".length($buffer)." bytes, sent ".($nbytes?$nbytes:'undefined').": $!\n" ); - return( undef ); - } - Debug( "Wrote '$buffer' ($nbytes bytes)\n" ); - return( !undef ); + my $self = shift; + my $buffer = shift; + my $nbytes = syswrite( $self->{handle}, $buffer ); + if ( !defined( $nbytes) || $nbytes < length($buffer) ) + { + Error( "Unable to write buffer '".$buffer + .", expected " + .length($buffer) + ." bytes, sent " + .($nbytes?$nbytes:'undefined') + .": $!\n" + ); + return( undef ); + } + Debug( "Wrote '$buffer' ($nbytes bytes)\n" ); + return( !undef ); } sub fileno { - my $self = shift; - return( defined($self->{handle})?fileno($self->{handle}):-1 ); + my $self = shift; + return( defined($self->{handle})?fileno($self->{handle}):-1 ); } 1; diff --git a/scripts/ZoneMinder/lib/ZoneMinder/Trigger/Channel/Inet.pm b/scripts/ZoneMinder/lib/ZoneMinder/Trigger/Channel/Inet.pm index 7b8b0163c..6c5f21961 100644 --- a/scripts/ZoneMinder/lib/ZoneMinder/Trigger/Channel/Inet.pm +++ b/scripts/ZoneMinder/lib/ZoneMinder/Trigger/Channel/Inet.pm @@ -48,44 +48,45 @@ use Socket; sub new { - my $class = shift; - my %params = @_; - my $self = ZoneMinder::Trigger::Channel::Spawning->new(); - $self->{selectable} = !undef; - $self->{port} = $params{port}; - bless( $self, $class ); - return $self; + my $class = shift; + my %params = @_; + my $self = ZoneMinder::Trigger::Channel::Spawning->new(); + $self->{selectable} = !undef; + $self->{port} = $params{port}; + bless( $self, $class ); + return $self; } sub open { - my $self = shift; - local *sfh; - my $saddr = sockaddr_in( $self->{port}, INADDR_ANY ); - socket( *sfh, PF_INET, SOCK_STREAM, getprotobyname('tcp') ) or croak( "Can't open socket: $!" ); - setsockopt( *sfh, SOL_SOCKET, SO_REUSEADDR, 1 ); - bind( *sfh, $saddr ) or croak( "Can't bind: $!" ); - listen( *sfh, SOMAXCONN ) or croak( "Can't listen: $!" ); - $self->{state} = 'open'; - $self->{handle} = *sfh; + my $self = shift; + local *sfh; + my $saddr = sockaddr_in( $self->{port}, INADDR_ANY ); + socket( *sfh, PF_INET, SOCK_STREAM, getprotobyname('tcp') ) + or croak( "Can't open socket: $!" ); + setsockopt( *sfh, SOL_SOCKET, SO_REUSEADDR, 1 ); + bind( *sfh, $saddr ) or croak( "Can't bind: $!" ); + listen( *sfh, SOMAXCONN ) or croak( "Can't listen: $!" ); + $self->{state} = 'open'; + $self->{handle} = *sfh; } sub _spawn { - my $self = shift; - my $new_handle = shift; - my $clone = $self->clone(); - $clone->{handle} = $new_handle; - $clone->{state} = 'connected'; - return( $clone ); + my $self = shift; + my $new_handle = shift; + my $clone = $self->clone(); + $clone->{handle} = $new_handle; + $clone->{state} = 'connected'; + return( $clone ); } sub accept { - my $self = shift; - local *cfh; - my $paddr = accept( *cfh, $self->{handle} ); - return( $self->_spawn( *cfh ) ); + my $self = shift; + local *cfh; + my $paddr = accept( *cfh, $self->{handle} ); + return( $self->_spawn( *cfh ) ); } 1; diff --git a/scripts/ZoneMinder/lib/ZoneMinder/Trigger/Channel/Serial.pm b/scripts/ZoneMinder/lib/ZoneMinder/Trigger/Channel/Serial.pm index 373b9e615..a3709b5bb 100644 --- a/scripts/ZoneMinder/lib/ZoneMinder/Trigger/Channel/Serial.pm +++ b/scripts/ZoneMinder/lib/ZoneMinder/Trigger/Channel/Serial.pm @@ -46,64 +46,70 @@ use Device::SerialPort; sub new { - my $class = shift; - my %params = @_; - my $self = ZoneMinder::Trigger::Channel->new; - $self->{path} = $params{path}; - bless( $self, $class ); - return $self; + my $class = shift; + my %params = @_; + my $self = ZoneMinder::Trigger::Channel->new; + $self->{path} = $params{path}; + bless( $self, $class ); + return $self; } sub open { - my $self = shift; - my $device = new Device::SerialPort( $self->{path} ); - $device->baudrate(9600); - $device->databits(8); - $device->parity('none'); - $device->stopbits(1); - $device->handshake('none'); + my $self = shift; + my $device = new Device::SerialPort( $self->{path} ); + $device->baudrate(9600); + $device->databits(8); + $device->parity('none'); + $device->stopbits(1); + $device->handshake('none'); - $device->read_const_time(50); - $device->read_char_time(10); + $device->read_const_time(50); + $device->read_char_time(10); - $self->{device} = $device; - $self->{state} = 'open'; - $self->{state} = 'connected'; + $self->{device} = $device; + $self->{state} = 'open'; + $self->{state} = 'connected'; } sub close { - my $self = shift; - $self->{device}->close(); - $self->{state} = 'closed'; + my $self = shift; + $self->{device}->close(); + $self->{state} = 'closed'; } sub read { - my $self = shift; - my $buffer = $self->{device}->lookfor(); - if ( !$buffer || !length($buffer) ) - { - return( undef ); - } - Debug( "Read '$buffer' (".length($buffer)." bytes)\n" ); - return( $buffer ); + my $self = shift; + my $buffer = $self->{device}->lookfor(); + if ( !$buffer || !length($buffer) ) + { + return( undef ); + } + Debug( "Read '$buffer' (".length($buffer)." bytes)\n" ); + return( $buffer ); } sub write { - my $self = shift; - my $buffer = shift; - my $nbytes = $self->{device}->write( $buffer ); - $self->{device}->write_drain(); - if ( !defined( $nbytes) || $nbytes < length($buffer) ) - { - Error( "Unable to write buffer '".$buffer.", expected ".length($buffer)." bytes, sent ".$nbytes.": $!\n" ); - return( undef ); - } - Debug( "Wrote '$buffer' ($nbytes bytes)\n" ); - return( !undef ); + my $self = shift; + my $buffer = shift; + my $nbytes = $self->{device}->write( $buffer ); + $self->{device}->write_drain(); + if ( !defined( $nbytes) || $nbytes < length($buffer) ) + { + Error( "Unable to write buffer '".$buffer + .", expected " + .length($buffer) + ." bytes, sent " + .$nbytes + .": $!\n" + ); + return( undef ); + } + Debug( "Wrote '$buffer' ($nbytes bytes)\n" ); + return( !undef ); } 1; diff --git a/scripts/ZoneMinder/lib/ZoneMinder/Trigger/Channel/Spawning.pm b/scripts/ZoneMinder/lib/ZoneMinder/Trigger/Channel/Spawning.pm index ff726ac38..aeaca182e 100644 --- a/scripts/ZoneMinder/lib/ZoneMinder/Trigger/Channel/Spawning.pm +++ b/scripts/ZoneMinder/lib/ZoneMinder/Trigger/Channel/Spawning.pm @@ -45,12 +45,12 @@ use ZoneMinder::Logger qw(:all); sub new { - my $class = shift; - my $port = shift; - my $self = ZoneMinder::Trigger::Channel::Handle->new(); - $self->{spawns} = !undef; - bless( $self, $class ); - return $self; + my $class = shift; + my $port = shift; + my $self = ZoneMinder::Trigger::Channel::Handle->new(); + $self->{spawns} = !undef; + bless( $self, $class ); + return $self; } sub spawns diff --git a/scripts/ZoneMinder/lib/ZoneMinder/Trigger/Channel/Unix.pm b/scripts/ZoneMinder/lib/ZoneMinder/Trigger/Channel/Unix.pm index 8ef593870..71d6e89fc 100644 --- a/scripts/ZoneMinder/lib/ZoneMinder/Trigger/Channel/Unix.pm +++ b/scripts/ZoneMinder/lib/ZoneMinder/Trigger/Channel/Unix.pm @@ -48,25 +48,25 @@ use Socket; sub new { - my $class = shift; - my %params = @_; - my $self = ZoneMinder::Trigger::Channel->new; - $self->{selectable} = !undef; - $self->{path} = $params{path}; - bless( $self, $class ); - return $self; + my $class = shift; + my %params = @_; + my $self = ZoneMinder::Trigger::Channel->new; + $self->{selectable} = !undef; + $self->{path} = $params{path}; + bless( $self, $class ); + return $self; } sub open { - my $self = shift; - local *sfh; - unlink( $self->{path} ); - my $saddr = sockaddr_un( $self->{path} ); - socket( *sfh, PF_UNIX, SOCK_STREAM, 0 ) or croak( "Can't open socket: $!" ); - bind( *sfh, $saddr ) or croak( "Can't bind: $!" ); - listen( *sfh, SOMAXCONN ) or croak( "Can't listen: $!" ); - $self->{handle} = *sfh; + my $self = shift; + local *sfh; + unlink( $self->{path} ); + my $saddr = sockaddr_un( $self->{path} ); + socket( *sfh, PF_UNIX, SOCK_STREAM, 0 ) or croak( "Can't open socket: $!" ); + bind( *sfh, $saddr ) or croak( "Can't bind: $!" ); + listen( *sfh, SOMAXCONN ) or croak( "Can't listen: $!" ); + $self->{handle} = *sfh; } sub _spawn diff --git a/scripts/ZoneMinder/lib/ZoneMinder/Trigger/Connection.pm b/scripts/ZoneMinder/lib/ZoneMinder/Trigger/Connection.pm index bd28e50ff..12cf3136d 100644 --- a/scripts/ZoneMinder/lib/ZoneMinder/Trigger/Connection.pm +++ b/scripts/ZoneMinder/lib/ZoneMinder/Trigger/Connection.pm @@ -46,115 +46,121 @@ our $AUTOLOAD; sub new { - my $class = shift; - my %params = @_; - my $self = {}; - $self->{name} = $params{name}; - $self->{channel} = $params{channel}; - $self->{input} = $params{mode} =~ /r/i; - $self->{output} = $params{mode} =~ /w/i; - bless( $self, $class ); - return $self; + my $class = shift; + my %params = @_; + my $self = {}; + $self->{name} = $params{name}; + $self->{channel} = $params{channel}; + $self->{input} = $params{mode} =~ /r/i; + $self->{output} = $params{mode} =~ /w/i; + bless( $self, $class ); + return $self; } sub clone { - my $self = shift; - my $clone = { %$self }; - bless $clone, ref $self; - return( $clone ); + my $self = shift; + my $clone = { %$self }; + bless $clone, ref $self; + return( $clone ); } sub spawns { - my $self = shift; + my $self = shift; return( $self->{channel}->spawns() ); } sub _spawn { - my $self = shift; - my $new_channel = shift; - my $clone = $self->clone(); - $clone->{channel} = $new_channel; - return( $clone ); + my $self = shift; + my $new_channel = shift; + my $clone = $self->clone(); + $clone->{channel} = $new_channel; + return( $clone ); } sub accept { - my $self = shift; - my $new_channel = $self->{channel}->accept(); - return( $self->_spawn( $new_channel ) ); + my $self = shift; + my $new_channel = $self->{channel}->accept(); + return( $self->_spawn( $new_channel ) ); } sub open { - my $self = shift; - return( $self->{channel}->open() ); + my $self = shift; + return( $self->{channel}->open() ); } sub close { - my $self = shift; - return( $self->{channel}->close() ); + my $self = shift; + return( $self->{channel}->close() ); } sub fileno { - my $self = shift; - return( $self->{channel}->fileno() ); + my $self = shift; + return( $self->{channel}->fileno() ); } sub isOpen { - my $self = shift; - return( $self->{channel}->isOpen() ); + my $self = shift; + return( $self->{channel}->isOpen() ); } sub isConnected { - my $self = shift; - return( $self->{channel}->isConnected() ); + my $self = shift; + return( $self->{channel}->isConnected() ); } sub canRead { - my $self = shift; - return( $self->{input} && $self->isConnected() ); + my $self = shift; + return( $self->{input} && $self->isConnected() ); } sub canWrite { - my $self = shift; - return( $self->{output} && $self->isConnected() ); + my $self = shift; + return( $self->{output} && $self->isConnected() ); } sub getMessages { - my $self = shift; - my $buffer = $self->{channel}->read(); + my $self = shift; + my $buffer = $self->{channel}->read(); - return( undef ) if ( !defined($buffer) ); + return( undef ) if ( !defined($buffer) ); - my @messages = split( /\r?\n/, $buffer ); - return( \@messages ); + my @messages = split( /\r?\n/, $buffer ); + return( \@messages ); } sub putMessages { - my $self = shift; - my $messages = shift; + my $self = shift; + my $messages = shift; - if ( @$messages ) - { - my $buffer = join( "\n", @$messages ); - $buffer .= "\n"; - if ( !$self->{channel}->write( $buffer ) ) - { - Error( "Unable to write buffer '".$buffer." to connection ".$self->{name}." (".$self->fileno().")\n" ); - } - } - return( undef ); + if ( @$messages ) + { + my $buffer = join( "\n", @$messages ); + $buffer .= "\n"; + if ( !$self->{channel}->write( $buffer ) ) + { + Error( "Unable to write buffer '".$buffer + ." to connection " + .$self->{name} + ." (" + .$self->fileno() + .")\n" + ); + } + } + return( undef ); } sub timedActions @@ -167,22 +173,22 @@ sub DESTROY sub AUTOLOAD { - my $self = shift; - my $class = ref($self) || croak( "$self not object" ); - my $name = $AUTOLOAD; - $name =~ s/.*://; - if ( exists($self->{$name}) ) - { - return( $self->{$name} ); - } - elsif ( defined($self->{channel}) ) - { - if ( exists($self->{channel}->{$name}) ) - { - return( $self->{channel}->{$name} ); - } - } - croak( "Can't access $name member of object of class $class" ); + my $self = shift; + my $class = ref($self) || croak( "$self not object" ); + my $name = $AUTOLOAD; + $name =~ s/.*://; + if ( exists($self->{$name}) ) + { + return( $self->{$name} ); + } + elsif ( defined($self->{channel}) ) + { + if ( exists($self->{channel}->{$name}) ) + { + return( $self->{channel}->{$name} ); + } + } + croak( "Can't access $name member of object of class $class" ); } 1; diff --git a/scripts/ZoneMinder/lib/ZoneMinder/Trigger/Connection/Example.pm b/scripts/ZoneMinder/lib/ZoneMinder/Trigger/Connection/Example.pm index 3bed2b351..6f3a86575 100644 --- a/scripts/ZoneMinder/lib/ZoneMinder/Trigger/Connection/Example.pm +++ b/scripts/ZoneMinder/lib/ZoneMinder/Trigger/Connection/Example.pm @@ -44,40 +44,40 @@ use ZoneMinder::Logger qw(:all); sub new { - my $class = shift; - my $path = shift; - my $self = ZoneMinder::Trigger::Connection->new( @_ ); - bless( $self, $class ); - return $self; + my $class = shift; + my $path = shift; + my $self = ZoneMinder::Trigger::Connection->new( @_ ); + bless( $self, $class ); + return $self; } sub getMessages { - my $self = shift; - my $buffer = $self->{channel}->read(); + my $self = shift; + my $buffer = $self->{channel}->read(); - return( undef ) if ( !defined($buffer) ); + return( undef ) if ( !defined($buffer) ); - Debug( "Handling buffer '$buffer'\n" ); - my @messages = grep { s/-/|/g; 1; } split( /\r?\n/, $buffer ); - return( \@messages ); + Debug( "Handling buffer '$buffer'\n" ); + my @messages = grep { s/-/|/g; 1; } split( /\r?\n/, $buffer ); + return( \@messages ); } sub putMessages { - my $self = shift; - my $messages = shift; + my $self = shift; + my $messages = shift; - if ( @$messages ) - { - my $buffer = join( "\n", grep{ s/\|/-/; 1; } @$messages ); - $buffer .= "\n"; - if ( !$self->{channel}->write( $buffer ) ) - { - Error( "Unable to write buffer '".$buffer." to connection ".$self->{name}." (".$self->fileno().")\n" ); - } - } - return( undef ); + if ( @$messages ) + { + my $buffer = join( "\n", grep{ s/\|/-/; 1; } @$messages ); + $buffer .= "\n"; + if ( !$self->{channel}->write( $buffer ) ) + { + Error( "Unable to write buffer '".$buffer." to connection ".$self->{name}." (".$self->fileno().")\n" ); + } + } + return( undef ); } 1; diff --git a/src/zm_event.cpp b/src/zm_event.cpp index 086e0fb08..5c7ccd3db 100644 --- a/src/zm_event.cpp +++ b/src/zm_event.cpp @@ -1554,8 +1554,10 @@ void EventStream::runStream() if ( ((curr_frame_id-1)%frame_mod) == 0 ) { delta_us = (unsigned int)(frame_data->delta * 1000000); - if ( effective_fps < base_fps ) - delta_us = (unsigned int)((delta_us * base_fps)/effective_fps); + // if effective > base we should speed up frame delivery + delta_us = (unsigned int)((delta_us * base_fps)/effective_fps); + // but must not exceed maxfps + delta_us = max(delta_us, 1000000 / maxfps); send_frame = true; } } diff --git a/src/zm_ffmpeg_camera.cpp b/src/zm_ffmpeg_camera.cpp index 5ae1e4a37..225d9ec66 100644 --- a/src/zm_ffmpeg_camera.cpp +++ b/src/zm_ffmpeg_camera.cpp @@ -427,7 +427,7 @@ void *FfmpegCamera::ReopenFfmpegThreadCallback(void *ctx){ // Close current stream. camera->CloseFfmpeg(); - // Sleep if neccessary to not reconnect too fast. + // Sleep if necessary to not reconnect too fast. int wait = config.ffmpeg_open_timeout - (time(NULL) - camera->mOpenStart); wait = wait < 0 ? 0 : wait; if (wait > 0){ diff --git a/src/zm_image.cpp b/src/zm_image.cpp index 956da6f08..eb7510cf5 100644 --- a/src/zm_image.cpp +++ b/src/zm_image.cpp @@ -305,7 +305,7 @@ void Image::Initialise() initialised = true; } -/* Requests a writeable buffer to the image. This is safer than buffer() because this way we can gurantee that a buffer of required size exists */ +/* Requests a writeable buffer to the image. This is safer than buffer() because this way we can guarantee that a buffer of required size exists */ uint8_t* Image::WriteBuffer(const unsigned int p_width, const unsigned int p_height, const unsigned int p_colours, const unsigned int p_subpixelorder) { unsigned int newsize; @@ -1593,7 +1593,7 @@ Image *Image::Highlight( unsigned int n_images, Image *images[], const Rgb thres return( result ); } -/* New function to allow buffer re-using instead of allocationg memory for the delta image everytime */ +/* New function to allow buffer re-using instead of allocationg memory for the delta image every time */ void Image::Delta( const Image &image, Image* targetimage) const { #ifdef ZM_IMAGE_PROFILING diff --git a/src/zm_local_camera.cpp b/src/zm_local_camera.cpp index 7b6add421..6740647bb 100644 --- a/src/zm_local_camera.cpp +++ b/src/zm_local_camera.cpp @@ -32,6 +32,13 @@ #include #include +/* Workaround for GNU/kFreeBSD */ +#if defined(__FreeBSD_kernel__) +#ifndef ENODATA +#define ENODATA ENOATTR +#endif +#endif + static unsigned int BigEndian; static int vidioctl( int fd, int request, void *arg ) @@ -255,7 +262,7 @@ static PixelFormat getFfPixFormatFromV4lPalette( int v4l_version, int palette ) #if ZM_HAS_V4L2 static char palette_desc[32]; -/* Automatic format selection prefered formats */ +/* Automatic format selection preferred formats */ static const uint32_t prefered_rgb32_formats[] = {V4L2_PIX_FMT_BGR32, V4L2_PIX_FMT_RGB32, V4L2_PIX_FMT_BGR24, V4L2_PIX_FMT_RGB24, V4L2_PIX_FMT_YUYV, V4L2_PIX_FMT_UYVY, V4L2_PIX_FMT_JPEG, V4L2_PIX_FMT_MJPEG, V4L2_PIX_FMT_YUV422P, V4L2_PIX_FMT_YUV420}; static const uint32_t prefered_rgb24_formats[] = {V4L2_PIX_FMT_BGR24, V4L2_PIX_FMT_RGB24, V4L2_PIX_FMT_YUYV, V4L2_PIX_FMT_UYVY, V4L2_PIX_FMT_JPEG, V4L2_PIX_FMT_MJPEG, V4L2_PIX_FMT_YUV422P, V4L2_PIX_FMT_YUV420}; static const uint32_t prefered_gray8_formats[] = {V4L2_PIX_FMT_GREY, V4L2_PIX_FMT_YUYV, V4L2_PIX_FMT_UYVY, V4L2_PIX_FMT_JPEG, V4L2_PIX_FMT_MJPEG, V4L2_PIX_FMT_YUV422P, V4L2_PIX_FMT_YUV420}; diff --git a/src/zm_logger.cpp b/src/zm_logger.cpp index ae5691990..705f865f2 100644 --- a/src/zm_logger.cpp +++ b/src/zm_logger.cpp @@ -535,7 +535,12 @@ void Logger::logPrint( bool hex, const char * const file, const int line, const if (tid < 0 ) // Thread/Process id #else #ifdef HAVE_SYSCALL + #ifdef __FreeBSD_kernel__ + if ( (syscall(SYS_thr_self, &tid)) < 0 ) // Thread/Process id + + # else if ( (tid = syscall(SYS_gettid)) < 0 ) // Thread/Process id + #endif #endif // HAVE_SYSCALL #endif tid = getpid(); // Process id diff --git a/src/zm_monitor.cpp b/src/zm_monitor.cpp index 883cb5ab5..b673eac33 100644 --- a/src/zm_monitor.cpp +++ b/src/zm_monitor.cpp @@ -470,7 +470,7 @@ Monitor::Monitor( } } - // Will this not happen everytime a monitor is instantiated? Seems like all the calls to the Monitor constructor pass a zero for n_zones, then load zones after.. + // Will this not happen every time a monitor is instantiated? Seems like all the calls to the Monitor constructor pass a zero for n_zones, then load zones after.. if ( !n_zones ) { Debug( 1, "Monitor %s has no zones, adding one.", name ); n_zones = 1; @@ -558,14 +558,18 @@ bool Monitor::connect() { Error( "Got unexpected memory map file size %ld, expected %d", map_stat.st_size, mem_size ); return false; } else { +#ifdef MAP_LOCKED mem_ptr = (unsigned char *)mmap( NULL, mem_size, PROT_READ|PROT_WRITE, MAP_SHARED|MAP_LOCKED, map_fd, 0 ); if ( mem_ptr == MAP_FAILED ) { if ( errno == EAGAIN ) { Debug( 1, "Unable to map file %s (%d bytes) to locked memory, trying unlocked", mem_file, mem_size ); +#endif mem_ptr = (unsigned char *)mmap( NULL, mem_size, PROT_READ|PROT_WRITE, MAP_SHARED, map_fd, 0 ); Debug( 1, "Mapped file %s (%d bytes) to locked memory, unlocked", mem_file, mem_size ); +#ifdef MAP_LOCKED } } +#endif if ( mem_ptr == MAP_FAILED ) Fatal( "Can't map file %s (%d bytes) to memory: %s(%d)", mem_file, mem_size, strerror(errno), errno ); } @@ -3150,7 +3154,7 @@ bool Monitor::closeEvent() * comparing it with ZM_COLOUR_RGB24 or ZM_COLOUR_RGB32 is the way ), and then * manage che check using RGB_VAL_RED() and so on macros instead of just RED(). * - * Be carefull that in 32 bit images we need to check also where the alpha channel is, so, + * Be careful that in 32 bit images we need to check also where the alpha channel is, so, * (RGBA and BGRA) or (ABGR and ARGB) aren't the same! * * To check black pixels in 32 bit images i can do a more efficient way using diff --git a/src/zm_mpeg.cpp b/src/zm_mpeg.cpp index e3e544e73..90092d96c 100644 --- a/src/zm_mpeg.cpp +++ b/src/zm_mpeg.cpp @@ -262,7 +262,7 @@ void VideoStream::SetupCodec( int colours, int subpixelorder, int width, int hei /* emit one intra frame every second */ c->gop_size = frame_rate; - // some formats want stream headers to be seperate + // some formats want stream headers to be separate if ( of->flags & AVFMT_GLOBALHEADER ) c->flags |= CODEC_FLAG_GLOBAL_HEADER; } diff --git a/src/zm_rtsp.cpp b/src/zm_rtsp.cpp index 76b000c9d..f36814945 100644 --- a/src/zm_rtsp.cpp +++ b/src/zm_rtsp.cpp @@ -392,7 +392,7 @@ int RtspThread::run() if ( ( lines[i].size() > 13 ) && ( lines[i].substr( 0, 13 ) == "Content-Base:" ) ) { mUrl = trimSpaces( lines[i].substr( 13 ) ); - Info("Recieved new Content-Base in DESCRIBE reponse header. Updated device Url to: '%s'", mUrl.c_str() ); + Info("Received new Content-Base in DESCRIBE response header. Updated device Url to: '%s'", mUrl.c_str() ); break; } } diff --git a/src/zm_signal.cpp b/src/zm_signal.cpp index 6db4697ed..91e1bc4ba 100644 --- a/src/zm_signal.cpp +++ b/src/zm_signal.cpp @@ -64,12 +64,19 @@ RETSIGTYPE zm_die_handler(int signal) info->si_uid, info->si_status); ucontext_t *uc = (ucontext_t *) context; + cr2 = info->si_addr; #if defined(__x86_64__) - cr2 = info->si_addr; + #ifdef __FreeBSD_kernel__ + ip = (void *)(uc->uc_mcontext.mc_rip); + #else ip = (void *)(uc->uc_mcontext.gregs[REG_RIP]); + #endif #else - cr2 = info->si_addr; + #ifdef __FreeBSD_kernel__ + ip = (void *)(uc->uc_mcontext.mc_eip); + #else ip = (void *)(uc->uc_mcontext.gregs[REG_EIP]); + #endif #endif // defined(__x86_64__) // Print the signal address and instruction pointer if available diff --git a/src/zm_thread.h b/src/zm_thread.h index 3ba80c09f..54190547c 100644 --- a/src/zm_thread.h +++ b/src/zm_thread.h @@ -36,15 +36,19 @@ class ThreadException : public Exception { private: pid_t pid() { -pid_t tid; + pid_t tid; #ifdef __FreeBSD__ -long lwpid; -thr_self(&lwpid); -tid = lwpid; + long lwpid; + thr_self(&lwpid); + tid = lwpid; #else -tid=syscall(SYS_gettid); + #ifdef __FreeBSD_kernel__ + if ( (syscall(SYS_thr_self, &tid)) < 0 ) // Thread/Process id + # else + tid=syscall(SYS_gettid); + #endif #endif -return tid; + return tid; } public: ThreadException( const std::string &message ) : Exception( stringtf( "(%d) "+message, (long int)pid() ) ) { @@ -219,13 +223,18 @@ protected: pid_t id() const { -pid_t tid; + pid_t tid; #ifdef __FreeBSD__ -long lwpid; -thr_self(&lwpid); -tid = lwpid; + long lwpid; + thr_self(&lwpid); + tid = lwpid; #else -tid=syscall(SYS_gettid); + #ifdef __FreeBSD_kernel__ + if ( (syscall(SYS_thr_self, &tid)) < 0 ) // Thread/Process id + + #else + tid=syscall(SYS_gettid); + #endif #endif return tid; } diff --git a/src/zm_timer.h b/src/zm_timer.h index 80461cf07..f7f74aa7d 100644 --- a/src/zm_timer.h +++ b/src/zm_timer.h @@ -40,7 +40,11 @@ private: thr_self(&lwpid); tid = lwpid; #else + #ifdef __FreeBSD_kernel__ + if ( (syscall(SYS_thr_self, &tid)) < 0 ) // Thread/Process id + #else tid=syscall(SYS_gettid); + #endif #endif return tid; } diff --git a/web/ajax/event.php b/web/ajax/event.php index d5cc2b09d..1953acab0 100644 --- a/web/ajax/event.php +++ b/web/ajax/event.php @@ -1,4 +1,6 @@