From e35c541715c8d001001070b3a23958388f9cadf6 Mon Sep 17 00:00:00 2001 From: guotie Date: Fri, 11 Oct 2013 14:24:23 +0800 Subject: [PATCH 001/107] Update zm_remote_camera.h --- src/zm_remote_camera.h | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/src/zm_remote_camera.h b/src/zm_remote_camera.h index 32a331136..19cffdcf0 100644 --- a/src/zm_remote_camera.h +++ b/src/zm_remote_camera.h @@ -23,6 +23,9 @@ #include "zm_camera.h" #include +//#include +#include +#include #include // @@ -40,8 +43,8 @@ protected: std::string auth64; protected: - struct hostent *hp; - struct sockaddr_in sa; + struct addrinfo *hp; + struct sockaddr *sa; public: RemoteCamera( int p_id, const std::string &p_proto, const std::string &p_host, const std::string &p_port, const std::string &p_path, int p_width, int p_height, int p_colours, int p_brightness, int p_contrast, int p_hue, int p_colour, bool p_capture ); From e0728f7dc1482ee0e432679257d63e43087190e9 Mon Sep 17 00:00:00 2001 From: guotie Date: Fri, 11 Oct 2013 14:26:48 +0800 Subject: [PATCH 002/107] Update zm_remote_camera.cpp --- src/zm_remote_camera.cpp | 16 ++++++++++++---- 1 file changed, 12 insertions(+), 4 deletions(-) diff --git a/src/zm_remote_camera.cpp b/src/zm_remote_camera.cpp index 8c54c0ad7..3b63cdbd8 100644 --- a/src/zm_remote_camera.cpp +++ b/src/zm_remote_camera.cpp @@ -63,13 +63,21 @@ void RemoteCamera::Initialise() if ( !hp ) { - if ( !(hp = gethostbyname(host.c_str())) ) + struct addrinfo hints; + memset(&hints, 0, sizeof(hints)); + hints.ai_family = PF_UNSPEC; + hints.ai_flags = AI_PASSIVE; + hints.ai_socktype = SOCK_STREAM; + + if ( getaddrinfo(host.c_str(), NULL, &hints, &hp) != 0 ) { Fatal( "Can't gethostbyname(%s): %s", host.c_str(), strerror(h_errno) ); } - memcpy((char *)&sa.sin_addr, (char *)hp->h_addr, hp->h_length); - sa.sin_family = hp->h_addrtype; - sa.sin_port = htons(atoi(port.c_str())); + //memcpy((char *)&sa.sin_addr, (char *)hp->h_addr, hp->h_length); + //sa.sin_family = hp->h_addrtype; + //sa.sin_port = htons(atoi(port.c_str())); + sa = hp->ai_addr; + ((struct sockaddr_in *)sa)->sin_port = htons(atoi(port.c_str())); } } From 042e50eecc0351a6ba263f8d682a46de25d6c137 Mon Sep 17 00:00:00 2001 From: guotie Date: Fri, 11 Oct 2013 14:28:43 +0800 Subject: [PATCH 003/107] Update zm_remote_camera_http.cpp --- src/zm_remote_camera_http.cpp | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/zm_remote_camera_http.cpp b/src/zm_remote_camera_http.cpp index 59c6f53e0..9ee3523ab 100644 --- a/src/zm_remote_camera_http.cpp +++ b/src/zm_remote_camera_http.cpp @@ -89,14 +89,14 @@ int RemoteCameraHttp::Connect() { if ( sd < 0 ) { - sd = socket( hp->h_addrtype, SOCK_STREAM, 0 ); + sd = socket( hp->ai_family, SOCK_STREAM, 0 ); if ( sd < 0 ) { Error( "Can't create socket: %s", strerror(errno) ); return( -1 ); } - if ( connect( sd, (struct sockaddr *)&sa, sizeof(sa) ) < 0 ) + if ( connect( sd, (struct sockaddr *)sa, hp->ai_addrlen ) < 0 ) { Error( "Can't connect to remote camera: %s", strerror(errno) ); Disconnect(); From 557c0a3d307627ad3554b0c76eecb2f7e93c67dc Mon Sep 17 00:00:00 2001 From: guotie Date: Fri, 11 Oct 2013 14:31:37 +0800 Subject: [PATCH 004/107] Update zm_remote_camera_http.cpp --- src/zm_remote_camera_http.cpp | 2 ++ 1 file changed, 2 insertions(+) diff --git a/src/zm_remote_camera_http.cpp b/src/zm_remote_camera_http.cpp index 9ee3523ab..4f89f68b2 100644 --- a/src/zm_remote_camera_http.cpp +++ b/src/zm_remote_camera_http.cpp @@ -24,6 +24,7 @@ #include #include #include +#include RemoteCameraHttp::RemoteCameraHttp( int p_id, const std::string &p_method, const std::string &p_host, const std::string &p_port, const std::string &p_path, int p_width, int p_height, int p_colours, int p_brightness, int p_contrast, int p_hue, int p_colour, bool p_capture ) : RemoteCamera( p_id, "http", p_host, p_port, p_path, p_width, p_height, p_colours, p_brightness, p_contrast, p_hue, p_colour, p_capture ) @@ -111,6 +112,7 @@ int RemoteCameraHttp::Disconnect() { close( sd ); sd = -1; + freeaddrinfo(hp); Debug( 3, "Disconnected from host" ); return( 0 ); } From 72b80d74177cc53bec976d18ff09427705186502 Mon Sep 17 00:00:00 2001 From: Isaac Connor Date: Fri, 1 Nov 2013 09:47:28 -0400 Subject: [PATCH 005/107] remake this branch off master instead of off mysql2PDO. Establish an automake substitution of @VERSION@ and use it throughotu to override whatever is in zm.conf --- configure.ac | 1 + scripts/zmdbbackup.in | 2 ++ scripts/zmeventdump.in | 2 ++ web/includes/config.php.in | 2 ++ zm.conf.in | 14 +++++++------- 5 files changed, 14 insertions(+), 7 deletions(-) diff --git a/configure.ac b/configure.ac index 7ce0942a7..d1592368a 100644 --- a/configure.ac +++ b/configure.ac @@ -10,6 +10,7 @@ PATH_BUILD=`pwd` AC_SUBST(PATH_BUILD) TIME_BUILD=`date +'%s'` AC_SUBST(TIME_BUILD) +AC_SUBST(VERSION) AC_ARG_VAR(ZM_DB_HOST,[Hostname where ZoneMinder database located, default localhost]) AC_ARG_VAR(ZM_DB_NAME,[Name of ZoneMinder database, default zm]) diff --git a/scripts/zmdbbackup.in b/scripts/zmdbbackup.in index 303cf86be..37879b5f1 100644 --- a/scripts/zmdbbackup.in +++ b/scripts/zmdbbackup.in @@ -20,6 +20,8 @@ # Edit these to suit your configuration ZM_CONFIG=@ZM_CONFIG@ source $ZM_CONFIG +# ZM_VERSION in the config is now deprecated but will likely still exist in people's config files. This will override it. +ZM_VERSION=@VERSION@ MYSQLDUMP=/usr/bin/mysqldump BACKUP_PATH=/var/lib/zm diff --git a/scripts/zmeventdump.in b/scripts/zmeventdump.in index 342b665b0..fad82db37 100644 --- a/scripts/zmeventdump.in +++ b/scripts/zmeventdump.in @@ -23,6 +23,8 @@ # Edit these to suit your configuration ZM_CONFIG=@ZM_CONFIG@ +# ZM_VERSION in the config is now deprecated but will likely still exist in people's config files. This will override it. +ZM_VERSION=@VERSION@ MYSQLDUMP=/usr/bin/mysqldump # The rest should not need editing diff --git a/web/includes/config.php.in b/web/includes/config.php.in index b9f66449e..14a8215fb 100644 --- a/web/includes/config.php.in +++ b/web/includes/config.php.in @@ -22,6 +22,8 @@ // This section contains options substituted by the zmconfig.pl utility, do not edit these directly // define( "ZM_CONFIG", "@ZM_CONFIG@" ); // Path to config file +// Define, and override any given in config file +define( "ZM_VERSION", "@VERSION@" ); // Version $configFile = ZM_CONFIG; $localConfigFile = basename($configFile); diff --git a/zm.conf.in b/zm.conf.in index f4c426c65..65380a533 100644 --- a/zm.conf.in +++ b/zm.conf.in @@ -9,15 +9,9 @@ # or installations. # -# Current version of ZoneMinder -ZM_VERSION=@VERSION@ - -# Path to build directory +# Path to build directory, used mostly for finding DB upgrade scripts ZM_PATH_BUILD=@PATH_BUILD@ -# Path to installed data directory, used mostly for finding DB upgrade scripts -ZM_PATH_DATA=@PKGDATADIR@ - # Build time, used to record when to trigger various checks ZM_TIME_BUILD=@TIME_BUILD@ @@ -40,6 +34,9 @@ ZM_PATH_CGI=@CGI_PREFIX@ ZM_WEB_USER=@WEB_USER@ ZM_WEB_GROUP=@WEB_GROUP@ +# ZoneMinder database type: so far only mysql is supported +ZM_DB_TYPE=@ZM_DB_TYPE@ + # ZoneMinder database hostname or ip address ZM_DB_HOST=@ZM_DB_HOST@ @@ -51,3 +48,6 @@ ZM_DB_USER=@ZM_DB_USER@ # ZoneMinder database password ZM_DB_PASS=@ZM_DB_PASS@ + +# Host of this machine +ZM_SERVER_HOST= From d428c832e7fde9cb81d4cab9b3af8def83dfee30 Mon Sep 17 00:00:00 2001 From: Isaac Connor Date: Fri, 1 Nov 2013 09:50:50 -0400 Subject: [PATCH 006/107] blah --- scripts/ZoneMinder/lib/ZoneMinder/Base.pm.in | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/scripts/ZoneMinder/lib/ZoneMinder/Base.pm.in b/scripts/ZoneMinder/lib/ZoneMinder/Base.pm.in index 37119f725..31854fe67 100644 --- a/scripts/ZoneMinder/lib/ZoneMinder/Base.pm.in +++ b/scripts/ZoneMinder/lib/ZoneMinder/Base.pm.in @@ -32,6 +32,8 @@ require Exporter; our @ISA = qw(Exporter); +use constant ZM_VERSION => "@VERSION"; + # 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. @@ -39,7 +41,7 @@ our @ISA = qw(Exporter); # 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() ] ); +our %EXPORT_TAGS = ( 'all' => [ qw(ZM_VERSION) ] ); our @EXPORT_OK = ( @{ $EXPORT_TAGS{'all'} } ); From 550040474fd80e29b568c4b76b3ed89e1acef66b Mon Sep 17 00:00:00 2001 From: Joe Evans Date: Fri, 1 Nov 2013 14:11:48 -0700 Subject: [PATCH 007/107] Cast content_length to signed int for error-check comparison, preventing segfault when attempting to read buffer. --- src/zm_remote_camera_http.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/zm_remote_camera_http.cpp b/src/zm_remote_camera_http.cpp index 59c6f53e0..c83db6401 100644 --- a/src/zm_remote_camera_http.cpp +++ b/src/zm_remote_camera_http.cpp @@ -1092,7 +1092,7 @@ int RemoteCameraHttp::Capture( Image &image ) Warning( "Unable to capture image, retrying" ); return( 1 ); } - if ( content_length < 0 ) + if ( (int)content_length < 0 ) { Error( "Unable to get response" ); Disconnect(); From 833705b6135aac74e95e7da2600af9b893468946 Mon Sep 17 00:00:00 2001 From: Kfir Itzhak Date: Sun, 3 Nov 2013 10:26:04 +0200 Subject: [PATCH 008/107] Added alarm blend percent (useful for controlling how long an alarm lasts) and a dropdown list is used now if ZM_FAST_IMAGE_BLENDS is enabled --- src/zm_monitor.cpp | 42 ++++++++++++++++++++--------- src/zm_monitor.h | 3 ++- web/skins/classic/views/monitor.php | 27 ++++++++++++++++++- 3 files changed, 58 insertions(+), 14 deletions(-) diff --git a/src/zm_monitor.cpp b/src/zm_monitor.cpp index 463cf2b07..1b54f4658 100644 --- a/src/zm_monitor.cpp +++ b/src/zm_monitor.cpp @@ -289,6 +289,7 @@ Monitor::Monitor( int p_alarm_capture_delay, int p_fps_report_interval, int p_ref_blend_perc, + int p_alarm_ref_blend_perc, bool p_track_motion, Rgb p_signal_check_colour, Purpose p_purpose, @@ -314,6 +315,7 @@ Monitor::Monitor( alarm_frame_count( p_alarm_frame_count ), fps_report_interval( p_fps_report_interval ), ref_blend_perc( p_ref_blend_perc ), + alarm_ref_blend_perc( p_alarm_ref_blend_perc ), track_motion( p_track_motion ), signal_check_colour( p_signal_check_colour ), delta_image( width, height, ZM_COLOUR_GRAY8, ZM_SUBPIX_ORDER_NONE ), @@ -509,7 +511,7 @@ Monitor::Monitor( Debug( 1, "Monitor %s has function %d", name, function ); Debug( 1, "Monitor %s LBF = '%s', LBX = %d, LBY = %d", name, label_format, label_coord.X(), label_coord.Y() ); - Debug( 1, "Monitor %s IBC = %d, WUC = %d, pEC = %d, PEC = %d, EAF = %d, FRI = %d, RBP = %d, FM = %d", name, image_buffer_count, warmup_count, pre_event_count, post_event_count, alarm_frame_count, fps_report_interval, ref_blend_perc, track_motion ); + Debug( 1, "Monitor %s IBC = %d, WUC = %d, pEC = %d, PEC = %d, EAF = %d, FRI = %d, RBP = %d, ARBP = %d, FM = %d", name, image_buffer_count, warmup_count, pre_event_count, post_event_count, alarm_frame_count, fps_report_interval, ref_blend_perc, alarm_ref_blend_perc, track_motion ); if ( purpose == ANALYSIS ) { @@ -1605,10 +1607,14 @@ bool Monitor::Analyse() shared_data->state = state = IDLE; last_section_mod = 0; } - if ( (!signal_change && signal) && (function == MODECT || function == MOCORD) && (config.blend_alarmed_images || state != ALARM) ) + if ( (!signal_change && signal) && (function == MODECT || function == MOCORD) && state != ALARM ) { ref_image.Blend( *snap_image, ref_blend_perc ); } + else if ( (!signal_change && signal) && (function == MODECT || function == MOCORD) && state == ALARM && config.blend_alarmed_images ) + { + ref_image.Blend( *snap_image, alarm_ref_blend_perc ); + } last_signal = signal; } @@ -1630,7 +1636,7 @@ void Monitor::Reload() closeEvent(); static char sql[ZM_SQL_MED_BUFSIZ]; - snprintf( sql, sizeof(sql), "select Function+0, Enabled, LinkedMonitors, EventPrefix, LabelFormat, LabelX, LabelY, WarmupCount, PreEventCount, PostEventCount, AlarmFrameCount, SectionLength, FrameSkip, MaxFPS, AlarmMaxFPS, FPSReportInterval, RefBlendPerc, TrackMotion, SignalCheckColour from Monitors where Id = '%d'", id ); + snprintf( sql, sizeof(sql), "select Function+0, Enabled, LinkedMonitors, EventPrefix, LabelFormat, LabelX, LabelY, WarmupCount, PreEventCount, PostEventCount, AlarmFrameCount, SectionLength, FrameSkip, MaxFPS, AlarmMaxFPS, FPSReportInterval, RefBlendPerc, AlarmRefBlendPerc, TrackMotion, SignalCheckColour from Monitors where Id = '%d'", id ); if ( mysql_query( &dbconn, sql ) ) { @@ -1670,6 +1676,7 @@ void Monitor::Reload() alarm_capture_delay = (dbrow[index]&&atof(dbrow[index])>0.0)?int(DT_PREC_3/atof(dbrow[index])):0; index++; fps_report_interval = atoi(dbrow[index++]); ref_blend_perc = atoi(dbrow[index++]); + alarm_ref_blend_perc = atoi(dbrow[index++]); track_motion = atoi(dbrow[index++]); @@ -1820,11 +1827,11 @@ int Monitor::LoadLocalMonitors( const char *device, Monitor **&monitors, Purpose static char sql[ZM_SQL_MED_BUFSIZ]; if ( !device[0] ) { - strncpy( sql, "select Id, Name, Function+0, Enabled, LinkedMonitors, Device, Channel, Format, Method, Width, Height, Colours, Palette, Orientation+0, Deinterlacing, Brightness, Contrast, Hue, Colour, EventPrefix, LabelFormat, LabelX, LabelY, ImageBufferCount, WarmupCount, PreEventCount, PostEventCount, StreamReplayBuffer, AlarmFrameCount, SectionLength, FrameSkip, MaxFPS, AlarmMaxFPS, FPSReportInterval, RefBlendPerc, TrackMotion, SignalCheckColour from Monitors where Function != 'None' and Type = 'Local' order by Device, Channel", sizeof(sql) ); + strncpy( sql, "select Id, Name, Function+0, Enabled, LinkedMonitors, Device, Channel, Format, Method, Width, Height, Colours, Palette, Orientation+0, Deinterlacing, Brightness, Contrast, Hue, Colour, EventPrefix, LabelFormat, LabelX, LabelY, ImageBufferCount, WarmupCount, PreEventCount, PostEventCount, StreamReplayBuffer, AlarmFrameCount, SectionLength, FrameSkip, MaxFPS, AlarmMaxFPS, FPSReportInterval, RefBlendPerc, AlarmRefBlendPerc, TrackMotion, SignalCheckColour from Monitors where Function != 'None' and Type = 'Local' order by Device, Channel", sizeof(sql) ); } else { - snprintf( sql, sizeof(sql), "select Id, Name, Function+0, Enabled, LinkedMonitors, Device, Channel, Format, Method, Width, Height, Colours, Palette, Orientation+0, Deinterlacing, Brightness, Contrast, Hue, Colour, EventPrefix, LabelFormat, LabelX, LabelY, ImageBufferCount, WarmupCount, PreEventCount, PostEventCount, StreamReplayBuffer, AlarmFrameCount, SectionLength, FrameSkip, MaxFPS, AlarmMaxFPS, FPSReportInterval, RefBlendPerc, TrackMotion, SignalCheckColour from Monitors where Function != 'None' and Type = 'Local' and Device = '%s' order by Channel", device ); + snprintf( sql, sizeof(sql), "select Id, Name, Function+0, Enabled, LinkedMonitors, Device, Channel, Format, Method, Width, Height, Colours, Palette, Orientation+0, Deinterlacing, Brightness, Contrast, Hue, Colour, EventPrefix, LabelFormat, LabelX, LabelY, ImageBufferCount, WarmupCount, PreEventCount, PostEventCount, StreamReplayBuffer, AlarmFrameCount, SectionLength, FrameSkip, MaxFPS, AlarmMaxFPS, FPSReportInterval, RefBlendPerc, AlarmRefBlendPerc, TrackMotion, SignalCheckColour from Monitors where Function != 'None' and Type = 'Local' and Device = '%s' order by Channel", device ); } if ( mysql_query( &dbconn, sql ) ) { @@ -1886,6 +1893,7 @@ int Monitor::LoadLocalMonitors( const char *device, Monitor **&monitors, Purpose int alarm_capture_delay = (dbrow[col]&&atof(dbrow[col])>0.0)?int(DT_PREC_3/atof(dbrow[col])):0; col++; int fps_report_interval = atoi(dbrow[col]); col++; int ref_blend_perc = atoi(dbrow[col]); col++; + int alarm_ref_blend_perc = atoi(dbrow[col]); col++; int track_motion = atoi(dbrow[col]); col++; int signal_check_colour; @@ -1942,6 +1950,7 @@ int Monitor::LoadLocalMonitors( const char *device, Monitor **&monitors, Purpose alarm_capture_delay, fps_report_interval, ref_blend_perc, + alarm_ref_blend_perc, track_motion, signal_check_colour, purpose, @@ -1970,11 +1979,11 @@ int Monitor::LoadRemoteMonitors( const char *protocol, const char *host, const c static char sql[ZM_SQL_MED_BUFSIZ]; if ( !protocol ) { - strncpy( sql, "select Id, Name, Function+0, Enabled, LinkedMonitors, Protocol, Method, Host, Port, Path, Width, Height, Colours, Palette, Orientation+0, Deinterlacing, Brightness, Contrast, Hue, Colour, EventPrefix, LabelFormat, LabelX, LabelY, ImageBufferCount, WarmupCount, PreEventCount, PostEventCount, StreamReplayBuffer, AlarmFrameCount, SectionLength, FrameSkip, MaxFPS, AlarmMaxFPS, FPSReportInterval, RefBlendPerc, TrackMotion from Monitors where Function != 'None' and Type = 'Remote'", sizeof(sql) ); + strncpy( sql, "select Id, Name, Function+0, Enabled, LinkedMonitors, Protocol, Method, Host, Port, Path, Width, Height, Colours, Palette, Orientation+0, Deinterlacing, Brightness, Contrast, Hue, Colour, EventPrefix, LabelFormat, LabelX, LabelY, ImageBufferCount, WarmupCount, PreEventCount, PostEventCount, StreamReplayBuffer, AlarmFrameCount, SectionLength, FrameSkip, MaxFPS, AlarmMaxFPS, FPSReportInterval, RefBlendPerc, AlarmRefBlendPerc, TrackMotion from Monitors where Function != 'None' and Type = 'Remote'", sizeof(sql) ); } else { - snprintf( sql, sizeof(sql), "select Id, Name, Function+0, Enabled, LinkedMonitors, Protocol, Method, Host, Port, Path, Width, Height, Colours, Palette, Orientation+0, Deinterlacing, Brightness, Contrast, Hue, Colour, EventPrefix, LabelFormat, LabelX, LabelY, ImageBufferCount, WarmupCount, PreEventCount, PostEventCount, StreamReplayBuffer, AlarmFrameCount, SectionLength, FrameSkip, MaxFPS, AlarmMaxFPS, FPSReportInterval, RefBlendPerc, TrackMotion from Monitors where Function != 'None' and Type = 'Remote' and Protocol = '%s' and Host = '%s' and Port = '%s' and Path = '%s'", protocol, host, port, path ); + snprintf( sql, sizeof(sql), "select Id, Name, Function+0, Enabled, LinkedMonitors, Protocol, Method, Host, Port, Path, Width, Height, Colours, Palette, Orientation+0, Deinterlacing, Brightness, Contrast, Hue, Colour, EventPrefix, LabelFormat, LabelX, LabelY, ImageBufferCount, WarmupCount, PreEventCount, PostEventCount, StreamReplayBuffer, AlarmFrameCount, SectionLength, FrameSkip, MaxFPS, AlarmMaxFPS, FPSReportInterval, RefBlendPerc, AlarmRefBlendPerc, TrackMotion from Monitors where Function != 'None' and Type = 'Remote' and Protocol = '%s' and Host = '%s' and Port = '%s' and Path = '%s'", protocol, host, port, path ); } if ( mysql_query( &dbconn, sql ) ) { @@ -2037,6 +2046,7 @@ int Monitor::LoadRemoteMonitors( const char *protocol, const char *host, const c int alarm_capture_delay = (dbrow[col]&&atof(dbrow[col])>0.0)?int(DT_PREC_3/atof(dbrow[col])):0; col++; int fps_report_interval = atoi(dbrow[col]); col++; int ref_blend_perc = atoi(dbrow[col]); col++; + int alarm_ref_blend_perc = atoi(dbrow[col]); col++; int track_motion = atoi(dbrow[col]); col++; @@ -2111,6 +2121,7 @@ int Monitor::LoadRemoteMonitors( const char *protocol, const char *host, const c alarm_capture_delay, fps_report_interval, ref_blend_perc, + alarm_ref_blend_perc, track_motion, RGB_WHITE, purpose, @@ -2139,11 +2150,11 @@ int Monitor::LoadFileMonitors( const char *file, Monitor **&monitors, Purpose pu static char sql[ZM_SQL_MED_BUFSIZ]; if ( !file[0] ) { - strncpy( sql, "select Id, Name, Function+0, Enabled, LinkedMonitors, Path, Width, Height, Colours, Palette, Orientation+0, Deinterlacing, Brightness, Contrast, Hue, Colour, EventPrefix, LabelFormat, LabelX, LabelY, ImageBufferCount, WarmupCount, PreEventCount, PostEventCount, StreamReplayBuffer, AlarmFrameCount, SectionLength, FrameSkip, MaxFPS, AlarmMaxFPS, FPSReportInterval, RefBlendPerc, TrackMotion from Monitors where Function != 'None' and Type = 'File'", sizeof(sql) ); + strncpy( sql, "select Id, Name, Function+0, Enabled, LinkedMonitors, Path, Width, Height, Colours, Palette, Orientation+0, Deinterlacing, Brightness, Contrast, Hue, Colour, EventPrefix, LabelFormat, LabelX, LabelY, ImageBufferCount, WarmupCount, PreEventCount, PostEventCount, StreamReplayBuffer, AlarmFrameCount, SectionLength, FrameSkip, MaxFPS, AlarmMaxFPS, FPSReportInterval, RefBlendPerc, AlarmRefBlendPerc, TrackMotion from Monitors where Function != 'None' and Type = 'File'", sizeof(sql) ); } else { - snprintf( sql, sizeof(sql), "select Id, Name, Function+0, Enabled, LinkedMonitors, Path, Width, Height, Colours, Palette, Orientation+0, Deinterlacing, Brightness, Contrast, Hue, Colour, EventPrefix, LabelFormat, LabelX, LabelY, ImageBufferCount, WarmupCount, PreEventCount, PostEventCount, StreamReplayBuffer, AlarmFrameCount, SectionLength, FrameSkip, MaxFPS, AlarmMaxFPS, FPSReportInterval, RefBlendPerc, TrackMotion from Monitors where Function != 'None' and Type = 'File' and Path = '%s'", file ); + snprintf( sql, sizeof(sql), "select Id, Name, Function+0, Enabled, LinkedMonitors, Path, Width, Height, Colours, Palette, Orientation+0, Deinterlacing, Brightness, Contrast, Hue, Colour, EventPrefix, LabelFormat, LabelX, LabelY, ImageBufferCount, WarmupCount, PreEventCount, PostEventCount, StreamReplayBuffer, AlarmFrameCount, SectionLength, FrameSkip, MaxFPS, AlarmMaxFPS, FPSReportInterval, RefBlendPerc, AlarmRefBlendPerc, TrackMotion from Monitors where Function != 'None' and Type = 'File' and Path = '%s'", file ); } if ( mysql_query( &dbconn, sql ) ) { @@ -2202,6 +2213,7 @@ int Monitor::LoadFileMonitors( const char *file, Monitor **&monitors, Purpose pu int alarm_capture_delay = (dbrow[col]&&atof(dbrow[col])>0.0)?int(DT_PREC_3/atof(dbrow[col])):0; col++; int fps_report_interval = atoi(dbrow[col]); col++; int ref_blend_perc = atoi(dbrow[col]); col++; + int alarm_ref_blend_perc = atoi(dbrow[col]); col++; int track_motion = atoi(dbrow[col]); col++; int cam_width = ((orientation==ROTATE_90||orientation==ROTATE_270)?height:width); @@ -2244,6 +2256,7 @@ int Monitor::LoadFileMonitors( const char *file, Monitor **&monitors, Purpose pu alarm_capture_delay, fps_report_interval, ref_blend_perc, + alarm_ref_blend_perc, track_motion, RGB_WHITE, purpose, @@ -2273,11 +2286,11 @@ int Monitor::LoadFfmpegMonitors( const char *file, Monitor **&monitors, Purpose static char sql[ZM_SQL_MED_BUFSIZ]; if ( !file[0] ) { - strncpy( sql, "select Id, Name, Function+0, Enabled, LinkedMonitors, Path, Width, Height, Colours, Palette, Orientation+0, Deinterlacing, Brightness, Contrast, Hue, Colour, EventPrefix, LabelFormat, LabelX, LabelY, ImageBufferCount, WarmupCount, PreEventCount, PostEventCount, StreamReplayBuffer, AlarmFrameCount, SectionLength, FrameSkip, MaxFPS, AlarmMaxFPS, FPSReportInterval, RefBlendPerc, TrackMotion from Monitors where Function != 'None' and Type = 'Ffmpeg'", sizeof(sql) ); + strncpy( sql, "select Id, Name, Function+0, Enabled, LinkedMonitors, Path, Width, Height, Colours, Palette, Orientation+0, Deinterlacing, Brightness, Contrast, Hue, Colour, EventPrefix, LabelFormat, LabelX, LabelY, ImageBufferCount, WarmupCount, PreEventCount, PostEventCount, StreamReplayBuffer, AlarmFrameCount, SectionLength, FrameSkip, MaxFPS, AlarmMaxFPS, FPSReportInterval, RefBlendPerc, AlarmRefBlendPerc, TrackMotion from Monitors where Function != 'None' and Type = 'Ffmpeg'", sizeof(sql) ); } else { - snprintf( sql, sizeof(sql), "select Id, Name, Function+0, Enabled, LinkedMonitors, Path, Width, Height, Colours, Palette, Orientation+0, Deinterlacing, Brightness, Contrast, Hue, Colour, EventPrefix, LabelFormat, LabelX, LabelY, ImageBufferCount, WarmupCount, PreEventCount, PostEventCount, StreamReplayBuffer, AlarmFrameCount, SectionLength, FrameSkip, MaxFPS, AlarmMaxFPS, FPSReportInterval, RefBlendPerc, TrackMotion from Monitors where Function != 'None' and Type = 'Ffmpeg' and Path = '%s'", file ); + snprintf( sql, sizeof(sql), "select Id, Name, Function+0, Enabled, LinkedMonitors, Path, Width, Height, Colours, Palette, Orientation+0, Deinterlacing, Brightness, Contrast, Hue, Colour, EventPrefix, LabelFormat, LabelX, LabelY, ImageBufferCount, WarmupCount, PreEventCount, PostEventCount, StreamReplayBuffer, AlarmFrameCount, SectionLength, FrameSkip, MaxFPS, AlarmMaxFPS, FPSReportInterval, RefBlendPerc, AlarmRefBlendPerc, TrackMotion from Monitors where Function != 'None' and Type = 'Ffmpeg' and Path = '%s'", file ); } if ( mysql_query( &dbconn, sql ) ) { @@ -2336,6 +2349,7 @@ int Monitor::LoadFfmpegMonitors( const char *file, Monitor **&monitors, Purpose int alarm_capture_delay = (dbrow[col]&&atof(dbrow[col])>0.0)?int(DT_PREC_3/atof(dbrow[col])):0; col++; int fps_report_interval = atoi(dbrow[col]); col++; int ref_blend_perc = atoi(dbrow[col]); col++; + int alarm_ref_blend_perc = atoi(dbrow[col]); col++; int track_motion = atoi(dbrow[col]); col++; int cam_width = ((orientation==ROTATE_90||orientation==ROTATE_270)?height:width); @@ -2378,6 +2392,7 @@ int Monitor::LoadFfmpegMonitors( const char *file, Monitor **&monitors, Purpose alarm_capture_delay, fps_report_interval, ref_blend_perc, + alarm_ref_blend_perc, track_motion, RGB_WHITE, purpose, @@ -2404,7 +2419,7 @@ int Monitor::LoadFfmpegMonitors( const char *file, Monitor **&monitors, Purpose Monitor *Monitor::Load( int id, bool load_zones, Purpose purpose ) { static char sql[ZM_SQL_MED_BUFSIZ]; - snprintf( sql, sizeof(sql), "select Id, Name, Type, Function+0, Enabled, LinkedMonitors, Device, Channel, Format, Protocol, Method, Host, Port, Path, Width, Height, Colours, Palette, Orientation+0, Deinterlacing, Brightness, Contrast, Hue, Colour, EventPrefix, LabelFormat, LabelX, LabelY, ImageBufferCount, WarmupCount, PreEventCount, PostEventCount, StreamReplayBuffer, AlarmFrameCount, SectionLength, FrameSkip, MaxFPS, AlarmMaxFPS, FPSReportInterval, RefBlendPerc, TrackMotion, SignalCheckColour from Monitors where Id = %d", id ); + snprintf( sql, sizeof(sql), "select Id, Name, Type, Function+0, Enabled, LinkedMonitors, Device, Channel, Format, Protocol, Method, Host, Port, Path, Width, Height, Colours, Palette, Orientation+0, Deinterlacing, Brightness, Contrast, Hue, Colour, EventPrefix, LabelFormat, LabelX, LabelY, ImageBufferCount, WarmupCount, PreEventCount, PostEventCount, StreamReplayBuffer, AlarmFrameCount, SectionLength, FrameSkip, MaxFPS, AlarmMaxFPS, FPSReportInterval, RefBlendPerc, AlarmRefBlendPerc, TrackMotion, SignalCheckColour from Monitors where Id = %d", id ); if ( mysql_query( &dbconn, sql ) ) { Error( "Can't run query: %s", mysql_error( &dbconn ) ); @@ -2470,6 +2485,7 @@ Monitor *Monitor::Load( int id, bool load_zones, Purpose purpose ) int alarm_capture_delay = (dbrow[col]&&atof(dbrow[col])>0.0)?int(DT_PREC_3/atof(dbrow[col])):0; col++; int fps_report_interval = atoi(dbrow[col]); col++; int ref_blend_perc = atoi(dbrow[col]); col++; + int alarm_ref_blend_perc = atoi(dbrow[col]); col++; int track_motion = atoi(dbrow[col]); col++; int signal_check_colour; @@ -2617,6 +2633,7 @@ Monitor *Monitor::Load( int id, bool load_zones, Purpose purpose ) alarm_capture_delay, fps_report_interval, ref_blend_perc, + alarm_ref_blend_perc, track_motion, signal_check_colour, purpose, @@ -3254,6 +3271,7 @@ bool Monitor::DumpSettings( char *output, bool verbose ) sprintf( output+strlen(output), "Maximum FPS : %.2f\n", capture_delay?DT_PREC_3/capture_delay:0.0 ); sprintf( output+strlen(output), "Alarm Maximum FPS : %.2f\n", alarm_capture_delay?DT_PREC_3/alarm_capture_delay:0.0 ); sprintf( output+strlen(output), "Reference Blend %%ge : %d\n", ref_blend_perc ); + sprintf( output+strlen(output), "Alarm Reference Blend %%ge : %d\n", alarm_ref_blend_perc ); sprintf( output+strlen(output), "Track Motion : %d\n", track_motion ); sprintf( output+strlen(output), "Function: %d - %s\n", function, function==NONE?"None":( diff --git a/src/zm_monitor.h b/src/zm_monitor.h index 496ce96b1..c8aea5a07 100644 --- a/src/zm_monitor.h +++ b/src/zm_monitor.h @@ -235,6 +235,7 @@ protected: int alarm_frame_count; // How many alarm frames are required before an event is triggered int fps_report_interval; // How many images should be captured/processed between reporting the current FPS int ref_blend_perc; // Percentage of new image going into reference image. + int alarm_ref_blend_perc; // Percentage of new image going into reference image during alarm. bool track_motion; // Whether this monitor tries to track detected motion Rgb signal_check_colour; // The colour that the camera will emit when no video signal detected @@ -287,7 +288,7 @@ protected: public: // OurCheckAlarms seems to be unused. Check it on zm_monitor.cpp for more info. //bool OurCheckAlarms( Zone *zone, const Image *pImage ); - Monitor( int p_id, const char *p_name, int p_function, bool p_enabled, const char *p_linked_monitors, Camera *p_camera, int p_orientation, unsigned int p_deinterlacing, const char *p_event_prefix, const char *p_label_format, const Coord &p_label_coord, int p_image_buffer_count, int p_warmup_count, int p_pre_event_count, int p_post_event_count, int p_stream_replay_buffer, int p_alarm_frame_count, int p_section_length, int p_frame_skip, int p_capture_delay, int p_alarm_capture_delay, int p_fps_report_interval, int p_ref_blend_perc, bool p_track_motion, Rgb p_signal_check_colour, Purpose p_purpose, int p_n_zones=0, Zone *p_zones[]=0 ); + Monitor( int p_id, const char *p_name, int p_function, bool p_enabled, const char *p_linked_monitors, Camera *p_camera, int p_orientation, unsigned int p_deinterlacing, const char *p_event_prefix, const char *p_label_format, const Coord &p_label_coord, int p_image_buffer_count, int p_warmup_count, int p_pre_event_count, int p_post_event_count, int p_stream_replay_buffer, int p_alarm_frame_count, int p_section_length, int p_frame_skip, int p_capture_delay, int p_alarm_capture_delay, int p_fps_report_interval, int p_ref_blend_perc, int p_alarm_ref_blend_perc, bool p_track_motion, Rgb p_signal_check_colour, Purpose p_purpose, int p_n_zones=0, Zone *p_zones[]=0 ); ~Monitor(); void AddZones( int p_n_zones, Zone *p_zones[] ); diff --git a/web/skins/classic/views/monitor.php b/web/skins/classic/views/monitor.php index 0170a308f..99d11f308 100644 --- a/web/skins/classic/views/monitor.php +++ b/web/skins/classic/views/monitor.php @@ -96,6 +96,7 @@ else 'AlarmMaxFPS' => "", 'FPSReportInterval' => 1000, 'RefBlendPerc' => 12, + 'AlarmRefBlendPerc' => 6, 'DefaultView' => 'Events', 'DefaultRate' => '100', 'DefaultScale' => '100', @@ -386,7 +387,17 @@ $deinterlaceopts_v4l2 = array( "V4L2: Capture bottom field only" => 0x03000000, "V4L2: Alternate fields (Bob)" => 0x07000000, "V4L2: Progressive" => 0x01000000, - "V4L2: Interlaced" => 0x04000000, + "V4L2: Interlaced" => 0x04000000 +); + +$fastblendopts = array( + "No blending" => 0, + "1.5625%" => 1, + "3.125%" => 3, + "6.25% (Indoor)" => 6, + "12.5% (Outdoor)" => 12, + "25%" => 25, + "50%" => 50 ); xhtmlHeaders(__FILE__, $SLANG['Monitor']." - ".validHtmlStr($monitor['Name']) ); @@ -444,6 +455,7 @@ if ( $tab != 'general' ) + + + + + + + Date: Sun, 3 Nov 2013 15:49:37 -0500 Subject: [PATCH 009/107] remove extra stuff that I don't think we need because we are the source. Also unconditionally call zmupdate.pl since it should do all the checking of versions to see if anything needs doing. We don't need to be doing that work in a postinst bash script. --- distros/ubuntu1204/changelog | 6 ++++ distros/ubuntu1204/postinst | 63 ++++++++++++++---------------------- distros/ubuntu1204/rules | 6 ---- 3 files changed, 30 insertions(+), 45 deletions(-) diff --git a/distros/ubuntu1204/changelog b/distros/ubuntu1204/changelog index 567177bc3..2f3fcfb4f 100644 --- a/distros/ubuntu1204/changelog +++ b/distros/ubuntu1204/changelog @@ -1,3 +1,9 @@ +zoneminder (1.26.4+1-SNAPSHOT2013110301) precise; urgency=high + + * Today's snapshot of master + + -- Isaac Connor Sun, 03 Nov 2013 14:05:46 -0500 + zoneminder (1.26.4-2) precise; urgency=high * improvements to zmupdate.pl, cleanups diff --git a/distros/ubuntu1204/postinst b/distros/ubuntu1204/postinst index 716c475e6..06b1deebb 100644 --- a/distros/ubuntu1204/postinst +++ b/distros/ubuntu1204/postinst @@ -2,44 +2,32 @@ set -e -VERSION=1.26.4 - if [ "$1" = "configure" ]; then - # - # Get mysql started if it isn't - # - if ! $(/etc/init.d/mysql status >/dev/null 2>&1); then - invoke-rc.d mysql start - fi - if $(/etc/init.d/mysql status >/dev/null 2>&1); then - mysqladmin --defaults-file=/etc/mysql/debian.cnf -f reload - # test if database if already present... - if ! $(echo quit | mysql --defaults-file=/etc/mysql/debian.cnf zm > /dev/null 2> /dev/null) ; then - cat /usr/share/zoneminder/db/zm_create.sql | mysql --defaults-file=/etc/mysql/debian.cnf - echo 'grant lock tables, alter,select,insert,update,delete on zm.* to 'zmuser'@localhost identified by "zmpass";' | mysql --defaults-file=/etc/mysql/debian.cnf mysql - fi + # + # Get mysql started if it isn't + # + if ! $(/etc/init.d/mysql status >/dev/null 2>&1); then + invoke-rc.d mysql start + fi + if $(/etc/init.d/mysql status >/dev/null 2>&1); then + mysqladmin --defaults-file=/etc/mysql/debian.cnf -f reload + # test if database if already present... + if ! $(echo quit | mysql --defaults-file=/etc/mysql/debian.cnf zm > /dev/null 2> /dev/null) ; then + cat /usr/share/zoneminder/db/zm_create.sql | mysql --defaults-file=/etc/mysql/debian.cnf + echo 'grant lock tables, alter,select,insert,update,delete on zm.* to 'zmuser'@localhost identified by "zmpass";' | mysql --defaults-file=/etc/mysql/debian.cnf mysql + fi - # get old version from upgrade... - OLD_ZM_VERSION=${2%-*} - if [ -z "$OLD_ZM_VERSION" ]; then - # fall back to getting version from database itself, which may not necessarily be accurate? - OLD_ZM_VERSION=$(echo 'select Value from Config where Name = "ZM_DYN_CURR_VERSION";' | mysql --defaults-file=/etc/mysql/debian.cnf --skip-column-names zm ) - fi - if [ -n "$OLD_ZM_VERSION" ] && [ "$OLD_ZM_VERSION" != "$VERSION" ] ; then - echo 'grant lock tables, create, alter on zm.* to 'zmuser'@localhost identified by "zmpass";' | mysql --defaults-file=/etc/mysql/debian.cnf mysql - # stop zoneminder before performing database upgrade. - invoke-rc.d zoneminder stop || true - zmupdate.pl --nointeractive --version $OLD_ZM_VERSION - fi + invoke-rc.d zoneminder stop || true + zmupdate.pl --nointeractive - else - echo 'NOTE: mysql not running, please start mysql and run dpkg-reconfigure zoneminder when it is running.' - fi - chown www-data:www-data /var/log/zm - chown www-data:www-data /var/lib/zm/ - if [ -z "$2" ]; then - chown www-data:www-data -R /var/cache/zoneminder - fi + else + echo 'NOTE: mysql not running, please start mysql and run dpkg-reconfigure zoneminder when it is running.' + fi + chown www-data:www-data /var/log/zm + chown www-data:www-data /var/lib/zm/ + if [ -z "$2" ]; then + chown www-data:www-data -R /var/cache/zoneminder + fi fi # Ensure zoneminder is stopped... if [ -x "/etc/init.d/zoneminder" ]; then @@ -55,10 +43,7 @@ if [ "$1" = "configure" ]; then chown www-data:www-data -R /var/cache/zoneminder else chown www-data:www-data /var/log/zm - OLD_ZM_VERSION=${2%-*} - if [ "$OLD_ZM_VERSION" != "$VERSION" ] ; then - zmupdate.pl --version $OLD_ZM_VERSION - fi + zmupdate.pl fi fi #DEBHELPER# diff --git a/distros/ubuntu1204/rules b/distros/ubuntu1204/rules index 601dcf62a..deb3b26ab 100755 --- a/distros/ubuntu1204/rules +++ b/distros/ubuntu1204/rules @@ -9,9 +9,6 @@ # Uncomment this to turn on verbose mode. #export DH_VERBOSE=1 -UPSTREAM_VERSION := $(shell dpkg-parsechangelog | egrep '^Version:' | cut -f 2 -d ' ' | cut -d - -f 1) -POSTINST_VERSION := $(shell egrep ^VERSION= debian/postinst | cut -d = -f 2) - # These are used for cross-compiling and for saving the configure script # from having to guess our platform (since we know it already) DEB_HOST_GNU_TYPE ?= $(shell dpkg-architecture -qDEB_HOST_GNU_TYPE) @@ -34,9 +31,6 @@ override_dh_auto_configure: CFLAGS="$(CFLAGS)" CXXFLAGS="$(CXXFLAGS)" ./configure --host=$(DEB_HOST_GNU_TYPE) --build=$(DEB_BUILD_GNU_TYPE) --sysconfdir=/etc/zm --prefix=/usr --mandir=\$${prefix}/share/man --infodir=\$${prefix}/share/info --with-mysql=/usr --with-webdir=/usr/share/zoneminder --with-ffmpeg=/usr --with-cgidir=/usr/lib/cgi-bin --with-webuser=www-data --with-webgroup=www-data --enable-crashtrace=no --enable-mmap=yes override_dh_clean: - # check to make sure that postinst contains the correct upstream version - [ $(UPSTREAM_VERSION) = $(POSTINST_VERSION) ] - # Add here commands to clean up after the build process. [ ! -f Makefile ] || $(MAKE) distclean dh_clean From 408cac512037a9984811fcdcdbb9fcd4e698081a Mon Sep 17 00:00:00 2001 From: Kfir Itzhak Date: Mon, 4 Nov 2013 09:11:33 +0200 Subject: [PATCH 010/107] Remove the ZM_BLEND_ALARMED_IMAGES option (not needed anymore, global per monitor now) --- scripts/ZoneMinder/lib/ZoneMinder/ConfigData.pm.in | 8 -------- src/zm_monitor.cpp | 12 ++++++------ 2 files changed, 6 insertions(+), 14 deletions(-) diff --git a/scripts/ZoneMinder/lib/ZoneMinder/ConfigData.pm.in b/scripts/ZoneMinder/lib/ZoneMinder/ConfigData.pm.in index 0b75a4d9a..d4e7aa6fd 100644 --- a/scripts/ZoneMinder/lib/ZoneMinder/ConfigData.pm.in +++ b/scripts/ZoneMinder/lib/ZoneMinder/ConfigData.pm.in @@ -331,14 +331,6 @@ our @options = type => $types{boolean}, category => "config", }, - { - name => "ZM_BLEND_ALARMED_IMAGES", - default => "yes", - description => "Blend alarmed images to update the reference image", - help => "To detect alarms ZoneMinder compares an image with a reference image which is formed from a composite of the previous images. This option determines whether images that cause events are included in this process. Doing so may increase the precision of the alarmed region but can cause problems if wholescale lighting changes cause alarms as this would not get fed back into the image and an alarm may persist indefinately. A better way to achive the same effect in most cases is to lower substantially the reference blend percentage in specific monitors.", - type => $types{boolean}, - category => "config", - }, { name => "ZM_MAX_SUSPEND_TIME", default => "30", diff --git a/src/zm_monitor.cpp b/src/zm_monitor.cpp index 1b54f4658..028d32d55 100644 --- a/src/zm_monitor.cpp +++ b/src/zm_monitor.cpp @@ -1607,13 +1607,13 @@ bool Monitor::Analyse() shared_data->state = state = IDLE; last_section_mod = 0; } - if ( (!signal_change && signal) && (function == MODECT || function == MOCORD) && state != ALARM ) + if ( (!signal_change && signal) && (function == MODECT || function == MOCORD) ) { - ref_image.Blend( *snap_image, ref_blend_perc ); - } - else if ( (!signal_change && signal) && (function == MODECT || function == MOCORD) && state == ALARM && config.blend_alarmed_images ) - { - ref_image.Blend( *snap_image, alarm_ref_blend_perc ); + if ( state == ALARM ) { + ref_image.Blend( *snap_image, alarm_ref_blend_perc ); + } else { + ref_image.Blend( *snap_image, ref_blend_perc ); + } } last_signal = signal; } From 4e1d23669f1a2c1e98bd32363d2c28a1f703b2fd Mon Sep 17 00:00:00 2001 From: Kfir Itzhak Date: Mon, 4 Nov 2013 10:54:39 +0200 Subject: [PATCH 011/107] Revert content_length to be int --- src/zm_remote_camera_http.cpp | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/src/zm_remote_camera_http.cpp b/src/zm_remote_camera_http.cpp index c83db6401..80cdca430 100644 --- a/src/zm_remote_camera_http.cpp +++ b/src/zm_remote_camera_http.cpp @@ -1086,13 +1086,13 @@ int RemoteCameraHttp::PreCapture() int RemoteCameraHttp::Capture( Image &image ) { - unsigned int content_length = GetResponse(); + int content_length = GetResponse(); if ( content_length == 0 ) { Warning( "Unable to capture image, retrying" ); return( 1 ); } - if ( (int)content_length < 0 ) + if ( content_length < 0 ) { Error( "Unable to get response" ); Disconnect(); @@ -1112,7 +1112,7 @@ int RemoteCameraHttp::Capture( Image &image ) } case X_RGB : { - if ( content_length != image.Size() ) + if ( (unsigned int)content_length != image.Size() ) { Error( "Image length mismatch, expected %d bytes, content length was %d", image.Size(), content_length ); Disconnect(); From fd656c55cf7f443d13579708b00f260075fa77c6 Mon Sep 17 00:00:00 2001 From: Kfir Itzhak Date: Mon, 4 Nov 2013 12:10:53 +0200 Subject: [PATCH 012/107] Changed default blend percentages and the dropdown list for alarm reference image blend --- db/zm_create.sql.in | 3 ++- web/skins/classic/views/monitor.php | 16 +++++++++++++--- 2 files changed, 15 insertions(+), 4 deletions(-) diff --git a/db/zm_create.sql.in b/db/zm_create.sql.in index 20e28d591..72c7a4637 100644 --- a/db/zm_create.sql.in +++ b/db/zm_create.sql.in @@ -352,7 +352,8 @@ CREATE TABLE `Monitors` ( `MaxFPS` decimal(5,2) default NULL, `AlarmMaxFPS` decimal(5,2) default NULL, `FPSReportInterval` smallint(5) unsigned NOT NULL default '250', - `RefBlendPerc` tinyint(3) unsigned NOT NULL default '10', + `RefBlendPerc` tinyint(3) unsigned NOT NULL default '6', + `AlarmRefBlendPerc` tinyint(3) unsigned NOT NULL default '3', `Controllable` tinyint(3) unsigned NOT NULL default '0', `ControlId` int(10) unsigned NOT NULL default '0', `ControlDevice` varchar(255) default NULL, diff --git a/web/skins/classic/views/monitor.php b/web/skins/classic/views/monitor.php index 99d11f308..043b81082 100644 --- a/web/skins/classic/views/monitor.php +++ b/web/skins/classic/views/monitor.php @@ -95,8 +95,8 @@ else 'MaxFPS' => "", 'AlarmMaxFPS' => "", 'FPSReportInterval' => 1000, - 'RefBlendPerc' => 12, - 'AlarmRefBlendPerc' => 6, + 'RefBlendPerc' => 6, + 'AlarmRefBlendPerc' => 3, 'DefaultView' => 'Events', 'DefaultRate' => '100', 'DefaultScale' => '100', @@ -400,6 +400,16 @@ $fastblendopts = array( "50%" => 50 ); +$fastblendopts_alarm = array( + "No blending (Alarm lasts forever)" => 0, + "1.5625%" => 1, + "3.125%" => 3, + "6.25%" => 6, + "12.5%" => 12, + "25%" => 25, + "50% (Alarm lasts a moment)" => 50 +); + xhtmlHeaders(__FILE__, $SLANG['Monitor']." - ".validHtmlStr($monitor['Name']) ); ?> @@ -620,7 +630,7 @@ switch ( $tab ) { ?> - + From a1cb1e6de2ae966dba54a1d86b2a07f061aaa1ec Mon Sep 17 00:00:00 2001 From: Isaac Connor Date: Mon, 4 Nov 2013 09:56:20 -0500 Subject: [PATCH 013/107] bump version # for snapshot --- distros/ubuntu1204/changelog | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/distros/ubuntu1204/changelog b/distros/ubuntu1204/changelog index 2f3fcfb4f..7da762cd1 100644 --- a/distros/ubuntu1204/changelog +++ b/distros/ubuntu1204/changelog @@ -1,4 +1,4 @@ -zoneminder (1.26.4+1-SNAPSHOT2013110301) precise; urgency=high +zoneminder (1.26.4+1-SNAPSHOT2013110302) precise; urgency=high * Today's snapshot of master From 7a2f3b5226df7909b89ef9b85b91c482c8d7b2f8 Mon Sep 17 00:00:00 2001 From: Isaac Connor Date: Mon, 4 Nov 2013 09:57:00 -0500 Subject: [PATCH 014/107] add in missing @ --- scripts/ZoneMinder/lib/ZoneMinder/Base.pm.in | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/scripts/ZoneMinder/lib/ZoneMinder/Base.pm.in b/scripts/ZoneMinder/lib/ZoneMinder/Base.pm.in index 31854fe67..3f10e9137 100644 --- a/scripts/ZoneMinder/lib/ZoneMinder/Base.pm.in +++ b/scripts/ZoneMinder/lib/ZoneMinder/Base.pm.in @@ -32,7 +32,7 @@ require Exporter; our @ISA = qw(Exporter); -use constant ZM_VERSION => "@VERSION"; +use constant ZM_VERSION => "@VERSION@"; # Items to export into callers namespace by default. Note: do not export # names by default without a very good reason. Use EXPORT_OK instead. From 0fd7d857bf8ff2b3ebfcce6a6c502817c8a45f32 Mon Sep 17 00:00:00 2001 From: Isaac Connor Date: Mon, 4 Nov 2013 10:06:39 -0500 Subject: [PATCH 015/107] put back ZM_PATH_DATA --- zm.conf.in | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/zm.conf.in b/zm.conf.in index 65380a533..dc3fd086f 100644 --- a/zm.conf.in +++ b/zm.conf.in @@ -9,12 +9,15 @@ # or installations. # -# Path to build directory, used mostly for finding DB upgrade scripts +# Path to build directory ZM_PATH_BUILD=@PATH_BUILD@ # Build time, used to record when to trigger various checks ZM_TIME_BUILD=@TIME_BUILD@ +# Path to installed data directory, used mostly for finding DB upgrade scripts +ZM_PATH_DATA=@PKGDATADIR@ + # Path to ZoneMinder binaries ZM_PATH_BIN=@BINDIR@ From f6bf3743f7933a19757bbc0eac1ae9abedcba675 Mon Sep 17 00:00:00 2001 From: Isaac Connor Date: Mon, 4 Nov 2013 10:50:40 -0500 Subject: [PATCH 016/107] very sub-optimisation, removing duplicate comparisons --- src/zm_image.cpp | 20 ++++++++++---------- 1 file changed, 10 insertions(+), 10 deletions(-) diff --git a/src/zm_image.cpp b/src/zm_image.cpp index 18b93c57b..f60d6e9d0 100644 --- a/src/zm_image.cpp +++ b/src/zm_image.cpp @@ -3000,23 +3000,23 @@ __attribute__((noinline,__target__("sse2"))) void sse2_fastblend(const uint8_t* // 1.5625% blending divider = 6; clearmask = 0x03030303; - } else if(blendpercent >= 2.34375 && blendpercent < 4.6875) { + } else if(blendpercent < 4.6875) { // 3.125% blending divider = 5; clearmask = 0x07070707; - } else if(blendpercent >= 4.6875 && blendpercent < 9.375) { + } else if(blendpercent < 9.375) { // 6.25% blending divider = 4; clearmask = 0x0F0F0F0F; - } else if(blendpercent >= 9.375 && blendpercent < 18.75) { + } else if(blendpercent < 18.75) { // 12.5% blending divider = 3; clearmask = 0x1F1F1F1F; - } else if(blendpercent >= 18.75 && blendpercent < 37.5) { + } else if(blendpercent < 37.5) { // 25% blending divider = 2; clearmask = 0x3F3F3F3F; - } else if(blendpercent >= 37.5) { + } else { // 50% blending divider = 1; clearmask = 0x7F7F7F7F; @@ -3063,19 +3063,19 @@ __attribute__((noinline)) void std_fastblend(const uint8_t* col1, const uint8_t* if(blendpercent < 2.34375) { // 1.5625% blending divider = 6; - } else if(blendpercent >= 2.34375 && blendpercent < 4.6875) { + } else if(blendpercent < 4.6875) { // 3.125% blending divider = 5; - } else if(blendpercent >= 4.6875 && blendpercent < 9.375) { + } else if(blendpercent < 9.375) { // 6.25% blending divider = 4; - } else if(blendpercent >= 9.375 && blendpercent < 18.75) { + } else if(blendpercent < 18.75) { // 12.5% blending divider = 3; - } else if(blendpercent >= 18.75 && blendpercent < 37.5) { + } else if(blendpercent < 37.5) { // 25% blending divider = 2; - } else if(blendpercent >= 37.5) { + } else { // 50% blending divider = 1; } From 90d7ce98f12b22368eea5f17a377f4077e0468af Mon Sep 17 00:00:00 2001 From: Kfir Itzhak Date: Mon, 4 Nov 2013 22:38:21 +0200 Subject: [PATCH 017/107] Delete PATH_BUILD and TIME_BUILD from zm.conf and setup default for ZM_DB_TYPE --- CMakeLists.txt | 3 +-- configure.ac | 7 +++---- zm.conf.in | 8 +------- 3 files changed, 5 insertions(+), 13 deletions(-) diff --git a/CMakeLists.txt b/CMakeLists.txt index 4dd8dc096..1fa4b2e52 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -418,9 +418,7 @@ message(STATUS "Using web group: ${ZM_WEB_GROUP}") set(ZM_PID "${ZM_RUNDIR}/zm.pid") set(ZM_CONFIG "/${CMAKE_INSTALL_SYSCONFDIR}/zm.conf") set(VERSION "${zoneminder_VERSION}") -set(PATH_BUILD "${PROJECT_SOURCE_DIR}") set(PKGDATADIR "${CMAKE_INSTALL_PREFIX}/${CMAKE_INSTALL_DATADIR}/zoneminder") -set(TIME_BUILD "1000000") # Don't have a solution for this one yet set(BINDIR "${CMAKE_INSTALL_FULL_BINDIR}") set(LIBDIR "${CMAKE_INSTALL_FULL_LIBDIR}") set(SYSCONFDIR "/${CMAKE_INSTALL_SYSCONFDIR}") @@ -428,6 +426,7 @@ set(WEB_PREFIX "${ZM_WEBDIR}") set(CGI_PREFIX "${ZM_CGIDIR}") set(WEB_USER "${ZM_WEB_USER}") set(WEB_GROUP "${ZM_WEB_GROUP}") +set(ZM_DB_TYPE "mysql") set(EXTRA_PERL_LIB "use lib '${ZM_PERL_USE_PATH}';") # Reassign some variables if a target distro has been specified diff --git a/configure.ac b/configure.ac index d1592368a..9b6270acd 100644 --- a/configure.ac +++ b/configure.ac @@ -6,10 +6,6 @@ AC_CONFIG_HEADERS(config.h) AC_SUBST([AM_CXXFLAGS], [-D__STDC_CONSTANT_MACROS]) -PATH_BUILD=`pwd` -AC_SUBST(PATH_BUILD) -TIME_BUILD=`date +'%s'` -AC_SUBST(TIME_BUILD) AC_SUBST(VERSION) AC_ARG_VAR(ZM_DB_HOST,[Hostname where ZoneMinder database located, default localhost]) @@ -22,6 +18,9 @@ AC_ARG_VAR(ZM_RUNDIR,[Location of transient process files, default /var/run/zm]) AC_ARG_VAR(ZM_TMPDIR,[Location of temporary files, default /tmp/zm]) AC_ARG_VAR(ZM_LOGDIR,[Location of generated log files, default /var/log/zm]) +if test "$ZM_DB_TYPE" == ""; then + AC_SUBST(ZM_DB_HOST,[mysql]) +fi if test "$ZM_DB_HOST" == ""; then AC_SUBST(ZM_DB_HOST,[localhost]) fi diff --git a/zm.conf.in b/zm.conf.in index dc3fd086f..242d6adea 100644 --- a/zm.conf.in +++ b/zm.conf.in @@ -9,12 +9,6 @@ # or installations. # -# Path to build directory -ZM_PATH_BUILD=@PATH_BUILD@ - -# Build time, used to record when to trigger various checks -ZM_TIME_BUILD=@TIME_BUILD@ - # Path to installed data directory, used mostly for finding DB upgrade scripts ZM_PATH_DATA=@PKGDATADIR@ @@ -37,7 +31,7 @@ ZM_PATH_CGI=@CGI_PREFIX@ ZM_WEB_USER=@WEB_USER@ ZM_WEB_GROUP=@WEB_GROUP@ -# ZoneMinder database type: so far only mysql is supported +# ZoneMinder database type ZM_DB_TYPE=@ZM_DB_TYPE@ # ZoneMinder database hostname or ip address From 82a3f4622f0187da237bc21496e58340fed985ac Mon Sep 17 00:00:00 2001 From: Will Scales Date: Wed, 6 Nov 2013 06:30:43 -0600 Subject: [PATCH 018/107] Update zoneminder.service Added "After=" rule to [unit] section to prevent Zoneminder from starting before mysqld. --- distros/fedora/zoneminder.service | 1 + 1 file changed, 1 insertion(+) diff --git a/distros/fedora/zoneminder.service b/distros/fedora/zoneminder.service index d59fc6796..fdd9b3af2 100644 --- a/distros/fedora/zoneminder.service +++ b/distros/fedora/zoneminder.service @@ -1,5 +1,6 @@ [Unit] Description=Video security and surveillance system +After=mysqld.service [Service] Type=forking From f4dfd88d9f2048fffbb1d17efbca8f6b941a8efb Mon Sep 17 00:00:00 2001 From: Isaac Connor Date: Wed, 6 Nov 2013 17:02:01 -0500 Subject: [PATCH 019/107] handle bad config lines better --- scripts/ZoneMinder/lib/ZoneMinder/Config.pm.in | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/scripts/ZoneMinder/lib/ZoneMinder/Config.pm.in b/scripts/ZoneMinder/lib/ZoneMinder/Config.pm.in index fbd9ea374..a840db080 100644 --- a/scripts/ZoneMinder/lib/ZoneMinder/Config.pm.in +++ b/scripts/ZoneMinder/lib/ZoneMinder/Config.pm.in @@ -78,7 +78,11 @@ BEGIN { next if ( $str =~ /^\s*$/ ); next if ( $str =~ /^\s*#/ ); - my ( $name, $value ) = $str =~ /^\s*([^=\s]+)\s*=\s*(.+?)\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/; *{$name} = sub { $value }; push( @EXPORT_CONFIG, $name ); From d87709528d551711409b6d8163aa0c1a925adfd0 Mon Sep 17 00:00:00 2001 From: Isaac Connor Date: Wed, 6 Nov 2013 17:47:23 -0500 Subject: [PATCH 020/107] fix assigning DB_TYPE --- configure.ac | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/configure.ac b/configure.ac index 9b6270acd..2afcdf0ff 100644 --- a/configure.ac +++ b/configure.ac @@ -19,7 +19,7 @@ AC_ARG_VAR(ZM_TMPDIR,[Location of temporary files, default /tmp/zm]) AC_ARG_VAR(ZM_LOGDIR,[Location of generated log files, default /var/log/zm]) if test "$ZM_DB_TYPE" == ""; then - AC_SUBST(ZM_DB_HOST,[mysql]) + AC_SUBST(ZM_DB_TYPE,[mysql]) fi if test "$ZM_DB_HOST" == ""; then AC_SUBST(ZM_DB_HOST,[localhost]) From c08e4de42ef64b84480fa5f515e6ced61d26eb63 Mon Sep 17 00:00:00 2001 From: Kfir Itzhak Date: Thu, 7 Nov 2013 16:29:02 +0200 Subject: [PATCH 021/107] Added the database update file for 1.26.5 with includes the AlarmRefBlendPerc option --- db/zm_update-1.26.5.sql | 9 +++++++++ 1 file changed, 9 insertions(+) create mode 100644 db/zm_update-1.26.5.sql diff --git a/db/zm_update-1.26.5.sql b/db/zm_update-1.26.5.sql new file mode 100644 index 000000000..01308aae4 --- /dev/null +++ b/db/zm_update-1.26.5.sql @@ -0,0 +1,9 @@ +-- +-- This updates a 1.26.4 database to 1.26.5 +-- + +-- +-- Add AlarmRefBlendPerc field for controlling the reference image blend percent during alarm (see pull request #241) +-- +ALTER TABLE `Monitors` ADD `AlarmRefBlendPerc` TINYINT(3) UNSIGNED NOT NULL DEFAULT '3' AFTER `RefBlendPerc`; + From 9979385c3b6416e45d0019e7006f1fbe03ee272c Mon Sep 17 00:00:00 2001 From: Kfir Itzhak Date: Thu, 7 Nov 2013 23:35:44 +0200 Subject: [PATCH 022/107] Remove the crashtrace option from configure.ac (autoconf) --- configure.ac | 16 ---------------- 1 file changed, 16 deletions(-) diff --git a/configure.ac b/configure.ac index 2afcdf0ff..11e453bdc 100644 --- a/configure.ac +++ b/configure.ac @@ -177,22 +177,6 @@ if test "$ENABLE_DEBUG" != "yes"; then AC_DEFINE(ZM_DBG_OFF,1,"Whether debug is switched off and compiled out") fi -ENABLE_CRASHTRACE=yes -AC_ARG_ENABLE(crashtrace, - [ --enable-crashtrace= enable or disabled crash tracing, default enabled], - [ENABLE_CRASHTRACE=$enable_crashtrace], - AC_MSG_WARN([You can call configure with the --enable-crashtrace= or --disable-crashtrace option. - This tells configure whether to compile ZoneMinder with crash tracing included. This allows a - dump of the stack trace when a ZoneMinder binary crashes or is killed by an unexpected signal. - Although this should work on most systems it does rely on un(or loosely) documented features and - so should be regarded as experimental. If you experience problems compiling zm_signal.cpp or - ZoneMinder binaries fail to shut down correctly then you should probably disable this feature. - e.g. --enable-crashtrace=yes or --disable-crashtrace]) -) -if test "$ENABLE_CRASHTRACE" != "yes"; then - AC_DEFINE(ZM_NO_CRASHTRACE,1,"Whether crash tracing is switched off and compiled out") -fi - ENABLE_MMAP=yes AC_ARG_ENABLE(mmap, [ --enable-mmap= enable or disabled mapped memory versus shared memory, default mapped], From e9c05093999d9e5f4b6ad100b95a5d67a9139f3e Mon Sep 17 00:00:00 2001 From: Isaac Connor Date: Fri, 8 Nov 2013 11:09:23 -0500 Subject: [PATCH 023/107] add rules for a dbg package --- distros/ubuntu1204/control | 22 ++++++++++++++++++++-- distros/ubuntu1204/rules | 4 ++++ 2 files changed, 24 insertions(+), 2 deletions(-) diff --git a/distros/ubuntu1204/control b/distros/ubuntu1204/control index 06bc6801e..39503027e 100644 --- a/distros/ubuntu1204/control +++ b/distros/ubuntu1204/control @@ -2,13 +2,31 @@ Source: zoneminder Section: net Priority: optional Maintainer: Isaac Connor -Build-Depends: debhelper (>= 5), autoconf, automake, dpatch, libphp-serialization-perl, libgnutls-dev, libmysqlclient-dev, libdbd-mysql-perl, libdate-manip-perl, libwww-perl, libjpeg8-dev, libpcre3-dev, libavcodec-dev, libavformat-dev (>= 3:0.svn20090204), libswscale-dev (>= 3:0.svn20090204), libavutil-dev, libv4l-dev (>= 0.8.3), libbz2-dev, libtool, libsys-mmap-perl, ffmpeg, libnetpbm10-dev, libavdevice-dev, libdevice-serialport-perl, libpcre3, libarchive-zip-perl, libmime-lite-perl, libjpeg8, dh-autoreconf +Build-Depends: debhelper (>= 7.0.50), autoconf, automake, dpatch, libphp-serialization-perl, libgnutls-dev, libmysqlclient-dev, libdbd-mysql-perl, libdate-manip-perl, libwww-perl, libjpeg8-dev, libpcre3-dev, libavcodec-dev, libavformat-dev (>= 3:0.svn20090204), libswscale-dev (>= 3:0.svn20090204), libavutil-dev, libv4l-dev (>= 0.8.3), libbz2-dev, libtool, libsys-mmap-perl, ffmpeg, libnetpbm10-dev, libavdevice-dev, libdevice-serialport-perl, libpcre3, libarchive-zip-perl, libmime-lite-perl, libjpeg8, dh-autoreconf Standards-Version: 3.9.2 Package: zoneminder Architecture: any Depends: ${shlibs:Depends}, ${misc:Depends}, ${perl:Depends}, apache2, libapache2-mod-php5, php5, php5-mysql, libphp-serialization-perl, libdate-manip-perl, libmime-lite-perl, libmime-lite-perl, mysql-client, libwww-perl, libarchive-tar-perl, libarchive-zip-perl, libdevice-serialport-perl, libpcre3, ffmpeg, rsyslog | system-log-daemon, libmodule-load-perl, libsys-mmap-perl, libjson-any-perl, netpbm, libavdevice53, libjpeg8, zip, libnet-sftp-foreign-perl -Description: Linux video camera security and surveillance solution +Description: A video camera security and surveillance solution + ZoneMinder is intended for use in single or multi-camera video security + applications, including commercial or home CCTV, theft prevention and child + or family member or home monitoring and other care scenarios. It + supports capture, analysis, recording, and monitoring of video data coming + from one or more video or network cameras attached to a Linux system. + ZoneMinder also support web and semi-automatic control of Pan/Tilt/Zoom + cameras using a variety of protocols. It is suitable for use as a home + video security system and for commercial or professional video security + and surveillance. It can also be integrated into a home automation system + via X.10 or other protocols. + +Package: zoneminder-dbg +Architecture: any +Depends: + zoneminder (= ${binary:Version}), + ${misc:Depends} +Description: debugging syumbols for zoneminder. + ZoneMinder is a video camera security and surveillance solution. ZoneMinder is intended for use in single or multi-camera video security applications, including commercial or home CCTV, theft prevention and child or family member or home monitoring and other care scenarios. It diff --git a/distros/ubuntu1204/rules b/distros/ubuntu1204/rules index 601dcf62a..3dea63174 100755 --- a/distros/ubuntu1204/rules +++ b/distros/ubuntu1204/rules @@ -71,3 +71,7 @@ override_dh_fixperms: override_dh_auto_test: # do not run tests... + +.PHONY: override_dh_strip +override_dh_strip: + dh_strip --dbg-package=zoneminder-dbg From 2cd0d0b4050669e749ca7790442e309fa4e31e4b Mon Sep 17 00:00:00 2001 From: Isaac Connor Date: Fri, 8 Nov 2013 11:25:06 -0500 Subject: [PATCH 024/107] repeat the dbh package lines for debian as well --- distros/debian/control | 22 ++++++++++++++++++++-- distros/debian/rules | 4 ++++ 2 files changed, 24 insertions(+), 2 deletions(-) diff --git a/distros/debian/control b/distros/debian/control index 06bc6801e..39503027e 100644 --- a/distros/debian/control +++ b/distros/debian/control @@ -2,13 +2,31 @@ Source: zoneminder Section: net Priority: optional Maintainer: Isaac Connor -Build-Depends: debhelper (>= 5), autoconf, automake, dpatch, libphp-serialization-perl, libgnutls-dev, libmysqlclient-dev, libdbd-mysql-perl, libdate-manip-perl, libwww-perl, libjpeg8-dev, libpcre3-dev, libavcodec-dev, libavformat-dev (>= 3:0.svn20090204), libswscale-dev (>= 3:0.svn20090204), libavutil-dev, libv4l-dev (>= 0.8.3), libbz2-dev, libtool, libsys-mmap-perl, ffmpeg, libnetpbm10-dev, libavdevice-dev, libdevice-serialport-perl, libpcre3, libarchive-zip-perl, libmime-lite-perl, libjpeg8, dh-autoreconf +Build-Depends: debhelper (>= 7.0.50), autoconf, automake, dpatch, libphp-serialization-perl, libgnutls-dev, libmysqlclient-dev, libdbd-mysql-perl, libdate-manip-perl, libwww-perl, libjpeg8-dev, libpcre3-dev, libavcodec-dev, libavformat-dev (>= 3:0.svn20090204), libswscale-dev (>= 3:0.svn20090204), libavutil-dev, libv4l-dev (>= 0.8.3), libbz2-dev, libtool, libsys-mmap-perl, ffmpeg, libnetpbm10-dev, libavdevice-dev, libdevice-serialport-perl, libpcre3, libarchive-zip-perl, libmime-lite-perl, libjpeg8, dh-autoreconf Standards-Version: 3.9.2 Package: zoneminder Architecture: any Depends: ${shlibs:Depends}, ${misc:Depends}, ${perl:Depends}, apache2, libapache2-mod-php5, php5, php5-mysql, libphp-serialization-perl, libdate-manip-perl, libmime-lite-perl, libmime-lite-perl, mysql-client, libwww-perl, libarchive-tar-perl, libarchive-zip-perl, libdevice-serialport-perl, libpcre3, ffmpeg, rsyslog | system-log-daemon, libmodule-load-perl, libsys-mmap-perl, libjson-any-perl, netpbm, libavdevice53, libjpeg8, zip, libnet-sftp-foreign-perl -Description: Linux video camera security and surveillance solution +Description: A video camera security and surveillance solution + ZoneMinder is intended for use in single or multi-camera video security + applications, including commercial or home CCTV, theft prevention and child + or family member or home monitoring and other care scenarios. It + supports capture, analysis, recording, and monitoring of video data coming + from one or more video or network cameras attached to a Linux system. + ZoneMinder also support web and semi-automatic control of Pan/Tilt/Zoom + cameras using a variety of protocols. It is suitable for use as a home + video security system and for commercial or professional video security + and surveillance. It can also be integrated into a home automation system + via X.10 or other protocols. + +Package: zoneminder-dbg +Architecture: any +Depends: + zoneminder (= ${binary:Version}), + ${misc:Depends} +Description: debugging syumbols for zoneminder. + ZoneMinder is a video camera security and surveillance solution. ZoneMinder is intended for use in single or multi-camera video security applications, including commercial or home CCTV, theft prevention and child or family member or home monitoring and other care scenarios. It diff --git a/distros/debian/rules b/distros/debian/rules index 601dcf62a..3dea63174 100755 --- a/distros/debian/rules +++ b/distros/debian/rules @@ -71,3 +71,7 @@ override_dh_fixperms: override_dh_auto_test: # do not run tests... + +.PHONY: override_dh_strip +override_dh_strip: + dh_strip --dbg-package=zoneminder-dbg From b8f075499b9605aa1c847e8714e3daf4dc73daef Mon Sep 17 00:00:00 2001 From: Isaac Connor Date: Fri, 8 Nov 2013 11:47:19 -0500 Subject: [PATCH 025/107] fix for debian bug #725840 Javascript errors in updateButtons function of filter.js Also a slight optimisation using else's instead of continuing to evaluate after the true value has been set. --- web/skins/classic/views/js/filter.js | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/web/skins/classic/views/js/filter.js b/web/skins/classic/views/js/filter.js index 840ca04e0..1fddbc246 100644 --- a/web/skins/classic/views/js/filter.js +++ b/web/skins/classic/views/js/filter.js @@ -9,17 +9,17 @@ function updateButtons( element ) var canExecute = false; if ( form.elements['autoArchive'].checked ) canExecute = true; - if ( form.elements['autoVideo'].checked ) + else if ( form.elements['autoVideo'].checked ) canExecute = true; - if ( form.elements['autoUpload'].checked ) + else if ( form.elements['autoUpload'] && form.elements['autoUpload'].checked ) canExecute = true; - if ( form.elements['autoEmail'].checked ) + else if ( form.elements['autoEmail'].checked ) canExecute = true; - if ( form.elements['autoMessage'].checked ) + else if ( form.elements['autoMessage'].checked ) canExecute = true; - if ( form.elements['autoExecute'].checked && form.elements['autoExecuteCmd'].value != '' ) + else if ( form.elements['autoExecute'].checked && form.elements['autoExecuteCmd'].value != '' ) canExecute = true; - if ( form.elements['autoDelete'].checked ) + else if ( form.elements['autoDelete'].checked ) canExecute = true; form.elements['executeButton'].disabled = !canExecute; } From cfc9a73851d23364daba757acb7c5e7752629a45 Mon Sep 17 00:00:00 2001 From: Kfir Itzhak Date: Fri, 8 Nov 2013 18:54:46 +0200 Subject: [PATCH 026/107] Fixed not installing mootools symlinks in an out-of-source build --- web/CMakeLists.txt | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/web/CMakeLists.txt b/web/CMakeLists.txt index b122bea4e..529ca0b09 100644 --- a/web/CMakeLists.txt +++ b/web/CMakeLists.txt @@ -10,3 +10,7 @@ configure_file(includes/config.php.in "${CMAKE_CURRENT_BINARY_DIR}/includes/conf install(DIRECTORY ajax css graphics includes js lang skins tools views DESTINATION "${ZM_WEBDIR}" PATTERN "*.in" EXCLUDE PATTERN "*Make*" EXCLUDE PATTERN "*cmake*" EXCLUDE REGEX "includes/config.php$" EXCLUDE) install(FILES index.php README.md DESTINATION "${ZM_WEBDIR}") install(FILES "${CMAKE_CURRENT_BINARY_DIR}/includes/config.php" DESTINATION "${ZM_WEBDIR}/includes") + +# Install the mootools symlinks +install(FILES "${CMAKE_CURRENT_BINARY_DIR}/tools/mootools/mootools-core.js" DESTINATION "${ZM_WEBDIR}/tools/mootools") +install(FILES "${CMAKE_CURRENT_BINARY_DIR}/tools/mootools/mootools-more.js" DESTINATION "${ZM_WEBDIR}/tools/mootools") From 6d6503c00620dd279afee0d881e3fb29a61b9b1a Mon Sep 17 00:00:00 2001 From: Isaac Connor Date: Fri, 8 Nov 2013 12:07:45 -0500 Subject: [PATCH 027/107] suggest mysql-server --- distros/debian/control | 1 + 1 file changed, 1 insertion(+) diff --git a/distros/debian/control b/distros/debian/control index 39503027e..d774fb45f 100644 --- a/distros/debian/control +++ b/distros/debian/control @@ -8,6 +8,7 @@ Standards-Version: 3.9.2 Package: zoneminder Architecture: any Depends: ${shlibs:Depends}, ${misc:Depends}, ${perl:Depends}, apache2, libapache2-mod-php5, php5, php5-mysql, libphp-serialization-perl, libdate-manip-perl, libmime-lite-perl, libmime-lite-perl, mysql-client, libwww-perl, libarchive-tar-perl, libarchive-zip-perl, libdevice-serialport-perl, libpcre3, ffmpeg, rsyslog | system-log-daemon, libmodule-load-perl, libsys-mmap-perl, libjson-any-perl, netpbm, libavdevice53, libjpeg8, zip, libnet-sftp-foreign-perl +Recommends: mysql-server Description: A video camera security and surveillance solution ZoneMinder is intended for use in single or multi-camera video security applications, including commercial or home CCTV, theft prevention and child From c840f1b6221a6ba1fdee7865f9cd54442906365b Mon Sep 17 00:00:00 2001 From: Isaac Connor Date: Fri, 8 Nov 2013 12:08:06 -0500 Subject: [PATCH 028/107] suggest mysql-server --- distros/ubuntu1204/control | 1 + 1 file changed, 1 insertion(+) diff --git a/distros/ubuntu1204/control b/distros/ubuntu1204/control index 39503027e..49be18df6 100644 --- a/distros/ubuntu1204/control +++ b/distros/ubuntu1204/control @@ -8,6 +8,7 @@ Standards-Version: 3.9.2 Package: zoneminder Architecture: any Depends: ${shlibs:Depends}, ${misc:Depends}, ${perl:Depends}, apache2, libapache2-mod-php5, php5, php5-mysql, libphp-serialization-perl, libdate-manip-perl, libmime-lite-perl, libmime-lite-perl, mysql-client, libwww-perl, libarchive-tar-perl, libarchive-zip-perl, libdevice-serialport-perl, libpcre3, ffmpeg, rsyslog | system-log-daemon, libmodule-load-perl, libsys-mmap-perl, libjson-any-perl, netpbm, libavdevice53, libjpeg8, zip, libnet-sftp-foreign-perl +SUggests: mysql-server Description: A video camera security and surveillance solution ZoneMinder is intended for use in single or multi-camera video security applications, including commercial or home CCTV, theft prevention and child From 8c0ad352f54aa6a93e210155805a063b2294934d Mon Sep 17 00:00:00 2001 From: Patrick McGuire Date: Fri, 8 Nov 2013 14:53:01 -0500 Subject: [PATCH 029/107] Fix shared memory errors on centos 6.4 --- scripts/ZoneMinder/lib/ZoneMinder/Memory/Shared.pm | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/scripts/ZoneMinder/lib/ZoneMinder/Memory/Shared.pm b/scripts/ZoneMinder/lib/ZoneMinder/Memory/Shared.pm index c04e4f413..6f3e46df3 100644 --- a/scripts/ZoneMinder/lib/ZoneMinder/Memory/Shared.pm +++ b/scripts/ZoneMinder/lib/ZoneMinder/Memory/Shared.pm @@ -33,6 +33,8 @@ require ZoneMinder::Base; our @ISA = qw(Exporter ZoneMinder::Base); +eval 'sub IPC_CREAT {0001000}' unless defined &IPC_CREAT; + # 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. @@ -80,7 +82,7 @@ sub zmMemAttach( $$ ) if ( !defined($monitor->{ShmId}) ) { my $shm_key = (hex(ZM_SHM_KEY)&0xffff0000)|$monitor->{Id}; - my $shm_id = shmget( $shm_key, $size, 0 ); + 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} ) ); From 29e2cdf56167c24b80d6387917fcf8836baf3570 Mon Sep 17 00:00:00 2001 From: Isaac Connor Date: Wed, 13 Nov 2013 09:42:10 -0500 Subject: [PATCH 030/107] split the innoDB upgrade out of the version section, so that it always checked for MyISAM tables and if found, offers to update them. --- scripts/zmupdate.pl.in | 79 +++++++++++++++++++++++------------------- 1 file changed, 43 insertions(+), 36 deletions(-) diff --git a/scripts/zmupdate.pl.in b/scripts/zmupdate.pl.in index d80209885..2595d8655 100644 --- a/scripts/zmupdate.pl.in +++ b/scripts/zmupdate.pl.in @@ -335,6 +335,49 @@ if ( $freshen ) loadConfigFromDB(); saveConfigToDB(); } + +sub getMyISAMTables { + my $dbh = shift; + my $sql = "SELECT table_name FROM INFORMATION_SCHEMA.TABLES WHERE table_schema='zm' AND engine = 'MyISAM'"; + my $sth = $dbh->prepare_cached( $sql ) or die( "Can't prepare '$sql': ".$dbh->errstr() ); + my $res = $sth->execute() or die( "Can't execute: ".$sth->errstr() ); + + my @dbTables; + while( my $dbTable = $sth->fetchrow() ) { + push( @dbTables, $dbTable ); + } + $sth->finish(); +} # end sub getInnoDBTables + +sub toInnoDB { + my ( $dbh, @dbTables ) = @_; + if (@dbTables) { + print "\nConverting MyISAM tables to InnoDB. Please wait.\n"; + foreach (@dbTables) { + my $sql = "ALTER TABLE $_ ENGINE = InnoDB"; + my $sth = $dbh->prepare_cached( $sql ) or die( "Can't prepare '$sql': ".$dbh->errstr() ); + my $res = $sth->execute() or die( "Can't execute: ".$sth->errstr() ); + $sth->finish(); + } + } else { + print "\nNo MyISAM tables found. Skipping...\n"; + } +} # end sub toInnoDB + +# Now check for MyISAM Tables +my $dbh = zmDbConnect(); +my @Tables = getMyISAMTables( $dbh ); +if ( @Tables ) { + print( "\nPrevious versions of ZoneMinder used the MyISAM database engine.\nHowever, the recommended database engine is InnoDB.\n"); + print( "\nHint: InnoDB tables are much less likely to be corrupted during an unclean shutdown.\n\nPress 'y' to convert your tables to InnoDB or 'n' to skip : "); + my $response = ; + chomp( $response ); + if ( $response =~ /^[yY]$/ ) { + toInnoDB($dbh); + } +} +$dbh->disconnect(); + if ( $version ) { my ( $detaint_version ) = $version =~ /^([\w.]+)$/; @@ -454,34 +497,6 @@ if ( $version ) } } - sub toInnoDB - { - my $dbh = shift; - my $sql = "SELECT table_name FROM INFORMATION_SCHEMA.TABLES WHERE table_schema='zm' AND engine = 'MyISAM'"; - my $sth = $dbh->prepare_cached( $sql ) or die( "Can't prepare '$sql': ".$dbh->errstr() ); - my $res = $sth->execute() or die( "Can't execute: ".$sth->errstr() ); - - my @dbTables; - while( my $dbTable = $sth->fetchrow() ) - { - push( @dbTables, $dbTable ); - } - $sth->finish(); - - if (@dbTables) - { - print "\nConverting MyISAM tables to InnoDB. Please wait.\n"; - foreach (@dbTables) - { - my $sql = "ALTER TABLE $_ ENGINE = InnoDB"; - my $sth = $dbh->prepare_cached( $sql ) or die( "Can't prepare '$sql': ".$dbh->errstr() ); - my $res = $sth->execute() or die( "Can't execute: ".$sth->errstr() ); - } - $sth->finish(); - } else { - print "\nNo MyISAM tables found. Skipping...\n"; - } - } print( "\nUpgrading database to version ".ZM_VERSION."\n" ); @@ -1014,14 +1029,6 @@ if ( $version ) } # end if $sth->finish(); - print( "\nPrevious versions of ZoneMinder used the MyISAM database engine.\nHowever, the recommended database engine is InnoDB.\n"); - print( "\nHint: InnoDB tables are much less likely to be corrupted during an unclean shutdown.\n\nPress 'y' to convert your tables to InnoDB or 'n' to skip : "); - my $response = ; - chomp( $response ); - if ( $response =~ /^[yY]$/ ) - { - toInnoDB($dbh); - } $cascade = !undef; $version = '1.26.0'; From 47179f793db16c7abdfd8d15394ef5c03b3dce65 Mon Sep 17 00:00:00 2001 From: Kfir Itzhak Date: Wed, 13 Nov 2013 16:52:01 +0200 Subject: [PATCH 031/107] Fix make install failing to install mootools symlinks in an out-of-source build --- web/tools/mootools/CMakeLists.txt | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/web/tools/mootools/CMakeLists.txt b/web/tools/mootools/CMakeLists.txt index c71e77ff4..e1e957913 100644 --- a/web/tools/mootools/CMakeLists.txt +++ b/web/tools/mootools/CMakeLists.txt @@ -32,3 +32,11 @@ else(NOT mtmorelist) message(WARNING " Failed creating the required symlinks for mootools-more. Exit code: ${mtmoreresult}") endif(mtmoreresult) endif(NOT mtmorelist) + +# If this is an out-of-source build, copy the mootools files we picked to the binary directory +# This is required to fix a cmake bug regarding installing symlinks pointing to nonexistent files +if(NOT (CMAKE_BINARY_DIR STREQUAL CMAKE_SOURCE_DIR)) + execute_process(COMMAND ${CMAKE_COMMAND} -E copy "${CMAKE_CURRENT_SOURCE_DIR}/${mtcorelatest}" "${CMAKE_CURRENT_BINARY_DIR}/${mtcorelatest}") + execute_process(COMMAND ${CMAKE_COMMAND} -E copy "${CMAKE_CURRENT_SOURCE_DIR}/${mtmorelatest}" "${CMAKE_CURRENT_BINARY_DIR}/${mtmorelatest}") +endif(NOT (CMAKE_BINARY_DIR STREQUAL CMAKE_SOURCE_DIR)) + From 7da2cdd15957f968ddbf8e137c7023144ce914b1 Mon Sep 17 00:00:00 2001 From: Isaac Connor Date: Wed, 13 Nov 2013 11:45:53 -0500 Subject: [PATCH 032/107] cleanups, only connect and disconnect once. Remove unncessary require's of DBI cleanup MyISAM to InnoDB code --- scripts/zmupdate.pl.in | 70 ++++++++++++------------------------------ 1 file changed, 20 insertions(+), 50 deletions(-) diff --git a/scripts/zmupdate.pl.in b/scripts/zmupdate.pl.in index 2595d8655..434f0d9e5 100644 --- a/scripts/zmupdate.pl.in +++ b/scripts/zmupdate.pl.in @@ -101,7 +101,6 @@ if ( !GetOptions( 'check'=>\$check, 'freshen'=>\$freshen, 'rename'=>\$rename, 'z my $dbh = zmDbConnect(); *ZoneMinder::Database::ZM_DB_USER = sub { $dbUser } if ZoneMinder::Database::ZM_DB_USER ne $dbUser; *ZoneMinder::Database::ZM_DB_PASS = sub { $dbPass } if ZoneMinder::Database::ZM_DB_PASS ne $dbPass; -zmDbDisconnect(); if ( ! ($check || $freshen || $rename || $zoneFix || $migrateEvents || $version) ) { @@ -126,8 +125,6 @@ if ( $check && ZM_CHECK_FOR_UPDATES ) { print( "Update agent starting at ".strftime( '%y/%m/%d %H:%M:%S', localtime() )."\n" ); - my $dbh = zmDbConnect(); - my $currVersion = ZM_DYN_CURR_VERSION; my $lastVersion = ZM_DYN_LAST_VERSION; my $lastCheck = ZM_DYN_LAST_CHECK; @@ -140,15 +137,12 @@ if ( $check && ZM_CHECK_FOR_UPDATES ) my $sth = $dbh->prepare_cached( $sql ) or die( "Can't prepare '$sql': ".$dbh->errstr() ); my $res = $sth->execute( "$currVersion" ) or die( "Can't execute: ".$sth->errstr() ); } - zmDbDisconnect(); while( 1 ) { my $now = time(); if ( !$lastVersion || !$lastCheck || (($now-$lastCheck) > CHECK_INTERVAL) ) { - $dbh = zmDbConnect(); - Info( "Checking for updates\n" ); use LWP::UserAgent; @@ -186,7 +180,6 @@ if ( $check && ZM_CHECK_FOR_UPDATES ) { Error( "Error check failed: '".$res->status_line()."'\n" ); } - zmDbDisconnect(); } sleep( 3600 ); } @@ -222,9 +215,6 @@ if ( $rename ) } if ( $zoneFix ) { - require DBI; - - my $dbh = zmDbConnect(); my $sql = "select Z.*, M.Width as MonitorWidth, M.Height as MonitorHeight from Zones as Z inner join Monitors as M on Z.MonitorId = M.Id where Z.Units = 'Percent'"; my $sth = $dbh->prepare_cached( $sql ) or die( "Can't prepare '$sql': ".$dbh->errstr() ); @@ -287,7 +277,6 @@ if ( $migrateEvents ) print( "Converting all events to deep storage.\n" ); chdir( ZM_PATH_WEB ); - my $dbh = zmDbConnect(); my $sql = "select *, unix_timestamp(StartTime) as UnixStartTime from Events"; my $sth = $dbh->prepare_cached( $sql ) or Fatal( "Can't prepare '$sql': ".$dbh->errstr() ); my $res = $sth->execute(); @@ -336,47 +325,32 @@ if ( $freshen ) saveConfigToDB(); } -sub getMyISAMTables { - my $dbh = shift; - my $sql = "SELECT table_name FROM INFORMATION_SCHEMA.TABLES WHERE table_schema='zm' AND engine = 'MyISAM'"; - my $sth = $dbh->prepare_cached( $sql ) or die( "Can't prepare '$sql': ".$dbh->errstr() ); - my $res = $sth->execute() or die( "Can't execute: ".$sth->errstr() ); - - my @dbTables; - while( my $dbTable = $sth->fetchrow() ) { - push( @dbTables, $dbTable ); - } - $sth->finish(); -} # end sub getInnoDBTables - -sub toInnoDB { - my ( $dbh, @dbTables ) = @_; - if (@dbTables) { - print "\nConverting MyISAM tables to InnoDB. Please wait.\n"; - foreach (@dbTables) { - my $sql = "ALTER TABLE $_ ENGINE = InnoDB"; - my $sth = $dbh->prepare_cached( $sql ) or die( "Can't prepare '$sql': ".$dbh->errstr() ); - my $res = $sth->execute() or die( "Can't execute: ".$sth->errstr() ); - $sth->finish(); - } - } else { - print "\nNo MyISAM tables found. Skipping...\n"; - } -} # end sub toInnoDB - # Now check for MyISAM Tables -my $dbh = zmDbConnect(); -my @Tables = getMyISAMTables( $dbh ); -if ( @Tables ) { +my @MyISAM_Tables; +my $sql = "SELECT table_name FROM INFORMATION_SCHEMA.TABLES WHERE table_schema='zm' AND engine = 'MyISAM'"; +my $sth = $dbh->prepare_cached( $sql ) or die( "Can't prepare '$sql': ".$dbh->errstr() ); +my $res = $sth->execute() or die( "Can't execute: ".$sth->errstr() ); + +while( my $dbTable = $sth->fetchrow() ) { + push @MyISAM_Tables, $dbTable; +} +$sth->finish(); + +if ( @MyISAM_Tables ) { print( "\nPrevious versions of ZoneMinder used the MyISAM database engine.\nHowever, the recommended database engine is InnoDB.\n"); print( "\nHint: InnoDB tables are much less likely to be corrupted during an unclean shutdown.\n\nPress 'y' to convert your tables to InnoDB or 'n' to skip : "); my $response = ; chomp( $response ); if ( $response =~ /^[yY]$/ ) { - toInnoDB($dbh); + print "\nConverting MyISAM tables to InnoDB. Please wait.\n"; + foreach (@MyISAM_Tables) { + my $sql = "ALTER TABLE $_ ENGINE = InnoDB"; + my $sth = $dbh->prepare_cached( $sql ) or die( "Can't prepare '$sql': ".$dbh->errstr() ); + my $res = $sth->execute() or die( "Can't execute: ".$sth->errstr() ); + $sth->finish(); + } } } -$dbh->disconnect(); if ( $version ) { @@ -504,8 +478,6 @@ if ( $version ) loadConfigFromDB(); saveConfigToDB(); - my $dbh = zmDbConnect(); - my $cascade = undef; if ( $cascade || $version eq "1.19.0" ) { @@ -533,8 +505,6 @@ if ( $version ) } if ( $cascade || $version eq "1.19.4" ) { - require DBI; - # Rename the event directories and create a new symlink for the names chdir( EVENT_PATH ); @@ -1068,13 +1038,13 @@ if ( $version ) my $sth = $dbh->prepare_cached( $sql ) or die( "Can't prepare '$sql': ".$dbh->errstr() ); my $res = $sth->execute( "$installed_version", "ZM_DYN_DB_VERSION" ) or die( "Can't execute: ".$sth->errstr() ); $res = $sth->execute( "$installed_version", "ZM_DYN_CURR_VERSION" ) or die( "Can't execute: ".$sth->errstr() ); - $dbh->disconnect(); } else { - $dbh->disconnect(); + zmDbDisconnect(); die( "Can't find upgrade from version '$version'" ); } print( "\nDatabase upgrade to version ".ZM_VERSION." successful.\n\n" ); } +zmDbDisconnect(); exit( 0 ); From 82a92639cadb80c529dfbccb78cccf8ea7aec871 Mon Sep 17 00:00:00 2001 From: Kfir Itzhak Date: Fri, 15 Nov 2013 10:44:31 +0200 Subject: [PATCH 033/107] Remove importing of binary directory in cmakecacheimport.sh --- CMakeLists.txt | 2 -- cmakecacheimport.sh | 6 +++--- 2 files changed, 3 insertions(+), 5 deletions(-) diff --git a/CMakeLists.txt b/CMakeLists.txt index 1fa4b2e52..4d663ce32 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -66,8 +66,6 @@ set(ZM_NO_X10 "OFF" CACHE BOOL "Set to ON to build ZoneMinder without X10 suppor set(ZM_PERL_SUBPREFIX "${CMAKE_INSTALL_LIBDIR}/perl5" CACHE PATH "Use a different directory for the zm perl modules. NOTE: This is a subprefix, e.g. lib will be turned into /lib, default: ${CMAKE_INSTALL_LIBDIR}/perl5") set(ZM_PERL_USE_PATH "${CMAKE_INSTALL_PREFIX}/${ZM_PERL_SUBPREFIX}" CACHE PATH "Override the include path for zm perl modules. Useful if you are moving the perl modules without using the ZM_PERL_SUBPREFIX option. default: /") set(ZM_TARGET_DISTRO "" CACHE STRING "Build ZoneMinder for a specific distribution. Currently, valid names are: f19, el6") -# Only required for cmakecacheimport: -set(CMAKE_INSTALL_FULL_BINDIR "${CMAKE_INSTALL_PREFIX}/${CMAKE_INSTALL_BINDIR}" CACHE PATH "Override default binary directory") # Required for certain checks to work set(CMAKE_EXTRA_INCLUDE_FILES ${CMAKE_EXTRA_INCLUDE_FILES} stdio.h stdlib.h math.h signal.h) diff --git a/cmakecacheimport.sh b/cmakecacheimport.sh index 4ae5fa49c..79253f6ad 100755 --- a/cmakecacheimport.sh +++ b/cmakecacheimport.sh @@ -44,7 +44,7 @@ if [ "$?" != "0" ]; then fi # Print some information -echo "Executables directory : $ZM_PATH_BIN" +#echo "Executables directory : $ZM_PATH_BIN" #echo "Libraries directory : $ZM_PATH_LIB" #echo "System config directory : $ZM_PATH_CONF" echo "Web directory : $ZM_PATH_WEB" @@ -60,8 +60,8 @@ echo "Database password : Not shown" CMPATH="CACHE PATH \"Imported by cmakecacheimport.sh\" FORCE" CMSTRING="CACHE STRING \"Imported by cmakecacheimport.sh\" FORCE" # Write -echo "# Generated by cmakecacheimport.sh">zm_conf.cmake -echo "set(CMAKE_INSTALL_FULL_BINDIR \"$ZM_PATH_BIN\" $CMPATH)">>zm_conf.cmake +echo "# This file was generated by cmakecacheimport.sh">zm_conf.cmake +#echo "set(CMAKE_INSTALL_FULL_BINDIR \"$ZM_PATH_BIN\" $CMPATH)">>zm_conf.cmake #echo "set(CMAKE_INSTALL_FULL_LIBDIR \"$ZM_PATH_LIB\" $CMPATH)">>zm_conf.cmake #echo "set(CMAKE_INSTALL_FULL_SYSCONFDIR \"$ZM_PATH_CONF\" $CMPATH)">>zm_conf.cmake echo "set(ZM_WEBDIR \"$ZM_PATH_WEB\" $CMPATH)">>zm_conf.cmake From 4a4018b8d72dfa148849de69d576508efa8a195d Mon Sep 17 00:00:00 2001 From: Kfir Itzhak Date: Fri, 15 Nov 2013 11:11:33 +0200 Subject: [PATCH 034/107] Add automatic finding of the ffmpeg executable to cmake --- CMakeLists.txt | 11 +++++++++++ 1 file changed, 11 insertions(+) diff --git a/CMakeLists.txt b/CMakeLists.txt index 4d663ce32..0c830af03 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -225,6 +225,8 @@ else(MYSQLCLIENT_LIBRARIES) message(FATAL_ERROR "zm requires mysqlclient but it was not found on your system") endif(MYSQLCLIENT_LIBRARIES) +set(PATH_FFMPEG "") +set(OPT_FFMPEG "no") # Do not check for ffmpeg if ZM_NO_FFMPEG is on if(NOT ZM_NO_FFMPEG) # avformat (using find_library and find_path) @@ -312,6 +314,15 @@ if(NOT ZM_NO_FFMPEG) else(SWSCALE_LIBRARIES) set(optlibsnotfound "${optlibsnotfound} SWScale") endif(SWSCALE_LIBRARIES) + + # Find the path to the ffmpeg executable + find_program(FFMPEG_EXECUTABLE ffmpeg PATH_SUFFIXES ffmpeg) + if(FFMPEG_EXECUTABLE) + set(PATH_FFMPEG "${FFMPEG_EXECUTABLE}") + set(OPT_FFMPEG "yes") + mark_as_advanced(FFMPEG_EXECUTABLE) + endif(FFMPEG_EXECUTABLE) + endif(NOT ZM_NO_FFMPEG) # *** END OF LIBRARY CHECKS *** From 762e63653cf9c2cb5b2df5a42e9b6a9c36891cfe Mon Sep 17 00:00:00 2001 From: Kfir Itzhak Date: Fri, 15 Nov 2013 11:12:33 +0200 Subject: [PATCH 035/107] Few minor cmake improvements, especially for whitespaces in paths --- CMakeLists.txt | 93 +++++++++++++++++++++++++------------------------- 1 file changed, 46 insertions(+), 47 deletions(-) diff --git a/CMakeLists.txt b/CMakeLists.txt index 0c830af03..47ef21ac6 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -31,7 +31,6 @@ set(CMAKE_C_FLAGS_RELEASE "-Wall -D__STDC_CONSTANT_MACROS -O2") set(CMAKE_CXX_FLAGS_RELEASE "-Wall -D__STDC_CONSTANT_MACROS -O2") set(CMAKE_C_FLAGS_DEBUG "-Wall -D__STDC_CONSTANT_MACROS -g") set(CMAKE_CXX_FLAGS_DEBUG "-Wall -D__STDC_CONSTANT_MACROS -g") -set(CMAKE_INCLUDE_CURRENT_DIR ON) set(CMAKE_MODULE_PATH ${CMAKE_MODULE_PATH} "${CMAKE_SOURCE_DIR}/cmake/Modules/") # Modules that we need: @@ -63,7 +62,7 @@ set(ZM_MYSQL_ENGINE "InnoDB" CACHE STRING "MySQL engine to use with database, de set(ZM_NO_MMAP "OFF" CACHE BOOL "Set to ON to not use mmap shared memory. Shouldn't be enabled unless you experience problems with the shared memory. default: OFF") set(ZM_NO_FFMPEG "OFF" CACHE BOOL "Set to ON to skip ffmpeg checks and force building ZM without ffmpeg. default: OFF") set(ZM_NO_X10 "OFF" CACHE BOOL "Set to ON to build ZoneMinder without X10 support. default: OFF") -set(ZM_PERL_SUBPREFIX "${CMAKE_INSTALL_LIBDIR}/perl5" CACHE PATH "Use a different directory for the zm perl modules. NOTE: This is a subprefix, e.g. lib will be turned into /lib, default: ${CMAKE_INSTALL_LIBDIR}/perl5") +set(ZM_PERL_SUBPREFIX "${CMAKE_INSTALL_LIBDIR}/perl5" CACHE PATH "Use a different directory for the zm perl modules. NOTE: This is a subprefix, e.g. lib will be turned into /lib, default: /perl5") set(ZM_PERL_USE_PATH "${CMAKE_INSTALL_PREFIX}/${ZM_PERL_SUBPREFIX}" CACHE PATH "Override the include path for zm perl modules. Useful if you are moving the perl modules without using the ZM_PERL_SUBPREFIX option. default: /") set(ZM_TARGET_DISTRO "" CACHE STRING "Build ZoneMinder for a specific distribution. Currently, valid names are: f19, el6") @@ -96,9 +95,9 @@ check_type_size("ucontext_t" HAVE_UCONTEXT_T) find_package(ZLIB) if(ZLIB_FOUND) set(HAVE_LIBZLIB 1) - list(APPEND ZM_BIN_LIBS ${ZLIB_LIBRARIES}) - include_directories(${ZLIB_INCLUDE_DIR}) - set(CMAKE_REQUIRED_INCLUDES ${ZLIB_INCLUDE_DIR}) + list(APPEND ZM_BIN_LIBS "${ZLIB_LIBRARIES}") + include_directories("${ZLIB_INCLUDE_DIR}") + set(CMAKE_REQUIRED_INCLUDES "${ZLIB_INCLUDE_DIR}") check_include_file("zlib.h" HAVE_ZLIB_H) set(optlibsfound "${optlibsfound} zlib") else(ZLIB_FOUND) @@ -109,10 +108,10 @@ endif(ZLIB_FOUND) find_package(JPEG) if(JPEG_FOUND) set(HAVE_LIBJPEG 1) - list(APPEND ZM_BIN_LIBS ${JPEG_LIBRARIES}) + list(APPEND ZM_BIN_LIBS "${JPEG_LIBRARIES}") #link_directories(${JPEG_LIBRARY}) - include_directories(${JPEG_INCLUDE_DIR}) - set(CMAKE_REQUIRED_INCLUDES ${JPEG_INCLUDE_DIR}) + include_directories("${JPEG_INCLUDE_DIR}") + set(CMAKE_REQUIRED_INCLUDES "${JPEG_INCLUDE_DIR}") check_include_files("stdio.h;jpeglib.h" HAVE_JPEGLIB_H) if(NOT HAVE_JPEGLIB_H) message(FATAL_ERROR " zm requires libjpeg headers - check that libjpeg development packages are installed") @@ -126,9 +125,9 @@ find_package(OpenSSL) if(OPENSSL_FOUND) set(HAVE_LIBOPENSSL 1) set(HAVE_LIBCRYPTO 1) - list(APPEND ZM_BIN_LIBS ${OPENSSL_LIBRARIES}) - include_directories(${OPENSSL_INCLUDE_DIR}) - set(CMAKE_REQUIRED_INCLUDES ${OPENSSL_INCLUDE_DIR}) + list(APPEND ZM_BIN_LIBS "${OPENSSL_LIBRARIES}") + include_directories("${OPENSSL_INCLUDE_DIR}") + set(CMAKE_REQUIRED_INCLUDES "${OPENSSL_INCLUDE_DIR}") check_include_file("openssl/md5.h" HAVE_OPENSSL_MD5_H) set(optlibsfound "${optlibsfound} OpenSSL") else(OPENSSL_FOUND) @@ -139,11 +138,11 @@ endif(OPENSSL_FOUND) find_library(PTHREAD_LIBRARIES pthread) if(PTHREAD_LIBRARIES) set(HAVE_LIBPTHREAD 1) - list(APPEND ZM_BIN_LIBS ${PTHREAD_LIBRARIES}) + list(APPEND ZM_BIN_LIBS "${PTHREAD_LIBRARIES}") find_path(PTHREAD_INCLUDE_DIR pthread.h) if(PTHREAD_INCLUDE_DIR) - include_directories(${PTHREAD_INCLUDE_DIR}) - set(CMAKE_REQUIRED_INCLUDES ${PTHREAD_INCLUDE_DIR}) + include_directories("${PTHREAD_INCLUDE_DIR}") + set(CMAKE_REQUIRED_INCLUDES "${PTHREAD_INCLUDE_DIR}") endif(PTHREAD_INCLUDE_DIR) mark_as_advanced(FORCE PTHREAD_LIBRARIES PTHREAD_INCLUDE_DIR) check_include_file("pthread.h" HAVE_PTHREAD_H) @@ -158,11 +157,11 @@ endif(PTHREAD_LIBRARIES) find_library(PCRE_LIBRARIES pcre) if(PCRE_LIBRARIES) set(HAVE_LIBPCRE 1) - list(APPEND ZM_BIN_LIBS ${PCRE_LIBRARIES}) + list(APPEND ZM_BIN_LIBS "${PCRE_LIBRARIES}") find_path(PCRE_INCLUDE_DIR pcre.h) if(PCRE_INCLUDE_DIR) - include_directories(${PCRE_INCLUDE_DIR}) - set(CMAKE_REQUIRED_INCLUDES ${PCRE_INCLUDE_DIR}) + include_directories("${PCRE_INCLUDE_DIR}") + set(CMAKE_REQUIRED_INCLUDES "${PCRE_INCLUDE_DIR}") endif(PCRE_INCLUDE_DIR) mark_as_advanced(FORCE PCRE_LIBRARIES PCRE_INCLUDE_DIR) check_include_file("pcre.h" HAVE_PCRE_H) @@ -175,11 +174,11 @@ endif(PCRE_LIBRARIES) find_library(GCRYPT_LIBRARIES gcrypt) if(GCRYPT_LIBRARIES) set(HAVE_LIBGCRYPT 1) - list(APPEND ZM_BIN_LIBS ${GCRYPT_LIBRARIES}) + list(APPEND ZM_BIN_LIBS "${GCRYPT_LIBRARIES}") find_path(GCRYPT_INCLUDE_DIR gcrypt.h) if(GCRYPT_INCLUDE_DIR) - include_directories(${GCRYPT_INCLUDE_DIR}) - set(CMAKE_REQUIRED_INCLUDES ${GCRYPT_INCLUDE_DIR}) + include_directories("${GCRYPT_INCLUDE_DIR}") + set(CMAKE_REQUIRED_INCLUDES "${GCRYPT_INCLUDE_DIR}") endif(GCRYPT_INCLUDE_DIR) mark_as_advanced(FORCE GCRYPT_LIBRARIES GCRYPT_INCLUDE_DIR) check_include_file("gcrypt.h" HAVE_GCRYPT_H) @@ -192,11 +191,11 @@ endif(GCRYPT_LIBRARIES) find_library(GNUTLS_LIBRARIES gnutls) if(GNUTLS_LIBRARIES) set(HAVE_LIBGNUTLS 1) - list(APPEND ZM_BIN_LIBS ${GNUTLS_LIBRARIES}) + list(APPEND ZM_BIN_LIBS "${GNUTLS_LIBRARIES}") find_path(GNUTLS_INCLUDE_DIR gnutls/gnutls.h) if(GNUTLS_INCLUDE_DIR) - include_directories(${GNUTLS_INCLUDE_DIR}) - set(CMAKE_REQUIRED_INCLUDES ${GNUTLS_INCLUDE_DIR}) + include_directories("${GNUTLS_INCLUDE_DIR}") + set(CMAKE_REQUIRED_INCLUDES "${GNUTLS_INCLUDE_DIR}") endif(GNUTLS_INCLUDE_DIR) mark_as_advanced(FORCE GNUTLS_LIBRARIES GNUTLS_INCLUDE_DIR) check_include_file("gnutls/openssl.h" HAVE_GNUTLS_OPENSSL_H) @@ -210,11 +209,11 @@ endif(GNUTLS_LIBRARIES) find_library(MYSQLCLIENT_LIBRARIES mysqlclient PATH_SUFFIXES mysql) if(MYSQLCLIENT_LIBRARIES) set(HAVE_LIBMYSQLCLIENT 1) - list(APPEND ZM_BIN_LIBS ${MYSQLCLIENT_LIBRARIES}) + list(APPEND ZM_BIN_LIBS "${MYSQLCLIENT_LIBRARIES}") find_path(MYSQLCLIENT_INCLUDE_DIR mysql/mysql.h) if(MYSQLCLIENT_INCLUDE_DIR) - include_directories(${MYSQLCLIENT_INCLUDE_DIR}) - set(CMAKE_REQUIRED_INCLUDES ${MYSQLCLIENT_INCLUDE_DIR}) + include_directories("${MYSQLCLIENT_INCLUDE_DIR}") + set(CMAKE_REQUIRED_INCLUDES "${MYSQLCLIENT_INCLUDE_DIR}") endif(MYSQLCLIENT_INCLUDE_DIR) mark_as_advanced(FORCE MYSQLCLIENT_LIBRARIES MYSQLCLIENT_INCLUDE_DIR) check_include_file("mysql/mysql.h" HAVE_MYSQL_H) @@ -233,11 +232,11 @@ if(NOT ZM_NO_FFMPEG) find_library(AVFORMAT_LIBRARIES avformat) if(AVFORMAT_LIBRARIES) set(HAVE_LIBAVFORMAT 1) - list(APPEND ZM_BIN_LIBS ${AVFORMAT_LIBRARIES}) + list(APPEND ZM_BIN_LIBS "${AVFORMAT_LIBRARIES}") find_path(AVFORMAT_INCLUDE_DIR "libavformat/avformat.h") if(AVFORMAT_INCLUDE_DIR) - include_directories(${AVFORMAT_INCLUDE_DIR}) - set(CMAKE_REQUIRED_INCLUDES ${AVFORMAT_INCLUDE_DIR}) + include_directories("${AVFORMAT_INCLUDE_DIR}") + set(CMAKE_REQUIRED_INCLUDES "${AVFORMAT_INCLUDE_DIR}") endif(AVFORMAT_INCLUDE_DIR) mark_as_advanced(FORCE AVFORMAT_LIBRARIES AVFORMAT_INCLUDE_DIR) check_include_file("libavformat/avformat.h" HAVE_LIBAVFORMAT_AVFORMAT_H) @@ -250,11 +249,11 @@ if(NOT ZM_NO_FFMPEG) find_library(AVCODEC_LIBRARIES avcodec) if(AVCODEC_LIBRARIES) set(HAVE_LIBAVCODEC 1) - list(APPEND ZM_BIN_LIBS ${AVCODEC_LIBRARIES}) + list(APPEND ZM_BIN_LIBS "${AVCODEC_LIBRARIES}") find_path(AVCODEC_INCLUDE_DIR "libavcodec/avcodec.h") if(AVCODEC_INCLUDE_DIR) - include_directories(${AVCODEC_INCLUDE_DIR}) - set(CMAKE_REQUIRED_INCLUDES ${AVCODEC_INCLUDE_DIR}) + include_directories("${AVCODEC_INCLUDE_DIR}") + set(CMAKE_REQUIRED_INCLUDES "${AVCODEC_INCLUDE_DIR}") endif(AVCODEC_INCLUDE_DIR) mark_as_advanced(FORCE AVCODEC_LIBRARIES AVCODEC_INCLUDE_DIR) check_include_file("libavcodec/avcodec.h" HAVE_LIBAVCODEC_AVCODEC_H) @@ -267,11 +266,11 @@ if(NOT ZM_NO_FFMPEG) find_library(AVDEVICE_LIBRARIES avdevice) if(AVDEVICE_LIBRARIES) set(HAVE_LIBAVDEVICE 1) - list(APPEND ZM_BIN_LIBS ${AVDEVICE_LIBRARIES}) + list(APPEND ZM_BIN_LIBS "${AVDEVICE_LIBRARIES}") find_path(AVDEVICE_INCLUDE_DIR "libavdevice/avdevice.h") if(AVDEVICE_INCLUDE_DIR) - include_directories(${AVDEVICE_INCLUDE_DIR}) - set(CMAKE_REQUIRED_INCLUDES ${AVDEVICE_INCLUDE_DIR}) + include_directories("${AVDEVICE_INCLUDE_DIR}") + set(CMAKE_REQUIRED_INCLUDES "${AVDEVICE_INCLUDE_DIR}") endif(AVDEVICE_INCLUDE_DIR) mark_as_advanced(FORCE AVDEVICE_LIBRARIES AVDEVICE_INCLUDE_DIR) check_include_file("libavdevice/avdevice.h" HAVE_LIBAVDEVICE_AVDEVICE_H) @@ -284,11 +283,11 @@ if(NOT ZM_NO_FFMPEG) find_library(AVUTIL_LIBRARIES avutil) if(AVUTIL_LIBRARIES) set(HAVE_LIBAVUTIL 1) - list(APPEND ZM_BIN_LIBS ${AVUTIL_LIBRARIES}) + list(APPEND ZM_BIN_LIBS "${AVUTIL_LIBRARIES}") find_path(AVUTIL_INCLUDE_DIR "libavutil/avutil.h") if(AVUTIL_INCLUDE_DIR) - include_directories(${AVUTIL_INCLUDE_DIR}) - set(CMAKE_REQUIRED_INCLUDES ${AVUTIL_INCLUDE_DIR}) + include_directories("${AVUTIL_INCLUDE_DIR}") + set(CMAKE_REQUIRED_INCLUDES "${AVUTIL_INCLUDE_DIR}") endif(AVUTIL_INCLUDE_DIR) mark_as_advanced(FORCE AVUTIL_LIBRARIES AVUTIL_INCLUDE_DIR) check_include_file("libavutil/avutil.h" HAVE_LIBAVUTIL_AVUTIL_H) @@ -302,11 +301,11 @@ if(NOT ZM_NO_FFMPEG) find_library(SWSCALE_LIBRARIES swscale) if(SWSCALE_LIBRARIES) set(HAVE_LIBSWSCALE 1) - list(APPEND ZM_BIN_LIBS ${SWSCALE_LIBRARIES}) + list(APPEND ZM_BIN_LIBS "${SWSCALE_LIBRARIES}") find_path(SWSCALE_INCLUDE_DIR "libswscale/swscale.h") if(SWSCALE_INCLUDE_DIR) - include_directories(${SWSCALE_INCLUDE_DIR}) - set(CMAKE_REQUIRED_INCLUDES ${SWSCALE_INCLUDE_DIR}) + include_directories("${SWSCALE_INCLUDE_DIR}") + set(CMAKE_REQUIRED_INCLUDES "${SWSCALE_INCLUDE_DIR}") endif(SWSCALE_INCLUDE_DIR) mark_as_advanced(FORCE SWSCALE_LIBRARIES SWSCALE_INCLUDE_DIR) check_include_file("libswscale/swscale.h" HAVE_LIBSWSCALE_SWSCALE_H) @@ -364,18 +363,18 @@ endif(NOT ZM_NO_MMAP) # Check for authenication functions if(HAVE_OPENSSL_MD5_H) - set(CMAKE_REQUIRED_LIBRARIES ${OPENSSL_LIBRARIES}) - set(CMAKE_REQUIRED_INCLUDES ${OPENSSL_INCLUDE_DIR}) + set(CMAKE_REQUIRED_LIBRARIES "${OPENSSL_LIBRARIES}") + set(CMAKE_REQUIRED_INCLUDES "${OPENSSL_INCLUDE_DIR}") check_prototype_definition(MD5 "unsigned char *MD5(const unsigned char *d, size_t n, unsigned char *md)" "NULL" "openssl/md5.h" HAVE_MD5_OPENSSL) endif(HAVE_OPENSSL_MD5_H) if(HAVE_GNUTLS_OPENSSL_H) - set(CMAKE_REQUIRED_LIBRARIES ${GNUTLS_LIBRARIES}) - set(CMAKE_REQUIRED_INCLUDES ${GNUTLS_INCLUDE_DIR}) + set(CMAKE_REQUIRED_LIBRARIES "${GNUTLS_LIBRARIES}") + set(CMAKE_REQUIRED_INCLUDES "${GNUTLS_INCLUDE_DIR}") check_prototype_definition(MD5 "unsigned char *MD5 (const unsigned char *buf, unsigned long len, unsigned char *md)" "NULL" "gnutls/openssl.h" HAVE_MD5_GNUTLS) endif(HAVE_GNUTLS_OPENSSL_H) if(HAVE_GNUTLS_GNUTLS_H) - set(CMAKE_REQUIRED_LIBRARIES ${GNUTLS_LIBRARIES}) - set(CMAKE_REQUIRED_INCLUDES ${GNUTLS_INCLUDE_DIR}) + set(CMAKE_REQUIRED_LIBRARIES "${GNUTLS_LIBRARIES}") + set(CMAKE_REQUIRED_INCLUDES "${GNUTLS_INCLUDE_DIR}") check_prototype_definition(gnutls_fingerprint "int gnutls_fingerprint (gnutls_digest_algorithm_t algo, const gnutls_datum_t * data, void *result, size_t * result_size)" "0" "stdlib.h;gnutls/gnutls.h" HAVE_DECL_GNUTLS_FINGERPRINT) endif(HAVE_GNUTLS_GNUTLS_H) if(HAVE_MD5_OPENSSL OR HAVE_MD5_GNUTLS) From bed30d32b6a0885b3e46af6e57b0025989ada32b Mon Sep 17 00:00:00 2001 From: Kfir Itzhak Date: Fri, 15 Nov 2013 11:41:26 +0200 Subject: [PATCH 036/107] Remove round() mess --- CMakeLists.txt | 1 - configure.ac | 1 - src/zm.h | 7 ------- zoneminder-config.cmake | 1 - 4 files changed, 10 deletions(-) diff --git a/CMakeLists.txt b/CMakeLists.txt index 47ef21ac6..053d17111 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -85,7 +85,6 @@ check_function_exists("sendfile" HAVE_SENDFILE) check_function_exists("backtrace" HAVE_DECL_BACKTRACE) check_function_exists("backtrace_symbols" HAVE_DECL_BACKTRACE_SYMBOLS) check_function_exists("posix_memalign" HAVE_POSIX_MEMALIGN) -check_prototype_definition("round" "double round (double x)" "0.0" "math.h" HAVE_DECL_ROUND) check_type_size("siginfo_t" HAVE_SIGINFO_T) check_type_size("ucontext_t" HAVE_UCONTEXT_T) diff --git a/configure.ac b/configure.ac index 11e453bdc..946badd52 100644 --- a/configure.ac +++ b/configure.ac @@ -314,7 +314,6 @@ AC_CHECK_HEADERS(sys/shm.h,,,) fi AC_CHECK_HEADERS(zlib.h,,,) -AC_CHECK_DECLS(round,,,[#include ]) if test "$ZM_SSL_LIB" == "openssl"; then AC_CHECK_DECLS(MD5,,AC_MSG_ERROR([zm requires openssl/md5.h - use ZM_SSL_LIB option to select gnutls instead]),[#include #include ]) diff --git a/src/zm.h b/src/zm.h index 4a25936aa..9e4f47b5d 100644 --- a/src/zm.h +++ b/src/zm.h @@ -23,13 +23,6 @@ #include "zm_config.h" #include "zm_logger.h" -extern "C" -{ -#if !HAVE_DECL_ROUND -double round(double); -#endif -} - #include extern const char* self; diff --git a/zoneminder-config.cmake b/zoneminder-config.cmake index a38f73d84..a665a3012 100644 --- a/zoneminder-config.cmake +++ b/zoneminder-config.cmake @@ -15,7 +15,6 @@ #cmakedefine HAVE_DECL_BACKTRACE 1 #cmakedefine HAVE_DECL_BACKTRACE_SYMBOLS 1 #cmakedefine HAVE_POSIX_MEMALIGN 1 -#cmakedefine HAVE_DECL_ROUND 1 #cmakedefine HAVE_SIGINFO_T 1 #cmakedefine HAVE_UCONTEXT_T 1 From 56d3c7504a38256c3499f3cf22dc6e92aa424284 Mon Sep 17 00:00:00 2001 From: Kfir Itzhak Date: Sun, 17 Nov 2013 15:10:35 +0200 Subject: [PATCH 037/107] Put CMAKE_INCLUDE_CURRENT_DIR back in --- CMakeLists.txt | 1 + 1 file changed, 1 insertion(+) diff --git a/CMakeLists.txt b/CMakeLists.txt index 053d17111..205808502 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -31,6 +31,7 @@ set(CMAKE_C_FLAGS_RELEASE "-Wall -D__STDC_CONSTANT_MACROS -O2") set(CMAKE_CXX_FLAGS_RELEASE "-Wall -D__STDC_CONSTANT_MACROS -O2") set(CMAKE_C_FLAGS_DEBUG "-Wall -D__STDC_CONSTANT_MACROS -g") set(CMAKE_CXX_FLAGS_DEBUG "-Wall -D__STDC_CONSTANT_MACROS -g") +set(CMAKE_INCLUDE_CURRENT_DIR ON) set(CMAKE_MODULE_PATH ${CMAKE_MODULE_PATH} "${CMAKE_SOURCE_DIR}/cmake/Modules/") # Modules that we need: From 17129cf078b0cd7ed5f457bada170363c457974d Mon Sep 17 00:00:00 2001 From: Kfir Itzhak Date: Sun, 17 Nov 2013 15:15:54 +0200 Subject: [PATCH 038/107] Fix minor bug introduced by commit cfc9a73851: Do not install mootools symlinks twice for out-of-source installations --- web/CMakeLists.txt | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) diff --git a/web/CMakeLists.txt b/web/CMakeLists.txt index 529ca0b09..a3479f595 100644 --- a/web/CMakeLists.txt +++ b/web/CMakeLists.txt @@ -11,6 +11,8 @@ install(DIRECTORY ajax css graphics includes js lang skins tools views DESTINATI install(FILES index.php README.md DESTINATION "${ZM_WEBDIR}") install(FILES "${CMAKE_CURRENT_BINARY_DIR}/includes/config.php" DESTINATION "${ZM_WEBDIR}/includes") -# Install the mootools symlinks -install(FILES "${CMAKE_CURRENT_BINARY_DIR}/tools/mootools/mootools-core.js" DESTINATION "${ZM_WEBDIR}/tools/mootools") -install(FILES "${CMAKE_CURRENT_BINARY_DIR}/tools/mootools/mootools-more.js" DESTINATION "${ZM_WEBDIR}/tools/mootools") +# Install the mootools symlinks (if its not in the source directory) +if(NOT (CMAKE_BINARY_DIR STREQUAL CMAKE_SOURCE_DIR)) + install(FILES "${CMAKE_CURRENT_BINARY_DIR}/tools/mootools/mootools-core.js" DESTINATION "${ZM_WEBDIR}/tools/mootools") + install(FILES "${CMAKE_CURRENT_BINARY_DIR}/tools/mootools/mootools-more.js" DESTINATION "${ZM_WEBDIR}/tools/mootools") +endif(NOT (CMAKE_BINARY_DIR STREQUAL CMAKE_SOURCE_DIR)) From d223303d28c513ad7b4d07350d32337f3401c7a5 Mon Sep 17 00:00:00 2001 From: Bartek Zdanowski Date: Tue, 19 Nov 2013 21:35:12 +0100 Subject: [PATCH 039/107] Update README.md fixed symlink problem --- README.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/README.md b/README.md index 1b5b62f13..17d7d53e8 100644 --- a/README.md +++ b/README.md @@ -26,7 +26,7 @@ root@host:~# aptitude install -y apache2 mysql-server php5 php5-mysql build-esse root@host:~# git clone https://github.com/ZoneMinder/ZoneMinder.git zoneminder; root@host:~# cd zoneminder; -root@host:~# ln -s distros/ubuntu1204; +root@host:~# ln -s distros/ubuntu1204 debian; root@host:~# dpkg-checkbuilddeps; root@host:~# dpkg-buildpackage; ``` From f6dca0f575bf7782aca41548db4039e6985aad1f Mon Sep 17 00:00:00 2001 From: Bartek Zdanowski Date: Wed, 20 Nov 2013 10:39:51 +0100 Subject: [PATCH 040/107] Fixing bug that stops installation/upgrade if DB is already at current version --- scripts/zmupdate.pl.in | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/scripts/zmupdate.pl.in b/scripts/zmupdate.pl.in index 434f0d9e5..f9565abef 100644 --- a/scripts/zmupdate.pl.in +++ b/scripts/zmupdate.pl.in @@ -360,7 +360,7 @@ if ( $version ) if ( ZM_VERSION eq $version ) { print( "\nDatabase already at version $version, update aborted.\n\n" ); - exit( -1 ); + exit( 0 ); } print( "\nInitiating database upgrade to version ".ZM_VERSION." from version $version\n" ); From eff58367b486ca94ec596262ed82b7531d9dc295 Mon Sep 17 00:00:00 2001 From: Kfir Itzhak Date: Fri, 22 Nov 2013 15:30:05 +0200 Subject: [PATCH 041/107] IPv6 improvements --- src/zm_remote_camera.cpp | 28 ++++++++++++---------------- src/zm_remote_camera.h | 4 +--- src/zm_remote_camera_http.cpp | 29 ++++++++++++++++++++--------- 3 files changed, 33 insertions(+), 28 deletions(-) diff --git a/src/zm_remote_camera.cpp b/src/zm_remote_camera.cpp index 3b63cdbd8..4ede09e69 100644 --- a/src/zm_remote_camera.cpp +++ b/src/zm_remote_camera.cpp @@ -35,6 +35,10 @@ RemoteCamera::RemoteCamera( int p_id, const std::string &p_protocol, const std:: RemoteCamera::~RemoteCamera() { + if(hp != NULL) { + freeaddrinfo(hp); + hp = NULL; + } } void RemoteCamera::Initialise() @@ -61,23 +65,15 @@ void RemoteCamera::Initialise() auth64 = base64Encode( auth ); } - if ( !hp ) - { - struct addrinfo hints; - memset(&hints, 0, sizeof(hints)); - hints.ai_family = PF_UNSPEC; - hints.ai_flags = AI_PASSIVE; - hints.ai_socktype = SOCK_STREAM; + struct addrinfo hints; + memset(&hints, 0, sizeof(hints)); + hints.ai_family = AF_UNSPEC; + hints.ai_socktype = SOCK_STREAM; - if ( getaddrinfo(host.c_str(), NULL, &hints, &hp) != 0 ) - { - Fatal( "Can't gethostbyname(%s): %s", host.c_str(), strerror(h_errno) ); - } - //memcpy((char *)&sa.sin_addr, (char *)hp->h_addr, hp->h_length); - //sa.sin_family = hp->h_addrtype; - //sa.sin_port = htons(atoi(port.c_str())); - sa = hp->ai_addr; - ((struct sockaddr_in *)sa)->sin_port = htons(atoi(port.c_str())); + int ret = getaddrinfo(host.c_str(), port.c_str(), &hints, &hp); + if ( ret != 0 ) + { + Fatal( "Can't getaddrinfo(%s port %s): %s", host.c_str(), port.c_str(), gai_strerror(ret) ); } } diff --git a/src/zm_remote_camera.h b/src/zm_remote_camera.h index 19cffdcf0..2738e4a5d 100644 --- a/src/zm_remote_camera.h +++ b/src/zm_remote_camera.h @@ -23,7 +23,6 @@ #include "zm_camera.h" #include -//#include #include #include #include @@ -43,8 +42,7 @@ protected: std::string auth64; protected: - struct addrinfo *hp; - struct sockaddr *sa; + struct addrinfo *hp; public: RemoteCamera( int p_id, const std::string &p_proto, const std::string &p_host, const std::string &p_port, const std::string &p_path, int p_width, int p_height, int p_colours, int p_brightness, int p_contrast, int p_hue, int p_colour, bool p_capture ); diff --git a/src/zm_remote_camera_http.cpp b/src/zm_remote_camera_http.cpp index bf50432f0..deae375db 100644 --- a/src/zm_remote_camera_http.cpp +++ b/src/zm_remote_camera_http.cpp @@ -88,22 +88,34 @@ void RemoteCameraHttp::Initialise() int RemoteCameraHttp::Connect() { - if ( sd < 0 ) + struct addrinfo *p; + + for(p = hp; p != NULL; p = p->ai_next) { - sd = socket( hp->ai_family, SOCK_STREAM, 0 ); + sd = socket( p->ai_family, p->ai_socktype, p->ai_protocol ); if ( sd < 0 ) { - Error( "Can't create socket: %s", strerror(errno) ); - return( -1 ); + Warning("Can't create socket: %s", strerror(errno) ); + continue; } - if ( connect( sd, (struct sockaddr *)sa, hp->ai_addrlen ) < 0 ) + if ( connect( sd, p->ai_addr, p->ai_addrlen ) < 0 ) { - Error( "Can't connect to remote camera: %s", strerror(errno) ); - Disconnect(); - return( -1 ); + close(sd); + sd = -1; + Warning("Can't connect to remote camera: %s", strerror(errno) ); + continue; } + + /* If we got here, we must have connected successfully */ + break; } + + if(p == NULL) { + Error("Unable to connect to the remote camera, aborting"); + return( -1 ); + } + Debug( 3, "Connected to host, socket = %d", sd ); return( sd ); } @@ -112,7 +124,6 @@ int RemoteCameraHttp::Disconnect() { close( sd ); sd = -1; - freeaddrinfo(hp); Debug( 3, "Disconnected from host" ); return( 0 ); } From 89689d8f3f13735d7da3b0f03804f57dd81f6b16 Mon Sep 17 00:00:00 2001 From: Kfir Itzhak Date: Fri, 22 Nov 2013 20:23:58 +0200 Subject: [PATCH 042/107] Correctly fix mootools symlinks being installed twice in cmake this time --- web/CMakeLists.txt | 5 ----- 1 file changed, 5 deletions(-) diff --git a/web/CMakeLists.txt b/web/CMakeLists.txt index a3479f595..dfd37c48a 100644 --- a/web/CMakeLists.txt +++ b/web/CMakeLists.txt @@ -11,8 +11,3 @@ install(DIRECTORY ajax css graphics includes js lang skins tools views DESTINATI install(FILES index.php README.md DESTINATION "${ZM_WEBDIR}") install(FILES "${CMAKE_CURRENT_BINARY_DIR}/includes/config.php" DESTINATION "${ZM_WEBDIR}/includes") -# Install the mootools symlinks (if its not in the source directory) -if(NOT (CMAKE_BINARY_DIR STREQUAL CMAKE_SOURCE_DIR)) - install(FILES "${CMAKE_CURRENT_BINARY_DIR}/tools/mootools/mootools-core.js" DESTINATION "${ZM_WEBDIR}/tools/mootools") - install(FILES "${CMAKE_CURRENT_BINARY_DIR}/tools/mootools/mootools-more.js" DESTINATION "${ZM_WEBDIR}/tools/mootools") -endif(NOT (CMAKE_BINARY_DIR STREQUAL CMAKE_SOURCE_DIR)) From 55ea6745f1fc5c22fd66adbcbd7714fc6112afd3 Mon Sep 17 00:00:00 2001 From: Kfir Itzhak Date: Fri, 22 Nov 2013 23:50:59 +0200 Subject: [PATCH 043/107] Revert "Correctly fix mootools symlinks being installed twice in cmake this time" This reverts commit 89689d8f3f13735d7da3b0f03804f57dd81f6b16. --- web/CMakeLists.txt | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/web/CMakeLists.txt b/web/CMakeLists.txt index dfd37c48a..a3479f595 100644 --- a/web/CMakeLists.txt +++ b/web/CMakeLists.txt @@ -11,3 +11,8 @@ install(DIRECTORY ajax css graphics includes js lang skins tools views DESTINATI install(FILES index.php README.md DESTINATION "${ZM_WEBDIR}") install(FILES "${CMAKE_CURRENT_BINARY_DIR}/includes/config.php" DESTINATION "${ZM_WEBDIR}/includes") +# Install the mootools symlinks (if its not in the source directory) +if(NOT (CMAKE_BINARY_DIR STREQUAL CMAKE_SOURCE_DIR)) + install(FILES "${CMAKE_CURRENT_BINARY_DIR}/tools/mootools/mootools-core.js" DESTINATION "${ZM_WEBDIR}/tools/mootools") + install(FILES "${CMAKE_CURRENT_BINARY_DIR}/tools/mootools/mootools-more.js" DESTINATION "${ZM_WEBDIR}/tools/mootools") +endif(NOT (CMAKE_BINARY_DIR STREQUAL CMAKE_SOURCE_DIR)) From 88f2bc6b630194b8c688ea579337039f78c30abb Mon Sep 17 00:00:00 2001 From: Kfir Itzhak Date: Sun, 24 Nov 2013 15:37:47 +0200 Subject: [PATCH 044/107] Fix zmc crashing on shutdown (for remote http cameras) caused by content_length sign mess --- src/zm_remote_camera_http.cpp | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/src/zm_remote_camera_http.cpp b/src/zm_remote_camera_http.cpp index deae375db..07d0e6a41 100644 --- a/src/zm_remote_camera_http.cpp +++ b/src/zm_remote_camera_http.cpp @@ -441,7 +441,7 @@ int RemoteCameraHttp::GetResponse() if ( content_length ) { - while ( buffer.size() < (unsigned int)content_length ) + while ( (long)buffer.size() < content_length ) { int buffer_len = ReadData( buffer ); if ( buffer_len == 0 ) @@ -973,7 +973,7 @@ int RemoteCameraHttp::GetResponse() if ( content_length ) { - while ( buffer.size() < (unsigned int)content_length ) + while ( (long)buffer.size() < content_length ) { //int buffer_len = ReadData( buffer, content_length-buffer.size() ); int buffer_len = ReadData( buffer ); @@ -1125,7 +1125,7 @@ int RemoteCameraHttp::Capture( Image &image ) } case X_RGB : { - if ( (unsigned int)content_length != image.Size() ) + if ( content_length != (long)image.Size() ) { Error( "Image length mismatch, expected %d bytes, content length was %d", image.Size(), content_length ); Disconnect(); From d50169c38355ca1bcf412623b8fe46c0f689c623 Mon Sep 17 00:00:00 2001 From: Kfir Itzhak Date: Tue, 26 Nov 2013 16:34:26 +0200 Subject: [PATCH 045/107] Added SWScale wrapper class and FFMPEG PixelFormat match function --- src/zm_ffmpeg.cpp | 199 +++++++++++++++++++++++++++++++++++++++++++++- src/zm_ffmpeg.h | 35 +++++++- 2 files changed, 230 insertions(+), 4 deletions(-) diff --git a/src/zm_ffmpeg.cpp b/src/zm_ffmpeg.cpp index 577a188ca..2369cc745 100644 --- a/src/zm_ffmpeg.cpp +++ b/src/zm_ffmpeg.cpp @@ -17,8 +17,201 @@ * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. */ -#if HAVE_LIBAVCODEC - #include "zm_ffmpeg.h" +#include "zm_image.h" +#include "zm_rgb.h" -#endif // HAVE_LIBAVCODEC +#if HAVE_LIBAVCODEC || HAVE_LIBAVUTIL || HAVE_LIBSWSCALE + +#if HAVE_LIBAVUTIL +enum PixelFormat GetFFMPEGPixelFormat(unsigned int p_colours, unsigned p_subpixelorder) { + enum PixelFormat pf; + + Debug(8,"Colours: %d SubpixelOrder: %d",p_colours,p_subpixelorder); + + switch(p_colours) { + case ZM_COLOUR_RGB24: + { + if(p_subpixelorder == ZM_SUBPIX_ORDER_BGR) { + /* BGR subpixel order */ + pf = PIX_FMT_BGR24; + } else { + /* Assume RGB subpixel order */ + pf = PIX_FMT_RGB24; + } + break; + } + case ZM_COLOUR_RGB32: + { + if(p_subpixelorder == ZM_SUBPIX_ORDER_ARGB) { + /* ARGB subpixel order */ + pf = PIX_FMT_ARGB; + } else if(p_subpixelorder == ZM_SUBPIX_ORDER_ABGR) { + /* ABGR subpixel order */ + pf = PIX_FMT_ABGR; + } else if(p_subpixelorder == ZM_SUBPIX_ORDER_BGRA) { + /* BGRA subpixel order */ + pf = PIX_FMT_BGRA; + } else { + /* Assume RGBA subpixel order */ + pf = PIX_FMT_RGBA; + } + break; + } + case ZM_COLOUR_GRAY8: + pf = PIX_FMT_GRAY8; + break; + default: + Panic("Unexpected colours: %d",p_colours); + pf = PIX_FMT_GRAY8; /* Just to shush gcc variable may be unused warning */ + break; + } + + return pf; +} +#endif // HAVE_LIBAVUTIL + +#if HAVE_LIBSWSCALE && HAVE_LIBAVUTIL +SWScale::SWScale() : gotdefaults(false), swscale_ctx(NULL), input_avframe(NULL), output_avframe(NULL) { + Debug(4,"SWScale object created"); + + /* Allocate AVFrame for the input */ + input_avframe = avcodec_alloc_frame(); + if(input_avframe == NULL) { + Fatal("Failed allocating AVFrame for the input"); + } + + /* Allocate AVFrame for the output */ + output_avframe = avcodec_alloc_frame(); + if(output_avframe == NULL) { + Fatal("Failed allocating AVFrame for the output"); + } +} + +SWScale::~SWScale() { + + /* Free up everything */ + av_free(input_avframe); + input_avframe = NULL; + + av_free(output_avframe); + output_avframe = NULL; + + if(swscale_ctx) { + sws_freeContext(swscale_ctx); + swscale_ctx = NULL; + } + + Debug(4,"SWScale object destroyed"); +} + +int SWScale::SetDefaults(enum PixelFormat in_pf, enum PixelFormat out_pf, unsigned int width, unsigned int height) { + + /* Assign the defaults */ + default_input_pf = in_pf; + default_output_pf = out_pf; + default_width = width; + default_height = height; + + gotdefaults = true; + + return 0; +} + +int SWScale::Convert(const uint8_t* in_buffer, const size_t in_buffer_size, uint8_t* out_buffer, const size_t out_buffer_size, enum PixelFormat in_pf, enum PixelFormat out_pf, unsigned int width, unsigned int height) { + /* Parameter checking */ + if(in_buffer == NULL || out_buffer == NULL) { + Error("NULL Input or output buffer"); + return -1; + } + if(in_pf == 0 || out_pf == 0) { + Error("Invalid input or output pixel formats"); + return -2; + } + if(!width || !height) { + Error("Invalid width or height"); + return -3; + } + + /* Warn if the input or output pixelformat is not supported */ + if(!sws_isSupportedInput(in_pf)) { + Warning("swscale does not support the input format: %c%c%c%c",(in_pf)&0xff,((in_pf)&0xff),((in_pf>>16)&0xff),((in_pf>>24)&0xff)); + } + if(!sws_isSupportedOutput(out_pf)) { + Warning("swscale does not support the output format: %c%c%c%c",(out_pf)&0xff,((out_pf>>8)&0xff),((out_pf>>16)&0xff),((out_pf>>24)&0xff)); + } + + /* Check the buffer sizes */ + size_t insize = avpicture_get_size(in_pf, width, height); + if(insize != in_buffer_size) { + Error("The input buffer size does not match the expected size for the input format. Required: %d Available: %d", insize, in_buffer_size); + return -4; + } + size_t outsize = avpicture_get_size(out_pf, width, height); + if(outsize < out_buffer_size) { + Error("The output buffer is undersized for the output format. Required: %d Available: %d", outsize, out_buffer_size); + return -5; + } + + /* Get the context */ + swscale_ctx = sws_getCachedContext( NULL, width, height, in_pf, width, height, out_pf, 0, NULL, NULL, NULL ); + if(swscale_ctx == NULL) { + Error("Failed getting swscale context"); + return -6; + } + + /* Fill in the buffers */ + if(!avpicture_fill( (AVPicture*)input_avframe, (uint8_t*)in_buffer, in_pf, width, height ) ) { + Error("Failed filling input frame with input buffer"); + return -7; + } + if(!avpicture_fill( (AVPicture*)output_avframe, out_buffer, out_pf, width, height ) ) { + Error("Failed filling output frame with output buffer"); + return -8; + } + + /* Do the conversion */ + if(!sws_scale(swscale_ctx, input_avframe->data, input_avframe->linesize, 0, height, output_avframe->data, output_avframe->linesize ) ) { + Error("swscale conversion failed"); + return -10; + } + + return 0; +} + +int SWScale::Convert(const Image* img, uint8_t* out_buffer, const size_t out_buffer_size, enum PixelFormat in_pf, enum PixelFormat out_pf, unsigned int width, unsigned int height) { + if(img->Width() != width) { + Error("Source image width differs. Source: %d Output: %d",img->Width(), width); + return -12; + } + + if(img->Height() != height) { + Error("Source image height differs. Source: %d Output: %d",img->Height(), height); + return -13; + } + + return Convert(img->Buffer(),img->Size(),out_buffer,out_buffer_size,in_pf,out_pf,width,height); +} + +int SWScale::ConvertDefaults(const Image* img, uint8_t* out_buffer, const size_t out_buffer_size) { + + if(!gotdefaults) { + Error("Defaults are not set"); + return -24; + } + + return Convert(img,out_buffer,out_buffer_size,default_input_pf,default_output_pf,default_width,default_height); +} + +int SWScale::ConvertDefaults(const uint8_t* in_buffer, const size_t in_buffer_size, uint8_t* out_buffer, const size_t out_buffer_size) { + + if(!gotdefaults) { + Error("Defaults are not set"); + return -24; + } + + return Convert(in_buffer,in_buffer_size,out_buffer,out_buffer_size,default_input_pf,default_output_pf,default_width,default_height); +} +#endif // HAVE_LIBSWSCALE && HAVE_LIBAVUTIL + +#endif // HAVE_LIBAVCODEC || HAVE_LIBAVUTIL || HAVE_LIBSWSCALE diff --git a/src/zm_ffmpeg.h b/src/zm_ffmpeg.h index 5fd3fe5b6..0a4837d67 100644 --- a/src/zm_ffmpeg.h +++ b/src/zm_ffmpeg.h @@ -20,6 +20,8 @@ #ifndef ZM_FFMPEG_H #define ZM_FFMPEG_H #include +#include "zm.h" +#include "zm_image.h" #ifdef __cplusplus extern "C" { @@ -94,7 +96,38 @@ extern "C" { #ifndef SWS_CPU_CAPS_SSE2 #define SWS_CPU_CAPS_SSE2 0x02000000 #endif - + + +#if HAVE_LIBAVUTIL +enum PixelFormat GetFFMPEGPixelFormat(unsigned int p_colours, unsigned p_subpixelorder); +#endif // HAVE_LIBAVUTIL + + +/* SWScale wrapper class to make our life easier and reduce code reuse */ +#if HAVE_LIBSWSCALE && HAVE_LIBAVUTIL +class SWScale { +public: + SWScale(); + ~SWScale(); + int SetDefaults(enum PixelFormat in_pf, enum PixelFormat out_pf, unsigned int width, unsigned int height); + int ConvertDefaults(const Image* img, uint8_t* out_buffer, const size_t out_buffer_size); + int ConvertDefaults(const uint8_t* in_buffer, const size_t in_buffer_size, uint8_t* out_buffer, const size_t out_buffer_size); + int Convert(const Image* img, uint8_t* out_buffer, const size_t out_buffer_size, enum PixelFormat in_pf, enum PixelFormat out_pf, unsigned int width, unsigned int height); + int Convert(const uint8_t* in_buffer, const size_t in_buffer_size, uint8_t* out_buffer, const size_t out_buffer_size, enum PixelFormat in_pf, enum PixelFormat out_pf, unsigned int width, unsigned int height); + +protected: + bool gotdefaults; + struct SwsContext* swscale_ctx; + AVFrame* input_avframe; + AVFrame* output_avframe; + enum PixelFormat default_input_pf; + enum PixelFormat default_output_pf; + unsigned int default_width; + unsigned int default_height; +}; +#endif // HAVE_LIBSWSCALE && HAVE_LIBAVUTIL + + #endif // ( HAVE_LIBAVUTIL_AVUTIL_H || HAVE_LIBAVCODEC_AVCODEC_H || HAVE_LIBAVFORMAT_AVFORMAT_H || HAVE_LIBAVDEVICE_AVDEVICE_H ) #endif // ZM_FFMPEG_H From d0debfa450ae37e186fa31429c49a143a63843b6 Mon Sep 17 00:00:00 2001 From: Andrew Bauer Date: Tue, 26 Nov 2013 15:21:28 -0600 Subject: [PATCH 046/107] Update zoneminder.in The freshen database feature does not appear to be necessary and may even corrupt the dB under certain conditions. Commenting out. --- distros/redhat/zoneminder.in | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/distros/redhat/zoneminder.in b/distros/redhat/zoneminder.in index 6fb4fef6b..917251548 100755 --- a/distros/redhat/zoneminder.in +++ b/distros/redhat/zoneminder.in @@ -82,7 +82,8 @@ zmstatus() zmupdate() { if [ -x $ZM_PATH_BIN/zmupdate.pl ]; then - $ZM_PATH_BIN/zmupdate.pl -f +# Commenting out as it is not needed. Leaving as a placeholder for future use. +# $ZM_PATH_BIN/zmupdate.pl -f fi } From 560d9bd809e40e804d92852ad9c01779bea1c55d Mon Sep 17 00:00:00 2001 From: Edward Barnard Date: Thu, 28 Nov 2013 21:32:06 +0000 Subject: [PATCH 047/107] RtpSource can now distinguish between payload types and handles some properly. --- src/zm_rtp_source.cpp | 106 ++++++++++++++++++++++++++---------------- src/zm_rtp_source.h | 14 +++++- src/zm_rtsp.cpp | 14 ++++-- 3 files changed, 91 insertions(+), 43 deletions(-) diff --git a/src/zm_rtp_source.cpp b/src/zm_rtp_source.cpp index 92c4f3d34..27e633bb5 100644 --- a/src/zm_rtp_source.cpp +++ b/src/zm_rtp_source.cpp @@ -24,12 +24,19 @@ #include -RtpSource::RtpSource( int id, const std::string &localHost, int localPortBase, const std::string &remoteHost, int remotePortBase, uint32_t ssrc, uint16_t seq, uint32_t rtpClock, uint32_t rtpTime ) : +#if LIBAVCODEC_VERSION_INT >= AV_VERSION_INT(54,25,0) + #define _AVCODECID AVCodecID +#else + #define _AVCODECID CodecID +#endif + +RtpSource::RtpSource( int id, const std::string &localHost, int localPortBase, const std::string &remoteHost, int remotePortBase, uint32_t ssrc, uint16_t seq, uint32_t rtpClock, uint32_t rtpTime, _AVCODECID codecId ) : mId( id ), mSsrc( ssrc ), mLocalHost( localHost ), mRemoteHost( remoteHost ), mRtpClock( rtpClock ), + mCodecId( codecId ), mFrame( 65536 ), mFrameCount( 0 ), mFrameGood( true ), @@ -254,6 +261,7 @@ bool RtpSource::handlePacket( const unsigned char *packet, size_t packetLen ) const RtpDataHeader *rtpHeader; rtpHeader = (RtpDataHeader *)packet; bool fragmentEnd = false; + int rtpHeaderSize = 12 + rtpHeader->cc * 4; // Each RTP packet delivers only one NAL. It can be either the Single NAL // ( in that case it must be in one packet ) or the Fragmentation NALs @@ -261,45 +269,63 @@ bool RtpSource::handlePacket( const unsigned char *packet, size_t packetLen ) if ( updateSeq( ntohs(rtpHeader->seqN) ) ) { - Hexdump( 4, packet+sizeof(RtpDataHeader), 16 ); - if ( ((packet[sizeof(RtpDataHeader)] & 0x1f) == 28 && - (packet[sizeof(RtpDataHeader)+1] & 0x80)) || - ((packet[sizeof(RtpDataHeader)] & 0x1f) != 28 && - prevM && rtpHeader->m) ) - mFrameGood = true; // This means that if packet is in sequence - // and is single NAL with mark set (and prev packet - // was NAL with mark set or it is Fragmentation NAL with - // Start bit set then we assume that sequence - // was restored and we can handle packet - if ( mFrameGood ) + Hexdump( 4, packet+rtpHeaderSize, 16 ); + + if( mCodecId == CODEC_ID_H264 ) { - // check if there fragmentation NAL - if ( (packet[sizeof(RtpDataHeader)] & 0x1f) == 28 ) - { - // is this NAL the first NAL in fragmentation sequence - if ( packet[sizeof(RtpDataHeader)+1] & 0x80 ) - { - // if there is any data in frame then we must - // discard it because that frame was incomplete - if ( mFrame.size() ) - mFrame.clear(); - // Now we will form new header of frame - mFrame.append("\x0\x0\x1\x0",4); - *(mFrame+3) = (packet[sizeof(RtpDataHeader)+1] & 0x1f) | - (packet[sizeof(RtpDataHeader)] & 0x60); - } - else - if ( packet[sizeof(RtpDataHeader)+1] & 0x40 ) - fragmentEnd = true; - mFrame.append(packet+sizeof(RtpDataHeader)+2, packetLen-sizeof(RtpDataHeader)-2); - } - else - { -// mframe.clear(); - if ( !mFrame.size() ) - mFrame.append("\x0\x0\x1",3); - mFrame.append( packet+sizeof(RtpDataHeader), packetLen-sizeof(RtpDataHeader) ); - } + // Is packet start of frangented sequence + bool isFragmentedFirst = (packet[rtpHeaderSize] & 0x1f == 28) && (packet[rtpHeaderSize+1] & 0x80); + // Are we back in sequence + bool hasRecovered = (packet[rtpHeaderSize] & 0x1f != 28) && prevM && rtpHeader->m; + if ( isFragmentedFirst || hasRecovered ) + mFrameGood = true; + + if ( mFrameGood ) + { + int nalType = (packet[rtpHeaderSize] & 0x1f); + + // NAL type FU-A (Fragmented) + if ( nalType == 28 ) + { + // Is this NAL the first NAL in fragmentation sequence + if ( packet[rtpHeaderSize+1] & 0x80 ) + { + // It's the start of a new packet so clean up any old data + if ( mFrame.size() ) + mFrame.clear(); + // Now we will form new header of frame + mFrame.append( "\x0\x0\x1\x0", 4 ); + // Reconstruct NAL header from FU headers + *(mFrame+3) = (packet[rtpHeaderSize+1] & 0x1f) | + (packet[rtpHeaderSize] & 0xe0); + } + // Is this the end of a fragmentation sequence + else if ( packet[rtpHeaderSize+1] & 0x40 ) + fragmentEnd = true; + mFrame.append( packet+rtpHeaderSize+2, packetLen-rtpHeaderSize-2 ); + } + else + { + if ( nalType < 1 || nalType > 23 ) + Error( "Unsupported NAL packet type recieved. Passing to decoder anyway." ) + + //mFrame.clear(); + if ( !mFrame.size() ) + mFrame.append( "\x0\x0\x1", 3 ); + mFrame.append( packet+rtpHeaderSize, packetLen-rtpHeaderSize ); + } + } + } + else if( mCodecId == CODEC_ID_MPEG4 ) + { + if( rtpHeader->m ) + mFrame.append( "\x0\x0\x1",3 ); + mFrame.append( packet+rtpHeaderSize, packetLen-rtpHeaderSize ); + } + else + { + // Let's just hope this works + mFrame.append( packet+rtpHeaderSize, packetLen-rtpHeaderSize ); } Hexdump( 4, mFrame.head(), 16 ); @@ -368,3 +394,5 @@ bool RtpSource::getFrame( Buffer &buffer ) Debug( 3, "Copied %d bytes", buffer.size() ); return( true ); } + +#undef _AVCODECID \ No newline at end of file diff --git a/src/zm_rtp_source.h b/src/zm_rtp_source.h index 4ffd6e101..668448528 100644 --- a/src/zm_rtp_source.h +++ b/src/zm_rtp_source.h @@ -21,12 +21,19 @@ #define ZM_RTP_SOURCE_H #include "zm_buffer.h" +#include "zm_ffmpeg.h" #include "zm_thread.h" #include #include #include +#if LIBAVCODEC_VERSION_INT >= AV_VERSION_INT(54,25,0) + #define _AVCODECID AVCodecID +#else + #define _AVCODECID CodecID +#endif + struct RtpDataHeader; class RtpSource @@ -81,6 +88,8 @@ private: uint32_t mLostPackets; uint8_t mLostFraction; + _AVCODECID mCodecId + Buffer mFrame; int mFrameCount; bool mFrameGood; @@ -92,7 +101,8 @@ private: void init( uint16_t seq ); public: - RtpSource( int id, const std::string &localHost, int localPortBase, const std::string &remoteHost, int remotePortBase, uint32_t ssrc, uint16_t seq, uint32_t rtpClock, uint32_t rtpTime ); + RtpSource( int id, const std::string &localHost, int localPortBase, const std::string &remoteHost, int remotePortBase, uint32_t ssrc, uint16_t seq, uint32_t rtpClock, uint32_t rtpTime, _AVCODECID codecId ); + bool updateSeq( uint16_t seq ); void updateJitter( const RtpDataHeader *header ); void updateRtcpData( uint32_t ntpTimeSecs, uint32_t ntpTimeFrac, uint32_t rtpTime ); @@ -177,4 +187,6 @@ public: } }; +#undef _AVCODECID + #endif // ZM_RTP_SOURCE_H diff --git a/src/zm_rtsp.cpp b/src/zm_rtsp.cpp index 3d82e7f35..e349dcf9f 100644 --- a/src/zm_rtsp.cpp +++ b/src/zm_rtsp.cpp @@ -330,6 +330,13 @@ int RtspThread::run() uint32_t rtpClock = 0; std::string trackUrl = mUrl; + + #if LIBAVCODEC_VERSION_INT >= AV_VERSION_INT(54,25,0) + enum AVCodecID codecId; + #else + enum CodecID codecId; + #endif + if ( mFormatContext->nb_streams >= 1 ) { for ( unsigned int i = 0; i < mFormatContext->nb_streams; i++ ) @@ -343,6 +350,7 @@ int RtspThread::run() { trackUrl += "/"+mediaDesc->getControlUrl(); rtpClock = mediaDesc->getClock(); + codecId = mFormatContext->streams[i]->codec->codec_id; // Hackery pokery //rtpClock = mFormatContext->streams[i]->codec->sample_rate; break; @@ -500,7 +508,7 @@ int RtspThread::run() { case RTP_UNICAST : { - RtpSource *source = new RtpSource( mId, "", localPorts[0], mHost, remotePorts[0], ssrc, seq, rtpClock, rtpTime ); + RtpSource *source = new RtpSource( mId, "", localPorts[0], mHost, remotePorts[0], ssrc, seq, rtpClock, rtpTime, codecId ); mSources[ssrc] = source; RtpDataThread rtpDataThread( *this, *source ); RtpCtrlThread rtpCtrlThread( *this, *source ); @@ -545,7 +553,7 @@ int RtspThread::run() case RTP_RTSP : case RTP_RTSP_HTTP : { - RtpSource *source = new RtpSource( mId, "", remoteChannels[0], mHost, remoteChannels[0], ssrc, seq, rtpClock, rtpTime ); + RtpSource *source = new RtpSource( mId, "", remoteChannels[0], mHost, remoteChannels[0], ssrc, seq, rtpClock, rtpTime, codecId ); mSources[ssrc] = source; // These never actually run RtpDataThread rtpDataThread( *this, *source ); @@ -673,7 +681,7 @@ int RtspThread::run() } case RTP_MULTICAST : { - RtpSource *source = new RtpSource( mId, localHost, localPorts[0], mHost, remotePorts[0], ssrc, seq, rtpClock, rtpTime ); + RtpSource *source = new RtpSource( mId, localHost, localPorts[0], mHost, remotePorts[0], ssrc, seq, rtpClock, rtpTime, codecId ); mSources[ssrc] = source; RtpDataThread rtpDataThread( *this, *source ); RtpCtrlThread rtpCtrlThread( *this, *source ); From 3665c3ee3ac0dd60969e2b50255274d6e55b7062 Mon Sep 17 00:00:00 2001 From: Edward Barnard Date: Thu, 28 Nov 2013 23:07:46 +0000 Subject: [PATCH 048/107] Fixed bug in mpeg4 depacketizer and RTCP implementation. --- src/zm_rtp_ctrl.cpp | 7 ++++++- src/zm_rtp_source.cpp | 10 ++++++---- src/zm_rtp_source.h | 2 +- 3 files changed, 13 insertions(+), 6 deletions(-) diff --git a/src/zm_rtp_ctrl.cpp b/src/zm_rtp_ctrl.cpp index 1d88482d4..01a0b535a 100644 --- a/src/zm_rtp_ctrl.cpp +++ b/src/zm_rtp_ctrl.cpp @@ -143,8 +143,13 @@ int RtpCtrlThread::recvPacket( const unsigned char *packet, ssize_t packetLen ) mStop = true; break; } - case RTCP_RR : case RTCP_APP : + { + // Ignoring as per RFC 3550 + Debug( 5, "Received RTCP_APP packet, ignoring."); + break; + } + case RTCP_RR : default : { Error( "Received unexpected packet type %d, ignoring", pt ); diff --git a/src/zm_rtp_source.cpp b/src/zm_rtp_source.cpp index 27e633bb5..865ac99f2 100644 --- a/src/zm_rtp_source.cpp +++ b/src/zm_rtp_source.cpp @@ -68,6 +68,9 @@ RtpSource::RtpSource( int id, const std::string &localHost, int localPortBase, c mLastSrTimeReal = tvZero(); mLastSrTimeNtp = tvZero(); mLastSrTimeRtp = 0; + + if(mCodecId != CODEC_ID_MPEG4 && mCodecId != CODEC_ID_MPEG4) + Warning( "The device is using a codec that may not be supported. Do not be surprised if things don't work." ); } void RtpSource::init( uint16_t seq ) @@ -307,9 +310,8 @@ bool RtpSource::handlePacket( const unsigned char *packet, size_t packetLen ) else { if ( nalType < 1 || nalType > 23 ) - Error( "Unsupported NAL packet type recieved. Passing to decoder anyway." ) + Warning( "Unsupported NAL packet type recieved. Passing to decoder anyway." ) - //mFrame.clear(); if ( !mFrame.size() ) mFrame.append( "\x0\x0\x1", 3 ); mFrame.append( packet+rtpHeaderSize, packetLen-rtpHeaderSize ); @@ -318,8 +320,8 @@ bool RtpSource::handlePacket( const unsigned char *packet, size_t packetLen ) } else if( mCodecId == CODEC_ID_MPEG4 ) { - if( rtpHeader->m ) - mFrame.append( "\x0\x0\x1",3 ); + if( rtpHeader->m && !prevM ) + mFrame.append( "\x0\x0\x1", 3 ); mFrame.append( packet+rtpHeaderSize, packetLen-rtpHeaderSize ); } else diff --git a/src/zm_rtp_source.h b/src/zm_rtp_source.h index 668448528..8d1f7da4f 100644 --- a/src/zm_rtp_source.h +++ b/src/zm_rtp_source.h @@ -88,7 +88,7 @@ private: uint32_t mLostPackets; uint8_t mLostFraction; - _AVCODECID mCodecId + _AVCODECID mCodecId; Buffer mFrame; int mFrameCount; From 80d172efa1e339a2539436715abe865c5c6832ba Mon Sep 17 00:00:00 2001 From: Edward Barnard Date: Fri, 29 Nov 2013 16:15:56 +0000 Subject: [PATCH 049/107] The last packet of a fragmented mpeg4 frame is no longer rejected. --- src/zm_rtp_source.cpp | 11 ++--------- 1 file changed, 2 insertions(+), 9 deletions(-) diff --git a/src/zm_rtp_source.cpp b/src/zm_rtp_source.cpp index 865ac99f2..9ad10969c 100644 --- a/src/zm_rtp_source.cpp +++ b/src/zm_rtp_source.cpp @@ -318,17 +318,10 @@ bool RtpSource::handlePacket( const unsigned char *packet, size_t packetLen ) } } } - else if( mCodecId == CODEC_ID_MPEG4 ) - { - if( rtpHeader->m && !prevM ) - mFrame.append( "\x0\x0\x1", 3 ); - mFrame.append( packet+rtpHeaderSize, packetLen-rtpHeaderSize ); - } else - { - // Let's just hope this works + // Works for mpeg4 and hopefully anything else that come its way mFrame.append( packet+rtpHeaderSize, packetLen-rtpHeaderSize ); - } + Hexdump( 4, mFrame.head(), 16 ); if ( rtpHeader->m || fragmentEnd ) From d4babd23f1f1c36e32e5c027d1c886485c25f43e Mon Sep 17 00:00:00 2001 From: Philipp Rehs Date: Sat, 30 Nov 2013 18:13:02 +0100 Subject: [PATCH 050/107] Fix checkJsonError messages The $value string was not set inside checkJsonError, so it was not possible to see the data which caused the error --- web/includes/functions.php | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/web/includes/functions.php b/web/includes/functions.php index 30ef63281..31fafc3fe 100644 --- a/web/includes/functions.php +++ b/web/includes/functions.php @@ -2225,10 +2225,11 @@ function isVector ( &$array ) return( true ); } -function checkJsonError() +function checkJsonError($value) { if ( function_exists('json_last_error') ) { + $value = var_export($value,true); switch( json_last_error() ) { case JSON_ERROR_DEPTH : @@ -2252,7 +2253,7 @@ function jsonEncode( &$value ) if ( function_exists('json_encode') ) { $string = json_encode( $value ); - checkJsonError(); + checkJsonError($value); return( $string ); } @@ -2293,7 +2294,7 @@ function jsonDecode( $value ) if ( function_exists('json_decode') ) { $object = json_decode( $value, true ); - checkJsonError(); + checkJsonError($value); return( $object ); } From 55dadcf758275d196b869de3a74a64e376cb4374 Mon Sep 17 00:00:00 2001 From: Philipp Rehs Date: Sat, 30 Nov 2013 20:46:59 +0100 Subject: [PATCH 051/107] Network Detection Support for Wansview Basis support for Wansview Cams Tested with NC541W --- web/skins/classic/views/monitorprobe.php | 19 +++++++++++++++++++ 1 file changed, 19 insertions(+) diff --git a/web/skins/classic/views/monitorprobe.php b/web/skins/classic/views/monitorprobe.php index ed278ea8e..f61010b9c 100644 --- a/web/skins/classic/views/monitorprobe.php +++ b/web/skins/classic/views/monitorprobe.php @@ -245,6 +245,24 @@ function probeVivotek( $ip ) return( $camera ); } +function probeWansview( $ip ) +{ + $camera = array( + 'model' => "Wansview Camera", + 'monitor' => array( + 'Type' => 'Remote', + 'Protocol' => 'http', + 'Host' => 'admin:123456@'.$ip, + 'Port' => 80, + 'Path' => 'videostream.cgi', + 'Width' => 640, + 'Height' => 480, + 'Palette' => 3 + ), + ); + return( $camera ); +} + $monitors = array(); foreach ( dbFetchAll( "select Id, Name, Host from Monitors where Type = 'Remote' order by Host" ) as $monitor ) { @@ -264,6 +282,7 @@ $macBases = array( '00:80:f0' => array( 'type'=>'Panasonic','probeFunc'=>'probePana' ), '00:0f:7c' => array( 'type'=>'ACTi','probeFunc'=>'probeACTi' ), '00:02:d1' => array( 'type'=>'Vivotek','probeFunc'=>'probeVivotek' ), + '7c:dd:90' => array( 'type'=>'Wansview','probeFunc'=>'probeWansview' ) ); unset($output); From 21946b585461a99ed8099ca18ded5d58e70ea81b Mon Sep 17 00:00:00 2001 From: Edward Barnard Date: Sat, 30 Nov 2013 21:59:04 +0000 Subject: [PATCH 052/107] H264 SPS and PPS frames are now handled correctly --- src/zm_remote_camera_rtsp.cpp | 21 +++++++++++++++++++++ src/zm_remote_camera_rtsp.h | 2 ++ 2 files changed, 23 insertions(+) diff --git a/src/zm_remote_camera_rtsp.cpp b/src/zm_remote_camera_rtsp.cpp index cffb91cce..9a90ac64d 100644 --- a/src/zm_remote_camera_rtsp.cpp +++ b/src/zm_remote_camera_rtsp.cpp @@ -261,6 +261,27 @@ int RemoteCameraRtsp::Capture( Image &image ) if ( !buffer.size() ) return( -1 ); + // SPS and PPS frames should be saved and appended to IDR frames + int nalType = (buffer.head()[3] & 0x1f); + if(mCodecContext->codec_id == CODEC_ID_H264) + { + if(nalType == 7) + { + lastSps = buffer; + continue; + } + else if(nalType == 8) + { + lastPps = buffer; + continue; + } + else if(nalType == 5) + { + buffer += lastSps; + buffer += lastPps; + } + } + av_init_packet( &packet ); while ( !frameComplete && buffer.size() > 0 ) diff --git a/src/zm_remote_camera_rtsp.h b/src/zm_remote_camera_rtsp.h index 3295c9363..359fea9f4 100644 --- a/src/zm_remote_camera_rtsp.h +++ b/src/zm_remote_camera_rtsp.h @@ -41,6 +41,8 @@ protected: int rtcp_sd; Buffer buffer; + Buffer lastSps; + Buffer lastPps; RtspThread::RtspMethod method; From 5d9dcba2d820ed75a22749942658df5b663af591 Mon Sep 17 00:00:00 2001 From: Edward Barnard Date: Sat, 30 Nov 2013 22:00:52 +0000 Subject: [PATCH 053/107] Adds support more H264 NAL types and tidies function --- src/zm_rtp_source.cpp | 82 +++++++++++++++++++------------------------ 1 file changed, 37 insertions(+), 45 deletions(-) diff --git a/src/zm_rtp_source.cpp b/src/zm_rtp_source.cpp index 9ad10969c..9adf7edb7 100644 --- a/src/zm_rtp_source.cpp +++ b/src/zm_rtp_source.cpp @@ -69,7 +69,7 @@ RtpSource::RtpSource( int id, const std::string &localHost, int localPortBase, c mLastSrTimeNtp = tvZero(); mLastSrTimeRtp = 0; - if(mCodecId != CODEC_ID_MPEG4 && mCodecId != CODEC_ID_MPEG4) + if(mCodecId != CODEC_ID_H264 && mCodecId != CODEC_ID_MPEG4) Warning( "The device is using a codec that may not be supported. Do not be surprised if things don't work." ); } @@ -263,68 +263,60 @@ bool RtpSource::handlePacket( const unsigned char *packet, size_t packetLen ) { const RtpDataHeader *rtpHeader; rtpHeader = (RtpDataHeader *)packet; - bool fragmentEnd = false; int rtpHeaderSize = 12 + rtpHeader->cc * 4; - // Each RTP packet delivers only one NAL. It can be either the Single NAL - // ( in that case it must be in one packet ) or the Fragmentation NALs - // that delivers large single NAL... - if ( updateSeq( ntohs(rtpHeader->seqN) ) ) { Hexdump( 4, packet+rtpHeaderSize, 16 ); - - if( mCodecId == CODEC_ID_H264 ) + + if ( mFrameGood ) { - // Is packet start of frangented sequence - bool isFragmentedFirst = (packet[rtpHeaderSize] & 0x1f == 28) && (packet[rtpHeaderSize+1] & 0x80); - // Are we back in sequence - bool hasRecovered = (packet[rtpHeaderSize] & 0x1f != 28) && prevM && rtpHeader->m; - if ( isFragmentedFirst || hasRecovered ) - mFrameGood = true; - - if ( mFrameGood ) + int extraHeader = 0; + + if( mCodecId == CODEC_ID_H264 ) { int nalType = (packet[rtpHeaderSize] & 0x1f); - // NAL type FU-A (Fragmented) - if ( nalType == 28 ) + switch (nalType) { - // Is this NAL the first NAL in fragmentation sequence - if ( packet[rtpHeaderSize+1] & 0x80 ) + case 24: { - // It's the start of a new packet so clean up any old data - if ( mFrame.size() ) - mFrame.clear(); - // Now we will form new header of frame - mFrame.append( "\x0\x0\x1\x0", 4 ); - // Reconstruct NAL header from FU headers - *(mFrame+3) = (packet[rtpHeaderSize+1] & 0x1f) | - (packet[rtpHeaderSize] & 0xe0); + extraHeader = 2; + break; } - // Is this the end of a fragmentation sequence - else if ( packet[rtpHeaderSize+1] & 0x40 ) - fragmentEnd = true; - mFrame.append( packet+rtpHeaderSize+2, packetLen-rtpHeaderSize-2 ); - } - else - { - if ( nalType < 1 || nalType > 23 ) - Warning( "Unsupported NAL packet type recieved. Passing to decoder anyway." ) + case 25: case 26: case 27: + { + extraHeader = 3; + break; + } + // FU-A and FU-B + case 28: case 29: + { + // Is this NAL the first NAL in fragmentation sequence + if ( packet[rtpHeaderSize+1] & 0x80 ) + { + // Now we will form new header of frame + mFrame.append( "\x0\x0\x1\x0", 4 ); + // Reconstruct NAL header from FU headers + *(mFrame+3) = (packet[rtpHeaderSize+1] & 0x1f) | + (packet[rtpHeaderSize] & 0xe0); + } - if ( !mFrame.size() ) - mFrame.append( "\x0\x0\x1", 3 ); - mFrame.append( packet+rtpHeaderSize, packetLen-rtpHeaderSize ); + extraHeader = 2; + break; + } } + + // Append NAL frame start code + if ( !mFrame.size() ) + mFrame.append( "\x0\x0\x1", 3 ); } + mFrame.append( packet+rtpHeaderSize+extraHeader, packetLen-rtpHeaderSize-extraHeader ); } - else - // Works for mpeg4 and hopefully anything else that come its way - mFrame.append( packet+rtpHeaderSize, packetLen-rtpHeaderSize ); Hexdump( 4, mFrame.head(), 16 ); - if ( rtpHeader->m || fragmentEnd ) + if ( rtpHeader->m ) { if ( mFrameGood ) { @@ -360,7 +352,7 @@ bool RtpSource::handlePacket( const unsigned char *packet, size_t packetLen ) mFrameGood = false; mFrame.clear(); } - if ( rtpHeader->m || fragmentEnd ) + if ( rtpHeader->m ) { mFrameGood = true; prevM = true; From 783bf4b8ab567d76188baf533e17bd65e044845e Mon Sep 17 00:00:00 2001 From: Kfir Itzhak Date: Mon, 2 Dec 2013 01:52:26 +0200 Subject: [PATCH 054/107] Fixed web/skins/*/includes/config.php not being installed --- web/CMakeLists.txt | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/web/CMakeLists.txt b/web/CMakeLists.txt index a3479f595..aaf9418cd 100644 --- a/web/CMakeLists.txt +++ b/web/CMakeLists.txt @@ -7,7 +7,7 @@ add_subdirectory(tools/mootools) configure_file(includes/config.php.in "${CMAKE_CURRENT_BINARY_DIR}/includes/config.php" @ONLY) # Install the web files -install(DIRECTORY ajax css graphics includes js lang skins tools views DESTINATION "${ZM_WEBDIR}" PATTERN "*.in" EXCLUDE PATTERN "*Make*" EXCLUDE PATTERN "*cmake*" EXCLUDE REGEX "includes/config.php$" EXCLUDE) +install(DIRECTORY ajax css graphics includes js lang skins tools views DESTINATION "${ZM_WEBDIR}" PATTERN "*.in" EXCLUDE PATTERN "*Make*" EXCLUDE PATTERN "*cmake*" EXCLUDE) install(FILES index.php README.md DESTINATION "${ZM_WEBDIR}") install(FILES "${CMAKE_CURRENT_BINARY_DIR}/includes/config.php" DESTINATION "${ZM_WEBDIR}/includes") From 23ff4023bd827ae3034af766753ba7dcece7cb7d Mon Sep 17 00:00:00 2001 From: Kfir Itzhak Date: Mon, 2 Dec 2013 01:53:21 +0200 Subject: [PATCH 055/107] Removed installation of web/README.md from cmake --- web/CMakeLists.txt | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/web/CMakeLists.txt b/web/CMakeLists.txt index aaf9418cd..b4d865c19 100644 --- a/web/CMakeLists.txt +++ b/web/CMakeLists.txt @@ -8,7 +8,7 @@ configure_file(includes/config.php.in "${CMAKE_CURRENT_BINARY_DIR}/includes/conf # Install the web files install(DIRECTORY ajax css graphics includes js lang skins tools views DESTINATION "${ZM_WEBDIR}" PATTERN "*.in" EXCLUDE PATTERN "*Make*" EXCLUDE PATTERN "*cmake*" EXCLUDE) -install(FILES index.php README.md DESTINATION "${ZM_WEBDIR}") +install(FILES index.php DESTINATION "${ZM_WEBDIR}") install(FILES "${CMAKE_CURRENT_BINARY_DIR}/includes/config.php" DESTINATION "${ZM_WEBDIR}/includes") # Install the mootools symlinks (if its not in the source directory) From 9a06ec51c612d6fe201e530e18a2914c692c77c1 Mon Sep 17 00:00:00 2001 From: Edward Barnard Date: Mon, 2 Dec 2013 15:37:26 +0000 Subject: [PATCH 056/107] Save a couple of cpu cycles. --- src/zm_remote_camera_rtsp.cpp | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/src/zm_remote_camera_rtsp.cpp b/src/zm_remote_camera_rtsp.cpp index 9a90ac64d..8a1c78f8e 100644 --- a/src/zm_remote_camera_rtsp.cpp +++ b/src/zm_remote_camera_rtsp.cpp @@ -261,20 +261,24 @@ int RemoteCameraRtsp::Capture( Image &image ) if ( !buffer.size() ) return( -1 ); - // SPS and PPS frames should be saved and appended to IDR frames - int nalType = (buffer.head()[3] & 0x1f); if(mCodecContext->codec_id == CODEC_ID_H264) { + // SPS and PPS frames should be saved and appended to IDR frames + int nalType = (buffer.head()[3] & 0x1f); + + // SPS if(nalType == 7) { lastSps = buffer; continue; } + // PPS else if(nalType == 8) { lastPps = buffer; continue; } + // IDR else if(nalType == 5) { buffer += lastSps; From 2775752a41f462bc1159b242353e3504e0dd6b4f Mon Sep 17 00:00:00 2001 From: Isaac Connor Date: Fri, 6 Dec 2013 16:46:21 -0500 Subject: [PATCH 057/107] use proper DBI parameter passing to improve security remark out call to zmupdate.pl -f --- scripts/zmpkg.pl.in | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/scripts/zmpkg.pl.in b/scripts/zmpkg.pl.in index 1158a1a29..25488636f 100644 --- a/scripts/zmpkg.pl.in +++ b/scripts/zmpkg.pl.in @@ -57,9 +57,9 @@ if ( !$command || $command !~ /^(?:start|stop|restart|status|logrot)$/ ) if ( $command ) { # Check to see if it's a valid run state - my $sql = "select * from States where Name = '$command'"; + my $sql = 'select * from States where Name = ?'; my $sth = $dbh->prepare_cached( $sql ) or Fatal( "Can't prepare '$sql': ".$dbh->errstr() ); - my $res = $sth->execute() or Fatal( "Can't execute: ".$sth->errstr() ); + my $res = $sth->execute( $command ) or Fatal( "Can't execute: ".$sth->errstr() ); if ( $state = $sth->fetchrow_hashref() ) { $state->{Name} = $command; @@ -138,7 +138,7 @@ if ( $command =~ /^(?:stop|restart)$/ ) } } -runCommand( "zmupdate.pl -f" ); +#runCommand( "zmupdate.pl -f" ); if ( $command =~ /^(?:start|restart)$/ ) { From c630174868f645262b3507fe93a8989cd54a289a Mon Sep 17 00:00:00 2001 From: Edward Barnard Date: Sat, 7 Dec 2013 11:21:10 +0000 Subject: [PATCH 058/107] Adds support for h264 cameras that fail to set m bit for end of fragmented frames. --- src/zm_rtp_source.cpp | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/src/zm_rtp_source.cpp b/src/zm_rtp_source.cpp index 9adf7edb7..0aecd0332 100644 --- a/src/zm_rtp_source.cpp +++ b/src/zm_rtp_source.cpp @@ -264,6 +264,9 @@ bool RtpSource::handlePacket( const unsigned char *packet, size_t packetLen ) const RtpDataHeader *rtpHeader; rtpHeader = (RtpDataHeader *)packet; int rtpHeaderSize = 12 + rtpHeader->cc * 4; + // No need to check for nal type as non fragmented packets already have 001 start sequence appended + bool h264FragmentEnd = (mCodecId == CODEC_ID_H264) && (packet[rtpHeaderSize+1] & 0x40); + bool thisM = rtpHeader->m || h264FragmentEnd; if ( updateSeq( ntohs(rtpHeader->seqN) ) ) { @@ -316,7 +319,7 @@ bool RtpSource::handlePacket( const unsigned char *packet, size_t packetLen ) Hexdump( 4, mFrame.head(), 16 ); - if ( rtpHeader->m ) + if ( thisM ) { if ( mFrameGood ) { @@ -352,7 +355,7 @@ bool RtpSource::handlePacket( const unsigned char *packet, size_t packetLen ) mFrameGood = false; mFrame.clear(); } - if ( rtpHeader->m ) + if ( thisM ) { mFrameGood = true; prevM = true; From e9f44791711cd93a6470f5de01507f27c6d7aa9d Mon Sep 17 00:00:00 2001 From: Kfir Itzhak Date: Tue, 10 Dec 2013 15:13:48 +0200 Subject: [PATCH 059/107] Added support for UYVY capture palette (required for some Bluecherry cards) --- src/zm_local_camera.cpp | 4 +++- web/skins/classic/views/monitor.php | 2 +- 2 files changed, 4 insertions(+), 2 deletions(-) diff --git a/src/zm_local_camera.cpp b/src/zm_local_camera.cpp index 110db6828..1d5eb195b 100644 --- a/src/zm_local_camera.cpp +++ b/src/zm_local_camera.cpp @@ -104,9 +104,11 @@ static PixelFormat getFfPixFormatFromV4lPalette( int v4l_version, int palette ) case V4L2_PIX_FMT_MJPEG : pixFormat = PIX_FMT_YUVJ444P; break; + case V4L2_PIX_FMT_UYVY : + pixFormat = PIX_FMT_UYVY422; + break; // These don't seem to have ffmpeg equivalents // See if you can match any of the ones in the default clause below!? - case V4L2_PIX_FMT_UYVY : case V4L2_PIX_FMT_RGB332 : case V4L2_PIX_FMT_RGB555X : case V4L2_PIX_FMT_RGB565X : diff --git a/web/skins/classic/views/monitor.php b/web/skins/classic/views/monitor.php index 0170a308f..f0e581b2c 100644 --- a/web/skins/classic/views/monitor.php +++ b/web/skins/classic/views/monitor.php @@ -306,7 +306,7 @@ if ( ZM_HAS_V4L2 ) //"YVU410" => fourcc('Y','V','U','9'), /* 9 YVU 4:1:0 */ //"YVU420" => fourcc('Y','V','1','2'), /* 12 YVU 4:2:0 */ - //"UYVY" => fourcc('U','Y','V','Y'), /* 16 YUV 4:2:2 */ + "*UYVY" => fourcc('U','Y','V','Y'), /* 16 YUV 4:2:2 */ "*YUV422P" => fourcc('4','2','2','P'), /* 16 YVU422 planar */ "*YUV411P" => fourcc('4','1','1','P'), /* 16 YVU411 planar */ //"Y41P" => fourcc('Y','4','1','P'), /* 12 YUV 4:1:1 */ From 529c124a9c6e43a1d37403275cb5a4f2baeb0903 Mon Sep 17 00:00:00 2001 From: Philipp Rehs Date: Wed, 11 Dec 2013 11:29:30 +0100 Subject: [PATCH 060/107] Detection Support for WansView Cams Support for detection of Wansview Cams which are connected by lan --- web/skins/classic/views/monitorprobe.php | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/web/skins/classic/views/monitorprobe.php b/web/skins/classic/views/monitorprobe.php index f61010b9c..d9b5b278a 100644 --- a/web/skins/classic/views/monitorprobe.php +++ b/web/skins/classic/views/monitorprobe.php @@ -282,7 +282,8 @@ $macBases = array( '00:80:f0' => array( 'type'=>'Panasonic','probeFunc'=>'probePana' ), '00:0f:7c' => array( 'type'=>'ACTi','probeFunc'=>'probeACTi' ), '00:02:d1' => array( 'type'=>'Vivotek','probeFunc'=>'probeVivotek' ), - '7c:dd:90' => array( 'type'=>'Wansview','probeFunc'=>'probeWansview' ) + '7c:dd:90' => array( 'type'=>'Wansview','probeFunc'=>'probeWansview' ), + '78:a5:dd' => array( 'type'=>'Wansview','probeFunc'=>'probeWansview' ) ); unset($output); From dc0d305811ede824d9a8c117ecd3726f3e98c834 Mon Sep 17 00:00:00 2001 From: Kyle Johnson Date: Fri, 13 Dec 2013 13:39:23 -0500 Subject: [PATCH 061/107] Bump version to 1.26.5 --- CMakeLists.txt | 2 +- configure.ac | 2 +- version | 2 +- 3 files changed, 3 insertions(+), 3 deletions(-) diff --git a/CMakeLists.txt b/CMakeLists.txt index 205808502..e0a93bf00 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -10,7 +10,7 @@ # cmake_minimum_required (VERSION 2.6) project (zoneminder) -set(zoneminder_VERSION "1.26.4") +set(zoneminder_VERSION "1.26.5") # CMake does not allow out-of-source build if CMakeCache.exists in the source folder. Abort and notify the user to save him from headache why it doesn't work. if((NOT (CMAKE_BINARY_DIR STREQUAL CMAKE_SOURCE_DIR)) AND (EXISTS "${CMAKE_SOURCE_DIR}/CMakeCache.txt")) diff --git a/configure.ac b/configure.ac index 946badd52..9e39c06f3 100644 --- a/configure.ac +++ b/configure.ac @@ -1,5 +1,5 @@ AC_PREREQ(2.59) -AC_INIT(zm,1.26.4,[http://www.zoneminder.com/forums/ - Please check FAQ first],zoneminder,http://www.zoneminder.com/downloads.html) +AC_INIT(zm,1.26.5,[http://www.zoneminder.com/forums/ - Please check FAQ first],zoneminder,http://www.zoneminder.com/downloads.html) AM_INIT_AUTOMAKE AC_CONFIG_SRCDIR(src/zm.h) AC_CONFIG_HEADERS(config.h) diff --git a/version b/version index ea0928ced..8fe00a57f 100644 --- a/version +++ b/version @@ -1 +1 @@ -1.26.4 +1.26.5 From 73dbe8106421580a7c0a7da2ddf1c30a39926aea Mon Sep 17 00:00:00 2001 From: Isaac Connor Date: Fri, 13 Dec 2013 13:45:55 -0500 Subject: [PATCH 062/107] update to 1.26.5 --- distros/debian/changelog | 2 +- distros/ubuntu1204/changelog | 8 +------- 2 files changed, 2 insertions(+), 8 deletions(-) diff --git a/distros/debian/changelog b/distros/debian/changelog index fbdacd988..af8df8eeb 100644 --- a/distros/debian/changelog +++ b/distros/debian/changelog @@ -1,4 +1,4 @@ -zoneminder (1.26.4-1) unstable; urgency=low +zoneminder (1.26.5-1) unstable; urgency=low * improvements to zmupdate.pl, cleanups diff --git a/distros/ubuntu1204/changelog b/distros/ubuntu1204/changelog index 7da762cd1..4ebc39de8 100644 --- a/distros/ubuntu1204/changelog +++ b/distros/ubuntu1204/changelog @@ -1,10 +1,4 @@ -zoneminder (1.26.4+1-SNAPSHOT2013110302) precise; urgency=high - - * Today's snapshot of master - - -- Isaac Connor Sun, 03 Nov 2013 14:05:46 -0500 - -zoneminder (1.26.4-2) precise; urgency=high +zoneminder (1.26.5-1) precise; urgency=high * improvements to zmupdate.pl, cleanups From 8265eb98dc115252fa657ce4c53af3eb180b62a7 Mon Sep 17 00:00:00 2001 From: Andrew Bauer Date: Fri, 13 Dec 2013 18:51:39 -0600 Subject: [PATCH 063/107] Add reference to zm_update-1.26.5.sql in Makefile.am --- db/Makefile.am | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/db/Makefile.am b/db/Makefile.am index b6da2b5d4..d33976d3d 100644 --- a/db/Makefile.am +++ b/db/Makefile.am @@ -54,4 +54,5 @@ dbupgrade_scripts = \ zm_update-1.26.0.sql \ zm_update-1.26.1.sql \ zm_update-1.26.2.sql \ - zm_update-1.26.3.sql + zm_update-1.26.3.sql \ + zm_update-1.26.5.sql From cd43496a7d31eaf07d6656ff84df5a1f85bfb829 Mon Sep 17 00:00:00 2001 From: Andrew Bauer Date: Sat, 14 Dec 2013 09:05:15 -0600 Subject: [PATCH 064/107] Update zm.in Don't think this is needed. This may contribute to the corrupt Config table issue --- scripts/zm.in | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/scripts/zm.in b/scripts/zm.in index c46d4b164..b866f56b1 100755 --- a/scripts/zm.in +++ b/scripts/zm.in @@ -82,7 +82,8 @@ zmstatus() zmupdate() { if [ -x $ZM_PATH_BIN/zmupdate.pl ]; then - $ZM_PATH_BIN/zmupdate.pl -f + # Commenting out as it is not needed. Leaving as a placeholder for future use. + # $ZM_PATH_BIN/zmupdate.pl -f fi } From b0b471eb5bf23710e264c235b60ce5b4539ce7f6 Mon Sep 17 00:00:00 2001 From: Andrew Bauer Date: Sat, 14 Dec 2013 09:13:49 -0600 Subject: [PATCH 065/107] Update zm.in --- scripts/zm.in | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/scripts/zm.in b/scripts/zm.in index b866f56b1..a46a89280 100755 --- a/scripts/zm.in +++ b/scripts/zm.in @@ -26,7 +26,8 @@ command="$ZM_PATH_BIN/zmpkg.pl" start() { - zmupdate || return $? +# Commenting out as it is not needed. Leaving as a placeholder for future use. +# zmupdate || return $? loadconf || return $? #Make sure the directory for our PID folder exists or create one. [ ! -d $pidfile ] \ @@ -82,8 +83,7 @@ zmstatus() zmupdate() { if [ -x $ZM_PATH_BIN/zmupdate.pl ]; then - # Commenting out as it is not needed. Leaving as a placeholder for future use. - # $ZM_PATH_BIN/zmupdate.pl -f + $ZM_PATH_BIN/zmupdate.pl -f fi } From 8d2dac67b337274b9735d2efb6af19662e4d01f8 Mon Sep 17 00:00:00 2001 From: Andrew Bauer Date: Sat, 14 Dec 2013 09:14:44 -0600 Subject: [PATCH 066/107] Update zoneminder.in --- distros/redhat/zoneminder.in | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/distros/redhat/zoneminder.in b/distros/redhat/zoneminder.in index 917251548..f1c6c47c6 100755 --- a/distros/redhat/zoneminder.in +++ b/distros/redhat/zoneminder.in @@ -26,7 +26,8 @@ command="$ZM_PATH_BIN/zmpkg.pl" start() { - zmupdate || return $? +# Commenting out as it is not needed. Leaving as a placeholder for future use. +# zmupdate || return $? loadconf || return $? #Make sure the directory for our PID folder exists or create one. [ ! -d $pidfile ] \ @@ -82,8 +83,7 @@ zmstatus() zmupdate() { if [ -x $ZM_PATH_BIN/zmupdate.pl ]; then -# Commenting out as it is not needed. Leaving as a placeholder for future use. -# $ZM_PATH_BIN/zmupdate.pl -f + $ZM_PATH_BIN/zmupdate.pl -f fi } From e68fd9db914b446867564d5c3695e1e6fac0927f Mon Sep 17 00:00:00 2001 From: Andrew Bauer Date: Sat, 14 Dec 2013 09:45:18 -0600 Subject: [PATCH 067/107] Automatically grab all sql scripts in the db subfolder --- db/Makefile.am | 48 ++---------------------------------------------- 1 file changed, 2 insertions(+), 46 deletions(-) diff --git a/db/Makefile.am b/db/Makefile.am index d33976d3d..4e349c5d3 100644 --- a/db/Makefile.am +++ b/db/Makefile.am @@ -10,49 +10,5 @@ dist_zmdbdata_DATA = \ zm_create.sql \ $(dbupgrade_scripts) -dbupgrade_scripts = \ - zm_update-0.0.1.sql \ - zm_update-0.9.7.sql \ - zm_update-0.9.8.sql \ - zm_update-0.9.9.sql \ - zm_update-0.9.10.sql \ - zm_update-0.9.11.sql \ - zm_update-0.9.12.sql \ - zm_update-0.9.13.sql \ - zm_update-0.9.15.sql \ - zm_update-0.9.16.sql \ - zm_update-1.17.1.sql \ - zm_update-1.17.2.sql \ - zm_update-1.18.0.sql \ - zm_update-1.18.1.sql \ - zm_update-1.19.0.sql \ - zm_update-1.19.1.sql \ - zm_update-1.19.2.sql \ - zm_update-1.19.3.sql \ - zm_update-1.19.4.sql \ - zm_update-1.19.5.sql \ - zm_update-1.20.0.sql \ - zm_update-1.20.1.sql \ - zm_update-1.21.0.sql \ - zm_update-1.21.1.sql \ - zm_update-1.21.2.sql \ - zm_update-1.21.3.sql \ - zm_update-1.21.4.sql \ - zm_update-1.22.0.sql \ - zm_update-1.22.1.sql \ - zm_update-1.22.2.sql \ - zm_update-1.22.3.sql \ - zm_update-1.23.0.sql \ - zm_update-1.23.1.sql \ - zm_update-1.23.2.sql \ - zm_update-1.23.3.sql \ - zm_update-1.24.0.sql \ - zm_update-1.24.1.sql \ - zm_update-1.24.2.sql \ - zm_update-1.24.3.sql \ - zm_update-1.24.4.sql \ - zm_update-1.26.0.sql \ - zm_update-1.26.1.sql \ - zm_update-1.26.2.sql \ - zm_update-1.26.3.sql \ - zm_update-1.26.5.sql +dbupgrade_scripts = $(wildcard zm_update-*.sql) + From 49e4d1089adbd34231fb42750990791861660ca0 Mon Sep 17 00:00:00 2001 From: Andrew Bauer Date: Mon, 16 Dec 2013 14:42:22 -0600 Subject: [PATCH 068/107] Update zoneminder.cmake.el6.spec Bugfix. Perl path was hardcoded to x86_64. Use macro instead. --- distros/redhat/zoneminder.cmake.el6.spec | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/distros/redhat/zoneminder.cmake.el6.spec b/distros/redhat/zoneminder.cmake.el6.spec index 73d5bf682..4b323a81f 100644 --- a/distros/redhat/zoneminder.cmake.el6.spec +++ b/distros/redhat/zoneminder.cmake.el6.spec @@ -136,7 +136,7 @@ rm -rf %{_docdir}/%{name}-%{version} %{_bindir}/zmx10.pl %{perl_vendorlib}/ZoneMinder* -%{perl_vendorlib}/x86_64-linux-thread-multi/auto/ZoneMinder* +%{perl_vendorlib}/%{_arch}-linux-thread-multi/auto/ZoneMinder* %{_mandir}/man*/* %dir %{_libexecdir}/%{name} %{_libexecdir}/%{name}/cgi-bin From 570606f01f5cbc2b766de0674e144d0d4a11643c Mon Sep 17 00:00:00 2001 From: Andrew Bauer Date: Mon, 16 Dec 2013 14:43:33 -0600 Subject: [PATCH 069/107] Update zoneminder.cmake.f19.spec Bugfix. Perl path had x86_64 hardcoded. Use macro instead. --- distros/fedora/zoneminder.cmake.f19.spec | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/distros/fedora/zoneminder.cmake.f19.spec b/distros/fedora/zoneminder.cmake.f19.spec index 19056a361..92adbf43b 100644 --- a/distros/fedora/zoneminder.cmake.f19.spec +++ b/distros/fedora/zoneminder.cmake.f19.spec @@ -139,7 +139,7 @@ fi #%{_bindir}/zmx10.pl %{perl_vendorlib}/ZoneMinder* -%{perl_vendorlib}/x86_64-linux-thread-multi/auto/ZoneMinder* +%{perl_vendorlib}/%{_arch}-linux-thread-multi/auto/ZoneMinder* #%{perl_archlib}/ZoneMinder* %{_mandir}/man*/* %dir %{_libexecdir}/zoneminder From 3ce3df8645734f310f66f91a40533defdcbc932b Mon Sep 17 00:00:00 2001 From: Andrew Bauer Date: Mon, 16 Dec 2013 14:44:22 -0600 Subject: [PATCH 070/107] Update zoneminder.cmake.f19.spec Bump revision and changelog --- distros/fedora/zoneminder.cmake.f19.spec | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/distros/fedora/zoneminder.cmake.f19.spec b/distros/fedora/zoneminder.cmake.f19.spec index 92adbf43b..a73902aa7 100644 --- a/distros/fedora/zoneminder.cmake.f19.spec +++ b/distros/fedora/zoneminder.cmake.f19.spec @@ -4,7 +4,7 @@ %define zmgid_final apache Name: zoneminder -Version: 1.26.4 +Version: 1.26.5 Release: 1%{?dist} Summary: A camera monitoring and analysis tool Group: System Environment/Daemons @@ -160,6 +160,10 @@ fi %changelog +* Mon Dec 16 2013 Andrew Bauer - 1.26.5 +- This is a bug fixe release +- RTSP fixes, cmake enhancements, couple other misc fixes + * Mon Oct 07 2013 Andrew Bauer - 1.26.4 - Initial cmake build. From 0f14db811d48ab62e398f80f348e83286bbcad66 Mon Sep 17 00:00:00 2001 From: Andrew Bauer Date: Mon, 16 Dec 2013 14:45:11 -0600 Subject: [PATCH 071/107] Update zoneminder.f19.spec Bump revision and changelog --- distros/fedora/zoneminder.f19.spec | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/distros/fedora/zoneminder.f19.spec b/distros/fedora/zoneminder.f19.spec index 906646568..2cf2d6028 100644 --- a/distros/fedora/zoneminder.f19.spec +++ b/distros/fedora/zoneminder.f19.spec @@ -8,7 +8,7 @@ %define zmgid_final apache Name: zoneminder -Version: 1.26.4 +Version: 1.26.5 Release: 1%{?dist} Summary: A camera monitoring and analysis tool Group: System Environment/Daemons @@ -259,6 +259,10 @@ fi %changelog +* Mon Dec 16 2013 Andrew Bauer - 1.26.5 +- This is a bug fixe release +- RTSP fixes, cmake enhancements, couple other misc fixes + * Sat Oct 05 2013 Andrew Bauer - 1.26.4 - Fedora specific path changes have been moved to zoneminder-1.26.0-defaults.patch - All files are now part of the zoneminder source tree. Update specfile accordingly. From 2ca23bf07add1ade37d1f2eb0fc01fd0056cff2d Mon Sep 17 00:00:00 2001 From: Andrew Bauer Date: Mon, 16 Dec 2013 14:45:50 -0600 Subject: [PATCH 072/107] Update zoneminder.cmake.el6.spec Bump revision and changelog --- distros/redhat/zoneminder.cmake.el6.spec | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/distros/redhat/zoneminder.cmake.el6.spec b/distros/redhat/zoneminder.cmake.el6.spec index 4b323a81f..6eff3aec8 100644 --- a/distros/redhat/zoneminder.cmake.el6.spec +++ b/distros/redhat/zoneminder.cmake.el6.spec @@ -4,7 +4,7 @@ %define zmgid_final apache Name: zoneminder -Version: 1.26.4 +Version: 1.26.5 Release: 1%{?dist} Summary: A camera monitoring and analysis tool Group: System Environment/Daemons @@ -155,6 +155,10 @@ rm -rf %{_docdir}/%{name}-%{version} %changelog +* Mon Dec 16 2013 Andrew Bauer - 1.26.5 +- This is a bug fixe release +- RTSP fixes, cmake enhancements, couple other misc fixes + * Sat Oct 19 2013 Andrew Bauer - 1.26.4 - Streamline the cmake build. Move much code into cmakelist.txt file. From 43b8990d736b22a455bdbebdb9842acd91db7420 Mon Sep 17 00:00:00 2001 From: Andrew Bauer Date: Mon, 16 Dec 2013 14:46:28 -0600 Subject: [PATCH 073/107] Update zoneminder.el6.spec Bump revision and changelog --- distros/redhat/zoneminder.el6.spec | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/distros/redhat/zoneminder.el6.spec b/distros/redhat/zoneminder.el6.spec index 72449cb1d..58ceff443 100644 --- a/distros/redhat/zoneminder.el6.spec +++ b/distros/redhat/zoneminder.el6.spec @@ -8,7 +8,7 @@ %define zmgid_final apache Name: zoneminder -Version: 1.26.4 +Version: 1.26.5 Release: 1%{?dist} Summary: A camera monitoring and analysis tool Group: System Environment/Daemons @@ -263,6 +263,10 @@ fi %changelog +* Mon Dec 16 2013 Andrew Bauer - 1.26.5 +- This is a bug fixe release +- RTSP fixes, cmake enhancements, couple other misc fixes + * Sun Oct 06 2013 Andrew Bauer - 1.26.4 - All files are now part of the zoneminder source tree. Update specfile accordingly. From 48a6dcf5cee1e9438855f07599ea18c60411d736 Mon Sep 17 00:00:00 2001 From: Isaac Connor Date: Mon, 16 Dec 2013 16:32:02 -0500 Subject: [PATCH 074/107] Change COnfig from using the subroutine symbol table to just using a global hash --- .../ZoneMinder/lib/ZoneMinder/Config.pm.in | 22 +- .../ZoneMinder/lib/ZoneMinder/ConfigAdmin.pm | 14 +- scripts/ZoneMinder/lib/ZoneMinder/Database.pm | 6 +- scripts/ZoneMinder/lib/ZoneMinder/General.pm | 36 +- scripts/ZoneMinder/lib/ZoneMinder/Logger.pm | 34 +- scripts/zmaudit.pl.in | 20 +- scripts/zmcontrol.pl.in | 2 +- scripts/zmdc.pl.in | 10 +- scripts/zmfilter.pl.in | 132 +++--- scripts/zmpkg.pl.in | 26 +- scripts/zmupdate.pl.in | 74 ++-- scripts/zmvideo.pl.in | 6 +- scripts/zmwatch.pl.in | 6 +- src/zm_config_defines.h | 377 +++++++++--------- 14 files changed, 382 insertions(+), 383 deletions(-) diff --git a/scripts/ZoneMinder/lib/ZoneMinder/Config.pm.in b/scripts/ZoneMinder/lib/ZoneMinder/Config.pm.in index a840db080..cb6c1cbc2 100644 --- a/scripts/ZoneMinder/lib/ZoneMinder/Config.pm.in +++ b/scripts/ZoneMinder/lib/ZoneMinder/Config.pm.in @@ -33,6 +33,7 @@ require ZoneMinder::Base; our @ISA = qw(Exporter ZoneMinder::Base); +use vars qw( %Config ); # 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. @@ -40,7 +41,7 @@ our @ISA = qw(Exporter ZoneMinder::Base); # 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; # Get populated by BEGIN +our @EXPORT_CONFIG = qw( %Config ); # Get populated by BEGIN our %EXPORT_TAGS = ( 'constants' => [ qw( @@ -64,11 +65,9 @@ use Carp; # Load the config from the database into the symbol table BEGIN { - no strict 'refs'; - my $config_file = ZM_CONFIG; ( my $local_config_file = $config_file ) =~ s|^.*/|./|; - if ( -s $local_config_file && -r $local_config_file ) + 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; @@ -84,23 +83,20 @@ BEGIN next; } # end if $name =~ tr/a-z/A-Z/; - *{$name} = sub { $value }; - push( @EXPORT_CONFIG, $name ); + $Config{$name} = $value; } close( CONFIG ); use DBI; - my $dbh = DBI->connect( "DBI:mysql:database=".&ZM_DB_NAME.";host=".&ZM_DB_HOST, &ZM_DB_USER, &ZM_DB_PASS ); - my $sql = "select * from Config"; + 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->{Name}} = sub { $config->{Value} }; - push( @EXPORT_CONFIG, $config->{Name} ); + while( my $config = $sth->fetchrow_hashref() ) { + $Config{$config->{Name}} = $config->{Value}; } $sth->finish(); - $dbh->disconnect(); + #$dbh->disconnect(); } 1; diff --git a/scripts/ZoneMinder/lib/ZoneMinder/ConfigAdmin.pm b/scripts/ZoneMinder/lib/ZoneMinder/ConfigAdmin.pm index 8ee1ec82b..673e13c98 100644 --- a/scripts/ZoneMinder/lib/ZoneMinder/ConfigAdmin.pm +++ b/scripts/ZoneMinder/lib/ZoneMinder/ConfigAdmin.pm @@ -68,7 +68,7 @@ use Carp; sub loadConfigFromDB { print( "Loading config from DB\n" ); - my $dbh = DBI->connect( "DBI:mysql:database=".ZM_DB_NAME.";host=".ZM_DB_HOST, ZM_DB_USER, ZM_DB_PASS ); + 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 ) { @@ -111,13 +111,19 @@ sub loadConfigFromDB sub saveConfigToDB { print( "Saving config to DB\n" ); - my $dbh = DBI->connect( "DBI:mysql:database=".ZM_DB_NAME.";host=".ZM_DB_HOST, ZM_DB_USER, ZM_DB_PASS ); + 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 ); } + + my $ac = $dbh->{AutoCommit}; + $dbh->{AutoCommit} = 0; + + $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() ); @@ -149,6 +155,10 @@ sub saveConfigToDB 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(); } diff --git a/scripts/ZoneMinder/lib/ZoneMinder/Database.pm b/scripts/ZoneMinder/lib/ZoneMinder/Database.pm index d0bae5dde..29b3c8b2a 100644 --- a/scripts/ZoneMinder/lib/ZoneMinder/Database.pm +++ b/scripts/ZoneMinder/lib/ZoneMinder/Database.pm @@ -79,15 +79,15 @@ sub zmDbConnect( ;$ ) } if ( !defined( $dbh ) ) { - my ( $host, $port ) = ( ZM_DB_HOST =~ /^([^:]+)(?::(.+))?$/ ); + my ( $host, $port ) = ( $Config{ZM_DB_HOST} =~ /^([^:]+)(?::(.+))?$/ ); if ( defined($port) ) { - $dbh = DBI->connect( "DBI:mysql:database=".ZM_DB_NAME.";host=".$host.";port=".$port, ZM_DB_USER, 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=".ZM_DB_NAME.";host=".ZM_DB_HOST, ZM_DB_USER, 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 ); } diff --git a/scripts/ZoneMinder/lib/ZoneMinder/General.pm b/scripts/ZoneMinder/lib/ZoneMinder/General.pm index 5af7150a8..4d60852a7 100644 --- a/scripts/ZoneMinder/lib/ZoneMinder/General.pm +++ b/scripts/ZoneMinder/lib/ZoneMinder/General.pm @@ -95,7 +95,7 @@ sub getCmdFormat() Debug( "Testing valid shell syntax\n" ); my ( $name ) = getpwuid( $> ); - if ( $name eq ZM_WEB_USER ) + if ( $name eq $Config{ZM_WEB_USER} ) { Debug( "Running as '$name', su commands not needed\n" ); return( "" ); @@ -103,7 +103,7 @@ sub getCmdFormat() my $null_command = "true"; - my $prefix = "sudo -u ".ZM_WEB_USER." "; + my $prefix = "sudo -u ".$Config{ZM_WEB_USER}." "; my $suffix = ""; my $command = $prefix.$null_command.$suffix; Debug( "Testing \"$command\"\n" ); @@ -120,7 +120,7 @@ sub getCmdFormat() chomp( $output ); Debug( "Test failed, '$output'\n" ); - $prefix = "su ".ZM_WEB_USER." --shell=/bin/sh --command='"; + $prefix = "su ".$Config{ZM_WEB_USER}." --shell=/bin/sh --command='"; $suffix = "'"; $command = $prefix.$null_command.$suffix; Debug( "Testing \"$command\"\n" ); @@ -136,7 +136,7 @@ sub getCmdFormat() chomp( $output ); Debug( "Test failed, '$output'\n" ); - $prefix = "su ".ZM_WEB_USER." -c '"; + $prefix = "su ".$Config{ZM_WEB_USER}." -c '"; $suffix = "'"; $command = $prefix.$null_command.$suffix; Debug( "Testing \"$command\"\n" ); @@ -172,7 +172,7 @@ sub runCommand( $ ) } my $command = shift; - $command = ZM_PATH_BIN."/".$command; + $command = $Config{ZM_PATH_BIN}."/".$command; if ( $cmdPrefix ) { $command = $cmdPrefix.$command.$cmdSuffix; @@ -201,15 +201,15 @@ sub getEventPath( $ ) my $event = shift; my $event_path = ""; - if ( ZM_USE_DEEP_STORAGE ) + if ( $Config{ZM_USE_DEEP_STORAGE} ) { - $event_path = 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 = ZM_DIR_EVENTS.'/'.$event->{MonitorId}.'/'.$event->{Id}; + $event_path = $Config{ZM_DIR_EVENTS}.'/'.$event->{MonitorId}.'/'.$event->{Id}; } - $event_path = ZM_PATH_WEB.'/'.$event_path if ( index(ZM_DIR_EVENTS,'/') != 0 ); + $event_path = $Config{ZM_PATH_WEB}.'/'.$event_path if ( index($Config{ZM_DIR_EVENTS},'/') != 0 ); return( $event_path ); } @@ -219,10 +219,10 @@ sub createEventPath( $ ) # WARNING assumes running from events directory # my $event = shift; - my $eventRootPath = (ZM_DIR_EVENTS=~m|/|)?ZM_DIR_EVENTS:(ZM_PATH_WEB.'/'.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 ( ZM_USE_DEEP_STORAGE ) + if ( $Config{ZM_USE_DEEP_STORAGE} ) { my @startTime = localtime( $event->{StartTime} ); @@ -277,10 +277,10 @@ sub _checkProcessOwner() if ( !defined($_setFileOwner) ) { my ( $processOwner ) = getpwuid( $> ); - if ( $processOwner ne ZM_WEB_USER ) + 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( ZM_WEB_USER ) or Fatal( "Can't get user details for web user '".ZM_WEB_USER."': $!" ); + ( 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 @@ -297,7 +297,7 @@ sub setFileOwner( $ ) if ( _checkProcessOwner() ) { - chown( $_ownerUid, $_ownerGid, $file ) or Fatal( "Can't change ownership of file '$file' to '".ZM_WEB_USER.":".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}."': $!" ); } } @@ -434,12 +434,12 @@ sub createEvent( $;$ ) #$frame->{FrameId} = $dbh->{mysql_insertid}; if ( $frame->{imagePath} ) { - $frame->{capturePath} = sprintf( "%s/%0".ZM_EVENT_IMAGE_DIGITS."d-capture.jpg", $eventPath, $frame->{FrameId} ); + $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 && ZM_CREATE_ANALYSIS_IMAGES ) + if ( 0 && $Config{ZM_CREATE_ANALYSIS_IMAGES} ) { - $frame->{analysePath} = sprintf( "%s/%0".ZM_EVENT_IMAGE_DIGITS."d-analyse.jpg", $eventPath, $frame->{FrameId} ); + $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} ); } @@ -497,7 +497,7 @@ sub deleteEventFiles( $;$ ) my $monitor_id = shift; $monitor_id = '*' if ( !defined($monitor_id) ); - if ( ZM_USE_DEEP_STORAGE ) + if ( $Config{ZM_USE_DEEP_STORAGE} ) { my $link_path = $monitor_id."/*/*/*/.".$event_id; #Debug( "LP1:$link_path" ); diff --git a/scripts/ZoneMinder/lib/ZoneMinder/Logger.pm b/scripts/ZoneMinder/lib/ZoneMinder/Logger.pm index 46095be2e..5b4438c72 100644 --- a/scripts/ZoneMinder/lib/ZoneMinder/Logger.pm +++ b/scripts/ZoneMinder/lib/ZoneMinder/Logger.pm @@ -150,7 +150,7 @@ sub new $this->{hasTerm} = -t STDERR; ( $this->{fileName} = $0 ) =~ s|^.*/||; - $this->{logPath} = ZM_PATH_LOGS; + $this->{logPath} = $Config{ZM_PATH_LOGS}; $this->{logFile} = $this->{logPath}."/".$this->{id}.".log"; $this->{trace} = 0; @@ -163,7 +163,7 @@ sub BEGIN { # Fake the config variables that are used in case they are not defined yet # Only really necessary to support upgrade from previous version - if ( !eval('defined(ZM_LOG_DEBUG)') ) + if ( !eval('defined($Config{ZM_LOG_DEBUG})') ) { no strict 'subs'; no strict 'refs'; @@ -221,7 +221,7 @@ sub initialise( @ ) } else { - $tempDatabaseLevel = ZM_LOG_LEVEL_DATABASE; + $tempDatabaseLevel = $Config{ZM_LOG_LEVEL_DATABASE}; } if ( defined($options{fileLevel}) ) { @@ -229,7 +229,7 @@ sub initialise( @ ) } else { - $tempFileLevel = ZM_LOG_LEVEL_FILE; + $tempFileLevel = $Config{ZM_LOG_LEVEL_FILE}; } if ( defined($options{syslogLevel}) ) { @@ -237,7 +237,7 @@ sub initialise( @ ) } else { - $tempSyslogLevel = ZM_LOG_LEVEL_SYSLOG; + $tempSyslogLevel = $Config{ZM_LOG_LEVEL_SYSLOG}; } if ( defined($ENV{'LOG_PRINT'}) ) @@ -253,18 +253,18 @@ sub initialise( @ ) $tempFileLevel = $level if ( defined($level = $this->getTargettedEnv('LOG_LEVEL_FILE')) ); $tempSyslogLevel = $level if ( defined($level = $this->getTargettedEnv('LOG_LEVEL_SYSLOG')) ); - if ( ZM_LOG_DEBUG ) + if ( $Config{ZM_LOG_DEBUG} ) { - foreach my $target ( split( /\|/, ZM_LOG_DEBUG_TARGET ) ) + 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 ( ZM_LOG_DEBUG_LEVEL > NOLOG ) + if ( $Config{ZM_LOG_DEBUG_LEVEL} > NOLOG ) { - $tempLevel = $this->limit( ZM_LOG_DEBUG_LEVEL ); - if ( ZM_LOG_DEBUG_FILE ne "" ) + $tempLevel = $this->limit( $Config{ZM_LOG_DEBUG_LEVEL} ); + if ( $Config{ZM_LOG_DEBUG_FILE} ne "" ) { - $tempLogFile = ZM_LOG_DEBUG_FILE; + $tempLogFile = $Config{ZM_LOG_DEBUG_FILE}; $tempFileLevel = $tempLevel; } } @@ -447,20 +447,20 @@ sub databaseLevel( ;$ ) { if ( !$this->{dbh} ) { - my ( $host, $port ) = ( ZM_DB_HOST =~ /^([^:]+)(?::(.+))?$/ ); + my ( $host, $port ) = ( $Config{ZM_DB_HOST} =~ /^([^:]+)(?::(.+))?$/ ); if ( defined($port) ) { - $this->{dbh} = DBI->connect( "DBI:mysql:database=".ZM_DB_NAME.";host=".$host.";port=".$port, ZM_DB_USER, 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=".ZM_DB_NAME.";host=".ZM_DB_HOST, ZM_DB_USER, 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 '".ZM_DB_NAME."' on host '".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 { @@ -553,8 +553,8 @@ sub openFile() { LOGFILE->autoflush() if ( $this->{autoFlush} ); - my $webUid = (getpwnam( ZM_WEB_USER ))[2]; - my $webGid = (getgrnam( ZM_WEB_GROUP ))[2]; + my $webUid = (getpwnam( $Config{ZM_WEB_USER} ))[2]; + my $webGid = (getgrnam( $Config{ZM_WEB_GROUP} ))[2]; if ( $> == 0 ) { chown( $webUid, $webGid, $this->{logFile} ) or Fatal( "Can't change permissions on log file '".$this->{logFile}."': $!" ) diff --git a/scripts/zmaudit.pl.in b/scripts/zmaudit.pl.in index 955198c9f..64a992196 100644 --- a/scripts/zmaudit.pl.in +++ b/scripts/zmaudit.pl.in @@ -57,8 +57,8 @@ use File::Find; use Time::HiRes qw/gettimeofday/; use Getopt::Long; -use constant IMAGE_PATH => ZM_PATH_WEB.'/'.ZM_DIR_IMAGES; -use constant EVENT_PATH => (ZM_DIR_EVENTS=~m|/|)?ZM_DIR_EVENTS:(ZM_PATH_WEB.'/'.ZM_DIR_EVENTS); +use constant IMAGE_PATH => $Config{ZM_PATH_WEB}.'/'.$Config{ZM_DIR_IMAGES}; +use constant EVENT_PATH => ($Config{ZM_DIR_EVENTS}=~m|/|)?$Config{ZM_DIR_EVENTS}:($Config{ZM_PATH_WEB}.'/'.$Config{ZM_DIR_EVENTS}); $| = 1; @@ -107,7 +107,7 @@ chdir( EVENT_PATH ); my $max_image_age = 6/24; # 6 hours my $max_swap_age = 24/24; # 24 hours my $image_path = IMAGE_PATH; -my $swap_image_path = ZM_PATH_SWAP; +my $swap_image_path = $Config{ZM_PATH_SWAP}; my $loop = 1; my $cleaned = 0; @@ -142,7 +142,7 @@ MAIN: while( $loop ) my $fs_events = $fs_monitors->{$monitor} = {}; ( my $monitor_dir ) = ( $monitor =~ /^(.*)$/ ); # De-taint - if ( ZM_USE_DEEP_STORAGE ) + if ( $Config{ZM_USE_DEEP_STORAGE} ) { foreach my $day_dir ( <$monitor_dir/*/*/*> ) { @@ -399,9 +399,9 @@ MAIN: while( $loop ) File::Find::find( { wanted=>\&deleteSwapImage, untaint=>1 }, $swap_image_root ); # Prune the Logs table if required - if ( ZM_LOG_DATABASE_LIMIT ) + if ( $Config{ZM_LOG_DATABASE_LIMIT} ) { - if ( ZM_LOG_DATABASE_LIMIT =~ /^\d+$/ ) + if ( $Config{ZM_LOG_DATABASE_LIMIT} =~ /^\d+$/ ) { # Number of rows my $selectLogRowCountSql = "select count(*) as Rows from Logs"; @@ -410,18 +410,18 @@ MAIN: while( $loop ) my $row = $selectLogRowCountSth->fetchrow_hashref(); my $logRows = $row->{Rows}; $selectLogRowCountSth->finish(); - if ( $logRows > ZM_LOG_DATABASE_LIMIT ) + if ( $logRows > $Config{ZM_LOG_DATABASE_LIMIT} ) { my $deleteLogByRowsSql = "delete low_priority from Logs order by TimeKey asc limit ?"; my $deleteLogByRowsSth = $dbh->prepare_cached( $deleteLogByRowsSql ) or Fatal( "Can't prepare '$deleteLogByRowsSql': ".$dbh->errstr() ); - $res = $deleteLogByRowsSth->execute( $logRows - ZM_LOG_DATABASE_LIMIT ) or Fatal( "Can't execute: ".$deleteLogByRowsSth->errstr() ); + $res = $deleteLogByRowsSth->execute( $logRows - $Config{ZM_LOG_DATABASE_LIMIT} ) or Fatal( "Can't execute: ".$deleteLogByRowsSth->errstr() ); aud_print( "Deleted ".$deleteLogByRowsSth->rows()." log table entries by count\n" ) if ( $deleteLogByRowsSth->rows() ); } } else { # Time of record - my $deleteLogByTimeSql = "delete low_priority from Logs where TimeKey < unix_timestamp(now() - interval ".ZM_LOG_DATABASE_LIMIT.")"; + my $deleteLogByTimeSql = "delete low_priority from Logs where TimeKey < unix_timestamp(now() - interval ".$Config{ZM_LOG_DATABASE_LIMIT}.")"; my $deleteLogByTimeSth = $dbh->prepare_cached( $deleteLogByTimeSql ) or Fatal( "Can't prepare '$deleteLogByTimeSql': ".$dbh->errstr() ); $res = $deleteLogByTimeSth->execute() or Fatal( "Can't execute: ".$deleteLogByTimeSth->errstr() ); aud_print( "Deleted ".$deleteLogByTimeSth->rows()." log table entries by time\n" ) if ( $deleteLogByTimeSth->rows() ); @@ -429,7 +429,7 @@ MAIN: while( $loop ) } $loop = $continuous; - sleep( ZM_AUDIT_CHECK_INTERVAL ) if ( $continuous ); + sleep( $Config{ZM_AUDIT_CHECK_INTERVAL} ) if $continuous; }; exit( 0 ); diff --git a/scripts/zmcontrol.pl.in b/scripts/zmcontrol.pl.in index aba203614..77283acc9 100644 --- a/scripts/zmcontrol.pl.in +++ b/scripts/zmcontrol.pl.in @@ -88,7 +88,7 @@ if ( !$id || !$options{command} ) Debug( $arg_string ); -my $sock_file = ZM_PATH_SOCKS.'/zmcontrol-'.$id.'.sock'; +my $sock_file = $Config{ZM_PATH_SOCKS}.'/zmcontrol-'.$id.'.sock'; socket( CLIENT, PF_UNIX, SOCK_STREAM, 0 ) or Fatal( "Can't open socket: $!" ); diff --git a/scripts/zmdc.pl.in b/scripts/zmdc.pl.in index 47e50cc39..c891553d5 100644 --- a/scripts/zmdc.pl.in +++ b/scripts/zmdc.pl.in @@ -51,7 +51,7 @@ use Socket; use IO::Handle; use Data::Dumper; -use constant SOCK_FILE => ZM_PATH_SOCKS.'/zmdc.sock'; +use constant SOCK_FILE => $Config{ZM_PATH_SOCKS}.'/zmdc.sock'; $| = 1; @@ -437,7 +437,7 @@ sub start if ( $daemon =~ /^${daemon_patt}$/ ) { - $daemon = ZM_PATH_BIN.'/'.$1; + $daemon = $Config{ZM_PATH_BIN}.'/'.$1; } else { @@ -645,7 +645,7 @@ sub reaper if ( $process->{keepalive} ) { - if ( !$process->{delay} || ($process->{runtime} > ZM_MAX_RESTART_DELAY) ) + if ( !$process->{delay} || ($process->{runtime} > $Config{ZM_MAX_RESTART_DELAY} ) ) { #start( $process->{daemon}, @{$process->{args}} ); # Schedule for immediate restart @@ -659,9 +659,9 @@ sub reaper $process->{pending} = $process->{stopped}+$process->{delay}; $process->{delay} *= 2; # Limit the start delay to 15 minutes max - if ( $process->{delay} > ZM_MAX_RESTART_DELAY ) + if ( $process->{delay} > $Config{ZM_MAX_RESTART_DELAY} ) { - $process->{delay} = ZM_MAX_RESTART_DELAY; + $process->{delay} = $Config{ZM_MAX_RESTART_DELAY}; } } } diff --git a/scripts/zmfilter.pl.in b/scripts/zmfilter.pl.in index 19e7a8977..e0c425740 100644 --- a/scripts/zmfilter.pl.in +++ b/scripts/zmfilter.pl.in @@ -56,11 +56,11 @@ use constant EVENT_PATH => (ZM_DIR_EVENTS=~m|/|)?ZM_DIR_EVENTS:(ZM_PATH_WEB.'/'. logInit(); logSetSignal(); -if ( ZM_OPT_UPLOAD ) +if ( $Config{ZM_OPT_UPLOAD} ) { # Comment these out if you don't have them and don't want to upload # or don't want to use that format - if ( ZM_UPLOAD_ARCH_FORMAT eq "zip" ) + if ( $Config{ZM_UPLOAD_ARCH_FORMAT} eq "zip" ) { require Archive::Zip; import Archive::Zip qw( :ERROR_CODES :CONSTANTS ); @@ -69,7 +69,7 @@ if ( ZM_OPT_UPLOAD ) { require Archive::Tar; } - if ( ZM_UPLOAD_PROTOCOL eq "ftp" ) + if ( $Config{ZM_UPLOAD_PROTOCOL} eq "ftp" ) { require Net::FTP; } @@ -79,9 +79,9 @@ if ( ZM_OPT_UPLOAD ) } } -if ( ZM_OPT_EMAIL ) +if ( $Config{ZM_OPT_EMAIL} ) { - if ( ZM_NEW_MAIL_MODULES ) + if ( $Config{ZM_NEW_MAIL_MODULES} ) { require MIME::Lite; require Net::SMTP; @@ -92,9 +92,9 @@ if ( ZM_OPT_EMAIL ) } } -if ( ZM_OPT_MESSAGE ) +if ( $Config{ZM_OPT_MESSAGE} ) { - if ( ZM_NEW_MAIL_MODULES ) + if ( $Config{ZM_NEW_MAIL_MODULES} ) { require MIME::Lite; require Net::SMTP; @@ -112,7 +112,7 @@ $ENV{PATH} = '/bin:/usr/bin'; $ENV{SHELL} = '/bin/sh' if exists $ENV{SHELL}; delete @ENV{qw(IFS CDPATH ENV BASH_ENV)}; -my $delay = ZM_FILTER_EXECUTE_INTERVAL; +my $delay = $Config{ZM_FILTER_EXECUTE_INTERVAL}; my $event_id = 0; my $filter_parm = ""; @@ -163,7 +163,7 @@ if ( !GetOptions( 'filter=s'=>\$filter_parm ) ) Usage(); } -chdir( EVENT_PATH ); +chdir( $Config{EVENT_PATH} ); my $dbh = zmDbConnect(); @@ -178,7 +178,7 @@ else if ( !$filter_parm ) { - sleep( START_DELAY ); + sleep( $Config{START_DELAY} ); } my $filters; @@ -186,7 +186,7 @@ my $last_action = 0; while( 1 ) { - if ( (time() - $last_action) > ZM_FILTER_RELOAD_DELAY ) + if ( (time() - $last_action) > $Config{ZM_FILTER_RELOAD_DELAY} ) { Debug( "Reloading filters\n" ); $last_action = time(); @@ -573,28 +573,28 @@ sub checkFilter my $sth = $dbh->prepare_cached( $sql ) or Fatal( "Can't prepare '$sql': ".$dbh->errstr() ); my $res = $sth->execute( $event->{Id} ) or Fatal( "Can't execute '$sql': ".$sth->errstr() ); } - if ( ZM_OPT_FFMPEG && $filter->{AutoVideo} ) + if ( $Config{ZM_OPT_FFMPEG} && $filter->{AutoVideo} ) { if ( !$event->{Videoed} ) { $delete_ok = undef if ( !generateVideo( $filter, $event ) ); } } - if ( ZM_OPT_EMAIL && $filter->{AutoEmail} ) + if ( $Config{ZM_OPT_EMAIL} && $filter->{AutoEmail} ) { if ( !$event->{Emailed} ) { $delete_ok = undef if ( !sendEmail( $filter, $event ) ); } } - if ( ZM_OPT_MESSAGE && $filter->{AutoMessage} ) + if ( $Config{ZM_OPT_MESSAGE} && $filter->{AutoMessage} ) { if ( !$event->{Messaged} ) { $delete_ok = undef if ( !sendMessage( $filter, $event ) ); } } - if ( ZM_OPT_UPLOAD && $filter->{AutoUpload} ) + if ( $Config{ZM_OPT_UPLOAD} && $filter->{AutoUpload} ) { if ( !$event->{Uploaded} ) { @@ -618,7 +618,7 @@ sub checkFilter my $sth = $dbh->prepare_cached( $sql ) or Fatal( "Can't prepare '$sql': ".$dbh->errstr() ); my $res = $sth->execute( $event->{Id} ) or Fatal( "Can't execute '$sql': ".$sth->errstr() ); - if ( !ZM_OPT_FAST_DELETE ) + if ( ! $Config{ZM_OPT_FAST_DELETE} ) { my $sql = "delete from Frames where EventId = ?"; my $sth = $dbh->prepare_cached( $sql ) or Fatal( "Can't prepare '$sql': ".$dbh->errstr() ); @@ -650,7 +650,7 @@ sub generateVideo my $scale = $event->{DefaultScale}/100; my $format; - my @ffmpeg_formats = split( /\s+/, ZM_FFMPEG_FORMATS ); + my @ffmpeg_formats = split( /\s+/, $Config{ZM_FFMPEG_FORMATS} ); my $default_video_format; my $default_phone_format; foreach my $ffmpeg_format( @ffmpeg_formats ) @@ -678,7 +678,7 @@ sub generateVideo $format = $ffmpeg_formats[0]; } - my $command = ZM_PATH_BIN."/zmvideo.pl -e ".$event->{Id}." -r ".$rate." -s ".$scale." -f ".$format; + my $command = $Config{ZM_PATH_BIN}."/zmvideo.pl -e ".$event->{Id}." -r ".$rate." -s ".$scale." -f ".$format; my $output = qx($command); chomp( $output ); my $status = $? >> 8; @@ -713,22 +713,22 @@ sub uploadArchFile my $filter = shift; my $event = shift; - if ( !ZM_UPLOAD_HOST ) + if ( ! $Config{ZM_UPLOAD_HOST} ) { Error( "Cannot upload archive as no upload host defined" ); return( 0 ); } my $archFile = $event->{MonitorName}.'-'.$event->{Id}; - my $archImagePath = getEventPath( $event )."/".((ZM_UPLOAD_ARCH_ANALYSE)?'{*analyse,*capture}':'*capture').".jpg"; + my $archImagePath = getEventPath( $event )."/".(( $Config{ZM_UPLOAD_ARCH_ANALYSE} )?'{*analyse,*capture}':'*capture').".jpg"; my @archImageFiles = glob($archImagePath); my $archLocPath; my $archError = 0; - if ( ZM_UPLOAD_ARCH_FORMAT eq "zip" ) + if ( $Config{ZM_UPLOAD_ARCH_FORMAT} eq "zip" ) { $archFile .= '.zip'; - $archLocPath = ZM_UPLOAD_LOC_DIR.'/'.$archFile; + $archLocPath = $Config{ZM_UPLOAD_LOC_DIR}.'/'.$archFile; my $zip = Archive::Zip->new(); Info( "Creating upload file '$archLocPath', ".int(@archImageFiles)." files\n" ); @@ -743,7 +743,7 @@ sub uploadArchFile $archError = 1; last; } - $member->desiredCompressionMethod( (ZM_UPLOAD_ARCH_COMPRESS)?&COMPRESSION_DEFLATED:&COMPRESSION_STORED ); + $member->desiredCompressionMethod( $Config{ZM_UPLOAD_ARCH_COMPRESS} ? &COMPRESSION_DEFLATED : &COMPRESSION_STORED ); } if ( !$archError ) { @@ -759,9 +759,9 @@ sub uploadArchFile Error( "Error adding images to zip archive $archLocPath, not writing" ); } } - elsif ( ZM_UPLOAD_ARCH_FORMAT eq "tar" ) + elsif ( $Config{ZM_UPLOAD_ARCH_FORMAT} eq "tar" ) { - if ( ZM_UPLOAD_ARCH_COMPRESS ) + if ( $Config{ZM_UPLOAD_ARCH_COMPRESS} ) { $archFile .= '.tar.gz'; } @@ -769,10 +769,10 @@ sub uploadArchFile { $archFile .= '.tar'; } - $archLocPath = ZM_UPLOAD_LOC_DIR.'/'.$archFile; + $archLocPath = $Config{ZM_UPLOAD_LOC_DIR}.'/'.$archFile; Info( "Creating upload file '$archLocPath', ".int(@archImageFiles)." files\n" ); - if ( $archError = !Archive::Tar->create_archive( $archLocPath, ZM_UPLOAD_ARCH_COMPRESS, @archImageFiles ) ) + if ( $archError = !Archive::Tar->create_archive( $archLocPath, $Config{ZM_UPLOAD_ARCH_COMPRESS}, @archImageFiles ) ) { Error( "Tar error: ".Archive::Tar->error()."\n " ); } @@ -784,39 +784,39 @@ sub uploadArchFile } else { - if ( ZM_UPLOAD_PROTOCOL eq "ftp" ) + if ( $Config{ZM_UPLOAD_PROTOCOL} eq "ftp" ) { - Info( "Uploading to ".ZM_UPLOAD_HOST." using FTP\n" ); - my $ftp = Net::FTP->new( ZM_UPLOAD_HOST, Timeout=>ZM_UPLOAD_TIMEOUT, Passive=>ZM_UPLOAD_FTP_PASSIVE, Debug=>ZM_UPLOAD_DEBUG ); + Info( "Uploading to ".$Config{ZM_UPLOAD_HOST}." using FTP\n" ); + my $ftp = Net::FTP->new( $Config{ZM_UPLOAD_HOST}, Timeout=>$Config{ZM_UPLOAD_TIMEOUT}, Passive=>$Config{ZM_UPLOAD_FTP_PASSIVE}, Debug=>$Config{ZM_UPLOAD_DEBUG} ); if ( !$ftp ) { Error( "Can't create FTP connection: $@" ); return( 0 ); } - $ftp->login( ZM_UPLOAD_USER, ZM_UPLOAD_PASS ) or Error( "FTP - Can't login" ); + $ftp->login( $Config{ZM_UPLOAD_USER}, $Config{ZM_UPLOAD_PASS} ) or Error( "FTP - Can't login" ); $ftp->binary() or Error( "FTP - Can't go binary" ); - $ftp->cwd( ZM_UPLOAD_REM_DIR ) or Error( "FTP - Can't cwd" ) if ( ZM_UPLOAD_REM_DIR ); + $ftp->cwd( $Config{ZM_UPLOAD_REM_DIR} ) or Error( "FTP - Can't cwd" ) if ( $Config{ZM_UPLOAD_REM_DIR} ); $ftp->put( $archLocPath ) or Error( "FTP - Can't upload '$archLocPath'" ); $ftp->quit() or Error( "FTP - Can't quit" ); } else { - my $host = ZM_UPLOAD_HOST; - $host .= ":".ZM_UPLOAD_PORT if ( ZM_UPLOAD_PORT ); + my $host = $Config{ZM_UPLOAD_HOST}; + $host .= ":".$Config{ZM_UPLOAD_PORT} if $Config{ZM_UPLOAD_PORT}; Info( "Uploading to ".$host." using SFTP\n" ); - my %sftpOptions = ( host=>ZM_UPLOAD_HOST, user=>ZM_UPLOAD_USER ); - $sftpOptions{password} = ZM_UPLOAD_PASS if ( ZM_UPLOAD_PASS ); - $sftpOptions{port} = ZM_UPLOAD_PORT if ( ZM_UPLOAD_PORT ); - $sftpOptions{timeout} = ZM_UPLOAD_TIMEOUT if ( ZM_UPLOAD_TIMEOUT ); + my %sftpOptions = ( host=>$Config{ZM_UPLOAD_HOST}, user=>$Config{ZM_UPLOAD_USER} ); + $sftpOptions{password} = $Config{ZM_UPLOAD_PASS} if $Config{ZM_UPLOAD_PASS}; + $sftpOptions{port} = $Config{ZM_UPLOAD_PORT} if $Config{ZM_UPLOAD_PORT}; + $sftpOptions{timeout} = $Config{ZM_UPLOAD_TIMEOUT} if $Config{ZM_UPLOAD_TIMEOUT}; $sftpOptions{more} = [ '-o'=>'StrictHostKeyChecking=no' ]; - $Net::SFTP::Foreign::debug = -1 if ( ZM_UPLOAD_DEBUG ); - my $sftp = Net::SFTP::Foreign->new( ZM_UPLOAD_HOST, %sftpOptions ); + $Net::SFTP::Foreign::debug = -1 if $Config{ZM_UPLOAD_DEBUG}; + my $sftp = Net::SFTP::Foreign->new( $Config{ZM_UPLOAD_HOST}, %sftpOptions ); if ( $sftp->error ) { Error( "Can't create SFTP connection: ".$sftp->error ); return( 0 ); } - $sftp->setcwd( ZM_UPLOAD_REM_DIR ) or Error( "SFTP - Can't setcwd: ".$sftp->error ) if ( ZM_UPLOAD_REM_DIR ); + $sftp->setcwd( $Config{ZM_UPLOAD_REM_DIR} ) or Error( "SFTP - Can't setcwd: ".$sftp->error ) if $Config{ZM_UPLOAD_REM_DIR}; $sftp->put( $archLocPath, $archFile ) or Error( "SFTP - Can't upload '$archLocPath': ".$sftp->error ); } unlink( $archLocPath ); @@ -908,18 +908,18 @@ sub substituteTags $text =~ s/%EPIM%/$url?view=frame&mid=$event->{MonitorId}&eid=$event->{Id}&fid=$max_alarm_frame->{FrameId}/g; if ( $attachments_ref && $text =~ s/%EI1%//g ) { - push( @$attachments_ref, { type=>"image/jpeg", path=>sprintf( "%s/%0".ZM_EVENT_IMAGE_DIGITS."d-capture.jpg", getEventPath( $event ), $first_alarm_frame->{FrameId} ) } ); + push( @$attachments_ref, { type=>"image/jpeg", path=>sprintf( "%s/%0".$Config{ZM_EVENT_IMAGE_DIGITS}."d-capture.jpg", getEventPath( $event ), $first_alarm_frame->{FrameId} ) } ); } if ( $attachments_ref && $text =~ s/%EIM%//g ) { # Don't attach the same image twice if ( !@$attachments_ref || ($first_alarm_frame->{FrameId} != $max_alarm_frame->{FrameId} ) ) { - push( @$attachments_ref, { type=>"image/jpeg", path=>sprintf( "%s/%0".ZM_EVENT_IMAGE_DIGITS."d-capture.jpg", getEventPath( $event ), $max_alarm_frame->{FrameId} ) } ); + push( @$attachments_ref, { type=>"image/jpeg", path=>sprintf( "%s/%0".$Config{ZM_EVENT_IMAGE_DIGITS}."d-capture.jpg", getEventPath( $event ), $max_alarm_frame->{FrameId} ) } ); } } } - if ( $attachments_ref && ZM_OPT_FFMPEG ) + if ( $attachments_ref && $Config{ZM_OPT_FFMPEG} ) { if ( $text =~ s/%EV%//g ) { @@ -952,12 +952,12 @@ sub sendEmail my $filter = shift; my $event = shift; - if ( !ZM_FROM_EMAIL ) + if ( ! $Config{ZM_FROM_EMAIL} ) { Error( "No 'from' email address defined, not sending email" ); return( 0 ); } - if ( !ZM_EMAIL_ADDRESS ) + if ( ! $Config{ZM_EMAIL_ADDRESS} ) { Error( "No email address defined, not sending email" ); return( 0 ); @@ -965,22 +965,22 @@ sub sendEmail Info( "Creating notification email\n" ); - my $subject = substituteTags( ZM_EMAIL_SUBJECT, $filter, $event ); + my $subject = substituteTags( $Config{ZM_EMAIL_SUBJECT}, $filter, $event ); return( 0 ) if ( !$subject ); my @attachments; - my $body = substituteTags( ZM_EMAIL_BODY, $filter, $event, \@attachments ); + my $body = substituteTags( $Config{ZM_EMAIL_BODY}, $filter, $event, \@attachments ); return( 0 ) if ( !$body ); Info( "Sending notification email '$subject'\n" ); eval { - if ( ZM_NEW_MAIL_MODULES ) + if ( $Config{ZM_NEW_MAIL_MODULES} ) { ### Create the multipart container my $mail = MIME::Lite->new ( - From => ZM_FROM_EMAIL, - To => ZM_EMAIL_ADDRESS, + From => $Config{ZM_FROM_EMAIL}, + To => $Config{ZM_EMAIL_ADDRESS}, Subject => $subject, Type => "multipart/mixed" ); @@ -1000,14 +1000,14 @@ sub sendEmail ); } ### Send the Message - MIME::Lite->send( "smtp", ZM_EMAIL_HOST, Timeout=>60 ); + MIME::Lite->send( "smtp", $Config{ZM_EMAIL_HOST}, Timeout=>60 ); $mail->send(); } else { my $mail = MIME::Entity->build( - From => ZM_FROM_EMAIL, - To => ZM_EMAIL_ADDRESS, + From => $Config{ZM_FROM_EMAIL}, + To => $Config{ZM_EMAIL_ADDRESS}, Subject => $subject, Type => (($body=~//)?'text/html':'text/plain'), Data => $body @@ -1022,7 +1022,7 @@ sub sendEmail Encoding => "base64" ); } - $mail->smtpsend( Host => ZM_EMAIL_HOST, MailFrom => ZM_FROM_EMAIL ); + $mail->smtpsend( Host => $Config{ZM_EMAIL_HOST}, MailFrom => $Config{ZM_FROM_EMAIL} ); } }; if ( $@ ) @@ -1046,12 +1046,12 @@ sub sendMessage my $filter = shift; my $event = shift; - if ( !ZM_FROM_EMAIL ) + if ( ! $Config{ZM_FROM_EMAIL} ) { Error( "No 'from' email address defined, not sending message" ); return( 0 ); } - if ( !ZM_MESSAGE_ADDRESS ) + if ( ! $Config{ZM_MESSAGE_ADDRESS} ) { Error( "No message address defined, not sending message" ); return( 0 ); @@ -1059,22 +1059,22 @@ sub sendMessage Info( "Creating notification message\n" ); - my $subject = substituteTags( ZM_MESSAGE_SUBJECT, $filter, $event ); + my $subject = substituteTags( $Config{ZM_MESSAGE_SUBJECT}, $filter, $event ); return( 0 ) if ( !$subject ); my @attachments; - my $body = substituteTags( ZM_MESSAGE_BODY, $filter, $event, \@attachments ); + my $body = substituteTags( $Config{ZM_MESSAGE_BODY}, $filter, $event, \@attachments ); return( 0 ) if ( !$body ); Info( "Sending notification message '$subject'\n" ); eval { - if ( ZM_NEW_MAIL_MODULES ) + if ( $Config{ZM_NEW_MAIL_MODULES} ) { ### Create the multipart container my $mail = MIME::Lite->new ( - From => ZM_FROM_EMAIL, - To => ZM_MESSAGE_ADDRESS, + From => $Config{ZM_FROM_EMAIL}, + To => $Config{ZM_MESSAGE_ADDRESS}, Subject => $subject, Type => "multipart/mixed" ); @@ -1094,14 +1094,14 @@ sub sendMessage ); } ### Send the Message - MIME::Lite->send( "smtp", ZM_EMAIL_HOST, Timeout=>60 ); + MIME::Lite->send( "smtp", $Config{ZM_EMAIL_HOST}, Timeout=>60 ); $mail->send(); } else { my $mail = MIME::Entity->build( - From => ZM_FROM_EMAIL, - To => ZM_MESSAGE_ADDRESS, + From => $Config{ZM_FROM_EMAIL}, + To => $Config{ZM_MESSAGE_ADDRESS}, Subject => $subject, Type => (($body=~//)?'text/html':'text/plain'), Data => $body @@ -1116,7 +1116,7 @@ sub sendMessage Encoding => "base64" ); } - $mail->smtpsend( Host => ZM_EMAIL_HOST, MailFrom => ZM_FROM_EMAIL ); + $mail->smtpsend( Host => $Config{ZM_EMAIL_HOST}, MailFrom => $Config{ZM_FROM_EMAIL} ); } }; if ( $@ ) diff --git a/scripts/zmpkg.pl.in b/scripts/zmpkg.pl.in index 25488636f..bfb87798c 100644 --- a/scripts/zmpkg.pl.in +++ b/scripts/zmpkg.pl.in @@ -84,7 +84,7 @@ if ( !$command || $command !~ /^(?:start|stop|restart|status|logrot)$/ ) } # Move to the right place -chdir( ZM_PATH_WEB ) or Fatal( "Can't chdir to '".ZM_PATH_WEB."': $!" ); +chdir( $Config{ZM_PATH_WEB} ) or Fatal( "Can't chdir to '".$Config{ZM_PATH_WEB}."': $!" ); my $dbg_id = ""; @@ -146,9 +146,9 @@ if ( $command =~ /^(?:start|restart)$/ ) if ( $status eq "stopped" ) { - if ( ZM_DYN_DB_VERSION && ZM_DYN_DB_VERSION ne ZM_VERSION ) + if ( $Config{ZM_DYN_DB_VERSION} and ( $Config{ZM_DYN_DB_VERSION} ne $Config{ZM_VERSION} ) ) { - Fatal( "Version mismatch, system is version ".ZM_VERSION.", database is ".ZM_DYN_DB_VERSION.", please run zmupdate.pl to update." ); + Fatal( "Version mismatch, system is version ".ZM_VERSION.", database is ".$Config{ZM_DYN_DB_VERSION}.", please run zmupdate.pl to update." ); exit( -1 ); } @@ -158,11 +158,11 @@ if ( $command =~ /^(?:start|restart)$/ ) Debug( "Recreating temporary directory '@ZM_TMPDIR@'" ); mkdir( "@ZM_TMPDIR@", 0700 ) or Fatal( "Can't create missing temporary directory '@ZM_TMPDIR@': $!" ); my ( $runName ) = getpwuid( $> ); - if ( $runName ne ZM_WEB_USER ) + if ( $runName ne $Config{ZM_WEB_USER} ) { # Not running as web user, so should be root in whch case chown the temporary directory - my ( $webName, $webPass, $webUid, $webGid ) = getpwnam( ZM_WEB_USER ) or Fatal( "Can't get user details for web user '".ZM_WEB_USER."': $!" ); - chown( $webUid, $webGid, "@ZM_TMPDIR@" ) or Fatal( "Can't change ownership of temporary directory '@ZM_TMPDIR@' to '".ZM_WEB_USER.":".ZM_WEB_GROUP."': $!" ); + my ( $webName, $webPass, $webUid, $webGid ) = getpwnam( $Config{ZM_WEB_USER} ) or Fatal( "Can't get user details for web user '".$Config{ZM_WEB_USER}."': $!" ); + chown( $webUid, $webGid, "@ZM_TMPDIR@" ) or Fatal( "Can't change ownership of temporary directory '@ZM_TMPDIR@' to '".$Config{ZM_WEB_USER}.":".$Config{ZM_WEB_GROUP}."': $!" ); } } zmMemTidy(); @@ -186,13 +186,13 @@ if ( $command =~ /^(?:start|restart)$/ ) } if ( $monitor->{Function} ne 'Monitor' ) { - if ( ZM_OPT_FRAME_SERVER ) + if ( $Config{ZM_OPT_FRAME_SERVER} ) { runCommand( "zmdc.pl start zmf -m $monitor->{Id}" ); } runCommand( "zmdc.pl start zma -m $monitor->{Id}" ); } - if ( ZM_OPT_CONTROL ) + if ( $Config{ZM_OPT_CONTROL} ) { if ( $monitor->{Function} eq 'Modect' || $monitor->{Function} eq 'Mocord' ) { @@ -208,20 +208,20 @@ if ( $command =~ /^(?:start|restart)$/ ) # This is now started unconditionally runCommand( "zmdc.pl start zmfilter.pl" ); - if ( ZM_RUN_AUDIT ) + if ( $Config{ZM_RUN_AUDIT} ) { runCommand( "zmdc.pl start zmaudit.pl -c" ); } - if ( ZM_OPT_TRIGGERS ) + if ( $Config{ZM_OPT_TRIGGERS} ) { runCommand( "zmdc.pl start zmtrigger.pl" ); } - if ( ZM_OPT_X10 ) + if ( $Config{ZM_OPT_X10} ) { runCommand( "zmdc.pl start zmx10.pl -c start" ); } runCommand( "zmdc.pl start zmwatch.pl" ); - if ( ZM_CHECK_FOR_UPDATES ) + if ( $Config{ZM_CHECK_FOR_UPDATES} ) { runCommand( "zmdc.pl start zmupdate.pl -c" ); } @@ -245,3 +245,5 @@ if ( $command eq "logrot" ) } exit( $retval ); + +__END__ diff --git a/scripts/zmupdate.pl.in b/scripts/zmupdate.pl.in index f9565abef..cc2e93467 100644 --- a/scripts/zmupdate.pl.in +++ b/scripts/zmupdate.pl.in @@ -54,7 +54,7 @@ use DBI; use Getopt::Long; use Data::Dumper; -use constant EVENT_PATH => (ZM_DIR_EVENTS=~m|/|)?ZM_DIR_EVENTS:(ZM_PATH_WEB.'/'.ZM_DIR_EVENTS); +use constant EVENT_PATH => ($Config{ZM_DIR_EVENTS}=~m|/|)?$Config{ZM_DIR_EVENTS}:($Config{ZM_PATH_WEB}.'/'.$Config{ZM_DIR_EVENTS}); $| = 1; @@ -62,7 +62,7 @@ $ENV{PATH} = '/bin:/usr/bin:/usr/local/bin'; $ENV{SHELL} = '/bin/sh' if exists $ENV{SHELL}; delete @ENV{qw(IFS CDPATH ENV BASH_ENV)}; -my $web_uid = (getpwnam( ZM_WEB_USER ))[2]; +my $web_uid = (getpwnam( $Config{ZM_WEB_USER} ))[2]; my $use_log = (($> == 0) || ($> == $web_uid)); logInit( toFile=>$use_log?DEBUG:NOLOG ); @@ -75,8 +75,8 @@ my $rename = 0; my $zoneFix = 0; my $migrateEvents = 0; my $version = ''; -my $dbUser = ZM_DB_USER; -my $dbPass = ZM_DB_PASS; +my $dbUser = $Config{ZM_DB_USER}; +my $dbPass = $Config{ZM_DB_PASS}; my $updateDir = ''; sub Usage { @@ -99,14 +99,14 @@ if ( !GetOptions( 'check'=>\$check, 'freshen'=>\$freshen, 'rename'=>\$rename, 'z } my $dbh = zmDbConnect(); -*ZoneMinder::Database::ZM_DB_USER = sub { $dbUser } if ZoneMinder::Database::ZM_DB_USER ne $dbUser; -*ZoneMinder::Database::ZM_DB_PASS = sub { $dbPass } if ZoneMinder::Database::ZM_DB_PASS ne $dbPass; +$Config{ZM_DB_USER} = $dbUser; +$Config{ZM_DB_PASS} = $dbPass; if ( ! ($check || $freshen || $rename || $zoneFix || $migrateEvents || $version) ) { - if ( ZM_DYN_DB_VERSION ) + if ( $Config{ZM_DYN_DB_VERSION} ) { - $version = ZM_DYN_DB_VERSION; + $version = $Config{ZM_DYN_DB_VERSION}; } else { @@ -121,17 +121,17 @@ if ( ($check + $freshen + $rename + $zoneFix + $migrateEvents + ($version?1:0)) Usage(); } -if ( $check && ZM_CHECK_FOR_UPDATES ) +if ( $check && $Config{ZM_CHECK_FOR_UPDATES} ) { print( "Update agent starting at ".strftime( '%y/%m/%d %H:%M:%S', localtime() )."\n" ); - my $currVersion = ZM_DYN_CURR_VERSION; - my $lastVersion = ZM_DYN_LAST_VERSION; - my $lastCheck = ZM_DYN_LAST_CHECK; + my $currVersion = $Config{ZM_DYN_CURR_VERSION}; + my $lastVersion = $Config{ZM_DYN_LAST_VERSION}; + my $lastCheck = $Config{ZM_DYN_LAST_CHECK}; if ( !$currVersion ) { - $currVersion = ZM_VERSION; + $currVersion = $Config{ZM_VERSION}; my $sql = "update Config set Value = ? where Name = 'ZM_DYN_CURR_VERSION'"; my $sth = $dbh->prepare_cached( $sql ) or die( "Can't prepare '$sql': ".$dbh->errstr() ); @@ -148,14 +148,8 @@ if ( $check && ZM_CHECK_FOR_UPDATES ) use LWP::UserAgent; my $ua = LWP::UserAgent->new; $ua->agent( "ZoneMinder Update Agent/".ZM_VERSION ); - if ( eval('defined(ZM_UPDATE_CHECK_PROXY)') ) - { - no strict 'subs'; - if ( ZM_UPDATE_CHECK_PROXY ) - { - $ua->proxy( "http", ZM_UPDATE_CHECK_PROXY ); - } - use strict 'subs'; + if ( $Config{ZM_UPDATE_CHECK_PROXY} ) { + $ua->proxy( "http", $Config{ZM_UPDATE_CHECK_PROXY} ); } my $req = HTTP::Request->new( GET=>'http://zoneminder.github.io/ZoneMinder/version.txt' ); my $res = $ua->request($req); @@ -247,12 +241,12 @@ if ( $zoneFix ) } if ( $migrateEvents ) { - my $webUid = (getpwnam( ZM_WEB_USER ))[2]; - my $webGid = (getgrnam( ZM_WEB_USER ))[2]; + my $webUid = (getpwnam( $Config{ZM_WEB_USER} ))[2]; + my $webGid = (getgrnam( $Config{ZM_WEB_USER} ))[2]; if ( !(($> == 0) || ($> == $webUid)) ) { - print( "Error, migrating events can only be done as user root or ".ZM_WEB_USER.".\n" ); + print( "Error, migrating events can only be done as user root or ".$Config{ZM_WEB_USER}.".\n" ); exit( -1 ); } @@ -276,7 +270,7 @@ if ( $migrateEvents ) { print( "Converting all events to deep storage.\n" ); - chdir( ZM_PATH_WEB ); + chdir( $Config{ZM_PATH_WEB} ); my $sql = "select *, unix_timestamp(StartTime) as UnixStartTime from Events"; my $sth = $dbh->prepare_cached( $sql ) or Fatal( "Can't prepare '$sql': ".$dbh->errstr() ); my $res = $sth->execute(); @@ -287,7 +281,7 @@ if ( $migrateEvents ) while( my $event = $sth->fetchrow_hashref() ) { - my $oldEventPath = ZM_DIR_EVENTS.'/'.$event->{MonitorId}.'/'.$event->{Id}; + my $oldEventPath = $Config{ZM_DIR_EVENTS}.'/'.$event->{MonitorId}.'/'.$event->{Id}; if ( !-d $oldEventPath ) { @@ -296,11 +290,11 @@ if ( $migrateEvents ) } print( "Converting event ".$event->{Id}."\n" ); - my $newDatePath = ZM_DIR_EVENTS.'/'.$event->{MonitorId}.'/'.strftime( "%y/%m/%d", localtime($event->{UnixStartTime}) ); + my $newDatePath = $Config{ZM_DIR_EVENTS}.'/'.$event->{MonitorId}.'/'.strftime( "%y/%m/%d", localtime($event->{UnixStartTime}) ); my $newTimePath = strftime( "%H/%M/%S", localtime($event->{UnixStartTime}) ); my $newEventPath = $newDatePath.'/'.$newTimePath; ( my $truncEventPath = $newEventPath ) =~ s|/\d+$||; - makePath( $truncEventPath, ZM_PATH_WEB ); + makePath( $truncEventPath, $Config{ZM_PATH_WEB} ); my $idLink = $newDatePath.'/.'.$event->{Id}; symlink( $newTimePath, $idLink ) or die( "Can't symlink $newTimePath -> $idLink: $!" ); rename( $oldEventPath, $newEventPath ) or die( "Can't move $oldEventPath -> $newEventPath: $!" ); @@ -366,9 +360,9 @@ if ( $version ) print( "\nInitiating database upgrade to version ".ZM_VERSION." from version $version\n" ); if ( $interactive ) { - if ( ZM_DYN_DB_VERSION && ZM_DYN_DB_VERSION ne $version ) + if ( $Config{ZM_DYN_DB_VERSION} && $Config{ZM_DYN_DB_VERSION} ne $version ) { - print( "\nWARNING - You have specified an upgrade from version $version but the database version found is ".ZM_DYN_DB_VERSION.". Is this correct?\nPress enter to continue or ctrl-C to abort : " ); + print( "\nWARNING - You have specified an upgrade from version $version but the database version found is ".$Config{ZM_DYN_DB_VERSION}.". Is this correct?\nPress enter to continue or ctrl-C to abort : " ); my $response = ; } @@ -387,7 +381,7 @@ if ( $version ) if ( $response =~ /^[yY]$/ ) { - my ( $host, $port ) = ( ZM_DB_HOST =~ /^([^:]+)(?::(.+))?$/ ); + my ( $host, $port ) = ( $Config{ZM_DB_HOST} =~ /^([^:]+)(?::(.+))?$/ ); my $command = "mysqldump -h".$host; $command .= " -P".$port if defined($port); if ( $dbUser ) @@ -398,8 +392,8 @@ if ( $version ) $command .= " -p".$dbPass; } } - my $backup = "@ZM_TMPDIR@/".ZM_DB_NAME."-".$version.".dump"; - $command .= " --add-drop-table --databases ".ZM_DB_NAME." > ".$backup; + my $backup = "@ZM_TMPDIR@/".$Config{ZM_DB_NAME}."-".$version.".dump"; + $command .= " --add-drop-table --databases ".$Config{ZM_DB_NAME}." > ".$backup; print( "Creating backup to $backup. This may take several minutes.\n" ); print( "Executing '$command'\n" ) if ( logDebugging() ); my $output = qx($command); @@ -428,7 +422,7 @@ if ( $version ) my $dbh = shift; my $version = shift; - my ( $host, $port ) = ( ZM_DB_HOST =~ /^([^:]+)(?::(.+))?$/ ); + my ( $host, $port ) = ( $Config{ZM_DB_HOST} =~ /^([^:]+)(?::(.+))?$/ ); my $command = "mysql -h".$host; $command .= " -P".$port if defined($port); if ( $dbUser ) @@ -439,14 +433,14 @@ if ( $version ) $command .= " -p".$dbPass; } } - $command .= " ".ZM_DB_NAME." < "; + $command .= " ".$Config{ZM_DB_NAME}." < "; if ( $updateDir ) { $command .= $updateDir; } else { - $command .= ZM_PATH_DATA."/db"; + $command .= $Config{ZM_PATH_DATA}."/db"; } $command .= "/zm_update-".$version.".sql"; @@ -727,7 +721,7 @@ if ( $version ) my ( $sql, $sth, $res ); if ( defined(&ZM_EMAIL_TEXT) && &ZM_EMAIL_TEXT ) { - my ( $email_subject, $email_body ) = ZM_EMAIL_TEXT =~ /subject\s*=\s*"([^\n]*)".*body\s*=\s*"(.*)"?$/ms; + my ( $email_subject, $email_body ) = $Config{ZM_EMAIL_TEXT} =~ /subject\s*=\s*"([^\n]*)".*body\s*=\s*"(.*)"?$/ms; $sql = "replace into Config set Id = 0, Name = 'ZM_EMAIL_SUBJECT', Value = '".$email_subject."', Type = 'string', DefaultValue = 'ZoneMinder: Alarm - %MN%-%EI% (%ESM% - %ESA% %EFA%)', Hint = 'string', Pattern = '(?-xism:^(.+)\$)', Format = ' \$1 ', Prompt = 'The subject of the email used to send matching event details', Help = 'This option is used to define the subject of the email that is sent for any events that match the appropriate filters.', Category = 'mail', Readonly = '0', Requires = 'ZM_OPT_EMAIL=1'"; $sth = $dbh->prepare_cached( $sql ) or die( "Can't prepare '$sql': ".$dbh->errstr() ); $res = $sth->execute() or die( "Can't execute: ".$sth->errstr() ); @@ -737,7 +731,7 @@ if ( $version ) } if ( defined(&ZM_MESSAGE_TEXT) && &ZM_MESSAGE_TEXT ) { - my ( $message_subject, $message_body ) = ZM_MESSAGE_TEXT =~ /subject\s*=\s*"([^\n]*)".*body\s*=\s*"(.*)"?$/ms; + my ( $message_subject, $message_body ) = $Config{ZM_MESSAGE_TEXT} =~ /subject\s*=\s*"([^\n]*)".*body\s*=\s*"(.*)"?$/ms; $sql = "replace into Config set Id = 0, Name = 'ZM_MESSAGE_SUBJECT', Value = '".$message_subject."', Type = 'string', DefaultValue = 'ZoneMinder: Alarm - %MN%-%EI%', Hint = 'string', Pattern = '(?-xism:^(.+)\$)', Format = ' \$1 ', Prompt = 'The subject of the message used to send matching event details', Help = 'This option is used to define the subject of the message that is sent for any events that match the appropriate filters.', Category = 'mail', Readonly = '0', Requires = 'ZM_OPT_MESSAGE=1'"; $sth = $dbh->prepare_cached( $sql ) or die( "Can't prepare '$sql': ".$dbh->errstr() ); $res = $sth->execute() or die( "Can't execute: ".$sth->errstr() ); @@ -871,7 +865,7 @@ if ( $version ) my $sql = "update Config set Value = ? where Name = 'ZM_JPEG_STREAM_QUALITY'"; my $sth = $dbh->prepare_cached( $sql ) or die( "Can't prepare '$sql': ".$dbh->errstr() ); - my $res = $sth->execute( ZM_JPEG_IMAGE_QUALITY ) or die( "Can't execute: ".$sth->errstr() ); + my $res = $sth->execute( $Config{ZM_JPEG_IMAGE_QUALITY} ) or die( "Can't execute: ".$sth->errstr() ); } $cascade = !undef; } @@ -1007,7 +1001,7 @@ if ( $version ) if ( $version ge '1.26.0' ) { my @files; - $updateDir = ZM_PATH_DATA."/db" if ! $updateDir; + $updateDir = $Config{ZM_PATH_DATA}."/db" if ! $updateDir; opendir( my $dh, $updateDir ) || die "Can't open updateDir $!"; @files = sort grep { (!/^\./) && /^zm_update\-[\d\.]+\.sql$/ && -f "$updateDir/$_" } readdir($dh); closedir $dh; diff --git a/scripts/zmvideo.pl.in b/scripts/zmvideo.pl.in index 236e5d20c..46cf83998 100644 --- a/scripts/zmvideo.pl.in +++ b/scripts/zmvideo.pl.in @@ -56,7 +56,7 @@ my $fps = ''; my $size = ''; my $overwrite = 0; -my @formats = split( /\s+/, ZM_FFMPEG_FORMATS ); +my @formats = split( /\s+/, $Config{ZM_FFMPEG_FORMATS} ); for ( my $i = 0; $i < @formats; $i++ ) { if ( $i =~ /^(.+)\*$/ ) @@ -92,7 +92,7 @@ if ( !$event_id || $event_id < 0 ) Usage(); } -if ( !ZM_OPT_FFMPEG ) +if ( ! $Config{ZM_OPT_FFMPEG} ) { print( STDERR "Mpeg encoding is not currently enabled\n" ); exit(-1); @@ -221,7 +221,7 @@ if ( $overwrite || !-s $video_file ) $video_size = $size; } - my $command = ZM_PATH_FFMPEG." -y -r $frame_rate ".ZM_FFMPEG_INPUT_OPTIONS." -i %0".ZM_EVENT_IMAGE_DIGITS."d-capture.jpg -s $video_size ".ZM_FFMPEG_OUTPUT_OPTIONS." '$video_file' > ffmpeg.log 2>&1"; + my $command = $Config{ZM_PATH_FFMPEG}." -y -r $frame_rate ".$Config{ZM_FFMPEG_INPUT_OPTIONS}." -i %0".$Config{ZM_EVENT_IMAGE_DIGITS}."d-capture.jpg -s $video_size ".$Config{ZM_FFMPEG_OUTPUT_OPTIONS}." '$video_file' > ffmpeg.log 2>&1"; Debug( $command."\n" ); my $output = qx($command); diff --git a/scripts/zmwatch.pl.in b/scripts/zmwatch.pl.in index 4d50f0496..bfa8b54bd 100644 --- a/scripts/zmwatch.pl.in +++ b/scripts/zmwatch.pl.in @@ -90,7 +90,7 @@ while( 1 ) next if ( !defined($image_time) ); # Can't read from shared data next if ( !$image_time ); # We can't get the last capture time so can't be sure it's died. - my $max_image_delay = ($monitor->{MaxFPS}&&($monitor->{MaxFPS}>0)&&($monitor->{MaxFPS}<1))?(3/$monitor->{MaxFPS}):ZM_WATCH_MAX_DELAY; + my $max_image_delay = ($monitor->{MaxFPS}&&($monitor->{MaxFPS}>0)&&($monitor->{MaxFPS}<1))?(3/$monitor->{MaxFPS}):$Config{ZM_WATCH_MAX_DELAY}; my $image_delay = $now-$image_time; Debug( "Monitor $monitor->{Id} last captured $image_delay seconds ago, max is $max_image_delay\n" ); if ( $image_delay > $max_image_delay ) @@ -127,7 +127,7 @@ while( 1 ) next if ( !defined($image_time) ); # Can't read from shared data next if ( !$image_time ); # We can't get the last capture time so can't be sure it's died. - my $max_image_delay = ($monitor->{MaxFPS}&&($monitor->{MaxFPS}>0)&&($monitor->{MaxFPS}<1))?(3/$monitor->{MaxFPS}):ZM_WATCH_MAX_DELAY; + my $max_image_delay = ($monitor->{MaxFPS}&&($monitor->{MaxFPS}>0)&&($monitor->{MaxFPS}<1))?(3/$monitor->{MaxFPS}):$Config{ZM_WATCH_MAX_DELAY}; my $image_delay = $now-$image_time; Debug( "Monitor $monitor->{Id} last analysed $image_delay seconds ago, max is $max_image_delay\n" ); if ( $image_delay > $max_image_delay ) @@ -142,7 +142,7 @@ while( 1 ) # Prevent open handles building up if we have connect to shared memory zmMemInvalidate( $monitor ); } - sleep( ZM_WATCH_CHECK_INTERVAL ); + sleep( $Config{ZM_WATCH_CHECK_INTERVAL} ); } Info( "Watchdog exiting\n" ); exit(); diff --git a/src/zm_config_defines.h b/src/zm_config_defines.h index 572ee589f..4d3b9085a 100644 --- a/src/zm_config_defines.h +++ b/src/zm_config_defines.h @@ -30,196 +30,195 @@ #define ZM_CPU_EXTENSIONS 26 #define ZM_FAST_IMAGE_BLENDS 27 #define ZM_OPT_ADAPTIVE_SKIP 28 -#define ZM_BLEND_ALARMED_IMAGES 29 -#define ZM_MAX_SUSPEND_TIME 30 -#define ZM_OPT_REMOTE_CAMERAS 31 -#define ZM_NETCAM_REGEXPS 32 -#define ZM_HTTP_VERSION 33 -#define ZM_HTTP_UA 34 -#define ZM_HTTP_TIMEOUT 35 -#define ZM_MIN_RTP_PORT 36 -#define ZM_MAX_RTP_PORT 37 -#define ZM_OPT_FFMPEG 38 -#define ZM_PATH_FFMPEG 39 -#define ZM_FFMPEG_INPUT_OPTIONS 40 -#define ZM_FFMPEG_OUTPUT_OPTIONS 41 -#define ZM_FFMPEG_FORMATS 42 -#define ZM_LOG_LEVEL_SYSLOG 43 -#define ZM_LOG_LEVEL_FILE 44 -#define ZM_LOG_LEVEL_WEBLOG 45 -#define ZM_LOG_LEVEL_DATABASE 46 -#define ZM_LOG_DATABASE_LIMIT 47 -#define ZM_LOG_DEBUG 48 -#define ZM_LOG_DEBUG_TARGET 49 -#define ZM_LOG_DEBUG_LEVEL 50 -#define ZM_LOG_DEBUG_FILE 51 -#define ZM_LOG_CHECK_PERIOD 52 -#define ZM_LOG_ALERT_WAR_COUNT 53 -#define ZM_LOG_ALERT_ERR_COUNT 54 -#define ZM_LOG_ALERT_FAT_COUNT 55 -#define ZM_LOG_ALARM_WAR_COUNT 56 -#define ZM_LOG_ALARM_ERR_COUNT 57 -#define ZM_LOG_ALARM_FAT_COUNT 58 -#define ZM_RECORD_EVENT_STATS 59 -#define ZM_RECORD_DIAG_IMAGES 60 -#define ZM_DUMP_CORES 61 -#define ZM_PATH_MAP 62 -#define ZM_PATH_SOCKS 63 -#define ZM_PATH_LOGS 64 -#define ZM_PATH_SWAP 65 -#define ZM_WEB_TITLE_PREFIX 66 -#define ZM_WEB_RESIZE_CONSOLE 67 -#define ZM_WEB_POPUP_ON_ALARM 68 -#define ZM_OPT_X10 69 -#define ZM_X10_DEVICE 70 -#define ZM_X10_HOUSE_CODE 71 -#define ZM_X10_DB_RELOAD_INTERVAL 72 -#define ZM_WEB_SOUND_ON_ALARM 73 -#define ZM_WEB_ALARM_SOUND 74 -#define ZM_WEB_COMPACT_MONTAGE 75 -#define ZM_OPT_FAST_DELETE 76 -#define ZM_STRICT_VIDEO_CONFIG 77 -#define ZM_SIGNAL_CHECK_POINTS 78 -#define ZM_V4L_MULTI_BUFFER 79 -#define ZM_CAPTURES_PER_FRAME 80 -#define ZM_FILTER_RELOAD_DELAY 81 -#define ZM_FILTER_EXECUTE_INTERVAL 82 -#define ZM_OPT_UPLOAD 83 -#define ZM_UPLOAD_ARCH_FORMAT 84 -#define ZM_UPLOAD_ARCH_COMPRESS 85 -#define ZM_UPLOAD_ARCH_ANALYSE 86 -#define ZM_UPLOAD_PROTOCOL 87 -#define ZM_UPLOAD_FTP_HOST 88 -#define ZM_UPLOAD_HOST 89 -#define ZM_UPLOAD_PORT 90 -#define ZM_UPLOAD_FTP_USER 91 -#define ZM_UPLOAD_USER 92 -#define ZM_UPLOAD_FTP_PASS 93 -#define ZM_UPLOAD_PASS 94 -#define ZM_UPLOAD_FTP_LOC_DIR 95 -#define ZM_UPLOAD_LOC_DIR 96 -#define ZM_UPLOAD_FTP_REM_DIR 97 -#define ZM_UPLOAD_REM_DIR 98 -#define ZM_UPLOAD_FTP_TIMEOUT 99 -#define ZM_UPLOAD_TIMEOUT 100 -#define ZM_UPLOAD_FTP_PASSIVE 101 -#define ZM_UPLOAD_FTP_DEBUG 102 -#define ZM_UPLOAD_DEBUG 103 -#define ZM_OPT_EMAIL 104 -#define ZM_EMAIL_ADDRESS 105 -#define ZM_EMAIL_TEXT 106 -#define ZM_EMAIL_SUBJECT 107 -#define ZM_EMAIL_BODY 108 -#define ZM_OPT_MESSAGE 109 -#define ZM_MESSAGE_ADDRESS 110 -#define ZM_MESSAGE_TEXT 111 -#define ZM_MESSAGE_SUBJECT 112 -#define ZM_MESSAGE_BODY 113 -#define ZM_NEW_MAIL_MODULES 114 -#define ZM_EMAIL_HOST 115 -#define ZM_FROM_EMAIL 116 -#define ZM_URL 117 -#define ZM_MAX_RESTART_DELAY 118 -#define ZM_WATCH_CHECK_INTERVAL 119 -#define ZM_WATCH_MAX_DELAY 120 -#define ZM_RUN_AUDIT 121 -#define ZM_AUDIT_CHECK_INTERVAL 122 -#define ZM_FORCED_ALARM_SCORE 123 -#define ZM_BULK_FRAME_INTERVAL 124 -#define ZM_EVENT_CLOSE_MODE 125 -#define ZM_FORCE_CLOSE_EVENTS 126 -#define ZM_CREATE_ANALYSIS_IMAGES 127 -#define ZM_WEIGHTED_ALARM_CENTRES 128 -#define ZM_EVENT_IMAGE_DIGITS 129 -#define ZM_DEFAULT_ASPECT_RATIO 130 -#define ZM_USER_SELF_EDIT 131 -#define ZM_OPT_FRAME_SERVER 132 -#define ZM_FRAME_SOCKET_SIZE 133 -#define ZM_OPT_CONTROL 134 -#define ZM_OPT_TRIGGERS 135 -#define ZM_CHECK_FOR_UPDATES 136 -#define ZM_UPDATE_CHECK_PROXY 137 -#define ZM_SHM_KEY 138 -#define ZM_WEB_REFRESH_METHOD 139 -#define ZM_WEB_EVENT_SORT_FIELD 140 -#define ZM_WEB_EVENT_SORT_ORDER 141 -#define ZM_WEB_EVENTS_PER_PAGE 142 -#define ZM_WEB_LIST_THUMBS 143 -#define ZM_WEB_LIST_THUMB_WIDTH 144 -#define ZM_WEB_LIST_THUMB_HEIGHT 145 -#define ZM_WEB_USE_OBJECT_TAGS 146 -#define ZM_WEB_H_REFRESH_MAIN 147 -#define ZM_WEB_H_REFRESH_CYCLE 148 -#define ZM_WEB_H_REFRESH_IMAGE 149 -#define ZM_WEB_H_REFRESH_STATUS 150 -#define ZM_WEB_H_REFRESH_EVENTS 151 -#define ZM_WEB_H_CAN_STREAM 152 -#define ZM_WEB_H_STREAM_METHOD 153 -#define ZM_WEB_H_DEFAULT_SCALE 154 -#define ZM_WEB_H_DEFAULT_RATE 155 -#define ZM_WEB_H_VIDEO_BITRATE 156 -#define ZM_WEB_H_VIDEO_MAXFPS 157 -#define ZM_WEB_H_SCALE_THUMBS 158 -#define ZM_WEB_H_EVENTS_VIEW 159 -#define ZM_WEB_H_SHOW_PROGRESS 160 -#define ZM_WEB_H_AJAX_TIMEOUT 161 -#define ZM_WEB_M_REFRESH_MAIN 162 -#define ZM_WEB_M_REFRESH_CYCLE 163 -#define ZM_WEB_M_REFRESH_IMAGE 164 -#define ZM_WEB_M_REFRESH_STATUS 165 -#define ZM_WEB_M_REFRESH_EVENTS 166 -#define ZM_WEB_M_CAN_STREAM 167 -#define ZM_WEB_M_STREAM_METHOD 168 -#define ZM_WEB_M_DEFAULT_SCALE 169 -#define ZM_WEB_M_DEFAULT_RATE 170 -#define ZM_WEB_M_VIDEO_BITRATE 171 -#define ZM_WEB_M_VIDEO_MAXFPS 172 -#define ZM_WEB_M_SCALE_THUMBS 173 -#define ZM_WEB_M_EVENTS_VIEW 174 -#define ZM_WEB_M_SHOW_PROGRESS 175 -#define ZM_WEB_M_AJAX_TIMEOUT 176 -#define ZM_WEB_L_REFRESH_MAIN 177 -#define ZM_WEB_L_REFRESH_CYCLE 178 -#define ZM_WEB_L_REFRESH_IMAGE 179 -#define ZM_WEB_L_REFRESH_STATUS 180 -#define ZM_WEB_L_REFRESH_EVENTS 181 -#define ZM_WEB_L_CAN_STREAM 182 -#define ZM_WEB_L_STREAM_METHOD 183 -#define ZM_WEB_L_DEFAULT_SCALE 184 -#define ZM_WEB_L_DEFAULT_RATE 185 -#define ZM_WEB_L_VIDEO_BITRATE 186 -#define ZM_WEB_L_VIDEO_MAXFPS 187 -#define ZM_WEB_L_SCALE_THUMBS 188 -#define ZM_WEB_L_EVENTS_VIEW 189 -#define ZM_WEB_L_SHOW_PROGRESS 190 -#define ZM_WEB_L_AJAX_TIMEOUT 191 -#define ZM_WEB_P_CAN_STREAM 192 -#define ZM_WEB_P_STREAM_METHOD 193 -#define ZM_WEB_P_DEFAULT_SCALE 194 -#define ZM_WEB_P_DEFAULT_RATE 195 -#define ZM_WEB_P_VIDEO_BITRATE 196 -#define ZM_WEB_P_VIDEO_MAXFPS 197 -#define ZM_WEB_P_SCALE_THUMBS 198 -#define ZM_WEB_P_AJAX_TIMEOUT 199 -#define ZM_DYN_LAST_VERSION 200 -#define ZM_DYN_CURR_VERSION 201 -#define ZM_DYN_DB_VERSION 202 -#define ZM_DYN_LAST_CHECK 203 -#define ZM_DYN_NEXT_REMINDER 204 -#define ZM_DYN_DONATE_REMINDER_TIME 205 -#define ZM_DYN_SHOW_DONATE_REMINDER 206 -#define ZM_EYEZM_DEBUG 207 -#define ZM_EYEZM_LOG_TO_FILE 208 -#define ZM_EYEZM_LOG_FILE 209 -#define ZM_EYEZM_EVENT_VCODEC 210 -#define ZM_EYEZM_FEED_VCODEC 211 -#define ZM_EYEZM_H264_DEFAULT_BR 212 -#define ZM_EYEZM_H264_DEFAULT_EVBR 213 -#define ZM_EYEZM_H264_TIMEOUT 214 -#define ZM_EYEZM_SEG_DURATION 215 +#define ZM_MAX_SUSPEND_TIME 29 +#define ZM_OPT_REMOTE_CAMERAS 30 +#define ZM_NETCAM_REGEXPS 31 +#define ZM_HTTP_VERSION 32 +#define ZM_HTTP_UA 33 +#define ZM_HTTP_TIMEOUT 34 +#define ZM_MIN_RTP_PORT 35 +#define ZM_MAX_RTP_PORT 36 +#define ZM_OPT_FFMPEG 37 +#define ZM_PATH_FFMPEG 38 +#define ZM_FFMPEG_INPUT_OPTIONS 39 +#define ZM_FFMPEG_OUTPUT_OPTIONS 40 +#define ZM_FFMPEG_FORMATS 41 +#define ZM_LOG_LEVEL_SYSLOG 42 +#define ZM_LOG_LEVEL_FILE 43 +#define ZM_LOG_LEVEL_WEBLOG 44 +#define ZM_LOG_LEVEL_DATABASE 45 +#define ZM_LOG_DATABASE_LIMIT 46 +#define ZM_LOG_DEBUG 47 +#define ZM_LOG_DEBUG_TARGET 48 +#define ZM_LOG_DEBUG_LEVEL 49 +#define ZM_LOG_DEBUG_FILE 50 +#define ZM_LOG_CHECK_PERIOD 51 +#define ZM_LOG_ALERT_WAR_COUNT 52 +#define ZM_LOG_ALERT_ERR_COUNT 53 +#define ZM_LOG_ALERT_FAT_COUNT 54 +#define ZM_LOG_ALARM_WAR_COUNT 55 +#define ZM_LOG_ALARM_ERR_COUNT 56 +#define ZM_LOG_ALARM_FAT_COUNT 57 +#define ZM_RECORD_EVENT_STATS 58 +#define ZM_RECORD_DIAG_IMAGES 59 +#define ZM_DUMP_CORES 60 +#define ZM_PATH_MAP 61 +#define ZM_PATH_SOCKS 62 +#define ZM_PATH_LOGS 63 +#define ZM_PATH_SWAP 64 +#define ZM_WEB_TITLE_PREFIX 65 +#define ZM_WEB_RESIZE_CONSOLE 66 +#define ZM_WEB_POPUP_ON_ALARM 67 +#define ZM_OPT_X10 68 +#define ZM_X10_DEVICE 69 +#define ZM_X10_HOUSE_CODE 70 +#define ZM_X10_DB_RELOAD_INTERVAL 71 +#define ZM_WEB_SOUND_ON_ALARM 72 +#define ZM_WEB_ALARM_SOUND 73 +#define ZM_WEB_COMPACT_MONTAGE 74 +#define ZM_OPT_FAST_DELETE 75 +#define ZM_STRICT_VIDEO_CONFIG 76 +#define ZM_SIGNAL_CHECK_POINTS 77 +#define ZM_V4L_MULTI_BUFFER 78 +#define ZM_CAPTURES_PER_FRAME 79 +#define ZM_FILTER_RELOAD_DELAY 80 +#define ZM_FILTER_EXECUTE_INTERVAL 81 +#define ZM_OPT_UPLOAD 82 +#define ZM_UPLOAD_ARCH_FORMAT 83 +#define ZM_UPLOAD_ARCH_COMPRESS 84 +#define ZM_UPLOAD_ARCH_ANALYSE 85 +#define ZM_UPLOAD_PROTOCOL 86 +#define ZM_UPLOAD_FTP_HOST 87 +#define ZM_UPLOAD_HOST 88 +#define ZM_UPLOAD_PORT 89 +#define ZM_UPLOAD_FTP_USER 90 +#define ZM_UPLOAD_USER 91 +#define ZM_UPLOAD_FTP_PASS 92 +#define ZM_UPLOAD_PASS 93 +#define ZM_UPLOAD_FTP_LOC_DIR 94 +#define ZM_UPLOAD_LOC_DIR 95 +#define ZM_UPLOAD_FTP_REM_DIR 96 +#define ZM_UPLOAD_REM_DIR 97 +#define ZM_UPLOAD_FTP_TIMEOUT 98 +#define ZM_UPLOAD_TIMEOUT 99 +#define ZM_UPLOAD_FTP_PASSIVE 100 +#define ZM_UPLOAD_FTP_DEBUG 101 +#define ZM_UPLOAD_DEBUG 102 +#define ZM_OPT_EMAIL 103 +#define ZM_EMAIL_ADDRESS 104 +#define ZM_EMAIL_TEXT 105 +#define ZM_EMAIL_SUBJECT 106 +#define ZM_EMAIL_BODY 107 +#define ZM_OPT_MESSAGE 108 +#define ZM_MESSAGE_ADDRESS 109 +#define ZM_MESSAGE_TEXT 110 +#define ZM_MESSAGE_SUBJECT 111 +#define ZM_MESSAGE_BODY 112 +#define ZM_NEW_MAIL_MODULES 113 +#define ZM_EMAIL_HOST 114 +#define ZM_FROM_EMAIL 115 +#define ZM_URL 116 +#define ZM_MAX_RESTART_DELAY 117 +#define ZM_WATCH_CHECK_INTERVAL 118 +#define ZM_WATCH_MAX_DELAY 119 +#define ZM_RUN_AUDIT 120 +#define ZM_AUDIT_CHECK_INTERVAL 121 +#define ZM_FORCED_ALARM_SCORE 122 +#define ZM_BULK_FRAME_INTERVAL 123 +#define ZM_EVENT_CLOSE_MODE 124 +#define ZM_FORCE_CLOSE_EVENTS 125 +#define ZM_CREATE_ANALYSIS_IMAGES 126 +#define ZM_WEIGHTED_ALARM_CENTRES 127 +#define ZM_EVENT_IMAGE_DIGITS 128 +#define ZM_DEFAULT_ASPECT_RATIO 129 +#define ZM_USER_SELF_EDIT 130 +#define ZM_OPT_FRAME_SERVER 131 +#define ZM_FRAME_SOCKET_SIZE 132 +#define ZM_OPT_CONTROL 133 +#define ZM_OPT_TRIGGERS 134 +#define ZM_CHECK_FOR_UPDATES 135 +#define ZM_UPDATE_CHECK_PROXY 136 +#define ZM_SHM_KEY 137 +#define ZM_WEB_REFRESH_METHOD 138 +#define ZM_WEB_EVENT_SORT_FIELD 139 +#define ZM_WEB_EVENT_SORT_ORDER 140 +#define ZM_WEB_EVENTS_PER_PAGE 141 +#define ZM_WEB_LIST_THUMBS 142 +#define ZM_WEB_LIST_THUMB_WIDTH 143 +#define ZM_WEB_LIST_THUMB_HEIGHT 144 +#define ZM_WEB_USE_OBJECT_TAGS 145 +#define ZM_WEB_H_REFRESH_MAIN 146 +#define ZM_WEB_H_REFRESH_CYCLE 147 +#define ZM_WEB_H_REFRESH_IMAGE 148 +#define ZM_WEB_H_REFRESH_STATUS 149 +#define ZM_WEB_H_REFRESH_EVENTS 150 +#define ZM_WEB_H_CAN_STREAM 151 +#define ZM_WEB_H_STREAM_METHOD 152 +#define ZM_WEB_H_DEFAULT_SCALE 153 +#define ZM_WEB_H_DEFAULT_RATE 154 +#define ZM_WEB_H_VIDEO_BITRATE 155 +#define ZM_WEB_H_VIDEO_MAXFPS 156 +#define ZM_WEB_H_SCALE_THUMBS 157 +#define ZM_WEB_H_EVENTS_VIEW 158 +#define ZM_WEB_H_SHOW_PROGRESS 159 +#define ZM_WEB_H_AJAX_TIMEOUT 160 +#define ZM_WEB_M_REFRESH_MAIN 161 +#define ZM_WEB_M_REFRESH_CYCLE 162 +#define ZM_WEB_M_REFRESH_IMAGE 163 +#define ZM_WEB_M_REFRESH_STATUS 164 +#define ZM_WEB_M_REFRESH_EVENTS 165 +#define ZM_WEB_M_CAN_STREAM 166 +#define ZM_WEB_M_STREAM_METHOD 167 +#define ZM_WEB_M_DEFAULT_SCALE 168 +#define ZM_WEB_M_DEFAULT_RATE 169 +#define ZM_WEB_M_VIDEO_BITRATE 170 +#define ZM_WEB_M_VIDEO_MAXFPS 171 +#define ZM_WEB_M_SCALE_THUMBS 172 +#define ZM_WEB_M_EVENTS_VIEW 173 +#define ZM_WEB_M_SHOW_PROGRESS 174 +#define ZM_WEB_M_AJAX_TIMEOUT 175 +#define ZM_WEB_L_REFRESH_MAIN 176 +#define ZM_WEB_L_REFRESH_CYCLE 177 +#define ZM_WEB_L_REFRESH_IMAGE 178 +#define ZM_WEB_L_REFRESH_STATUS 179 +#define ZM_WEB_L_REFRESH_EVENTS 180 +#define ZM_WEB_L_CAN_STREAM 181 +#define ZM_WEB_L_STREAM_METHOD 182 +#define ZM_WEB_L_DEFAULT_SCALE 183 +#define ZM_WEB_L_DEFAULT_RATE 184 +#define ZM_WEB_L_VIDEO_BITRATE 185 +#define ZM_WEB_L_VIDEO_MAXFPS 186 +#define ZM_WEB_L_SCALE_THUMBS 187 +#define ZM_WEB_L_EVENTS_VIEW 188 +#define ZM_WEB_L_SHOW_PROGRESS 189 +#define ZM_WEB_L_AJAX_TIMEOUT 190 +#define ZM_WEB_P_CAN_STREAM 191 +#define ZM_WEB_P_STREAM_METHOD 192 +#define ZM_WEB_P_DEFAULT_SCALE 193 +#define ZM_WEB_P_DEFAULT_RATE 194 +#define ZM_WEB_P_VIDEO_BITRATE 195 +#define ZM_WEB_P_VIDEO_MAXFPS 196 +#define ZM_WEB_P_SCALE_THUMBS 197 +#define ZM_WEB_P_AJAX_TIMEOUT 198 +#define ZM_DYN_LAST_VERSION 199 +#define ZM_DYN_CURR_VERSION 200 +#define ZM_DYN_DB_VERSION 201 +#define ZM_DYN_LAST_CHECK 202 +#define ZM_DYN_NEXT_REMINDER 203 +#define ZM_DYN_DONATE_REMINDER_TIME 204 +#define ZM_DYN_SHOW_DONATE_REMINDER 205 +#define ZM_EYEZM_DEBUG 206 +#define ZM_EYEZM_LOG_TO_FILE 207 +#define ZM_EYEZM_LOG_FILE 208 +#define ZM_EYEZM_EVENT_VCODEC 209 +#define ZM_EYEZM_FEED_VCODEC 210 +#define ZM_EYEZM_H264_DEFAULT_BR 211 +#define ZM_EYEZM_H264_DEFAULT_EVBR 212 +#define ZM_EYEZM_H264_TIMEOUT 213 +#define ZM_EYEZM_SEG_DURATION 214 -#define ZM_MAX_CFG_ID 215 +#define ZM_MAX_CFG_ID 214 #define ZM_CFG_DECLARE_LIST \ const char *lang_default;\ @@ -251,7 +250,6 @@ bool cpu_extensions;\ bool fast_image_blends;\ bool opt_adaptive_skip;\ - bool blend_alarmed_images;\ int max_suspend_time;\ bool opt_remote_cameras;\ bool netcam_regexps;\ @@ -470,7 +468,6 @@ cpu_extensions = (bool)config.Item( ZM_CPU_EXTENSIONS );\ fast_image_blends = (bool)config.Item( ZM_FAST_IMAGE_BLENDS );\ opt_adaptive_skip = (bool)config.Item( ZM_OPT_ADAPTIVE_SKIP );\ - blend_alarmed_images = (bool)config.Item( ZM_BLEND_ALARMED_IMAGES );\ max_suspend_time = (int)config.Item( ZM_MAX_SUSPEND_TIME );\ opt_remote_cameras = (bool)config.Item( ZM_OPT_REMOTE_CAMERAS );\ netcam_regexps = (bool)config.Item( ZM_NETCAM_REGEXPS );\ From 1d338ed8793a70db1fa1f55c1b5e53ee2a558ecf Mon Sep 17 00:00:00 2001 From: Isaac Connor Date: Mon, 16 Dec 2013 16:36:12 -0500 Subject: [PATCH 075/107] more --- scripts/ZoneMinder/lib/ZoneMinder/Config.pm.in | 2 +- scripts/ZoneMinder/lib/ZoneMinder/Memory/Shared.pm | 4 ++-- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/scripts/ZoneMinder/lib/ZoneMinder/Config.pm.in b/scripts/ZoneMinder/lib/ZoneMinder/Config.pm.in index cb6c1cbc2..21f7a2d50 100644 --- a/scripts/ZoneMinder/lib/ZoneMinder/Config.pm.in +++ b/scripts/ZoneMinder/lib/ZoneMinder/Config.pm.in @@ -116,7 +116,7 @@ The ZoneMinder::Config module is used to import the ZoneMinder configuration fro Once the configuration has been imported then configuration variables are defined as constants and can be accessed directory by name, e.g. - $lang = ZM_LANG_DEFAULT; + $lang = $Config{ZM_LANG_DEFAULT}; =head2 EXPORT diff --git a/scripts/ZoneMinder/lib/ZoneMinder/Memory/Shared.pm b/scripts/ZoneMinder/lib/ZoneMinder/Memory/Shared.pm index 6f3e46df3..59dc399f1 100644 --- a/scripts/ZoneMinder/lib/ZoneMinder/Memory/Shared.pm +++ b/scripts/ZoneMinder/lib/ZoneMinder/Memory/Shared.pm @@ -81,7 +81,7 @@ sub zmMemAttach( $$ ) my $size = shift; if ( !defined($monitor->{ShmId}) ) { - my $shm_key = (hex(ZM_SHM_KEY)&0xffff0000)|$monitor->{Id}; + 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) ) { @@ -141,7 +141,7 @@ sub zmMemClean { Debug( "Removing shared memory\n" ); # Find ZoneMinder shared memory - my $command = "ipcs -m | grep '^".substr( sprintf( "0x%x", hex(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( CMD, "$command |" ) or Fatal( "Can't execute '$command': $!" ); while( ) From 2ced76c20d6e6b1f5edc4e3a661ef006ac4c1fe5 Mon Sep 17 00:00:00 2001 From: Isaac Connor Date: Tue, 17 Dec 2013 11:24:33 -0500 Subject: [PATCH 076/107] do this one too --- scripts/ZoneMinder/lib/ZoneMinder/Memory/Mapped.pm | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/scripts/ZoneMinder/lib/ZoneMinder/Memory/Mapped.pm b/scripts/ZoneMinder/lib/ZoneMinder/Memory/Mapped.pm index 2c68c7209..7c472591d 100644 --- a/scripts/ZoneMinder/lib/ZoneMinder/Memory/Mapped.pm +++ b/scripts/ZoneMinder/lib/ZoneMinder/Memory/Mapped.pm @@ -80,7 +80,7 @@ sub zmMemAttach( $$ ) my $size = shift; if ( !defined($monitor->{MMapAddr}) ) { - my $mmap_file = ZM_PATH_MAP."/zm.mmap.".$monitor->{Id}; + my $mmap_file = $Config{ZM_PATH_MAP}."/zm.mmap.".$monitor->{Id}; if ( -s $mmap_file < $size ) { Error( sprintf( "Memory map file '%s' should have been %d but was instead %d", $mmap_file, $size, -s $mmap_file ) ); return ( undef ); @@ -160,7 +160,7 @@ sub zmMemPut( $$$$ ) sub zmMemClean { Debug( "Removing memory map files\n" ); - my $mapPath = ZM_PATH_MAP."/zm.mmap.*"; + my $mapPath = $Config{ZM_PATH_MAP}."/zm.mmap.*"; foreach my $mapFile( glob( $mapPath ) ) { ( $mapFile ) = $mapFile =~ /^(.+)$/; From 9e7d729ca8c54c9d38d8b64d9b05cc3d66d6ab37 Mon Sep 17 00:00:00 2001 From: Isaac Connor Date: Tue, 17 Dec 2013 12:06:14 -0500 Subject: [PATCH 077/107] use the full path for ZM_VERSION --- scripts/ZoneMinder/lib/ZoneMinder/Control/FI8608W_Y2k.pm | 3 +-- scripts/ZoneMinder/lib/ZoneMinder/Control/FI8620_Y2k.pm | 3 +-- scripts/ZoneMinder/lib/ZoneMinder/Control/FI9821W_Y2k.pm | 3 +-- scripts/ZoneMinder/lib/ZoneMinder/Control/LoftekSentinel.pm | 4 +--- scripts/ZoneMinder/lib/ZoneMinder/Control/Ncs370.pm | 4 +--- scripts/ZoneMinder/lib/ZoneMinder/Control/PanasonicIP.pm | 4 +--- scripts/ZoneMinder/lib/ZoneMinder/Control/PelcoD.pm | 2 -- scripts/ZoneMinder/lib/ZoneMinder/Control/PelcoP.pm | 2 -- scripts/ZoneMinder/lib/ZoneMinder/Control/SkyIPCam7xx.pm | 4 +--- scripts/ZoneMinder/lib/ZoneMinder/Control/Visca.pm | 2 -- scripts/ZoneMinder/lib/ZoneMinder/Control/mjpgStreamer.pm | 4 +--- 11 files changed, 8 insertions(+), 27 deletions(-) diff --git a/scripts/ZoneMinder/lib/ZoneMinder/Control/FI8608W_Y2k.pm b/scripts/ZoneMinder/lib/ZoneMinder/Control/FI8608W_Y2k.pm index ef4f5ad9e..fe695f3f2 100644 --- a/scripts/ZoneMinder/lib/ZoneMinder/Control/FI8608W_Y2k.pm +++ b/scripts/ZoneMinder/lib/ZoneMinder/Control/FI8608W_Y2k.pm @@ -37,7 +37,6 @@ require ZoneMinder::Base; require ZoneMinder::Control; our @ISA = qw(ZoneMinder::Control); -our $VERSION = $ZoneMinder::Base::VERSION; # =================================================================================================================================== # # FI8608W FOSCAM PT H264 Control Protocol @@ -111,7 +110,7 @@ sub open $self->loadMonitor(); use LWP::UserAgent; $self->{ua} = LWP::UserAgent->new; - $self->{ua}->agent( "ZoneMinder Control Agent/".ZM_VERSION ); + $self->{ua}->agent( "ZoneMinder Control Agent/".ZOneMinder::Base::ZM_VERSION ); $self->{state} = 'open'; } diff --git a/scripts/ZoneMinder/lib/ZoneMinder/Control/FI8620_Y2k.pm b/scripts/ZoneMinder/lib/ZoneMinder/Control/FI8620_Y2k.pm index bc8bd8c48..7d9cd261d 100644 --- a/scripts/ZoneMinder/lib/ZoneMinder/Control/FI8620_Y2k.pm +++ b/scripts/ZoneMinder/lib/ZoneMinder/Control/FI8620_Y2k.pm @@ -41,7 +41,6 @@ require ZoneMinder::Base; require ZoneMinder::Control; our @ISA = qw(ZoneMinder::Control); -our $VERSION = $ZoneMinder::Base::VERSION; # =================================================================================================================================== # # FI8620 FOSCAM Dome PTZ H264 Control Protocol @@ -117,7 +116,7 @@ sub open $self->loadMonitor(); use LWP::UserAgent; $self->{ua} = LWP::UserAgent->new; - $self->{ua}->agent( "ZoneMinder Control Agent/".ZM_VERSION ); + $self->{ua}->agent( "ZoneMinder Control Agent/".ZoneMinder::Base::ZM_VERSION ); $self->{state} = 'open'; } diff --git a/scripts/ZoneMinder/lib/ZoneMinder/Control/FI9821W_Y2k.pm b/scripts/ZoneMinder/lib/ZoneMinder/Control/FI9821W_Y2k.pm index e3b1a6d22..d363ca247 100644 --- a/scripts/ZoneMinder/lib/ZoneMinder/Control/FI9821W_Y2k.pm +++ b/scripts/ZoneMinder/lib/ZoneMinder/Control/FI9821W_Y2k.pm @@ -36,7 +36,6 @@ require ZoneMinder::Base; require ZoneMinder::Control; our @ISA = qw(ZoneMinder::Control); -our $VERSION = $ZoneMinder::Base::VERSION; # =================================================================================================================================== # # FI9821 FOSCAM PT H264 Control Protocol @@ -91,7 +90,7 @@ sub open $self->loadMonitor(); use LWP::UserAgent; $self->{ua} = LWP::UserAgent->new; - $self->{ua}->agent( "ZoneMinder Control Agent/".ZM_VERSION ); + $self->{ua}->agent( "ZoneMinder Control Agent/".ZoneMinder::Base::ZM_VERSION ); $self->{state} = 'open'; } diff --git a/scripts/ZoneMinder/lib/ZoneMinder/Control/LoftekSentinel.pm b/scripts/ZoneMinder/lib/ZoneMinder/Control/LoftekSentinel.pm index c6a9582c6..610b8d78c 100644 --- a/scripts/ZoneMinder/lib/ZoneMinder/Control/LoftekSentinel.pm +++ b/scripts/ZoneMinder/lib/ZoneMinder/Control/LoftekSentinel.pm @@ -36,8 +36,6 @@ require ZoneMinder::Control; our @ISA = qw(ZoneMinder::Control); -our $VERSION = $ZoneMinder::Base::VERSION; - our %CamParams = (); # ========================================================================== @@ -91,7 +89,7 @@ sub open use LWP::UserAgent; $self->{ua} = LWP::UserAgent->new; - $self->{ua}->agent( "ZoneMinder Control Agent/".ZM_VERSION ); + $self->{ua}->agent( "ZoneMinder Control Agent/".ZoneMinder::Base::ZM_VERSION ); $self->{state} = 'open'; } diff --git a/scripts/ZoneMinder/lib/ZoneMinder/Control/Ncs370.pm b/scripts/ZoneMinder/lib/ZoneMinder/Control/Ncs370.pm index 358aecb2b..c69b4f29d 100644 --- a/scripts/ZoneMinder/lib/ZoneMinder/Control/Ncs370.pm +++ b/scripts/ZoneMinder/lib/ZoneMinder/Control/Ncs370.pm @@ -33,8 +33,6 @@ require ZoneMinder::Control; our @ISA = qw(ZoneMinder::Control); -our $VERSION = $ZoneMinder::Base::VERSION; - # ========================================================================== # # Ncs370 IP Control Protocol @@ -79,7 +77,7 @@ sub open use LWP::UserAgent; $self->{ua} = LWP::UserAgent->new; - $self->{ua}->agent( "ZoneMinder Control Agent/".ZM_VERSION ); + $self->{ua}->agent( "ZoneMinder Control Agent/".ZoneMinder::Base::ZM_VERSION ); $self->{state} = 'open'; } diff --git a/scripts/ZoneMinder/lib/ZoneMinder/Control/PanasonicIP.pm b/scripts/ZoneMinder/lib/ZoneMinder/Control/PanasonicIP.pm index 643765e9f..d3e19e3aa 100644 --- a/scripts/ZoneMinder/lib/ZoneMinder/Control/PanasonicIP.pm +++ b/scripts/ZoneMinder/lib/ZoneMinder/Control/PanasonicIP.pm @@ -33,8 +33,6 @@ require ZoneMinder::Control; our @ISA = qw(ZoneMinder::Control); -our $VERSION = $ZoneMinder::Base::VERSION; - # ========================================================================== # # Panasonic IP Control Protocol @@ -79,7 +77,7 @@ sub open use LWP::UserAgent; $self->{ua} = LWP::UserAgent->new; - $self->{ua}->agent( "ZoneMinder Control Agent/".ZM_VERSION ); + $self->{ua}->agent( "ZoneMinder Control Agent/".ZoneMinder::Base::ZM_VERSION ); $self->{state} = 'open'; } diff --git a/scripts/ZoneMinder/lib/ZoneMinder/Control/PelcoD.pm b/scripts/ZoneMinder/lib/ZoneMinder/Control/PelcoD.pm index 6c507bd1a..8e5d07f74 100644 --- a/scripts/ZoneMinder/lib/ZoneMinder/Control/PelcoD.pm +++ b/scripts/ZoneMinder/lib/ZoneMinder/Control/PelcoD.pm @@ -33,8 +33,6 @@ require ZoneMinder::Control; our @ISA = qw(ZoneMinder::Control); -our $VERSION = $ZoneMinder::Base::VERSION; - # ========================================================================== # # Pelco-D Control Protocol diff --git a/scripts/ZoneMinder/lib/ZoneMinder/Control/PelcoP.pm b/scripts/ZoneMinder/lib/ZoneMinder/Control/PelcoP.pm index c743f2b51..c9d9d907d 100644 --- a/scripts/ZoneMinder/lib/ZoneMinder/Control/PelcoP.pm +++ b/scripts/ZoneMinder/lib/ZoneMinder/Control/PelcoP.pm @@ -33,8 +33,6 @@ require ZoneMinder::Control; our @ISA = qw(ZoneMinder::Control); -our $VERSION = $ZoneMinder::Base::VERSION; - # ========================================================================== # # Pelco-P Control Protocol diff --git a/scripts/ZoneMinder/lib/ZoneMinder/Control/SkyIPCam7xx.pm b/scripts/ZoneMinder/lib/ZoneMinder/Control/SkyIPCam7xx.pm index 89108ed41..fd97c5a49 100644 --- a/scripts/ZoneMinder/lib/ZoneMinder/Control/SkyIPCam7xx.pm +++ b/scripts/ZoneMinder/lib/ZoneMinder/Control/SkyIPCam7xx.pm @@ -34,8 +34,6 @@ require ZoneMinder::Control; our @ISA = qw(ZoneMinder::Control); -our $VERSION = $ZoneMinder::Base::VERSION; - # ========================================================================== # # Airlink SkyIPCam AICN747/AICN747W Control Protocol @@ -80,7 +78,7 @@ sub open use LWP::UserAgent; $self->{ua} = LWP::UserAgent->new; - $self->{ua}->agent( "ZoneMinder Control Agent/".ZM_VERSION ); + $self->{ua}->agent( "ZoneMinder Control Agent/".ZoneMinder::Base::ZM_VERSION ); $self->{state} = 'open'; } diff --git a/scripts/ZoneMinder/lib/ZoneMinder/Control/Visca.pm b/scripts/ZoneMinder/lib/ZoneMinder/Control/Visca.pm index 37f30dc09..749beae21 100644 --- a/scripts/ZoneMinder/lib/ZoneMinder/Control/Visca.pm +++ b/scripts/ZoneMinder/lib/ZoneMinder/Control/Visca.pm @@ -33,8 +33,6 @@ require ZoneMinder::Control; our @ISA = qw(ZoneMinder::Control); -our $VERSION = $ZoneMinder::Base::VERSION; - # ========================================================================== # # Visca Control Protocol diff --git a/scripts/ZoneMinder/lib/ZoneMinder/Control/mjpgStreamer.pm b/scripts/ZoneMinder/lib/ZoneMinder/Control/mjpgStreamer.pm index 33a15cba1..255dac056 100644 --- a/scripts/ZoneMinder/lib/ZoneMinder/Control/mjpgStreamer.pm +++ b/scripts/ZoneMinder/lib/ZoneMinder/Control/mjpgStreamer.pm @@ -33,8 +33,6 @@ require ZoneMinder::Control; our @ISA = qw(ZoneMinder::Control); -our $VERSION = $ZoneMinder::Base::VERSION; - # ========================================================================== # # mjpgSTreamer Control Protocol @@ -81,7 +79,7 @@ sub open Debug( "Camera open" ); use LWP::UserAgent; $self->{ua} = LWP::UserAgent->new; - $self->{ua}->agent( "ZoneMinder Control Agent/".ZM_VERSION ); + $self->{ua}->agent( "ZoneMinder Control Agent/".ZoneMinder::Base::ZM_VERSION ); $self->{state} = 'open'; } From 42642937e440598de9c0f3063fd8be291a9992f2 Mon Sep 17 00:00:00 2001 From: Isaac Connor Date: Tue, 17 Dec 2013 13:05:58 -0500 Subject: [PATCH 078/107] fix ZM_VERSION --- scripts/zmpkg.pl.in | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/scripts/zmpkg.pl.in b/scripts/zmpkg.pl.in index bfb87798c..30b1eca9e 100644 --- a/scripts/zmpkg.pl.in +++ b/scripts/zmpkg.pl.in @@ -146,7 +146,7 @@ if ( $command =~ /^(?:start|restart)$/ ) if ( $status eq "stopped" ) { - if ( $Config{ZM_DYN_DB_VERSION} and ( $Config{ZM_DYN_DB_VERSION} ne $Config{ZM_VERSION} ) ) + if ( $Config{ZM_DYN_DB_VERSION} and ( $Config{ZM_DYN_DB_VERSION} ne ZM_VERSION ) ) { Fatal( "Version mismatch, system is version ".ZM_VERSION.", database is ".$Config{ZM_DYN_DB_VERSION}.", please run zmupdate.pl to update." ); exit( -1 ); From 7064141161bdf15b08e41841b0e9bd2bb2764e33 Mon Sep 17 00:00:00 2001 From: Isaac Connor Date: Tue, 17 Dec 2013 13:13:45 -0500 Subject: [PATCH 079/107] check for mysql existence first. --- distros/ubuntu1204/postinst | 20 ++++++++++++-------- 1 file changed, 12 insertions(+), 8 deletions(-) diff --git a/distros/ubuntu1204/postinst b/distros/ubuntu1204/postinst index 06b1deebb..d06f9c641 100644 --- a/distros/ubuntu1204/postinst +++ b/distros/ubuntu1204/postinst @@ -3,13 +3,14 @@ set -e if [ "$1" = "configure" ]; then - # - # Get mysql started if it isn't - # - if ! $(/etc/init.d/mysql status >/dev/null 2>&1); then - invoke-rc.d mysql start - fi - if $(/etc/init.d/mysql status >/dev/null 2>&1); then + if [ -e "/etc/init.d/mysql" ]; then + # + # Get mysql started if it isn't + # + if ! $(/etc/init.d/mysql status >/dev/null 2>&1); then + invoke-rc.d mysql start + fi + if $(/etc/init.d/mysql status >/dev/null 2>&1); then mysqladmin --defaults-file=/etc/mysql/debian.cnf -f reload # test if database if already present... if ! $(echo quit | mysql --defaults-file=/etc/mysql/debian.cnf zm > /dev/null 2> /dev/null) ; then @@ -20,8 +21,11 @@ if [ "$1" = "configure" ]; then invoke-rc.d zoneminder stop || true zmupdate.pl --nointeractive - else + else echo 'NOTE: mysql not running, please start mysql and run dpkg-reconfigure zoneminder when it is running.' + fi + else + echo 'mysql not found, assuming remote server.' fi chown www-data:www-data /var/log/zm chown www-data:www-data /var/lib/zm/ From 1a744ebed66401b9b5e7d3ec752f87f21a78e555 Mon Sep 17 00:00:00 2001 From: Kyle Johnson Date: Tue, 17 Dec 2013 13:41:36 -0500 Subject: [PATCH 080/107] Added jquery 1.4.2.min.js to the classic skin's js dir --- web/skins/classic/js/jquery-1.4.2.min.js | 154 +++++++++++++++++++++++ 1 file changed, 154 insertions(+) create mode 100644 web/skins/classic/js/jquery-1.4.2.min.js diff --git a/web/skins/classic/js/jquery-1.4.2.min.js b/web/skins/classic/js/jquery-1.4.2.min.js new file mode 100644 index 000000000..7c2430802 --- /dev/null +++ b/web/skins/classic/js/jquery-1.4.2.min.js @@ -0,0 +1,154 @@ +/*! + * jQuery JavaScript Library v1.4.2 + * http://jquery.com/ + * + * Copyright 2010, John Resig + * Dual licensed under the MIT or GPL Version 2 licenses. + * http://jquery.org/license + * + * Includes Sizzle.js + * http://sizzlejs.com/ + * Copyright 2010, The Dojo Foundation + * Released under the MIT, BSD, and GPL Licenses. + * + * Date: Sat Feb 13 22:33:48 2010 -0500 + */ +(function(A,w){function ma(){if(!c.isReady){try{s.documentElement.doScroll("left")}catch(a){setTimeout(ma,1);return}c.ready()}}function Qa(a,b){b.src?c.ajax({url:b.src,async:false,dataType:"script"}):c.globalEval(b.text||b.textContent||b.innerHTML||"");b.parentNode&&b.parentNode.removeChild(b)}function X(a,b,d,f,e,j){var i=a.length;if(typeof b==="object"){for(var o in b)X(a,o,b[o],f,e,d);return a}if(d!==w){f=!j&&f&&c.isFunction(d);for(o=0;o)[^>]*$|^#([\w-]+)$/,Ua=/^.[^:#\[\.,]*$/,Va=/\S/, +Wa=/^(\s|\u00A0)+|(\s|\u00A0)+$/g,Xa=/^<(\w+)\s*\/?>(?:<\/\1>)?$/,P=navigator.userAgent,xa=false,Q=[],L,$=Object.prototype.toString,aa=Object.prototype.hasOwnProperty,ba=Array.prototype.push,R=Array.prototype.slice,ya=Array.prototype.indexOf;c.fn=c.prototype={init:function(a,b){var d,f;if(!a)return this;if(a.nodeType){this.context=this[0]=a;this.length=1;return this}if(a==="body"&&!b){this.context=s;this[0]=s.body;this.selector="body";this.length=1;return this}if(typeof a==="string")if((d=Ta.exec(a))&& +(d[1]||!b))if(d[1]){f=b?b.ownerDocument||b:s;if(a=Xa.exec(a))if(c.isPlainObject(b)){a=[s.createElement(a[1])];c.fn.attr.call(a,b,true)}else a=[f.createElement(a[1])];else{a=sa([d[1]],[f]);a=(a.cacheable?a.fragment.cloneNode(true):a.fragment).childNodes}return c.merge(this,a)}else{if(b=s.getElementById(d[2])){if(b.id!==d[2])return T.find(a);this.length=1;this[0]=b}this.context=s;this.selector=a;return this}else if(!b&&/^\w+$/.test(a)){this.selector=a;this.context=s;a=s.getElementsByTagName(a);return c.merge(this, +a)}else return!b||b.jquery?(b||T).find(a):c(b).find(a);else if(c.isFunction(a))return T.ready(a);if(a.selector!==w){this.selector=a.selector;this.context=a.context}return c.makeArray(a,this)},selector:"",jquery:"1.4.2",length:0,size:function(){return this.length},toArray:function(){return R.call(this,0)},get:function(a){return a==null?this.toArray():a<0?this.slice(a)[0]:this[a]},pushStack:function(a,b,d){var f=c();c.isArray(a)?ba.apply(f,a):c.merge(f,a);f.prevObject=this;f.context=this.context;if(b=== +"find")f.selector=this.selector+(this.selector?" ":"")+d;else if(b)f.selector=this.selector+"."+b+"("+d+")";return f},each:function(a,b){return c.each(this,a,b)},ready:function(a){c.bindReady();if(c.isReady)a.call(s,c);else Q&&Q.push(a);return this},eq:function(a){return a===-1?this.slice(a):this.slice(a,+a+1)},first:function(){return this.eq(0)},last:function(){return this.eq(-1)},slice:function(){return this.pushStack(R.apply(this,arguments),"slice",R.call(arguments).join(","))},map:function(a){return this.pushStack(c.map(this, +function(b,d){return a.call(b,d,b)}))},end:function(){return this.prevObject||c(null)},push:ba,sort:[].sort,splice:[].splice};c.fn.init.prototype=c.fn;c.extend=c.fn.extend=function(){var a=arguments[0]||{},b=1,d=arguments.length,f=false,e,j,i,o;if(typeof a==="boolean"){f=a;a=arguments[1]||{};b=2}if(typeof a!=="object"&&!c.isFunction(a))a={};if(d===b){a=this;--b}for(;b
a"; +var e=d.getElementsByTagName("*"),j=d.getElementsByTagName("a")[0];if(!(!e||!e.length||!j)){c.support={leadingWhitespace:d.firstChild.nodeType===3,tbody:!d.getElementsByTagName("tbody").length,htmlSerialize:!!d.getElementsByTagName("link").length,style:/red/.test(j.getAttribute("style")),hrefNormalized:j.getAttribute("href")==="/a",opacity:/^0.55$/.test(j.style.opacity),cssFloat:!!j.style.cssFloat,checkOn:d.getElementsByTagName("input")[0].value==="on",optSelected:s.createElement("select").appendChild(s.createElement("option")).selected, +parentNode:d.removeChild(d.appendChild(s.createElement("div"))).parentNode===null,deleteExpando:true,checkClone:false,scriptEval:false,noCloneEvent:true,boxModel:null};b.type="text/javascript";try{b.appendChild(s.createTextNode("window."+f+"=1;"))}catch(i){}a.insertBefore(b,a.firstChild);if(A[f]){c.support.scriptEval=true;delete A[f]}try{delete b.test}catch(o){c.support.deleteExpando=false}a.removeChild(b);if(d.attachEvent&&d.fireEvent){d.attachEvent("onclick",function k(){c.support.noCloneEvent= +false;d.detachEvent("onclick",k)});d.cloneNode(true).fireEvent("onclick")}d=s.createElement("div");d.innerHTML="";a=s.createDocumentFragment();a.appendChild(d.firstChild);c.support.checkClone=a.cloneNode(true).cloneNode(true).lastChild.checked;c(function(){var k=s.createElement("div");k.style.width=k.style.paddingLeft="1px";s.body.appendChild(k);c.boxModel=c.support.boxModel=k.offsetWidth===2;s.body.removeChild(k).style.display="none"});a=function(k){var n= +s.createElement("div");k="on"+k;var r=k in n;if(!r){n.setAttribute(k,"return;");r=typeof n[k]==="function"}return r};c.support.submitBubbles=a("submit");c.support.changeBubbles=a("change");a=b=d=e=j=null}})();c.props={"for":"htmlFor","class":"className",readonly:"readOnly",maxlength:"maxLength",cellspacing:"cellSpacing",rowspan:"rowSpan",colspan:"colSpan",tabindex:"tabIndex",usemap:"useMap",frameborder:"frameBorder"};var G="jQuery"+J(),Ya=0,za={};c.extend({cache:{},expando:G,noData:{embed:true,object:true, +applet:true},data:function(a,b,d){if(!(a.nodeName&&c.noData[a.nodeName.toLowerCase()])){a=a==A?za:a;var f=a[G],e=c.cache;if(!f&&typeof b==="string"&&d===w)return null;f||(f=++Ya);if(typeof b==="object"){a[G]=f;e[f]=c.extend(true,{},b)}else if(!e[f]){a[G]=f;e[f]={}}a=e[f];if(d!==w)a[b]=d;return typeof b==="string"?a[b]:a}},removeData:function(a,b){if(!(a.nodeName&&c.noData[a.nodeName.toLowerCase()])){a=a==A?za:a;var d=a[G],f=c.cache,e=f[d];if(b){if(e){delete e[b];c.isEmptyObject(e)&&c.removeData(a)}}else{if(c.support.deleteExpando)delete a[c.expando]; +else a.removeAttribute&&a.removeAttribute(c.expando);delete f[d]}}}});c.fn.extend({data:function(a,b){if(typeof a==="undefined"&&this.length)return c.data(this[0]);else if(typeof a==="object")return this.each(function(){c.data(this,a)});var d=a.split(".");d[1]=d[1]?"."+d[1]:"";if(b===w){var f=this.triggerHandler("getData"+d[1]+"!",[d[0]]);if(f===w&&this.length)f=c.data(this[0],a);return f===w&&d[1]?this.data(d[0]):f}else return this.trigger("setData"+d[1]+"!",[d[0],b]).each(function(){c.data(this, +a,b)})},removeData:function(a){return this.each(function(){c.removeData(this,a)})}});c.extend({queue:function(a,b,d){if(a){b=(b||"fx")+"queue";var f=c.data(a,b);if(!d)return f||[];if(!f||c.isArray(d))f=c.data(a,b,c.makeArray(d));else f.push(d);return f}},dequeue:function(a,b){b=b||"fx";var d=c.queue(a,b),f=d.shift();if(f==="inprogress")f=d.shift();if(f){b==="fx"&&d.unshift("inprogress");f.call(a,function(){c.dequeue(a,b)})}}});c.fn.extend({queue:function(a,b){if(typeof a!=="string"){b=a;a="fx"}if(b=== +w)return c.queue(this[0],a);return this.each(function(){var d=c.queue(this,a,b);a==="fx"&&d[0]!=="inprogress"&&c.dequeue(this,a)})},dequeue:function(a){return this.each(function(){c.dequeue(this,a)})},delay:function(a,b){a=c.fx?c.fx.speeds[a]||a:a;b=b||"fx";return this.queue(b,function(){var d=this;setTimeout(function(){c.dequeue(d,b)},a)})},clearQueue:function(a){return this.queue(a||"fx",[])}});var Aa=/[\n\t]/g,ca=/\s+/,Za=/\r/g,$a=/href|src|style/,ab=/(button|input)/i,bb=/(button|input|object|select|textarea)/i, +cb=/^(a|area)$/i,Ba=/radio|checkbox/;c.fn.extend({attr:function(a,b){return X(this,a,b,true,c.attr)},removeAttr:function(a){return this.each(function(){c.attr(this,a,"");this.nodeType===1&&this.removeAttribute(a)})},addClass:function(a){if(c.isFunction(a))return this.each(function(n){var r=c(this);r.addClass(a.call(this,n,r.attr("class")))});if(a&&typeof a==="string")for(var b=(a||"").split(ca),d=0,f=this.length;d-1)return true;return false},val:function(a){if(a===w){var b=this[0];if(b){if(c.nodeName(b,"option"))return(b.attributes.value||{}).specified?b.value:b.text;if(c.nodeName(b,"select")){var d=b.selectedIndex,f=[],e=b.options;b=b.type==="select-one";if(d<0)return null;var j=b?d:0;for(d=b?d+1:e.length;j=0;else if(c.nodeName(this,"select")){var u=c.makeArray(r);c("option",this).each(function(){this.selected= +c.inArray(c(this).val(),u)>=0});if(!u.length)this.selectedIndex=-1}else this.value=r}})}});c.extend({attrFn:{val:true,css:true,html:true,text:true,data:true,width:true,height:true,offset:true},attr:function(a,b,d,f){if(!a||a.nodeType===3||a.nodeType===8)return w;if(f&&b in c.attrFn)return c(a)[b](d);f=a.nodeType!==1||!c.isXMLDoc(a);var e=d!==w;b=f&&c.props[b]||b;if(a.nodeType===1){var j=$a.test(b);if(b in a&&f&&!j){if(e){b==="type"&&ab.test(a.nodeName)&&a.parentNode&&c.error("type property can't be changed"); +a[b]=d}if(c.nodeName(a,"form")&&a.getAttributeNode(b))return a.getAttributeNode(b).nodeValue;if(b==="tabIndex")return(b=a.getAttributeNode("tabIndex"))&&b.specified?b.value:bb.test(a.nodeName)||cb.test(a.nodeName)&&a.href?0:w;return a[b]}if(!c.support.style&&f&&b==="style"){if(e)a.style.cssText=""+d;return a.style.cssText}e&&a.setAttribute(b,""+d);a=!c.support.hrefNormalized&&f&&j?a.getAttribute(b,2):a.getAttribute(b);return a===null?w:a}return c.style(a,b,d)}});var O=/\.(.*)$/,db=function(a){return a.replace(/[^\w\s\.\|`]/g, +function(b){return"\\"+b})};c.event={add:function(a,b,d,f){if(!(a.nodeType===3||a.nodeType===8)){if(a.setInterval&&a!==A&&!a.frameElement)a=A;var e,j;if(d.handler){e=d;d=e.handler}if(!d.guid)d.guid=c.guid++;if(j=c.data(a)){var i=j.events=j.events||{},o=j.handle;if(!o)j.handle=o=function(){return typeof c!=="undefined"&&!c.event.triggered?c.event.handle.apply(o.elem,arguments):w};o.elem=a;b=b.split(" ");for(var k,n=0,r;k=b[n++];){j=e?c.extend({},e):{handler:d,data:f};if(k.indexOf(".")>-1){r=k.split("."); +k=r.shift();j.namespace=r.slice(0).sort().join(".")}else{r=[];j.namespace=""}j.type=k;j.guid=d.guid;var u=i[k],z=c.event.special[k]||{};if(!u){u=i[k]=[];if(!z.setup||z.setup.call(a,f,r,o)===false)if(a.addEventListener)a.addEventListener(k,o,false);else a.attachEvent&&a.attachEvent("on"+k,o)}if(z.add){z.add.call(a,j);if(!j.handler.guid)j.handler.guid=d.guid}u.push(j);c.event.global[k]=true}a=null}}},global:{},remove:function(a,b,d,f){if(!(a.nodeType===3||a.nodeType===8)){var e,j=0,i,o,k,n,r,u,z=c.data(a), +C=z&&z.events;if(z&&C){if(b&&b.type){d=b.handler;b=b.type}if(!b||typeof b==="string"&&b.charAt(0)==="."){b=b||"";for(e in C)c.event.remove(a,e+b)}else{for(b=b.split(" ");e=b[j++];){n=e;i=e.indexOf(".")<0;o=[];if(!i){o=e.split(".");e=o.shift();k=new RegExp("(^|\\.)"+c.map(o.slice(0).sort(),db).join("\\.(?:.*\\.)?")+"(\\.|$)")}if(r=C[e])if(d){n=c.event.special[e]||{};for(B=f||0;B=0){a.type= +e=e.slice(0,-1);a.exclusive=true}if(!d){a.stopPropagation();c.event.global[e]&&c.each(c.cache,function(){this.events&&this.events[e]&&c.event.trigger(a,b,this.handle.elem)})}if(!d||d.nodeType===3||d.nodeType===8)return w;a.result=w;a.target=d;b=c.makeArray(b);b.unshift(a)}a.currentTarget=d;(f=c.data(d,"handle"))&&f.apply(d,b);f=d.parentNode||d.ownerDocument;try{if(!(d&&d.nodeName&&c.noData[d.nodeName.toLowerCase()]))if(d["on"+e]&&d["on"+e].apply(d,b)===false)a.result=false}catch(j){}if(!a.isPropagationStopped()&& +f)c.event.trigger(a,b,f,true);else if(!a.isDefaultPrevented()){f=a.target;var i,o=c.nodeName(f,"a")&&e==="click",k=c.event.special[e]||{};if((!k._default||k._default.call(d,a)===false)&&!o&&!(f&&f.nodeName&&c.noData[f.nodeName.toLowerCase()])){try{if(f[e]){if(i=f["on"+e])f["on"+e]=null;c.event.triggered=true;f[e]()}}catch(n){}if(i)f["on"+e]=i;c.event.triggered=false}}},handle:function(a){var b,d,f,e;a=arguments[0]=c.event.fix(a||A.event);a.currentTarget=this;b=a.type.indexOf(".")<0&&!a.exclusive; +if(!b){d=a.type.split(".");a.type=d.shift();f=new RegExp("(^|\\.)"+d.slice(0).sort().join("\\.(?:.*\\.)?")+"(\\.|$)")}e=c.data(this,"events");d=e[a.type];if(e&&d){d=d.slice(0);e=0;for(var j=d.length;e-1?c.map(a.options,function(f){return f.selected}).join("-"):"";else if(a.nodeName.toLowerCase()==="select")d=a.selectedIndex;return d},fa=function(a,b){var d=a.target,f,e;if(!(!da.test(d.nodeName)||d.readOnly)){f=c.data(d,"_change_data");e=Fa(d);if(a.type!=="focusout"||d.type!=="radio")c.data(d,"_change_data", +e);if(!(f===w||e===f))if(f!=null||e){a.type="change";return c.event.trigger(a,b,d)}}};c.event.special.change={filters:{focusout:fa,click:function(a){var b=a.target,d=b.type;if(d==="radio"||d==="checkbox"||b.nodeName.toLowerCase()==="select")return fa.call(this,a)},keydown:function(a){var b=a.target,d=b.type;if(a.keyCode===13&&b.nodeName.toLowerCase()!=="textarea"||a.keyCode===32&&(d==="checkbox"||d==="radio")||d==="select-multiple")return fa.call(this,a)},beforeactivate:function(a){a=a.target;c.data(a, +"_change_data",Fa(a))}},setup:function(){if(this.type==="file")return false;for(var a in ea)c.event.add(this,a+".specialChange",ea[a]);return da.test(this.nodeName)},teardown:function(){c.event.remove(this,".specialChange");return da.test(this.nodeName)}};ea=c.event.special.change.filters}s.addEventListener&&c.each({focus:"focusin",blur:"focusout"},function(a,b){function d(f){f=c.event.fix(f);f.type=b;return c.event.handle.call(this,f)}c.event.special[b]={setup:function(){this.addEventListener(a, +d,true)},teardown:function(){this.removeEventListener(a,d,true)}}});c.each(["bind","one"],function(a,b){c.fn[b]=function(d,f,e){if(typeof d==="object"){for(var j in d)this[b](j,f,d[j],e);return this}if(c.isFunction(f)){e=f;f=w}var i=b==="one"?c.proxy(e,function(k){c(this).unbind(k,i);return e.apply(this,arguments)}):e;if(d==="unload"&&b!=="one")this.one(d,f,e);else{j=0;for(var o=this.length;j0){y=t;break}}t=t[g]}m[q]=y}}}var f=/((?:\((?:\([^()]+\)|[^()]+)+\)|\[(?:\[[^[\]]*\]|['"][^'"]*['"]|[^[\]'"]+)+\]|\\.|[^ >+~,(\[\\]+)+|[>+~])(\s*,\s*)?((?:.|\r|\n)*)/g, +e=0,j=Object.prototype.toString,i=false,o=true;[0,0].sort(function(){o=false;return 0});var k=function(g,h,l,m){l=l||[];var q=h=h||s;if(h.nodeType!==1&&h.nodeType!==9)return[];if(!g||typeof g!=="string")return l;for(var p=[],v,t,y,S,H=true,M=x(h),I=g;(f.exec(""),v=f.exec(I))!==null;){I=v[3];p.push(v[1]);if(v[2]){S=v[3];break}}if(p.length>1&&r.exec(g))if(p.length===2&&n.relative[p[0]])t=ga(p[0]+p[1],h);else for(t=n.relative[p[0]]?[h]:k(p.shift(),h);p.length;){g=p.shift();if(n.relative[g])g+=p.shift(); +t=ga(g,t)}else{if(!m&&p.length>1&&h.nodeType===9&&!M&&n.match.ID.test(p[0])&&!n.match.ID.test(p[p.length-1])){v=k.find(p.shift(),h,M);h=v.expr?k.filter(v.expr,v.set)[0]:v.set[0]}if(h){v=m?{expr:p.pop(),set:z(m)}:k.find(p.pop(),p.length===1&&(p[0]==="~"||p[0]==="+")&&h.parentNode?h.parentNode:h,M);t=v.expr?k.filter(v.expr,v.set):v.set;if(p.length>0)y=z(t);else H=false;for(;p.length;){var D=p.pop();v=D;if(n.relative[D])v=p.pop();else D="";if(v==null)v=h;n.relative[D](y,v,M)}}else y=[]}y||(y=t);y||k.error(D|| +g);if(j.call(y)==="[object Array]")if(H)if(h&&h.nodeType===1)for(g=0;y[g]!=null;g++){if(y[g]&&(y[g]===true||y[g].nodeType===1&&E(h,y[g])))l.push(t[g])}else for(g=0;y[g]!=null;g++)y[g]&&y[g].nodeType===1&&l.push(t[g]);else l.push.apply(l,y);else z(y,l);if(S){k(S,q,l,m);k.uniqueSort(l)}return l};k.uniqueSort=function(g){if(B){i=o;g.sort(B);if(i)for(var h=1;h":function(g,h){var l=typeof h==="string";if(l&&!/\W/.test(h)){h=h.toLowerCase();for(var m=0,q=g.length;m=0))l||m.push(v);else if(l)h[p]=false;return false},ID:function(g){return g[1].replace(/\\/g,"")},TAG:function(g){return g[1].toLowerCase()}, +CHILD:function(g){if(g[1]==="nth"){var h=/(-?)(\d*)n((?:\+|-)?\d*)/.exec(g[2]==="even"&&"2n"||g[2]==="odd"&&"2n+1"||!/\D/.test(g[2])&&"0n+"+g[2]||g[2]);g[2]=h[1]+(h[2]||1)-0;g[3]=h[3]-0}g[0]=e++;return g},ATTR:function(g,h,l,m,q,p){h=g[1].replace(/\\/g,"");if(!p&&n.attrMap[h])g[1]=n.attrMap[h];if(g[2]==="~=")g[4]=" "+g[4]+" ";return g},PSEUDO:function(g,h,l,m,q){if(g[1]==="not")if((f.exec(g[3])||"").length>1||/^\w/.test(g[3]))g[3]=k(g[3],null,null,h);else{g=k.filter(g[3],h,l,true^q);l||m.push.apply(m, +g);return false}else if(n.match.POS.test(g[0])||n.match.CHILD.test(g[0]))return true;return g},POS:function(g){g.unshift(true);return g}},filters:{enabled:function(g){return g.disabled===false&&g.type!=="hidden"},disabled:function(g){return g.disabled===true},checked:function(g){return g.checked===true},selected:function(g){return g.selected===true},parent:function(g){return!!g.firstChild},empty:function(g){return!g.firstChild},has:function(g,h,l){return!!k(l[3],g).length},header:function(g){return/h\d/i.test(g.nodeName)}, +text:function(g){return"text"===g.type},radio:function(g){return"radio"===g.type},checkbox:function(g){return"checkbox"===g.type},file:function(g){return"file"===g.type},password:function(g){return"password"===g.type},submit:function(g){return"submit"===g.type},image:function(g){return"image"===g.type},reset:function(g){return"reset"===g.type},button:function(g){return"button"===g.type||g.nodeName.toLowerCase()==="button"},input:function(g){return/input|select|textarea|button/i.test(g.nodeName)}}, +setFilters:{first:function(g,h){return h===0},last:function(g,h,l,m){return h===m.length-1},even:function(g,h){return h%2===0},odd:function(g,h){return h%2===1},lt:function(g,h,l){return hl[3]-0},nth:function(g,h,l){return l[3]-0===h},eq:function(g,h,l){return l[3]-0===h}},filter:{PSEUDO:function(g,h,l,m){var q=h[1],p=n.filters[q];if(p)return p(g,l,h,m);else if(q==="contains")return(g.textContent||g.innerText||a([g])||"").indexOf(h[3])>=0;else if(q==="not"){h= +h[3];l=0;for(m=h.length;l=0}},ID:function(g,h){return g.nodeType===1&&g.getAttribute("id")===h},TAG:function(g,h){return h==="*"&&g.nodeType===1||g.nodeName.toLowerCase()===h},CLASS:function(g,h){return(" "+(g.className||g.getAttribute("class"))+" ").indexOf(h)>-1},ATTR:function(g,h){var l=h[1];g=n.attrHandle[l]?n.attrHandle[l](g):g[l]!=null?g[l]:g.getAttribute(l);l=g+"";var m=h[2];h=h[4];return g==null?m==="!=":m=== +"="?l===h:m==="*="?l.indexOf(h)>=0:m==="~="?(" "+l+" ").indexOf(h)>=0:!h?l&&g!==false:m==="!="?l!==h:m==="^="?l.indexOf(h)===0:m==="$="?l.substr(l.length-h.length)===h:m==="|="?l===h||l.substr(0,h.length+1)===h+"-":false},POS:function(g,h,l,m){var q=n.setFilters[h[2]];if(q)return q(g,l,h,m)}}},r=n.match.POS;for(var u in n.match){n.match[u]=new RegExp(n.match[u].source+/(?![^\[]*\])(?![^\(]*\))/.source);n.leftMatch[u]=new RegExp(/(^(?:.|\r|\n)*?)/.source+n.match[u].source.replace(/\\(\d+)/g,function(g, +h){return"\\"+(h-0+1)}))}var z=function(g,h){g=Array.prototype.slice.call(g,0);if(h){h.push.apply(h,g);return h}return g};try{Array.prototype.slice.call(s.documentElement.childNodes,0)}catch(C){z=function(g,h){h=h||[];if(j.call(g)==="[object Array]")Array.prototype.push.apply(h,g);else if(typeof g.length==="number")for(var l=0,m=g.length;l";var l=s.documentElement;l.insertBefore(g,l.firstChild);if(s.getElementById(h)){n.find.ID=function(m,q,p){if(typeof q.getElementById!=="undefined"&&!p)return(q=q.getElementById(m[1]))?q.id===m[1]||typeof q.getAttributeNode!=="undefined"&& +q.getAttributeNode("id").nodeValue===m[1]?[q]:w:[]};n.filter.ID=function(m,q){var p=typeof m.getAttributeNode!=="undefined"&&m.getAttributeNode("id");return m.nodeType===1&&p&&p.nodeValue===q}}l.removeChild(g);l=g=null})();(function(){var g=s.createElement("div");g.appendChild(s.createComment(""));if(g.getElementsByTagName("*").length>0)n.find.TAG=function(h,l){l=l.getElementsByTagName(h[1]);if(h[1]==="*"){h=[];for(var m=0;l[m];m++)l[m].nodeType===1&&h.push(l[m]);l=h}return l};g.innerHTML=""; +if(g.firstChild&&typeof g.firstChild.getAttribute!=="undefined"&&g.firstChild.getAttribute("href")!=="#")n.attrHandle.href=function(h){return h.getAttribute("href",2)};g=null})();s.querySelectorAll&&function(){var g=k,h=s.createElement("div");h.innerHTML="

";if(!(h.querySelectorAll&&h.querySelectorAll(".TEST").length===0)){k=function(m,q,p,v){q=q||s;if(!v&&q.nodeType===9&&!x(q))try{return z(q.querySelectorAll(m),p)}catch(t){}return g(m,q,p,v)};for(var l in g)k[l]=g[l];h=null}}(); +(function(){var g=s.createElement("div");g.innerHTML="
";if(!(!g.getElementsByClassName||g.getElementsByClassName("e").length===0)){g.lastChild.className="e";if(g.getElementsByClassName("e").length!==1){n.order.splice(1,0,"CLASS");n.find.CLASS=function(h,l,m){if(typeof l.getElementsByClassName!=="undefined"&&!m)return l.getElementsByClassName(h[1])};g=null}}})();var E=s.compareDocumentPosition?function(g,h){return!!(g.compareDocumentPosition(h)&16)}: +function(g,h){return g!==h&&(g.contains?g.contains(h):true)},x=function(g){return(g=(g?g.ownerDocument||g:0).documentElement)?g.nodeName!=="HTML":false},ga=function(g,h){var l=[],m="",q;for(h=h.nodeType?[h]:h;q=n.match.PSEUDO.exec(g);){m+=q[0];g=g.replace(n.match.PSEUDO,"")}g=n.relative[g]?g+"*":g;q=0;for(var p=h.length;q=0===d})};c.fn.extend({find:function(a){for(var b=this.pushStack("","find",a),d=0,f=0,e=this.length;f0)for(var j=d;j0},closest:function(a,b){if(c.isArray(a)){var d=[],f=this[0],e,j= +{},i;if(f&&a.length){e=0;for(var o=a.length;e-1:c(f).is(e)){d.push({selector:i,elem:f});delete j[i]}}f=f.parentNode}}return d}var k=c.expr.match.POS.test(a)?c(a,b||this.context):null;return this.map(function(n,r){for(;r&&r.ownerDocument&&r!==b;){if(k?k.index(r)>-1:c(r).is(a))return r;r=r.parentNode}return null})},index:function(a){if(!a||typeof a=== +"string")return c.inArray(this[0],a?c(a):this.parent().children());return c.inArray(a.jquery?a[0]:a,this)},add:function(a,b){a=typeof a==="string"?c(a,b||this.context):c.makeArray(a);b=c.merge(this.get(),a);return this.pushStack(qa(a[0])||qa(b[0])?b:c.unique(b))},andSelf:function(){return this.add(this.prevObject)}});c.each({parent:function(a){return(a=a.parentNode)&&a.nodeType!==11?a:null},parents:function(a){return c.dir(a,"parentNode")},parentsUntil:function(a,b,d){return c.dir(a,"parentNode", +d)},next:function(a){return c.nth(a,2,"nextSibling")},prev:function(a){return c.nth(a,2,"previousSibling")},nextAll:function(a){return c.dir(a,"nextSibling")},prevAll:function(a){return c.dir(a,"previousSibling")},nextUntil:function(a,b,d){return c.dir(a,"nextSibling",d)},prevUntil:function(a,b,d){return c.dir(a,"previousSibling",d)},siblings:function(a){return c.sibling(a.parentNode.firstChild,a)},children:function(a){return c.sibling(a.firstChild)},contents:function(a){return c.nodeName(a,"iframe")? +a.contentDocument||a.contentWindow.document:c.makeArray(a.childNodes)}},function(a,b){c.fn[a]=function(d,f){var e=c.map(this,b,d);eb.test(a)||(f=d);if(f&&typeof f==="string")e=c.filter(f,e);e=this.length>1?c.unique(e):e;if((this.length>1||gb.test(f))&&fb.test(a))e=e.reverse();return this.pushStack(e,a,R.call(arguments).join(","))}});c.extend({filter:function(a,b,d){if(d)a=":not("+a+")";return c.find.matches(a,b)},dir:function(a,b,d){var f=[];for(a=a[b];a&&a.nodeType!==9&&(d===w||a.nodeType!==1||!c(a).is(d));){a.nodeType=== +1&&f.push(a);a=a[b]}return f},nth:function(a,b,d){b=b||1;for(var f=0;a;a=a[d])if(a.nodeType===1&&++f===b)break;return a},sibling:function(a,b){for(var d=[];a;a=a.nextSibling)a.nodeType===1&&a!==b&&d.push(a);return d}});var Ja=/ jQuery\d+="(?:\d+|null)"/g,V=/^\s+/,Ka=/(<([\w:]+)[^>]*?)\/>/g,hb=/^(?:area|br|col|embed|hr|img|input|link|meta|param)$/i,La=/<([\w:]+)/,ib=/"},F={option:[1,""],legend:[1,"
","
"],thead:[1,"","
"],tr:[2,"","
"],td:[3,"","
"],col:[2,"","
"],area:[1,"",""],_default:[0,"",""]};F.optgroup=F.option;F.tbody=F.tfoot=F.colgroup=F.caption=F.thead;F.th=F.td;if(!c.support.htmlSerialize)F._default=[1,"div
","
"];c.fn.extend({text:function(a){if(c.isFunction(a))return this.each(function(b){var d= +c(this);d.text(a.call(this,b,d.text()))});if(typeof a!=="object"&&a!==w)return this.empty().append((this[0]&&this[0].ownerDocument||s).createTextNode(a));return c.text(this)},wrapAll:function(a){if(c.isFunction(a))return this.each(function(d){c(this).wrapAll(a.call(this,d))});if(this[0]){var b=c(a,this[0].ownerDocument).eq(0).clone(true);this[0].parentNode&&b.insertBefore(this[0]);b.map(function(){for(var d=this;d.firstChild&&d.firstChild.nodeType===1;)d=d.firstChild;return d}).append(this)}return this}, +wrapInner:function(a){if(c.isFunction(a))return this.each(function(b){c(this).wrapInner(a.call(this,b))});return this.each(function(){var b=c(this),d=b.contents();d.length?d.wrapAll(a):b.append(a)})},wrap:function(a){return this.each(function(){c(this).wrapAll(a)})},unwrap:function(){return this.parent().each(function(){c.nodeName(this,"body")||c(this).replaceWith(this.childNodes)}).end()},append:function(){return this.domManip(arguments,true,function(a){this.nodeType===1&&this.appendChild(a)})}, +prepend:function(){return this.domManip(arguments,true,function(a){this.nodeType===1&&this.insertBefore(a,this.firstChild)})},before:function(){if(this[0]&&this[0].parentNode)return this.domManip(arguments,false,function(b){this.parentNode.insertBefore(b,this)});else if(arguments.length){var a=c(arguments[0]);a.push.apply(a,this.toArray());return this.pushStack(a,"before",arguments)}},after:function(){if(this[0]&&this[0].parentNode)return this.domManip(arguments,false,function(b){this.parentNode.insertBefore(b, +this.nextSibling)});else if(arguments.length){var a=this.pushStack(this,"after",arguments);a.push.apply(a,c(arguments[0]).toArray());return a}},remove:function(a,b){for(var d=0,f;(f=this[d])!=null;d++)if(!a||c.filter(a,[f]).length){if(!b&&f.nodeType===1){c.cleanData(f.getElementsByTagName("*"));c.cleanData([f])}f.parentNode&&f.parentNode.removeChild(f)}return this},empty:function(){for(var a=0,b;(b=this[a])!=null;a++)for(b.nodeType===1&&c.cleanData(b.getElementsByTagName("*"));b.firstChild;)b.removeChild(b.firstChild); +return this},clone:function(a){var b=this.map(function(){if(!c.support.noCloneEvent&&!c.isXMLDoc(this)){var d=this.outerHTML,f=this.ownerDocument;if(!d){d=f.createElement("div");d.appendChild(this.cloneNode(true));d=d.innerHTML}return c.clean([d.replace(Ja,"").replace(/=([^="'>\s]+\/)>/g,'="$1">').replace(V,"")],f)[0]}else return this.cloneNode(true)});if(a===true){ra(this,b);ra(this.find("*"),b.find("*"))}return b},html:function(a){if(a===w)return this[0]&&this[0].nodeType===1?this[0].innerHTML.replace(Ja, +""):null;else if(typeof a==="string"&&!ta.test(a)&&(c.support.leadingWhitespace||!V.test(a))&&!F[(La.exec(a)||["",""])[1].toLowerCase()]){a=a.replace(Ka,Ma);try{for(var b=0,d=this.length;b0||e.cacheable||this.length>1?k.cloneNode(true):k)}o.length&&c.each(o,Qa)}return this}});c.fragments={};c.each({appendTo:"append",prependTo:"prepend",insertBefore:"before",insertAfter:"after",replaceAll:"replaceWith"},function(a,b){c.fn[a]=function(d){var f=[];d=c(d);var e=this.length===1&&this[0].parentNode;if(e&&e.nodeType===11&&e.childNodes.length===1&&d.length===1){d[b](this[0]); +return this}else{e=0;for(var j=d.length;e0?this.clone(true):this).get();c.fn[b].apply(c(d[e]),i);f=f.concat(i)}return this.pushStack(f,a,d.selector)}}});c.extend({clean:function(a,b,d,f){b=b||s;if(typeof b.createElement==="undefined")b=b.ownerDocument||b[0]&&b[0].ownerDocument||s;for(var e=[],j=0,i;(i=a[j])!=null;j++){if(typeof i==="number")i+="";if(i){if(typeof i==="string"&&!jb.test(i))i=b.createTextNode(i);else if(typeof i==="string"){i=i.replace(Ka,Ma);var o=(La.exec(i)||["", +""])[1].toLowerCase(),k=F[o]||F._default,n=k[0],r=b.createElement("div");for(r.innerHTML=k[1]+i+k[2];n--;)r=r.lastChild;if(!c.support.tbody){n=ib.test(i);o=o==="table"&&!n?r.firstChild&&r.firstChild.childNodes:k[1]===""&&!n?r.childNodes:[];for(k=o.length-1;k>=0;--k)c.nodeName(o[k],"tbody")&&!o[k].childNodes.length&&o[k].parentNode.removeChild(o[k])}!c.support.leadingWhitespace&&V.test(i)&&r.insertBefore(b.createTextNode(V.exec(i)[0]),r.firstChild);i=r.childNodes}if(i.nodeType)e.push(i);else e= +c.merge(e,i)}}if(d)for(j=0;e[j];j++)if(f&&c.nodeName(e[j],"script")&&(!e[j].type||e[j].type.toLowerCase()==="text/javascript"))f.push(e[j].parentNode?e[j].parentNode.removeChild(e[j]):e[j]);else{e[j].nodeType===1&&e.splice.apply(e,[j+1,0].concat(c.makeArray(e[j].getElementsByTagName("script"))));d.appendChild(e[j])}return e},cleanData:function(a){for(var b,d,f=c.cache,e=c.event.special,j=c.support.deleteExpando,i=0,o;(o=a[i])!=null;i++)if(d=o[c.expando]){b=f[d];if(b.events)for(var k in b.events)e[k]? +c.event.remove(o,k):Ca(o,k,b.handle);if(j)delete o[c.expando];else o.removeAttribute&&o.removeAttribute(c.expando);delete f[d]}}});var kb=/z-?index|font-?weight|opacity|zoom|line-?height/i,Na=/alpha\([^)]*\)/,Oa=/opacity=([^)]*)/,ha=/float/i,ia=/-([a-z])/ig,lb=/([A-Z])/g,mb=/^-?\d+(?:px)?$/i,nb=/^-?\d/,ob={position:"absolute",visibility:"hidden",display:"block"},pb=["Left","Right"],qb=["Top","Bottom"],rb=s.defaultView&&s.defaultView.getComputedStyle,Pa=c.support.cssFloat?"cssFloat":"styleFloat",ja= +function(a,b){return b.toUpperCase()};c.fn.css=function(a,b){return X(this,a,b,true,function(d,f,e){if(e===w)return c.curCSS(d,f);if(typeof e==="number"&&!kb.test(f))e+="px";c.style(d,f,e)})};c.extend({style:function(a,b,d){if(!a||a.nodeType===3||a.nodeType===8)return w;if((b==="width"||b==="height")&&parseFloat(d)<0)d=w;var f=a.style||a,e=d!==w;if(!c.support.opacity&&b==="opacity"){if(e){f.zoom=1;b=parseInt(d,10)+""==="NaN"?"":"alpha(opacity="+d*100+")";a=f.filter||c.curCSS(a,"filter")||"";f.filter= +Na.test(a)?a.replace(Na,b):b}return f.filter&&f.filter.indexOf("opacity=")>=0?parseFloat(Oa.exec(f.filter)[1])/100+"":""}if(ha.test(b))b=Pa;b=b.replace(ia,ja);if(e)f[b]=d;return f[b]},css:function(a,b,d,f){if(b==="width"||b==="height"){var e,j=b==="width"?pb:qb;function i(){e=b==="width"?a.offsetWidth:a.offsetHeight;f!=="border"&&c.each(j,function(){f||(e-=parseFloat(c.curCSS(a,"padding"+this,true))||0);if(f==="margin")e+=parseFloat(c.curCSS(a,"margin"+this,true))||0;else e-=parseFloat(c.curCSS(a, +"border"+this+"Width",true))||0})}a.offsetWidth!==0?i():c.swap(a,ob,i);return Math.max(0,Math.round(e))}return c.curCSS(a,b,d)},curCSS:function(a,b,d){var f,e=a.style;if(!c.support.opacity&&b==="opacity"&&a.currentStyle){f=Oa.test(a.currentStyle.filter||"")?parseFloat(RegExp.$1)/100+"":"";return f===""?"1":f}if(ha.test(b))b=Pa;if(!d&&e&&e[b])f=e[b];else if(rb){if(ha.test(b))b="float";b=b.replace(lb,"-$1").toLowerCase();e=a.ownerDocument.defaultView;if(!e)return null;if(a=e.getComputedStyle(a,null))f= +a.getPropertyValue(b);if(b==="opacity"&&f==="")f="1"}else if(a.currentStyle){d=b.replace(ia,ja);f=a.currentStyle[b]||a.currentStyle[d];if(!mb.test(f)&&nb.test(f)){b=e.left;var j=a.runtimeStyle.left;a.runtimeStyle.left=a.currentStyle.left;e.left=d==="fontSize"?"1em":f||0;f=e.pixelLeft+"px";e.left=b;a.runtimeStyle.left=j}}return f},swap:function(a,b,d){var f={};for(var e in b){f[e]=a.style[e];a.style[e]=b[e]}d.call(a);for(e in b)a.style[e]=f[e]}});if(c.expr&&c.expr.filters){c.expr.filters.hidden=function(a){var b= +a.offsetWidth,d=a.offsetHeight,f=a.nodeName.toLowerCase()==="tr";return b===0&&d===0&&!f?true:b>0&&d>0&&!f?false:c.curCSS(a,"display")==="none"};c.expr.filters.visible=function(a){return!c.expr.filters.hidden(a)}}var sb=J(),tb=//gi,ub=/select|textarea/i,vb=/color|date|datetime|email|hidden|month|number|password|range|search|tel|text|time|url|week/i,N=/=\?(&|$)/,ka=/\?/,wb=/(\?|&)_=.*?(&|$)/,xb=/^(\w+:)?\/\/([^\/?#]+)/,yb=/%20/g,zb=c.fn.load;c.fn.extend({load:function(a,b,d){if(typeof a!== +"string")return zb.call(this,a);else if(!this.length)return this;var f=a.indexOf(" ");if(f>=0){var e=a.slice(f,a.length);a=a.slice(0,f)}f="GET";if(b)if(c.isFunction(b)){d=b;b=null}else if(typeof b==="object"){b=c.param(b,c.ajaxSettings.traditional);f="POST"}var j=this;c.ajax({url:a,type:f,dataType:"html",data:b,complete:function(i,o){if(o==="success"||o==="notmodified")j.html(e?c("
").append(i.responseText.replace(tb,"")).find(e):i.responseText);d&&j.each(d,[i.responseText,o,i])}});return this}, +serialize:function(){return c.param(this.serializeArray())},serializeArray:function(){return this.map(function(){return this.elements?c.makeArray(this.elements):this}).filter(function(){return this.name&&!this.disabled&&(this.checked||ub.test(this.nodeName)||vb.test(this.type))}).map(function(a,b){a=c(this).val();return a==null?null:c.isArray(a)?c.map(a,function(d){return{name:b.name,value:d}}):{name:b.name,value:a}}).get()}});c.each("ajaxStart ajaxStop ajaxComplete ajaxError ajaxSuccess ajaxSend".split(" "), +function(a,b){c.fn[b]=function(d){return this.bind(b,d)}});c.extend({get:function(a,b,d,f){if(c.isFunction(b)){f=f||d;d=b;b=null}return c.ajax({type:"GET",url:a,data:b,success:d,dataType:f})},getScript:function(a,b){return c.get(a,null,b,"script")},getJSON:function(a,b,d){return c.get(a,b,d,"json")},post:function(a,b,d,f){if(c.isFunction(b)){f=f||d;d=b;b={}}return c.ajax({type:"POST",url:a,data:b,success:d,dataType:f})},ajaxSetup:function(a){c.extend(c.ajaxSettings,a)},ajaxSettings:{url:location.href, +global:true,type:"GET",contentType:"application/x-www-form-urlencoded",processData:true,async:true,xhr:A.XMLHttpRequest&&(A.location.protocol!=="file:"||!A.ActiveXObject)?function(){return new A.XMLHttpRequest}:function(){try{return new A.ActiveXObject("Microsoft.XMLHTTP")}catch(a){}},accepts:{xml:"application/xml, text/xml",html:"text/html",script:"text/javascript, application/javascript",json:"application/json, text/javascript",text:"text/plain",_default:"*/*"}},lastModified:{},etag:{},ajax:function(a){function b(){e.success&& +e.success.call(k,o,i,x);e.global&&f("ajaxSuccess",[x,e])}function d(){e.complete&&e.complete.call(k,x,i);e.global&&f("ajaxComplete",[x,e]);e.global&&!--c.active&&c.event.trigger("ajaxStop")}function f(q,p){(e.context?c(e.context):c.event).trigger(q,p)}var e=c.extend(true,{},c.ajaxSettings,a),j,i,o,k=a&&a.context||e,n=e.type.toUpperCase();if(e.data&&e.processData&&typeof e.data!=="string")e.data=c.param(e.data,e.traditional);if(e.dataType==="jsonp"){if(n==="GET")N.test(e.url)||(e.url+=(ka.test(e.url)? +"&":"?")+(e.jsonp||"callback")+"=?");else if(!e.data||!N.test(e.data))e.data=(e.data?e.data+"&":"")+(e.jsonp||"callback")+"=?";e.dataType="json"}if(e.dataType==="json"&&(e.data&&N.test(e.data)||N.test(e.url))){j=e.jsonpCallback||"jsonp"+sb++;if(e.data)e.data=(e.data+"").replace(N,"="+j+"$1");e.url=e.url.replace(N,"="+j+"$1");e.dataType="script";A[j]=A[j]||function(q){o=q;b();d();A[j]=w;try{delete A[j]}catch(p){}z&&z.removeChild(C)}}if(e.dataType==="script"&&e.cache===null)e.cache=false;if(e.cache=== +false&&n==="GET"){var r=J(),u=e.url.replace(wb,"$1_="+r+"$2");e.url=u+(u===e.url?(ka.test(e.url)?"&":"?")+"_="+r:"")}if(e.data&&n==="GET")e.url+=(ka.test(e.url)?"&":"?")+e.data;e.global&&!c.active++&&c.event.trigger("ajaxStart");r=(r=xb.exec(e.url))&&(r[1]&&r[1]!==location.protocol||r[2]!==location.host);if(e.dataType==="script"&&n==="GET"&&r){var z=s.getElementsByTagName("head")[0]||s.documentElement,C=s.createElement("script");C.src=e.url;if(e.scriptCharset)C.charset=e.scriptCharset;if(!j){var B= +false;C.onload=C.onreadystatechange=function(){if(!B&&(!this.readyState||this.readyState==="loaded"||this.readyState==="complete")){B=true;b();d();C.onload=C.onreadystatechange=null;z&&C.parentNode&&z.removeChild(C)}}}z.insertBefore(C,z.firstChild);return w}var E=false,x=e.xhr();if(x){e.username?x.open(n,e.url,e.async,e.username,e.password):x.open(n,e.url,e.async);try{if(e.data||a&&a.contentType)x.setRequestHeader("Content-Type",e.contentType);if(e.ifModified){c.lastModified[e.url]&&x.setRequestHeader("If-Modified-Since", +c.lastModified[e.url]);c.etag[e.url]&&x.setRequestHeader("If-None-Match",c.etag[e.url])}r||x.setRequestHeader("X-Requested-With","XMLHttpRequest");x.setRequestHeader("Accept",e.dataType&&e.accepts[e.dataType]?e.accepts[e.dataType]+", */*":e.accepts._default)}catch(ga){}if(e.beforeSend&&e.beforeSend.call(k,x,e)===false){e.global&&!--c.active&&c.event.trigger("ajaxStop");x.abort();return false}e.global&&f("ajaxSend",[x,e]);var g=x.onreadystatechange=function(q){if(!x||x.readyState===0||q==="abort"){E|| +d();E=true;if(x)x.onreadystatechange=c.noop}else if(!E&&x&&(x.readyState===4||q==="timeout")){E=true;x.onreadystatechange=c.noop;i=q==="timeout"?"timeout":!c.httpSuccess(x)?"error":e.ifModified&&c.httpNotModified(x,e.url)?"notmodified":"success";var p;if(i==="success")try{o=c.httpData(x,e.dataType,e)}catch(v){i="parsererror";p=v}if(i==="success"||i==="notmodified")j||b();else c.handleError(e,x,i,p);d();q==="timeout"&&x.abort();if(e.async)x=null}};try{var h=x.abort;x.abort=function(){x&&h.call(x); +g("abort")}}catch(l){}e.async&&e.timeout>0&&setTimeout(function(){x&&!E&&g("timeout")},e.timeout);try{x.send(n==="POST"||n==="PUT"||n==="DELETE"?e.data:null)}catch(m){c.handleError(e,x,null,m);d()}e.async||g();return x}},handleError:function(a,b,d,f){if(a.error)a.error.call(a.context||a,b,d,f);if(a.global)(a.context?c(a.context):c.event).trigger("ajaxError",[b,a,f])},active:0,httpSuccess:function(a){try{return!a.status&&location.protocol==="file:"||a.status>=200&&a.status<300||a.status===304||a.status=== +1223||a.status===0}catch(b){}return false},httpNotModified:function(a,b){var d=a.getResponseHeader("Last-Modified"),f=a.getResponseHeader("Etag");if(d)c.lastModified[b]=d;if(f)c.etag[b]=f;return a.status===304||a.status===0},httpData:function(a,b,d){var f=a.getResponseHeader("content-type")||"",e=b==="xml"||!b&&f.indexOf("xml")>=0;a=e?a.responseXML:a.responseText;e&&a.documentElement.nodeName==="parsererror"&&c.error("parsererror");if(d&&d.dataFilter)a=d.dataFilter(a,b);if(typeof a==="string")if(b=== +"json"||!b&&f.indexOf("json")>=0)a=c.parseJSON(a);else if(b==="script"||!b&&f.indexOf("javascript")>=0)c.globalEval(a);return a},param:function(a,b){function d(i,o){if(c.isArray(o))c.each(o,function(k,n){b||/\[\]$/.test(i)?f(i,n):d(i+"["+(typeof n==="object"||c.isArray(n)?k:"")+"]",n)});else!b&&o!=null&&typeof o==="object"?c.each(o,function(k,n){d(i+"["+k+"]",n)}):f(i,o)}function f(i,o){o=c.isFunction(o)?o():o;e[e.length]=encodeURIComponent(i)+"="+encodeURIComponent(o)}var e=[];if(b===w)b=c.ajaxSettings.traditional; +if(c.isArray(a)||a.jquery)c.each(a,function(){f(this.name,this.value)});else for(var j in a)d(j,a[j]);return e.join("&").replace(yb,"+")}});var la={},Ab=/toggle|show|hide/,Bb=/^([+-]=)?([\d+-.]+)(.*)$/,W,va=[["height","marginTop","marginBottom","paddingTop","paddingBottom"],["width","marginLeft","marginRight","paddingLeft","paddingRight"],["opacity"]];c.fn.extend({show:function(a,b){if(a||a===0)return this.animate(K("show",3),a,b);else{a=0;for(b=this.length;a").appendTo("body");f=e.css("display");if(f==="none")f="block";e.remove();la[d]=f}c.data(this[a],"olddisplay",f)}}a=0;for(b=this.length;a=0;f--)if(d[f].elem===this){b&&d[f](true);d.splice(f,1)}});b||this.dequeue();return this}});c.each({slideDown:K("show",1),slideUp:K("hide",1),slideToggle:K("toggle",1),fadeIn:{opacity:"show"},fadeOut:{opacity:"hide"}},function(a,b){c.fn[a]=function(d,f){return this.animate(b,d,f)}});c.extend({speed:function(a,b,d){var f=a&&typeof a==="object"?a:{complete:d||!d&&b||c.isFunction(a)&&a,duration:a,easing:d&&b||b&&!c.isFunction(b)&&b};f.duration=c.fx.off?0:typeof f.duration=== +"number"?f.duration:c.fx.speeds[f.duration]||c.fx.speeds._default;f.old=f.complete;f.complete=function(){f.queue!==false&&c(this).dequeue();c.isFunction(f.old)&&f.old.call(this)};return f},easing:{linear:function(a,b,d,f){return d+f*a},swing:function(a,b,d,f){return(-Math.cos(a*Math.PI)/2+0.5)*f+d}},timers:[],fx:function(a,b,d){this.options=b;this.elem=a;this.prop=d;if(!b.orig)b.orig={}}});c.fx.prototype={update:function(){this.options.step&&this.options.step.call(this.elem,this.now,this);(c.fx.step[this.prop]|| +c.fx.step._default)(this);if((this.prop==="height"||this.prop==="width")&&this.elem.style)this.elem.style.display="block"},cur:function(a){if(this.elem[this.prop]!=null&&(!this.elem.style||this.elem.style[this.prop]==null))return this.elem[this.prop];return(a=parseFloat(c.css(this.elem,this.prop,a)))&&a>-10000?a:parseFloat(c.curCSS(this.elem,this.prop))||0},custom:function(a,b,d){function f(j){return e.step(j)}this.startTime=J();this.start=a;this.end=b;this.unit=d||this.unit||"px";this.now=this.start; +this.pos=this.state=0;var e=this;f.elem=this.elem;if(f()&&c.timers.push(f)&&!W)W=setInterval(c.fx.tick,13)},show:function(){this.options.orig[this.prop]=c.style(this.elem,this.prop);this.options.show=true;this.custom(this.prop==="width"||this.prop==="height"?1:0,this.cur());c(this.elem).show()},hide:function(){this.options.orig[this.prop]=c.style(this.elem,this.prop);this.options.hide=true;this.custom(this.cur(),0)},step:function(a){var b=J(),d=true;if(a||b>=this.options.duration+this.startTime){this.now= +this.end;this.pos=this.state=1;this.update();this.options.curAnim[this.prop]=true;for(var f in this.options.curAnim)if(this.options.curAnim[f]!==true)d=false;if(d){if(this.options.display!=null){this.elem.style.overflow=this.options.overflow;a=c.data(this.elem,"olddisplay");this.elem.style.display=a?a:this.options.display;if(c.css(this.elem,"display")==="none")this.elem.style.display="block"}this.options.hide&&c(this.elem).hide();if(this.options.hide||this.options.show)for(var e in this.options.curAnim)c.style(this.elem, +e,this.options.orig[e]);this.options.complete.call(this.elem)}return false}else{e=b-this.startTime;this.state=e/this.options.duration;a=this.options.easing||(c.easing.swing?"swing":"linear");this.pos=c.easing[this.options.specialEasing&&this.options.specialEasing[this.prop]||a](this.state,e,0,1,this.options.duration);this.now=this.start+(this.end-this.start)*this.pos;this.update()}return true}};c.extend(c.fx,{tick:function(){for(var a=c.timers,b=0;b
"; +a.insertBefore(b,a.firstChild);d=b.firstChild;f=d.firstChild;e=d.nextSibling.firstChild.firstChild;this.doesNotAddBorder=f.offsetTop!==5;this.doesAddBorderForTableAndCells=e.offsetTop===5;f.style.position="fixed";f.style.top="20px";this.supportsFixedPosition=f.offsetTop===20||f.offsetTop===15;f.style.position=f.style.top="";d.style.overflow="hidden";d.style.position="relative";this.subtractsBorderForOverflowNotVisible=f.offsetTop===-5;this.doesNotIncludeMarginInBodyOffset=a.offsetTop!==j;a.removeChild(b); +c.offset.initialize=c.noop},bodyOffset:function(a){var b=a.offsetTop,d=a.offsetLeft;c.offset.initialize();if(c.offset.doesNotIncludeMarginInBodyOffset){b+=parseFloat(c.curCSS(a,"marginTop",true))||0;d+=parseFloat(c.curCSS(a,"marginLeft",true))||0}return{top:b,left:d}},setOffset:function(a,b,d){if(/static/.test(c.curCSS(a,"position")))a.style.position="relative";var f=c(a),e=f.offset(),j=parseInt(c.curCSS(a,"top",true),10)||0,i=parseInt(c.curCSS(a,"left",true),10)||0;if(c.isFunction(b))b=b.call(a, +d,e);d={top:b.top-e.top+j,left:b.left-e.left+i};"using"in b?b.using.call(a,d):f.css(d)}};c.fn.extend({position:function(){if(!this[0])return null;var a=this[0],b=this.offsetParent(),d=this.offset(),f=/^body|html$/i.test(b[0].nodeName)?{top:0,left:0}:b.offset();d.top-=parseFloat(c.curCSS(a,"marginTop",true))||0;d.left-=parseFloat(c.curCSS(a,"marginLeft",true))||0;f.top+=parseFloat(c.curCSS(b[0],"borderTopWidth",true))||0;f.left+=parseFloat(c.curCSS(b[0],"borderLeftWidth",true))||0;return{top:d.top- +f.top,left:d.left-f.left}},offsetParent:function(){return this.map(function(){for(var a=this.offsetParent||s.body;a&&!/^body|html$/i.test(a.nodeName)&&c.css(a,"position")==="static";)a=a.offsetParent;return a})}});c.each(["Left","Top"],function(a,b){var d="scroll"+b;c.fn[d]=function(f){var e=this[0],j;if(!e)return null;if(f!==w)return this.each(function(){if(j=wa(this))j.scrollTo(!a?f:c(j).scrollLeft(),a?f:c(j).scrollTop());else this[d]=f});else return(j=wa(e))?"pageXOffset"in j?j[a?"pageYOffset": +"pageXOffset"]:c.support.boxModel&&j.document.documentElement[d]||j.document.body[d]:e[d]}});c.each(["Height","Width"],function(a,b){var d=b.toLowerCase();c.fn["inner"+b]=function(){return this[0]?c.css(this[0],d,false,"padding"):null};c.fn["outer"+b]=function(f){return this[0]?c.css(this[0],d,false,f?"margin":"border"):null};c.fn[d]=function(f){var e=this[0];if(!e)return f==null?null:this;if(c.isFunction(f))return this.each(function(j){var i=c(this);i[d](f.call(this,j,i[d]()))});return"scrollTo"in +e&&e.document?e.document.compatMode==="CSS1Compat"&&e.document.documentElement["client"+b]||e.document.body["client"+b]:e.nodeType===9?Math.max(e.documentElement["client"+b],e.body["scroll"+b],e.documentElement["scroll"+b],e.body["offset"+b],e.documentElement["offset"+b]):f===w?c.css(e,d):this.css(d,typeof f==="string"?f:f+"px")}});A.jQuery=A.$=c})(window); From cad33ddb963a3cc1de69ff7c9b15e86db28f357f Mon Sep 17 00:00:00 2001 From: Kyle Johnson Date: Tue, 17 Dec 2013 13:41:55 -0500 Subject: [PATCH 081/107] Removed embedded jquery, instead include by