Merge branch 'master' into storageareas

This commit is contained in:
Isaac Connor 2017-05-10 13:16:08 -04:00
commit fd44ff4e60
90 changed files with 1307 additions and 737 deletions

4
.eslintignore Normal file
View File

@ -0,0 +1,4 @@
web/api/lib
web/skins/classic/js/jquery-1.11.3.js
web/skins/classic/js/jquery.js
web/tools/mootools

29
.eslintrc.js Normal file
View File

@ -0,0 +1,29 @@
"use strict";
module.exports = {
"env": {
"browser": true,
},
"extends": ["google"],
"rules": {
"brace-style": "off",
"camelcase": "off",
"comma-dangle": "off",
"key-spacing": "off",
"max-len": "off",
"new-cap": ["error", {
capIsNewExceptions: ["Error", "Warning", "Debug", "Polygon_calcArea", "Play", "Stop"],
newIsCapExceptionPattern: "^Asset\.."
}],
"no-array-constructor": "off",
"no-caller": "off",
"no-new-object": "off",
"no-unused-vars": "off",
"no-var": "off",
"object-curly-spacing": "off",
"prefer-rest-params": "off",
"quotes": "off",
"require-jsdoc": "off",
"spaced-comment": "off",
},
};

View File

@ -103,7 +103,8 @@ mark_as_advanced(
ZM_PERL_MM_PARMS
ZM_PERL_SEARCH_PATH
ZM_TARGET_DISTRO
ZM_CONFIG_DIR)
ZM_CONFIG_DIR
ZM_SYSTEMD)
set(ZM_RUNDIR "/var/run/zm" CACHE PATH
"Location of transient process files, default: /var/run/zm")
@ -166,6 +167,8 @@ set(ZM_PERL_SEARCH_PATH "" CACHE PATH
installed outside Perl's default search path.")
set(ZM_TARGET_DISTRO "" CACHE STRING
"Build ZoneMinder for a specific distribution. Currently, valid names are: fc24, fc25, el6, el7, OS13, FreeBSD")
set(ZM_SYSTEMD "OFF" CACHE BOOL
"Set to ON to force building ZM with systemd support. default: OFF")
# Reassign some variables if a target distro has been specified
if((ZM_TARGET_DISTRO STREQUAL "fc24") OR (ZM_TARGET_DISTRO STREQUAL "fc25"))
@ -223,6 +226,11 @@ include_directories("${CMAKE_BINARY_DIR}")
# This is required to enable searching in lib64 (if exists), do not change
set_property(GLOBAL PROPERTY FIND_LIBRARY_USE_LIB64_PATHS ON)
# Set the systemd flag if systemd is autodetected or ZM_SYSTEMD has been set
if(ZM_SYSTEMD OR (IS_DIRECTORY /usr/lib/systemd/system) OR (IS_DIRECTORY /lib/systemd/system))
set(WITH_SYSTEMD 1)
endif(ZM_SYSTEMD OR (IS_DIRECTORY /usr/lib/systemd/system) OR (IS_DIRECTORY /lib/systemd/system))
# System checks
check_include_file("libv4l1-videodev.h" HAVE_LIBV4L1_VIDEODEV_H)
if(NOT HAVE_LIBV4L1_VIDEODEV_H)
@ -404,13 +412,13 @@ find_library(MYSQLCLIENT_LIBRARIES mysqlclient PATH_SUFFIXES mysql)
if(MYSQLCLIENT_LIBRARIES)
set(HAVE_LIBMYSQLCLIENT 1)
list(APPEND ZM_BIN_LIBS "${MYSQLCLIENT_LIBRARIES}")
find_path(MYSQLCLIENT_INCLUDE_DIR mysql/mysql.h)
find_path(MYSQLCLIENT_INCLUDE_DIR mysql.h PATH_SUFFIXES mysql)
if(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)
check_include_file("mysql.h" HAVE_MYSQL_H)
if(NOT HAVE_MYSQL_H)
message(FATAL_ERROR
"ZoneMinder requires MySQL headers - check that MySQL development packages are installed")
@ -754,12 +762,14 @@ endif(NOT ZM_WEB_GROUP)
message(STATUS "Using web user: ${ZM_WEB_USER}")
message(STATUS "Using web group: ${ZM_WEB_GROUP}")
# Check for polkit
find_package(Polkit)
if(NOT POLKIT_FOUND)
message(FATAL_ERROR
"Running ZoneMinder requires polkit. Building ZoneMinder requires the polkit development package.")
endif(NOT POLKIT_FOUND)
if(WITH_SYSTEMD)
# Check for polkit
find_package(Polkit)
if(NOT POLKIT_FOUND)
message(FATAL_ERROR
"Running ZoneMinder requires polkit. Building ZoneMinder requires the polkit development package.")
endif(NOT POLKIT_FOUND)
endif(WITH_SYSTEMD)
# Some variables that zm expects
set(ZM_PID "${ZM_RUNDIR}/zm.pid")
@ -828,7 +838,15 @@ else(zmconfgen_result EQUAL 0)
endif(zmconfgen_result EQUAL 0)
# Install zm.conf
install(FILES "${CMAKE_CURRENT_BINARY_DIR}/zm.conf" DESTINATION "${ZM_CONFIG_DIR}")
install(CODE "
if (NOT EXISTS \"${ZM_CONFIG_DIR}/zm.conf\")
file(INSTALL \"${CMAKE_CURRENT_BINARY_DIR}/zm.conf\" DESTINATION \"${ZM_CONFIG_DIR}\")
else (NOT EXISTS \"${ZM_CONFIG_DIR}/zm.conf\")
file(RENAME \"${CMAKE_CURRENT_BINARY_DIR}/zm.conf\" \"${CMAKE_CURRENT_BINARY_DIR}/zm.conf.new\")
file(INSTALL \"${CMAKE_CURRENT_BINARY_DIR}/zm.conf.new\" DESTINATION \"${ZM_CONFIG_DIR}\")
endif()
")
# Uninstall target
configure_file(

View File

@ -1,7 +1,7 @@
# ZoneMinder
FROM ubuntu:trusty
MAINTAINER Kyle Johnson <kjohnson@gnulnx.net>
FROM ubuntu:xenial
MAINTAINER Markos Vakondios <mvakondios@gmail.com>
# Resynchronize the package index files
RUN apt-get update && \
@ -10,8 +10,8 @@ RUN apt-get update && \
libdbi-perl libarchive-zip-perl libdate-manip-perl libdevice-serialport-perl libmime-perl libpcre3 \
libwww-perl libdbd-mysql-perl libsys-mmap-perl yasm cmake libjpeg-turbo8-dev \
libjpeg-turbo8 libtheora-dev libvorbis-dev libvpx-dev libx264-dev libmp4v2-dev libav-tools mysql-client \
apache2 php5 php5-mysql apache2-mpm-prefork libapache2-mod-php5 php5-cli \
mysql-server libvlc-dev libvlc5 libvlccore-dev libvlccore7 vlc-data libcurl4-openssl-dev \
apache2 php php-mysql libapache2-mod-php php-cli \
mysql-server libvlc-dev libvlc5 libvlccore-dev libvlccore8 vlc-data libcurl4-openssl-dev \
libavformat-dev libswscale-dev libavutil-dev libavcodec-dev libavfilter-dev \
libavresample-dev libavdevice-dev libpostproc-dev libv4l-dev libtool libnetpbm10-dev \
libmime-lite-perl dh-autoreconf dpatch \
@ -46,7 +46,7 @@ RUN chown -R www-data:www-data /usr/local/share/zoneminder/
RUN cp misc/apache.conf /etc/apache2/sites-available/000-default.conf
ADD utils/docker/phpdate.ini /etc/php5/apache2/conf.d/25-phpdate.ini
# Expose http ports
# Expose http port
EXPOSE 80
# Initial database and apache setup:

5
db/zm_update-1.30.4.sql Normal file
View File

@ -0,0 +1,5 @@
--
-- This updates a 1.30.3 database to 1.30.4
--
-- No changes required
--

View File

@ -33,7 +33,7 @@
%global _hardened_build 1
Name: zoneminder
Version: 1.30.3
Version: 1.30.4
Release: 1%{?dist}
Summary: A camera monitoring and analysis tool
Group: System Environment/Daemons
@ -50,6 +50,7 @@ Source1: https://github.com/FriendsOfCake/crud/archive/v%{crud_version}.tar.gz#/
%{?with_init_systemd:BuildRequires: systemd-devel}
%{?with_init_systemd:BuildRequires: mariadb-devel}
%{?with_init_systemd:BuildRequires: perl-podlators}
%{?with_init_systemd:BuildRequires: polkit-devel}
%{?with_init_sysv:BuildRequires: mysql-devel}
%{?el6:BuildRequires: epel-rpm-macros}
BuildRequires: cmake >= 2.8.7
@ -81,7 +82,6 @@ BuildRequires: vlc-devel
BuildRequires: libcurl-devel
BuildRequires: libv4l-devel
BuildRequires: ffmpeg-devel
BuildRequires: polkit-devel
%{?with_nginx:Requires: nginx}
%{?with_nginx:Requires: fcgiwrap}
@ -291,6 +291,8 @@ rm -rf %{_docdir}/%{name}-%{version}
%if 0%{?with_init_systemd}
%{_tmpfilesdir}/zoneminder.conf
%{_unitdir}/zoneminder.service
%{_datadir}/polkit-1/actions/com.zoneminder.systemctl.policy
%{_datadir}/polkit-1/rules.d/com.zoneminder.systemctl.rules
%endif
%if 0%{?with_init_sysv}
@ -303,7 +305,6 @@ rm -rf %{_docdir}/%{name}-%{version}
%{_bindir}/zmc
%{_bindir}/zmcontrol.pl
%{_bindir}/zmdc.pl
%{_bindir}/zmf
%{_bindir}/zmfilter.pl
%{_bindir}/zmpkg.pl
%{_bindir}/zmtrack.pl
@ -328,9 +329,6 @@ rm -rf %{_docdir}/%{name}-%{version}
%{_libexecdir}/zoneminder/
%{_datadir}/zoneminder/
%{_datadir}/polkit-1/actions/com.zoneminder.systemctl.policy
%{_datadir}/polkit-1/rules.d/com.zoneminder.systemctl.rules
%dir %attr(755,%{zmuid_final},%{zmgid_final}) %{_sharedstatedir}/zoneminder
%dir %attr(755,%{zmuid_final},%{zmgid_final}) %{_sharedstatedir}/zoneminder/events
%dir %attr(755,%{zmuid_final},%{zmgid_final}) %{_sharedstatedir}/zoneminder/images
@ -342,6 +340,11 @@ rm -rf %{_docdir}/%{name}-%{version}
%dir %attr(755,%{zmuid_final},%{zmgid_final}) %{_localstatedir}/run/zoneminder
%changelog
* Tue May 09 2017 Andrew Bauer <zonexpertconsulting@outlook.com> - 1.30.4-1
- modify autosetup macro parameters
- modify requirements for php-pecl-acpu-bc package
- 1.30.4 release
* Tue May 02 2017 Andrew Bauer <zonexpertconsulting@outlook.com> - 1.30.3-1
- 1.30.3 release

View File

@ -309,7 +309,7 @@ The main causes are.
* Capture frame rates. Unless there's a compelling reason in your case there is often little benefit in running cameras at 25fps when 5-10fps would often get you results just as good. Try changing your monitor settings to limit your cameras to lower frame rates. You can still configure ZM to ignore these limits and capture as fast as possible when motion is detected.
* Run function. Obviously running in Record or Mocord modes or in Modect with lots of events generates a lot of DB and file activity and so CPU and load will increase.
* Basic default detection zones. By default when a camera is added one detection zone is added which covers the whole image with a default set of parameters. If your camera covers a view in which various regions are unlikely to generate a valid alarm (ie the sky) then I would experiment with reducing the zone sizes or adding inactive zones to blank out areas you don't want to monitor. Additionally the actual settings of the zone themselves may not be optimal. When doing motion detection the number of changed pixels above a threshold is examined, then this is filter, then contiguous regions are calculated to see if an alarm is generated. If any maximum or minimum threshold is exceeded according to your zone settings at any time the calculation stops. If your settings always result in the calculations going through to the last stage before being failed then additional CPU time is used unnecessarily. Make sure your maximum and minimumzone thresholds are set to sensible values and experiment by switching RECORD_EVENT_STATS on and seeing what the actual values of alarmed pixels etc are during sample events.
* Optimise your settings. After you've got some settings you're happy with then switching off RECORD_EVENT_STATS will prevent the statistics being written to the database which saves some time. Other settings which might make a difference are ZM_FAST_RGB_DIFFS, ZM_OPT_FRAME_SERVER and the JPEG_xxx_QUALITY ones.
* Optimise your settings. After you've got some settings you're happy with then switching off RECORD_EVENT_STATS will prevent the statistics being written to the database which saves some time. Other settings which might make a difference are ZM_FAST_RGB_DIFFS and the JPEG_xxx_QUALITY ones.
I'm sure there are other things which might make a difference such as what else you have running on the box and memory sizes (make sure there's no swapping going on). Also speed of disk etc will make some difference during event capture and also if you are watching the whole time then you may have a bunch of zms processes running also.

View File

@ -29,7 +29,7 @@ Here is what the filter window looks like
events later and also make sure archived events don't get deleted, for example
* Email details of all matches: Sends an email to the configured address with details about the event.
The email can be customized as per TBD
* Execute command on all matches: Allows you to execute any arbitrary command on the matched events
* Execute command on all matches: Allows you to execute any arbitrary command on the matched events. You can use replacement tokens as subsequent arguents to the command, the last argument will be the absolute path to the event, preceeded by replacement arguents. eg: /usr/bin/script.sh %MN% will excecute as /usr/bin/script.sh MonitorName /path/to/event.
* Delete all matches: Deletes all the matched events
* *E*: Use 'Submit' to 'test' your matching conditions. This will just match and show you what filters match. Use 'Execute' to actually execute the action after matching your conditions. Use 'Save' to save the filter for future use and 'Reset' to clear your settings

View File

@ -33,10 +33,6 @@ RUN_AUDIT - The zmaudit daemon exists to check that the saved information in the
AUDIT_CHECK_INTERVAL - The zmaudit daemon exists to check that the saved information in the database and on the filesystem match and are consistent with each other. If an error occurs or if you are using 'fast deletes' it may be that database records are deleted but files remain. In this case, and similar, zmaudit will remove redundant information to synchronise the two data stores. The default check interval of 900 seconds (15 minutes) is fine for most systems however if you have a very large number of events the process of scanning the database and filesystem may take a long time and impact performance. In this case you may prefer to make this interval much larger to reduce the impact on your system. This option determines how often these checks are performed.
OPT_FRAME_SERVER - In some circumstances it is possible for a slow disk to take so long writing images to disk that it causes the analysis daemon to fall behind especially during high frame rate events. Setting this option to yes enables a frame server daemon (zmf) which will be sent the images from the analysis daemon and will do the actual writing of images itself freeing up the analysis daemon to get on with other things. Should this transmission fail or other permanent or transient error occur, this function will fall back to the analysis daemon.
FRAME_SOCKET_SIZE - For large captured images it is possible for the writes from the analysis daemon to the frame server to fail as the amount to be written exceeds the default buffer size. While the images are then written by the analysis daemon so no data is lost, it defeats the object of the frame server daemon in the first place. You can use this option to indicate that a larger buffer size should be used. Note that you may have to change the existing maximum socket buffer size on your system via sysctl (or in /proc/sys/net/core/wmem_max) to allow this new size to be set. Alternatively you can change the default buffer size on your system in the same way in which case that will be used with no change necessary in this option
OPT_CONTROL - ZoneMinder includes limited support for controllable cameras. A number of sample protocols are included and others can easily be added. If you wish to control your cameras via ZoneMinder then select this option otherwise if you only have static cameras or use other control methods then leave this option off.
OPT_TRIGGERS - ZoneMinder can interact with external systems which prompt or cancel alarms. This is done via the zmtrigger.pl script. This option indicates whether you want to use these external triggers. Most people will say no here.

View File

@ -13,7 +13,9 @@ configure_file(zoneminder.desktop.in "${CMAKE_CURRENT_BINARY_DIR}/zoneminder.des
# Do not install the misc files by default
#install(FILES "${CMAKE_CURRENT_BINARY_DIR}/apache.conf" "${CMAKE_CURRENT_BINARY_DIR}/logrotate.conf" "${CMAKE_CURRENT_BINARY_DIR}/syslog.conf" DESTINATION "${CMAKE_INSTALL_DATADIR}/zoneminder/misc")
# Install Policykit rules and actions into the proper folders
install(FILES "${CMAKE_CURRENT_BINARY_DIR}/com.zoneminder.systemctl.policy" DESTINATION "${PC_POLKIT_PREFIX}/${CMAKE_INSTALL_DATAROOTDIR}/polkit-1/actions")
install(FILES "${CMAKE_CURRENT_BINARY_DIR}/com.zoneminder.systemctl.rules" DESTINATION "${PC_POLKIT_PREFIX}/${CMAKE_INSTALL_DATAROOTDIR}/polkit-1/rules.d")
# Install Policykit rules and actions into the proper folders only on systems with systemd
if(WITH_SYSTEMD)
install(FILES "${CMAKE_CURRENT_BINARY_DIR}/com.zoneminder.systemctl.policy" DESTINATION "${PC_POLKIT_PREFIX}/${CMAKE_INSTALL_DATAROOTDIR}/polkit-1/actions")
install(FILES "${CMAKE_CURRENT_BINARY_DIR}/com.zoneminder.systemctl.rules" DESTINATION "${PC_POLKIT_PREFIX}/${CMAKE_INSTALL_DATAROOTDIR}/polkit-1/rules.d")
endif(WITH_SYSTEMD)
install(FILES "${CMAKE_CURRENT_BINARY_DIR}/zoneminder.desktop" DESTINATION "${CMAKE_INSTALL_DATADIR}/applications")

View File

@ -2722,47 +2722,6 @@ our @options = (
type => $types{boolean},
category => 'config',
},
{
name => 'ZM_OPT_FRAME_SERVER',
default => 'no',
description => 'Should analysis farm out the writing of images to disk',
#requires => [ { name => 'ZM_OPT_ADAPTIVE_SKIP', value => 'yes' } ],
help => q`
In some circumstances it is possible for a slow disk to take so
long writing images to disk that it causes the analysis daemon
to fall behind especially during high frame rate events.
Setting this option to yes enables a frame server daemon (zmf)
which will be sent the images from the analysis daemon and will
do the actual writing of images itself freeing up the analysis
daemon to get on with other things. Should this transmission
fail or other permanent or transient error occur, this function
will fall back to the analysis daemon.
`,
type => $types{boolean},
category => 'system',
},
{
name => 'ZM_FRAME_SOCKET_SIZE',
default => '0',
description => 'Specify the frame server socket buffer size if non-standard',
requires => [ { name => 'ZM_OPT_FRAME_SERVER', value => 'yes' } ],
help => q`
For large captured images it is possible for the writes from
the analysis daemon to the frame server to fail as the amount
to be written exceeds the default buffer size. While the images
are then written by the analysis daemon so no data is lost, it
defeats the object of the frame server daemon in the first
place. You can use this option to indicate that a larger buffer
size should be used. Note that you may have to change the
existing maximum socket buffer size on your system via sysctl
(or in /proc/sys/net/core/wmem_max) to allow this new size to
be set. Alternatively you can change the default buffer size on
your system in the same way in which case that will be used
with no change necessary in this option
`,
type => $types{integer},
category => 'system',
},
{
name => 'ZM_OPT_CONTROL',
default => 'no',

View File

@ -92,7 +92,6 @@ delete @ENV{qw(IFS CDPATH ENV BASH_ENV)};
my @daemons = (
'zmc',
'zma',
'zmf',
'zmfilter.pl',
'zmaudit.pl',
'zmtrigger.pl',

View File

@ -935,6 +935,7 @@ sub executeCommand
my $command = $filter->{AutoExecuteCmd};
$command .= " $event_path";
$command = substituteTags( $command, $filter, $event );
Info( "Executing '$command'\n" );
my $output = qx($command);

View File

@ -251,10 +251,6 @@ if ( $command =~ /^(?:start|restart)$/ )
}
if ( $monitor->{Function} ne 'Monitor' )
{
if ( $Config{ZM_OPT_FRAME_SERVER} )
{
runCommand( "zmdc.pl start zmf -m $monitor->{Id}" );
}
runCommand( "zmdc.pl start zma -m $monitor->{Id}" );
}
if ( $Config{ZM_OPT_CONTROL} )

View File

@ -12,21 +12,19 @@ add_library(zm STATIC ${ZM_BIN_SRC_FILES})
add_executable(zmc zmc.cpp)
add_executable(zma zma.cpp)
add_executable(zmu zmu.cpp)
add_executable(zmf zmf.cpp)
add_executable(zms zms.cpp)
target_link_libraries(zmc zm ${ZM_EXTRA_LIBS} ${ZM_BIN_LIBS})
target_link_libraries(zma zm ${ZM_EXTRA_LIBS} ${ZM_BIN_LIBS})
target_link_libraries(zmu zm ${ZM_EXTRA_LIBS} ${ZM_BIN_LIBS})
target_link_libraries(zmf zm ${ZM_EXTRA_LIBS} ${ZM_BIN_LIBS})
target_link_libraries(zms zm ${ZM_EXTRA_LIBS} ${ZM_BIN_LIBS})
# Generate man files for the binaries destined for the bin folder
FOREACH(CBINARY zma zmc zmf zmu)
FOREACH(CBINARY zma zmc zmu)
POD2MAN(${CMAKE_CURRENT_SOURCE_DIR}/${CBINARY}.cpp zoneminder-${CBINARY} 8)
ENDFOREACH(CBINARY zma zmc zmf zmu)
ENDFOREACH(CBINARY zma zmc zmu)
install(TARGETS zmc zma zmu zmf RUNTIME DESTINATION "${CMAKE_INSTALL_FULL_BINDIR}" PERMISSIONS OWNER_WRITE OWNER_READ OWNER_EXECUTE GROUP_READ GROUP_EXECUTE WORLD_READ WORLD_EXECUTE)
install(TARGETS zmc zma zmu RUNTIME DESTINATION "${CMAKE_INSTALL_FULL_BINDIR}" PERMISSIONS OWNER_WRITE OWNER_READ OWNER_EXECUTE GROUP_READ GROUP_EXECUTE WORLD_READ WORLD_EXECUTE)
install(TARGETS zms RUNTIME DESTINATION "${ZM_CGIDIR}" PERMISSIONS OWNER_WRITE OWNER_READ OWNER_EXECUTE GROUP_READ GROUP_EXECUTE WORLD_READ WORLD_EXECUTE)
install(CODE "execute_process(COMMAND ln -sf zms nph-zms WORKING_DIRECTORY ${CMAKE_CURRENT_BINARY_DIR})" )
install(FILES ${CMAKE_CURRENT_BINARY_DIR}/nph-zms DESTINATION "${ZM_CGIDIR}")

View File

@ -40,10 +40,10 @@ Camera::Camera( unsigned int p_monitor_id, SourceType p_type, unsigned int p_wid
Debug(2,"New camera id: %d width: %d height: %d colours: %d subpixelorder: %d capture: %d",monitor_id,width,height,colours,subpixelorder,capture);
/* Because many loops are unrolled and work on 16 colours/time or 4 pixels/time, we have to meet requirements */
if((colours == ZM_COLOUR_GRAY8 || colours == ZM_COLOUR_RGB32) && (imagesize % 16) != 0) {
Fatal("Image size is not multiples of 16");
} else if(colours == ZM_COLOUR_RGB24 && ((imagesize % 16) != 0 || (imagesize % 12) != 0)) {
Fatal("Image size is not multiples of 12 and 16");
if((colours == ZM_COLOUR_GRAY8 || colours == ZM_COLOUR_RGB32) && (imagesize % 64) != 0) {
Fatal("Image size is not multiples of 64");
} else if(colours == ZM_COLOUR_RGB24 && ((imagesize % 64) != 0 || (imagesize % 12) != 0)) {
Fatal("Image size is not multiples of 12 and 64");
}
}

View File

@ -42,8 +42,6 @@ extern "C"
#include "zm_sendfile.h"
}
#include "zmf.h"
#if HAVE_SYS_SENDFILE_H
#include <sys/sendfile.h>
#endif
@ -278,116 +276,6 @@ void Event::createNotes( std::string &notes ) {
int Event::sd = -1;
bool Event::OpenFrameSocket( int monitor_id ) {
if ( sd > 0 ) {
close( sd );
}
sd = socket( AF_UNIX, SOCK_STREAM, 0 );
if ( sd < 0 ) {
Error( "Can't create socket: %s", strerror(errno) );
return( false );
}
int socket_buffer_size = config.frame_socket_size;
if ( socket_buffer_size > 0 ) {
if ( setsockopt( sd, SOL_SOCKET, SO_SNDBUF, &socket_buffer_size, sizeof(socket_buffer_size) ) < 0 ) {
Error( "Can't get socket buffer size to %d, error = %s", socket_buffer_size, strerror(errno) );
close( sd );
sd = -1;
return( false );
}
}
int flags;
if ( (flags = fcntl( sd, F_GETFL )) < 0 ) {
Error( "Can't get socket flags, error = %s", strerror(errno) );
close( sd );
sd = -1;
return( false );
}
flags |= O_NONBLOCK;
if ( fcntl( sd, F_SETFL, flags ) < 0 ) {
Error( "Can't set socket flags, error = %s", strerror(errno) );
close( sd );
sd = -1;
return( false );
}
char sock_path[PATH_MAX] = "";
snprintf( sock_path, sizeof(sock_path), "%s/zmf-%d.sock", config.path_socks, monitor_id );
struct sockaddr_un addr;
strncpy( addr.sun_path, sock_path, sizeof(addr.sun_path) );
addr.sun_family = AF_UNIX;
if ( connect( sd, (struct sockaddr *)&addr, strlen(addr.sun_path)+sizeof(addr.sun_family)+1) < 0 ) {
Warning( "Can't connect to frame server: %s", strerror(errno) );
close( sd );
sd = -1;
return( false );
}
Debug( 1, "Opened connection to frame server" );
return( true );
}
bool Event::ValidateFrameSocket( int monitor_id ) {
if ( sd < 0 ) {
return( OpenFrameSocket( monitor_id ) );
}
return( true );
}
bool Event::SendFrameImage( const Image *image, bool alarm_frame ) {
if ( !ValidateFrameSocket( monitor->Id() ) ) {
return( false );
}
static int jpg_buffer_size = 0;
static unsigned char jpg_buffer[ZM_MAX_IMAGE_SIZE];
image->EncodeJpeg( jpg_buffer, &jpg_buffer_size, (alarm_frame&&(config.jpeg_alarm_file_quality>config.jpeg_file_quality))?config.jpeg_alarm_file_quality:config.jpeg_file_quality );
static FrameHeader frame_header;
frame_header.event_id = id;
if ( config.use_deep_storage )
frame_header.event_time = start_time.tv_sec;
frame_header.frame_id = frames;
frame_header.alarm_frame = alarm_frame;
frame_header.image_length = jpg_buffer_size;
struct iovec iovecs[2];
iovecs[0].iov_base = &frame_header;
iovecs[0].iov_len = sizeof(frame_header);
iovecs[1].iov_base = jpg_buffer;
iovecs[1].iov_len = jpg_buffer_size;
ssize_t writev_size = sizeof(frame_header)+jpg_buffer_size;
ssize_t writev_result = writev( sd, iovecs, sizeof(iovecs)/sizeof(*iovecs));
if ( writev_result != writev_size ) {
if ( writev_result < 0 ) {
if ( errno == EAGAIN ) {
Warning( "Blocking write detected" );
} else {
Error( "Can't write frame: %s", strerror(errno) );
close( sd );
sd = -1;
}
} else {
Error( "Incomplete frame write: %zd of %zd bytes written", writev_result, writev_size );
close( sd );
sd = -1;
}
return( false );
}
Debug( 1, "Wrote frame image, %d bytes", jpg_buffer_size );
return( true );
}
bool Event::WriteFrameImage( Image *image, struct timeval timestamp, const char *event_file, bool alarm_frame ) {
Image* ImgToWrite;
Image* ts_image = NULL;
@ -400,10 +288,9 @@ bool Event::WriteFrameImage( Image *image, struct timeval timestamp, const char
} else
ImgToWrite=image;
if ( !config.opt_frame_server || !SendFrameImage(ImgToWrite, alarm_frame) ) {
int thisquality = ( alarm_frame && (config.jpeg_alarm_file_quality > config.jpeg_file_quality) ) ? config.jpeg_alarm_file_quality : 0 ; // quality to use, zero is default
ImgToWrite->WriteJpeg( event_file, thisquality, (monitor->Exif() ? timestamp : (timeval){0,0}) ); // exif is only timestamp at present this switches on or off for write
}
int thisquality = ( alarm_frame && (config.jpeg_alarm_file_quality > config.jpeg_file_quality) ) ? config.jpeg_alarm_file_quality : 0 ; // quality to use, zero is default
ImgToWrite->WriteJpeg( event_file, thisquality, (monitor->Exif() ? timestamp : (timeval){0,0}) ); // exif is only timestamp at present this switches on or off for write
if(ts_image) delete(ts_image); // clean up if used.
return( true );
}

View File

@ -204,16 +204,32 @@ void Image::Initialise()
fptr_blend = &std_blend;
Debug(4,"Blend: Using standard blend function");
}
__attribute__((aligned(64))) uint8_t blend1[128] = {
86,58,54,63,149,62,209,34,148,46,186,176,9,236,193,254,113,146,228,220,123,164,92,98,9,72,67,156,63,118,96,167,
48,224,106,176,201,245,223,219,198,50,100,31,68,77,33,76,166,90,254,128,191,82,84,32,3,171,147,248,14,196,141,179,
79,237,121,11,132,37,194,225,45,171,169,167,56,64,193,85,147,33,97,221,94,97,90,44,191,248,65,8,17,240,167,207,
224,23,71,74,81,1,46,110,227,94,163,170,55,155,52,147,224,154,237,35,255,26,229,11,223,242,118,155,82,37,189,2
};
__attribute__((aligned(64))) uint8_t blend2[128] = {
92,188,203,118,121,231,252,218,126,88,80,72,123,16,91,131,109,0,57,56,95,204,74,8,137,94,6,69,18,146,229,194,
146,230,13,146,95,48,185,65,162,47,152,172,184,111,245,143,247,105,49,42,89,37,145,255,221,200,103,80,98,39,14,227,
227,46,46,59,248,7,83,20,157,79,36,161,237,55,77,175,232,200,38,170,198,239,89,19,82,88,130,120,203,184,141,117,
228,140,150,107,103,195,74,130,42,11,150,70,176,204,198,188,38,252,174,104,128,106,31,17,141,231,62,104,179,29,143,130
};
__attribute__((aligned(64))) uint8_t blendexp[128] = {
86,73,71,69,145,82,214,56,145,51,173,163,22,209,180,239,112,128,207,200,119,168,89,87,24,74,59,145,57,121,111,170,
59,224,94,172,188,221,218,200,193,49,106,47,81,81,58,84,175,91,229,117,178,76,91,58,29,174,141,227,24,177,125,184,
96,214,112,16,145,33,180,200,58,159,153,166,77,62,179,95,157,53,89,214,106,114,89,41,177,228,72,21,39,233,163,196,
224,37,80,77,83,24,49,112,204,84,161,158,69,160,69,151,201,165,229,43,239,35,205,11,213,240,111,148,93,36,183,17
};
__attribute__((aligned(64))) uint8_t blendres[128];
__attribute__((aligned(16))) uint8_t blend1[16] = {142,255,159,91,88,227,0,52,37,80,152,97,104,252,90,82};
__attribute__((aligned(16))) uint8_t blend2[16] = {129,56,136,96,119,149,94,29,96,176,1,144,230,203,111,172};
__attribute__((aligned(16))) uint8_t blendres[16];
__attribute__((aligned(16))) uint8_t blendexp[16] = {141,231,157,92,91,217,11,49,45,92,133,103,119,246,92,93}; /* Expected results for 12.5% blend */
(*fptr_blend)(blend1,blend2,blendres,16,12.5);
/* Run the blend function */
(*fptr_blend)(blend1,blend2,blendres,128,12.0);
/* Compare results with expected results */
for(int i=0;i<16;i++) {
for(int i=0;i<128;i++) {
if(abs(blendexp[i] - blendres[i]) > 3) {
Panic("Blend function failed self-test: Results differ from the expected results");
}
@ -238,15 +254,6 @@ void Image::Initialise()
fptr_delta8_bgra = &sse2_delta8_bgra;
fptr_delta8_argb = &sse2_delta8_argb;
fptr_delta8_abgr = &sse2_delta8_abgr;
/*
** On some systems, the 4 SSE2 algorithms above might be a little slower than
** the standard algorithms, especially on early Pentium 4 processors.
** In that case, comment out the 4 lines above and uncomment the 4 lines below
*/
// fptr_delta8_rgba = &std_delta8_rgba;
// fptr_delta8_bgra = &std_delta8_bgra;
// fptr_delta8_argb = &std_delta8_argb;
// fptr_delta8_abgr = &std_delta8_abgr;
fptr_delta8_gray8 = &sse2_delta8_gray8;
Debug(4,"Delta: Using SSE2 delta functions");
} else if(neonversion >= 1) {
@ -276,11 +283,55 @@ void Image::Initialise()
Debug(4,"Delta: CPU extensions disabled, using standard delta functions");
}
__attribute__((aligned(64))) uint8_t delta8_1[128] = {
221,22,234,254,8,140,15,28,166,13,203,56,92,250,79,225,19,59,241,145,253,33,87,204,97,168,229,180,3,108,205,177,
41,108,65,149,4,87,16,240,56,50,135,64,153,3,219,214,239,55,169,180,167,45,243,56,191,119,145,250,102,145,73,32,
207,213,189,167,147,83,217,30,113,51,142,125,219,97,60,5,135,195,95,133,21,197,150,82,134,93,198,97,97,49,117,24,
242,253,242,5,190,71,182,1,0,69,25,181,139,84,242,79,150,158,29,215,98,100,245,16,86,165,18,98,46,100,139,19
};
__attribute__((aligned(64))) uint8_t delta8_2[128] = {
236,22,153,161,50,141,15,130,89,251,33,5,140,201,225,194,138,76,248,89,25,26,29,93,250,251,48,157,41,126,140,152,
170,177,134,14,234,99,3,105,217,76,38,233,89,30,93,48,234,40,202,80,184,4,250,71,183,249,76,78,184,148,185,120,
137,214,238,57,50,93,29,60,99,207,40,15,43,28,177,118,60,231,90,47,198,251,250,241,212,114,249,17,95,161,216,218,
51,178,137,161,213,108,35,72,65,24,5,176,110,15,0,2,137,58,0,133,197,1,122,169,175,33,223,138,37,114,52,186
};
__attribute__((aligned(64))) uint8_t delta8_gray8_exp[128] = {
15,0,81,93,42,1,0,102,77,238,170,51,48,49,146,31,119,17,7,56,228,7,58,111,153,83,181,23,38,18,65,25,
129,69,69,135,230,12,13,135,161,26,97,169,64,27,126,166,5,15,33,100,17,41,7,15,8,130,69,172,82,3,112,88,
70,1,49,110,97,10,188,30,14,156,102,110,176,69,117,113,75,36,5,86,177,54,100,159,78,21,51,80,2,112,99,194,
191,75,105,156,23,37,147,71,65,45,20,5,29,69,242,77,13,100,29,82,99,99,123,153,89,132,205,40,9,14,87,167
};
__attribute__((aligned(64))) uint8_t delta8_rgba_exp[32] = {
73,25,148,105,20,64,129,49,85,43,106,123,47,13,102,92,58,126,110,110,29,109,54,124,114,114,19,179,51,127,154,97
};
__attribute__((aligned(64))) uint8_t delta8_gray8_res[128];
__attribute__((aligned(64))) uint8_t delta8_rgba_res[32];
/* Run the delta8 grayscale function */
(*fptr_delta8_gray8)(delta8_1,delta8_2,delta8_gray8_exp,128);
/* Compare results with expected results */
for(int i=0;i<128;i++) {
if(abs(delta8_gray8_exp[i] - delta8_gray8_res[i]) > 7) {
Panic("Delta grayscale function failed self-test: Results differ from the expected results");
}
}
/* Run the delta8 RGBA function */
(*fptr_delta8_rgba)(delta8_1,delta8_2,delta8_rgba_exp,32);
/* Compare results with expected results */
for(int i=0;i<32;i++) {
if(abs(delta8_rgba_exp[i] - delta8_rgba_res[i]) > 7) {
Panic("Delta RGBA function failed self-test: Results differ from the expected results");
}
}
/*
SSSE3 deinterlacing functions were removed because they were usually equal
or slower than the standard code (compiled with -O2 or better)
The function is too complicated to be vectorized efficiently
*/
The function is too complicated to be vectorized efficiently on SSSE3
*/
fptr_deinterlace_4field_rgba = &std_deinterlace_4field_rgba;
fptr_deinterlace_4field_bgra = &std_deinterlace_4field_bgra;
fptr_deinterlace_4field_argb = &std_deinterlace_4field_argb;
@ -1658,6 +1709,8 @@ Image *Image::Highlight( unsigned int n_images, Image *images[], const Rgb thres
unsigned int size = result->size;
for ( unsigned int c = 0; c < colours; c++ )
{
unsigned int ref_colour_rgb = RGB_VAL(ref_colour,c);
for ( unsigned int i = 0; i < size; i++ )
{
unsigned int count = 0;
@ -1666,14 +1719,12 @@ Image *Image::Highlight( unsigned int n_images, Image *images[], const Rgb thres
{
uint8_t *psrc = images[j]->buffer+c;
#ifndef SOLARIS
if ( (unsigned)abs((*psrc)-RGB_VAL(ref_colour,c)) >= RGB_VAL(threshold,c) )
#else
if ( (unsigned)std::abs((*psrc)-RGB_VAL(ref_colour,c)) >= RGB_VAL(threshold,c) )
#endif
{
count++;
}
unsigned int diff = ((*psrc)-ref_colour_rgb) > 0 ? (*psrc)-ref_colour_rgb : ref_colour_rgb - (*psrc);
if (diff >= RGB_VAL(threshold,c))
{
count++;
}
psrc += colours;
}
*pdest = (count*255)/n_images;
@ -3337,12 +3388,22 @@ void neon32_armv7_fastblend(const uint8_t* col1, const uint8_t* col2, uint8_t* r
current_blendpercent = blendpercent;
}
/* Q0(D0,D1) = col1 */
/* Q1(D2,D3) = col2 */
/* Q2(D4,D5) = col1 backup */
/* Q3(D6,D7) = divider */
/* Q0(D0,D1) = col1+0 */
/* Q1(D2,D3) = col1+16 */
/* Q2(D4,D5) = col1+32 */
/* Q3(D6,D7) = col1+48 */
/* Q4(D8,D9) = col2+0 */
/* Q5(D10,D11) = col2+16 */
/* Q6(D12,D13) = col2+32 */
/* Q7(D14,D15) = col2+48 */
/* Q8(D16,D17) = col1tmp+0 */
/* Q9(D18,D19) = col1tmp+16 */
/* Q10(D20,D21) = col1tmp+32 */
/* Q11(D22,D23) = col1tmp+48 */
/* Q12(D24,D25) = divider */
__asm__ __volatile__ (
<<<<<<< HEAD
"mov r12, %4\n\t"
"vdup.8 q3, r12\n\t"
"neon32_armv7_fastblend_iter:\n\t"
@ -3359,6 +3420,38 @@ void neon32_armv7_fastblend(const uint8_t* col1, const uint8_t* col2, uint8_t* r
: "r" (col1), "r" (col2), "r" (result), "r" (count), "g" (divider)
: "%r12", "%q0", "%q1", "%q2", "%q3", "cc", "memory"
);
=======
"mov r12, %4\n\t"
"vdup.8 q12, r12\n\t"
"neon32_armv7_fastblend_iter:\n\t"
"pld [%0,#256]\n\t"
"pld [%1,#256]\n\t"
"vldm %0!, {q0,q1,q2,q3}\n\t"
"vldm %1!, {q4,q5,q6,q7}\n\t"
"vrshl.u8 q8, q0, q12\n\t"
"vrshl.u8 q9, q1, q12\n\t"
"vrshl.u8 q10, q2, q12\n\t"
"vrshl.u8 q11, q3, q12\n\t"
"vrshl.u8 q4, q4, q12\n\t"
"vrshl.u8 q5, q5, q12\n\t"
"vrshl.u8 q6, q6, q12\n\t"
"vrshl.u8 q7, q7, q12\n\t"
"vsub.i8 q4, q4, q8\n\t"
"vsub.i8 q5, q5, q9\n\t"
"vsub.i8 q6, q6, q10\n\t"
"vsub.i8 q7, q7, q11\n\t"
"vadd.i8 q4, q4, q0\n\t"
"vadd.i8 q5, q5, q1\n\t"
"vadd.i8 q6, q6, q2\n\t"
"vadd.i8 q7, q7, q3\n\t"
"vstm %2!, {q4,q5,q6,q7}\n\t"
"subs %3, %3, #64\n\t"
"bne neon32_armv7_fastblend_iter\n\t"
:
: "r" (col1), "r" (col2), "r" (result), "r" (count), "r" (divider)
: "%r12", "%q0", "%q1", "%q2", "%q3", "%q4", "%q5", "%q6", "%q7", "%q8", "%q9", "%q10", "%q11", "%q12", "cc", "memory"
);
>>>>>>> master
#else
Panic("Neon function called on a non-ARM platform or Neon code is absent");
#endif
@ -3593,10 +3686,17 @@ __attribute__((noinline,__target__("fpu=neon")))
void neon32_armv7_delta8_gray8(const uint8_t* col1, const uint8_t* col2, uint8_t* result, unsigned long count) {
#if (defined(__arm__) && !defined(ZM_STRIP_NEON))
/* Q0(D0,D1) = col1 */
/* Q1(D2,D3) = col2 */
/* Q0(D0,D1) = col1+0 */
/* Q1(D2,D3) = col1+16 */
/* Q2(D4,D5) = col1+32 */
/* Q3(D6,D7) = col1+48 */
/* Q4(D8,D9) = col2+0 */
/* Q5(D10,D11) = col2+16 */
/* Q6(D12,D13) = col2+32 */
/* Q7(D14,D15) = col2+48 */
__asm__ __volatile__ (
<<<<<<< HEAD
"neon32_armv7_delta8_gray8_iter:\n\t"
"vldm %0!, {q0}\n\t"
"vldm %1!, {q1}\n\t"
@ -3608,6 +3708,24 @@ void neon32_armv7_delta8_gray8(const uint8_t* col1, const uint8_t* col2, uint8_t
: "r" (col1), "r" (col2), "r" (result), "r" (count)
: "%q0", "%q1", "cc", "memory"
);
=======
"neon32_armv7_delta8_gray8_iter:\n\t"
"pld [%0,#256]\n\t"
"pld [%1,#256]\n\t"
"vldm %0!, {q0,q1,q2,q3}\n\t"
"vldm %1!, {q4,q5,q6,q7}\n\t"
"vabd.u8 q0, q0, q4\n\t"
"vabd.u8 q1, q1, q5\n\t"
"vabd.u8 q2, q2, q6\n\t"
"vabd.u8 q3, q3, q7\n\t"
"vstm %2!, {q0,q1,q2,q3}\n\t"
"subs %3, %3, #64\n\t"
"bne neon32_armv7_delta8_gray8_iter\n\t"
:
: "r" (col1), "r" (col2), "r" (result), "r" (count)
: "%q0", "%q1", "%q2", "%q3", "%q4", "%q5", "%q6", "%q7", "cc", "memory"
);
>>>>>>> master
#else
Panic("Neon function called on a non-ARM platform or Neon code is absent");
#endif
@ -3620,11 +3738,18 @@ __attribute__((noinline,__target__("fpu=neon")))
void neon32_armv7_delta8_rgb32(const uint8_t* col1, const uint8_t* col2, uint8_t* result, unsigned long count, uint32_t multiplier) {
#if (defined(__arm__) && !defined(ZM_STRIP_NEON))
/* Q0(D0,D1) = col1 */
/* Q1(D2,D3) = col2 */
/* Q2(D4,D5) = multiplier */
/* Q0(D0,D1) = col1+0 */
/* Q1(D2,D3) = col1+16 */
/* Q2(D4,D5) = col1+32 */
/* Q3(D6,D7) = col1+48 */
/* Q4(D8,D9) = col2+0 */
/* Q5(D10,D11) = col2+16 */
/* Q6(D12,D13) = col2+32 */
/* Q7(D14,D15) = col2+48 */
/* Q8(D16,D17) = multiplier */
__asm__ __volatile__ (
<<<<<<< HEAD
"mov r12, %4\n\t"
"vdup.32 q2, r12\n\t"
"neon32_armv7_delta8_rgb32_iter:\n\t"
@ -3643,6 +3768,43 @@ void neon32_armv7_delta8_rgb32(const uint8_t* col1, const uint8_t* col2, uint8_t
: "r" (col1), "r" (col2), "r" (result), "r" (count), "r" (multiplier)
: "%r12", "%q0", "%q1", "%q2", "cc", "memory"
);
=======
"mov r12, %4\n\t"
"vdup.32 q8, r12\n\t"
"neon32_armv7_delta8_rgb32_iter:\n\t"
"pld [%0,#256]\n\t"
"pld [%1,#256]\n\t"
"vldm %0!, {q0,q1,q2,q3}\n\t"
"vldm %1!, {q4,q5,q6,q7}\n\t"
"vabd.u8 q0, q0, q4\n\t"
"vabd.u8 q1, q1, q5\n\t"
"vabd.u8 q2, q2, q6\n\t"
"vabd.u8 q3, q3, q7\n\t"
"vrshr.u8 q0, q0, #3\n\t"
"vrshr.u8 q1, q1, #3\n\t"
"vrshr.u8 q2, q2, #3\n\t"
"vrshr.u8 q3, q3, #3\n\t"
"vmul.i8 q0, q0, q8\n\t"
"vmul.i8 q1, q1, q8\n\t"
"vmul.i8 q2, q2, q8\n\t"
"vmul.i8 q3, q3, q8\n\t"
"vpadd.i8 d0, d0, d1\n\t"
"vpadd.i8 d2, d2, d3\n\t"
"vpadd.i8 d4, d4, d5\n\t"
"vpadd.i8 d6, d6, d7\n\t"
"vpadd.i8 d0, d0, d0\n\t"
"vpadd.i8 d1, d2, d2\n\t"
"vpadd.i8 d2, d4, d4\n\t"
"vpadd.i8 d3, d6, d6\n\t"
"vst4.32 {d0[0],d1[0],d2[0],d3[0]}, [%2]!\n\t"
"subs %3, %3, #16\n\t"
"bne neon32_armv7_delta8_rgb32_iter\n\t"
:
: "r" (col1), "r" (col2), "r" (result), "r" (count), "r" (multiplier)
: "%r12", "%q0", "%q1", "%q2", "%q3", "%q4", "%q5", "%q6", "%q7", "%q8", "cc", "memory"
);
}
>>>>>>> master
#else
Panic("Neon function called on a non-ARM platform or Neon code is absent");
#endif

View File

@ -54,7 +54,7 @@ extern imgbufcpy_fptr_t fptr_imgbufcpy;
/* Should be called from Image class functions */
inline static uint8_t* AllocBuffer(size_t p_bufsize) {
uint8_t* buffer = (uint8_t*)zm_mallocaligned(16,p_bufsize);
uint8_t* buffer = (uint8_t*)zm_mallocaligned(64,p_bufsize);
if(buffer == NULL)
Fatal("Memory allocation failed: %s",strerror(errno));

View File

@ -182,9 +182,9 @@ int LibvlcCamera::PrimeCapture()
mLibvlcData.bufferSize = width * height * mBpp;
// Libvlc wants 32 byte alignment for images (should in theory do this for all image lines)
mLibvlcData.buffer = (uint8_t*)zm_mallocaligned(32, mLibvlcData.bufferSize);
mLibvlcData.prevBuffer = (uint8_t*)zm_mallocaligned(32, mLibvlcData.bufferSize);
mLibvlcData.buffer = (uint8_t*)zm_mallocaligned(64, mLibvlcData.bufferSize);
mLibvlcData.prevBuffer = (uint8_t*)zm_mallocaligned(64, mLibvlcData.bufferSize);
mLibvlcData.newImage.setValueImmediate(false);
libvlc_media_player_play(mLibvlcMediaPlayer);

View File

@ -31,9 +31,9 @@
#include <signal.h>
#include <stdarg.h>
#include <errno.h>
#include <libgen.h>
#ifdef __FreeBSD__
#include <sys/thr.h>
#include <libgen.h>
#endif
bool Logger::smInitialised = false;
@ -515,7 +515,8 @@ void Logger::logPrint( bool hex, const char * const filepath, const int line, co
va_list argPtr;
struct timeval timeVal;
const char * const file = basename(filepath);
char *filecopy = strdup(filepath);
const char * const file = basename(filecopy);
const char *classString = smCodes[level].c_str();
if ( level < PANIC || level > DEBUG9 )
@ -630,6 +631,7 @@ void Logger::logPrint( bool hex, const char * const filepath, const int line, co
syslog( priority, "%s [%s] [%s]", classString, mId.c_str(), syslogStart );
}
free(filecopy);
if ( level <= FATAL )
{
if ( level <= PANIC )

View File

@ -148,7 +148,7 @@ bool Monitor::MonitorLink::connect() {
return( false );
}
mem_ptr = (unsigned char *)shmat( shm_id, 0, 0 );
if ( mem_ptr < 0 ) {
if ( mem_ptr < (void *)0 ) {
Debug( 3, "Can't shmat link memory: %s", strerror(errno) );
connected = false;
return( false );
@ -374,7 +374,7 @@ Monitor::Monitor(
+ sizeof(VideoStoreData) //Information to pass back to the capture process
+ (image_buffer_count*sizeof(struct timeval))
+ (image_buffer_count*camera->ImageSize())
+ 64; /* Padding used to permit aligning the images buffer to 16 byte boundary */
+ 64; /* Padding used to permit aligning the images buffer to 64 byte boundary */
Debug( 1, "mem.size=%d", mem_size );
mem_ptr = NULL;
@ -530,7 +530,7 @@ bool Monitor::connect() {
exit( -1 );
}
mem_ptr = (unsigned char *)shmat( shm_id, 0, 0 );
if ( mem_ptr < 0 ) {
if ( mem_ptr < (void *)0 ) {
Error( "Can't shmat: %s", strerror(errno));
exit( -1 );
}
@ -541,10 +541,10 @@ bool Monitor::connect() {
struct timeval *shared_timestamps = (struct timeval *)((char *)video_store_data + sizeof(VideoStoreData));
unsigned char *shared_images = (unsigned char *)((char *)shared_timestamps + (image_buffer_count*sizeof(struct timeval)));
if(((unsigned long)shared_images % 16) != 0) {
/* Align images buffer to nearest 16 byte boundary */
Debug(3,"Aligning shared memory images to the next 16 byte boundary");
shared_images = (uint8_t*)((unsigned long)shared_images + (16 - ((unsigned long)shared_images % 16)));
if(((unsigned long)shared_images % 64) != 0) {
/* Align images buffer to nearest 64 byte boundary */
Debug(3,"Aligning shared memory images to the next 64 byte boundary");
shared_images = (uint8_t*)((unsigned long)shared_images + (64 - ((unsigned long)shared_images % 64)));
}
Debug(3, "Allocating %d image buffers", image_buffer_count );
image_buffer = new Snapshot[image_buffer_count];

View File

@ -141,11 +141,6 @@ int main( int argc, char *argv[] )
{
Info( "In mode %d/%d, warming up", monitor->GetFunction(), monitor->Enabled() );
if ( config.opt_frame_server )
{
Event::OpenFrameSocket( monitor->Id() );
}
zmSetDefaultHupHandler();
zmSetDefaultTermHandler();
zmSetDefaultDieHandler();

View File

@ -1,32 +0,0 @@
//
// ZoneMinder Image File Write Class Interface, $Date$, $Revision$
// Copyright (C) 2001-2008 Philip Coombes
//
// This program is free software; you can redistribute it and/or
// modify it under the terms of the GNU General Public License
// as published by the Free Software Foundation; either version 2
// of the License, or (at your option) any later version.
//
// This program is distributed in the hope that it will be useful,
// but WITHOUT ANY WARRANTY; without even the implied warranty of
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
// GNU General Public License for more details.
//
// You should have received a copy of the GNU General Public License
// along with this program; if not, write to the Free Software
// Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
//
#ifndef ZMFILE_H
#define ZMFILE_H
struct FrameHeader
{
unsigned long event_id;
time_t event_time;
unsigned long frame_id;
bool alarm_frame;
unsigned long image_length;
};
#endif // ZMFILE_H

View File

@ -1,7 +1,9 @@
#!/bin/bash
# Start MySQL
/usr/bin/mysqld_safe &
test -e /var/run/mysqld || install -m 755 -o mysql -g root -d /var/run/mysqld
su - mysql -s /bin/sh -c "/usr/bin/mysqld_safe > /dev/null 2>&1 &"
# Give MySQL time to wake up
SECONDS_LEFT=120

View File

@ -7,7 +7,8 @@ umount /dev/shm
mount -t tmpfs -o rw,nosuid,nodev,noexec,relatime,size=512M tmpfs /dev/shm
# Start MySQL
/usr/bin/mysqld_safe &
test -e /var/run/mysqld || install -m 755 -o mysql -g root -d /var/run/mysqld
su - mysql -s /bin/sh -c "/usr/bin/mysqld_safe > /dev/null 2>&1 &"
# Ensure we shut down mysql cleanly later:
trap close_mysql SIGTERM

View File

@ -1 +1,5 @@
<<<<<<< HEAD
1.31.0
=======
1.30.4
>>>>>>> master

Binary file not shown.

Binary file not shown.

Before

Width:  |  Height:  |  Size: 2.5 KiB

BIN
web/graphics/spinner.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 384 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 61 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 137 B

View File

@ -891,21 +891,12 @@ function zmaControl( $monitor, $mode=false ) {
daemonControl( "stop", "zmtrack.pl", "-m ".$monitor['Id'] );
}
daemonControl( "stop", "zma", "-m ".$monitor['Id'] );
if ( ZM_OPT_FRAME_SERVER ) {
daemonControl( "stop", "zmf", "-m ".$monitor['Id'] );
}
} else {
if ( $mode == "restart" ) {
if ( ZM_OPT_CONTROL ) {
daemonControl( "stop", "zmtrack.pl", "-m ".$monitor['Id'] );
}
daemonControl( "stop", "zma", "-m ".$monitor['Id'] );
if ( ZM_OPT_FRAME_SERVER ) {
daemonControl( "stop", "zmf", "-m ".$monitor['Id'] );
}
}
if ( ZM_OPT_FRAME_SERVER ) {
daemonControl( "start", "zmf", "-m ".$monitor['Id'] );
}
daemonControl( "start", "zma", "-m ".$monitor['Id'] );
if ( ZM_OPT_CONTROL && $monitor['Controllable'] && $monitor['TrackMotion'] && ( $monitor['Function'] == 'Modect' || $monitor['Function'] == 'Mocord' ) ) {

View File

@ -46,7 +46,7 @@ function logReport( level, message, file, line )
return;
if ( arguments && arguments.callee && arguments.callee.caller && arguments.callee.caller.name )
message += ' - '+arguments.callee.caller.caller.name+'()';
message += ' - '+arguments.callee.caller.caller.name+'()';
if ( !debugReq )
{
@ -115,4 +115,4 @@ window.onerror =
function( message, url, line )
{
logReport( "ERR", message, url, line );
}
};

View File

@ -84,7 +84,7 @@ var Overlay = new Class({
showAnimation:function()
{
showOverlay();
//console.log( "Showing overlay loading" );
if ( !this.loading )
{
@ -116,7 +116,7 @@ function setupOverlays()
overlay.getElements('.overlayCloser').each(
function( closer )
{
closer.addEvent( 'click', function() { overlay.element.hide(); } )
closer.addEvent( 'click', function() { overlay.element.hide(); } );
}
);
overlay.overlayShow = function() { overlay.element.show(); };

View File

@ -822,14 +822,6 @@ $OLANG = array(
'Prompt' => "Creaz&#259; imagini analizate cu marcaje ale mi&#351;c&#259;rii",
'Help' => "Implicit, &#238;n cazul unei alarme, ZoneMinder &#238;nregistreaz&#259; at&#226;t imaginile neprelucrate c&#226;t &#351;i cele ce au fost analizate &#351;i au zone marcate unde a fost detectat&#259; mi&#351;care. Acest lucru poate fi foarte folositor la configurarea zonelor sau &#238;n analiza evenimentelor. Acest parametru permite oprirea &#238;nregistr&#259;rii imaginilor cu zone de mi&#351;care marcate."
),
'OPT_FRAME_SERVER' => array(
'Prompt' => "Daemon-ul de analiz&#259; va scrie imaginile pe disc",
'Help' => "&#206;n unele cazuri este posibil ca viteza de scriere a unui HDD sa fie at&#226;t de mic&#259; &#238;ncat s&#259; cauzeze &#238;ncetinirea daemon-ului de analiz&#259; &#238;n special &#238;n timpul evenimentelor cu multe cadre. Activarea acestei op&#355;iuni porne&#351;te daemon-ul de cadre (zmf) care va 'primi' imaginile de la daemon-ul de analiz&#259; &#351;i le va scrie pe disc. Dac&#259; aceast&#259; transmisie e&#351;ueaz&#259; sau apar alte erori, func&#355;ia de scriere va reveni daemon-ului de analiz&#259;."
),
'FRAME_SOCKET_SIZE' => array(
'Prompt' => "Specifica&#355;i dimensiunea memoriei tampon",
'Help' => "Pentru imaginile de dimensiuni mari capturate este posibil ca scrierea lor pe disc s&#259; e&#351;ueze deoarece cantitatea de informa&#355;ie scris&#259; este mai mare dec&#226;t memoria tampon alocat&#259;. De&#351;i imaginile sunt scrise apoi de c&#259;tre daemon-ul de analiz&#259;, se distruge obiectul daemon-ului de cadre. Pute&#355;i folosi aceast&#259; op&#355;iune pentru a specifica o memorie tampon de dimensiuni mai mari. Va trebui sa modifica&#355;i dimensiunea socket-ului tampon maxim folosind 'sysctl' (sau in /proc/sys/net/core/wmem_max) pentru a permite setarea acestei noi valori. Alternativa este s&#259; schimba&#355;i m&#259;rimea implicit&#259; a memorie tampon a sistemului, caz &#238;n care modificarea acestei valori nu mai este necesar&#259;."
),
'OPT_CONTROL' => array(
'Prompt' => "Suport camere controlabile (rotire/&#238;nclinare/zoom)",
'Help' => "ZoneMinder include suport limitat pentru camere controlabile. Sunt incluse c&#226;teva protocoale mostr&#259; &#351;i pot fi ad&#259;ugate cu u&#351;urin&#355;&#259; &#351;i altele. Dac&#259; vre&#355;i s&#259; controla&#355;i camerele prin intermediul ZoneMinder selecta&#355;i aceast&#259; op&#355;iune."

File diff suppressed because it is too large Load Diff

Binary file not shown.

Before

Width:  |  Height:  |  Size: 293 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 313 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 232 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 321 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 263 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 324 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 538 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 520 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 524 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 479 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 284 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 304 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 265 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 299 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 206 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 237 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 203 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 234 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 278 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 297 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 286 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 332 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 282 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 337 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 621 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 641 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 76 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 156 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 76 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 156 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 76 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 156 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 68 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 165 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 68 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 162 B

View File

@ -33,7 +33,7 @@ var popupSizes = {
'device': { 'width': 260, 'height': 150 },
'devices': { 'width': 400, 'height': 240 },
'donate': { 'width': 500, 'height': 280 },
'event': { 'addWidth': 108, 'minWidth': 496, 'addHeight': 230, minHeight: 540 },
'event': { 'addWidth': 108, 'minWidth': 496, 'addHeight': 230, 'minHeight': 540 },
'eventdetail': { 'width': 600, 'height': 220 },
'events': { 'width': 960, 'height': 780 },
'export': { 'width': 400, 'height': 340 },

View File

@ -33,7 +33,7 @@ var popupSizes = {
'device': { 'width': 260, 'height': 150 },
'devices': { 'width': 400, 'height': 240 },
'donate': { 'width': 500, 'height': 280 },
'event': { 'addWidth': 108, 'minWidth': 496, 'addHeight': 230, minHeight: 540 },
'event': { 'addWidth': 108, 'minWidth': 496, 'addHeight': 230, 'minHeight': 540 },
'eventdetail': { 'width': 600, 'height': 220 },
'events': { 'width': 960, 'height': 780 },
'export': { 'width': 400, 'height': 340 },

View File

@ -33,7 +33,7 @@ var popupSizes = {
'device': { 'width': 260, 'height': 150 },
'devices': { 'width': 400, 'height': 240 },
'donate': { 'width': 500, 'height': 280 },
'event': { 'addWidth': 108, 'minWidth': 496, 'addHeight': 230, minHeight: 540 },
'event': { 'addWidth': 108, 'minWidth': 496, 'addHeight': 230, 'minHeight': 540 },
'eventdetail': { 'width': 600, 'height': 220 },
'events': { 'width': 1220, 'height': 780 },
'export': { 'width': 400, 'height': 340 },

View File

@ -31,11 +31,11 @@ function checkSize() {
var h = window.outerHeight;
var prevH = h;
if (h > screen.availHeight)
h = screen.availHeight;
h = screen.availHeight;
if (w > screen.availWidth)
w = screen.availWidth;
w = screen.availWidth;
if (w != prevW || h != prevH)
window.resizeTo(w,h);
window.resizeTo(w, h);
}
}
@ -56,7 +56,7 @@ function getPopupSize( tag, width, height )
if ( popupSize.width && popupSize.height )
{
if ( width || height )
Warning( "Ignoring passed dimensions "+width+"x"+height+" when getting popup size for tag '"+tag+"'" );
Warning( "Ignoring passed dimensions "+width+"x"+height+" when getting popup size for tag '"+tag+"'" );
return( popupSize );
}
if ( popupSize.addWidth )

View File

@ -19,7 +19,11 @@
//
if ( !canView( 'Events' ) ) {
<<<<<<< HEAD
$view = 'error';
=======
$view = "error";
>>>>>>> master
return;
}
@ -60,6 +64,7 @@ if ( isset( $_REQUEST['scale'] ) ) {
$scale = max( reScale( SCALE_BASE, $Monitor->DefaultScale(), ZM_WEB_DEFAULT_SCALE ), SCALE_BASE );
}
<<<<<<< HEAD
$show = 'capt';
if ( isset($_REQUEST['show']) ) {
$show = $_REQUEST['show'];
@ -67,6 +72,9 @@ if ( isset($_REQUEST['show']) ) {
#$show = 'anal';
}
$imageData = $Event->getImageSrc( $frame, $scale, ($show=="capt") );
=======
$imageData = $Event->getImageSrc( $frame, $scale, (isset($_REQUEST['show']) && $_REQUEST['show']=="capt") );
>>>>>>> master
$imagePath = $imageData['thumbPath'];
$eventPath = $imageData['eventPath'];
@ -94,6 +102,7 @@ xhtmlHeaders(__FILE__, translate('Frame')." - ".$Event->Id()." - ".$Frame->Frame
</div>
<div id="content">
<p id="image">
<<<<<<< HEAD
<a href="?view=frame&amp;eid=<?php echo $Event->Id() ?>&amp;fid=<?php echo $Frame->FrameId() ?>&amp;scale=<?php echo $scale ?>&amp;show=<?php echo $show == 'anal' ? 'capt':'anal' ?>">
<img id="frameImg" src="<?php echo $Frame->getImageSrc($imageData['isAnalImage']?'analyse':'capture') ?>" width="<?php echo reScale( $Event->Width(), $Monitor->DefaultScale(), $scale ) ?>" height="<?php echo reScale( $Event->Height(), $Monitor->DefaultScale(), $scale ) ?>" alt="<?php echo $Frame->EventId()."-".$Frame->FrameId() ?>" class="<?php echo $imageData['imageClass'] ?>"/>
</p>
@ -104,14 +113,38 @@ xhtmlHeaders(__FILE__, translate('Frame')." - ".$Event->Id()." - ".$Frame->Frame
<?php } if ( $Frame->FrameId() < $maxFid ) { ?>
<a id="nextLink" href="?view=frame&amp;eid=<?php echo $Event->Id() ?>&amp;fid=<?php echo $nextFid ?>&amp;scale=<?php echo $scale ?>&amp;show=<?php echo $show ?>"><?php echo translate('Next') ?></a>
<a id="lastLink" href="?view=frame&amp;eid=<?php echo $Event->Id() ?>&amp;fid=<?php echo $lastFid ?>&amp;scale=<?php echo $scale ?>&amp;show=<?php echo $show ?>"><?php echo translate('Last') ?></a>
=======
<?php if ( $imageData['hasAnalImage'] ) { ?>
<a href="?view=frame&amp;eid=<?php echo $Event->Id() ?>&amp;fid=<?php echo $Frame->FrameId() ?>&amp;scale=<?php echo $scale ?>&amp;show=<?php echo $imageData['isAnalImage']?"capt":"anal" ?>">
<?php } ?>
<img id="frameImg" src="<?php echo $Frame->getImageSrc($imageData['isAnalImage']?'analyse':'capture') ?>" width="<?php echo reScale( $Event->Width(), $Event->DefaultScale(), $scale ) ?>" height="<?php echo reScale( $Event->Height(), $Event->DefaultScale(), $scale ) ?>" alt="<?php echo $Frame->EventId()."-".$Frame->FrameId() ?>" class="<?php echo $imageData['imageClass'] ?>"/>
<?php if ( $imageData['hasAnalImage'] ) { ?></a><?php } ?>
<p id="controls">
<?php if ( $Frame->FrameId() > 1 ) { ?>
<a id="firstLink" href="?view=frame&amp;eid=<?php echo $Event->Id() ?>&amp;fid=<?php echo $firstFid ?>&amp;scale=<?php echo $scale ?>"><?php echo translate('First') ?></a>
<?php } if ( $Frame->FrameId() > 1 ) { ?>
<a id="prevLink" href="?view=frame&amp;eid=<?php echo $Event->Id() ?>&amp;fid=<?php echo $prevFid ?>&amp;scale=<?php echo $scale ?>"><?php echo translate('Prev') ?></a>
<?php } if ( $Frame->FrameId() < $maxFid ) { ?>
<a id="nextLink" href="?view=frame&amp;eid=<?php echo $Event->Id() ?>&amp;fid=<?php echo $nextFid ?>&amp;scale=<?php echo $scale ?>"><?php echo translate('Next') ?></a>
<?php } if ( $Frame->FrameId() < $maxFid ) { ?>
<a id="lastLink" href="?view=frame&amp;eid=<?php echo $Event->Id() ?>&amp;fid=<?php echo $lastFid ?>&amp;scale=<?php echo $scale ?>"><?php echo translate('Last') ?></a>
>>>>>>> master
<?php } ?>
</p>
<?php if (file_exists ($dImagePath)) { ?>
<p id="diagImagePath"><?php echo $dImagePath ?></p>
<<<<<<< HEAD
<p id="diagImage"><img src="<?php echo viewImagePath( $dImagePath ) ?>" width="<?php echo reScale( $Event->Width(), $Monitor->DefaultScale(), $scale ) ?>" height="<?php echo reScale( $Event->Height(), $Monitor->DefaultScale(), $scale ) ?>" class="<?php echo $imageData['imageClass'] ?>"/></p>
<?php } if (file_exists ($rImagePath)) { ?>
<p id="refImagePath"><?php echo $rImagePath ?></p>
<p id="refImage"><img src="<?php echo viewImagePath( $rImagePath ) ?>" width="<?php echo reScale( $Event->Width(), $Monitor->DefaultScale(), $scale ) ?>" height="<?php echo reScale( $Event->Height(), $Monitor->DefaultScale(), $scale ) ?>" class="<?php echo $imageData['imageClass'] ?>"/></p>
=======
<p id="diagImage"><img src=?"<?php echo viewImagePath( $dImagePath ) ?>" width="<?php echo reScale( $Event->Width(), $Event->DefaultScale(), $scale ) ?>" height="<?php echo reScale( $Event->Height(), $Event->DefaultScale(), $scale ) ?>" class="<?php echo $imageData['imageClass'] ?>"/></p>
<?php } if (file_exists ($rImagePath)) { ?>
<p id="refImagePath"><?php echo $rImagePath ?></p>
<p id="refImage"><img src="<?php echo viewImagePath( $rImagePath ) ?>" width="<?php echo reScale( $Event->Width(), $Event->DefaultScale(), $scale ) ?>" height="<?php echo reScale( $Event->Height(), $Event->DefaultScale(), $scale ) ?>" class="<?php echo $imageData['imageClass'] ?>"/></p>
>>>>>>> master
<?php } ?>
</div>
</div>

View File

@ -25,15 +25,14 @@ function setButtonStates( element )
function addMonitor( element)
{
var form = element.form;
var dupParam;
var monitorId=-1;
if (form.addBtn.value == jsTranslatedCloneText)
var form = element.form;
var dupParam;
var monitorId=-1;
if (form.addBtn.value == jsTranslatedCloneText)
{
// get the value of the first checkbox
for ( var i = 0; i < form.elements.length; i++ )
{
// get the value of the first checkbox
for ( var i = 0; i < form.elements.length; i++ )
{
if ( form.elements[i].type == "checkbox" )
{
if ( form.elements[i].checked )
@ -42,10 +41,10 @@ function addMonitor( element)
break;
}
}
}
}
dupParam = (monitorId == -1 ) ? '': '&dupId='+monitorId;
createPopup( '?view=monitor'+dupParam, 'zmMonitor0','monitor' );
}
}
dupParam = (monitorId == -1 ) ? '': '&dupId='+monitorId;
createPopup( '?view=monitor'+dupParam, 'zmMonitor0', 'monitor' );
}
function editMonitor( element )
@ -85,8 +84,8 @@ function reloadWindow()
function initPage()
{
jsTranslatedAddText = translatedAddText;
jsTranslatedCloneText = translatedCloneText;
jsTranslatedAddText = translatedAddText;
jsTranslatedCloneText = translatedCloneText;
reloadWindow.periodical( consoleRefreshTimeout );
if ( showVersionPopup )
createPopup( '?view=version', 'zmVersion', 'version' );

View File

@ -26,7 +26,7 @@ function controlCmd( control, event, xtell, ytell )
var x = xEvent.page.x - l;
var y = xEvent.page.y - t;
if ( xtell )
if ( xtell )
{
var xge = parseInt( (x*100)/coords.width );
if ( xtell == -1 )
@ -35,7 +35,7 @@ function controlCmd( control, event, xtell, ytell )
xge = 2*(50 - xge);
locParms += "&xge="+xge;
}
if ( ytell )
if ( ytell )
{
var yge = parseInt( (y*100)/coords.height );
if ( ytell == -1 )

View File

@ -19,6 +19,5 @@ function validateForm( form ) {
return( false );
}
return( true );
}

View File

@ -21,18 +21,27 @@ function changeScale() {
vid.height = newHeight;
} else {
streamScale( scale );
<<<<<<< HEAD
var streamImg = document.getElementById('evtStream');
streamImg.style.width = newWidth + "px";
streamImg.style.height = newHeight + "px";
}
Cookie.write( 'zmEventScale'+eventData.MonitorId, scale, { duration: 10*365 } );
=======
Cookie.write( 'zmEventScale'+eventData.MonitorId, scale, { duration: 10*365 } );
/*Stream could be an applet so can't use moo tools*/
var streamImg = document.getElementById('evtStream');
streamImg.style.width = newWidth + "px";
streamImg.style.height = newHeight + "px";
>>>>>>> master
}
function changeReplayMode()
{
var replayMode = $('replayMode').get('value');
Cookie.write( 'replayMode', replayMode, { duration: 10*365 })
Cookie.write( 'replayMode', replayMode, { duration: 10*365 });
refreshWindow();
}
@ -45,7 +54,7 @@ var lastEventId = 0;
function getCmdResponse( respObj, respText )
{
if ( checkStreamForErrors( "getCmdResponse" ,respObj ) )
if ( checkStreamForErrors( "getCmdResponse", respObj ) )
return;
if ( streamCmdTimer )
@ -65,7 +74,7 @@ function getCmdResponse( respObj, respText )
$('rate').addClass( 'hidden' );
streamPause( false );
}
else
else
{
$('modeValue').set( 'text', "Replay" );
$('rateValue').set( 'text', streamStatus.rate );
@ -203,9 +212,9 @@ function streamSeek( offset )
}
function streamQuery()
{
{
streamReq.send( streamParms+"&command="+CMD_QUERY );
}
}
var slider = null;
var scroll = null;
@ -455,7 +464,7 @@ function getFrameResponse( respObj, respText )
eventData['frames'] = new Object();
eventData['frames'][frame.FrameId] = frame;
loadEventThumb( eventData, frame, respObj.loopback=="true" );
}
@ -494,7 +503,7 @@ function checkFrames( eventId, frameId, loadImage )
if ( !$('eventThumb'+fid) )
{
var img = new Element( 'img', { 'id': 'eventThumb'+fid, 'src': 'graphics/transparent.gif', 'alt': fid, 'class': 'placeholder' } );
img.addEvent( 'click', function () { eventData['frames'][fid] = null; checkFrames( eventId, fid ) } );
img.addEvent( 'click', function() { eventData['frames'][fid] = null; checkFrames( eventId, fid ); } );
frameQuery( eventId, fid, loadImage && (fid == frameId) );
var imgs = $('eventThumbs').getElements( 'img' );
var injected = false;
@ -723,7 +732,7 @@ function drawProgressBar()
var offset = parseInt((index*eventData.Length)/$$(cells).length);
$(cell).setProperty( 'title', '+'+secsToTime(offset)+'s' );
$(cell).removeEvent( 'click' );
$(cell).addEvent( 'click', function(){ streamSeek( offset ); } );
$(cell).addEvent( 'click', function() { streamSeek( offset ); } );
barWidth += $(cell).getCoordinates().width;
}
);
@ -764,7 +773,7 @@ function handleClick( event )
var target = event.target;
var x = event.page.x - $(target).getLeft();
var y = event.page.y - $(target).getTop();
if ( event.shift )
streamPan( x, y );
else

View File

@ -9,7 +9,6 @@ if ( refreshParent )
}
function configureButtons( element ) {
if ( canEditGroups ) {
var form = element.form;
form.saveBtn.disabled = (element.value == 0);

View File

@ -22,7 +22,7 @@ var logTimeout = maxSampleTime;
var firstLoad = true;
var initialDisplayLimit = 200;
var sortReversed = false;
var filterFields = [ 'Component', 'ServerId', 'Pid', 'Level', 'File', 'Line'];
var filterFields = ['Component', 'ServerId', 'Pid', 'Level', 'File', 'Line'];
var options = {};
function buildFetchParms( parms )
@ -68,7 +68,7 @@ function logResponse( respObj )
maxLogTime = log.TimeKey;
if ( !minLogTime || log.TimeKey < minLogTime )
minLogTime = log.TimeKey;
var row = logTable.push( [ { content: log.DateTime, properties: { style: 'white-space: nowrap' }}, log.Component, log.Server, log.Pid, log.Code, log.Message, log.File, log.Line ] );
var row = logTable.push( [{ content: log.DateTime, properties: { style: 'white-space: nowrap' }}, log.Component, log.Server, log.Pid, log.Code, log.Message, log.File, log.Line] );
delete log.Message;
row.tr.store( 'log', log );
if ( log.Level <= -3 )
@ -81,7 +81,7 @@ function logResponse( respObj )
row.tr.addClass( 'log-dbg' );
if ( !firstLoad )
{
var color = document.defaultView.getComputedStyle(row.tr,null).getPropertyValue('color');
var color = document.defaultView.getComputedStyle(row.tr, null).getPropertyValue('color');
var colorParts = color.match(/^rgb.*\((\d+),\s*(\d+),\s*(\d+)/);
rowOrigColor = '#' + parseInt(colorParts[1]).toString(16) + parseInt(colorParts[2]).toString(16) + parseInt(colorParts[3]).toString(16);
new Fx.Tween( row.tr, { duration: 10000, transition: Fx.Transitions.Sine } ).start( 'color', '#6495ED', rowOrigColor );
@ -90,15 +90,15 @@ function logResponse( respObj )
);
options = respObj.options;
updateFilterSelectors();
$('lastUpdate').set('text',respObj.updated);
$('logState').set('text',respObj.state);
$('lastUpdate').set('text', respObj.updated);
$('logState').set('text', respObj.state);
$('logState').removeClass('ok');
$('logState').removeClass('alert');
$('logState').removeClass('alarm');
$('logState').addClass(respObj.state);
$('totalLogs').set('text',respObj.total);
$('availLogs').set('text',respObj.available);
$('displayLogs').set('text',logCount);
$('totalLogs').set('text', respObj.total);
$('availLogs').set('text', respObj.available);
$('displayLogs').set('text', logCount);
if ( firstLoad )
{
if ( logCount < displayLimit )
@ -123,7 +123,7 @@ function logResponse( respObj )
}
}
logTimer = fetchNextLogs.delay( logTimeout );
}
}
function refreshLog()
{
@ -151,7 +151,7 @@ function clearLog()
logCount = 0;
logTimeout = maxSampleTime;
displayLimit = initialDisplayLimit;
$('displayLogs').set('text',logCount);
$('displayLogs').set('text', logCount);
options = {};
logTable.empty();
}
@ -265,12 +265,12 @@ function updateFilterSelectors()
selector.options[selector.options.length] = new Option( value, label );
}
);
}
}
else if ( key == 'ServerId' )
{
Object.each(values,
function( value, label )
{
{
selector.options[selector.options.length] = new Option( value, label );
}
);
@ -285,7 +285,7 @@ function updateFilterSelectors()
);
}
if ( filter[key] )
selector.set('value',filter[key]);
selector.set('value', filter[key]);
}
);
}
@ -315,13 +315,13 @@ function initPage()
if ( sortReversed )
startIndex = displayLimit;
else
startIndex = 0;;
startIndex = 0;
for ( var i = startIndex; logCount > displayLimit; i++ )
{
rows[i].destroy();
logCount--;
}
$('displayLogs').set('text',logCount);
$('displayLogs').set('text', logCount);
}
}
);

View File

@ -14,7 +14,7 @@ function Monitor( monitorData )
this.start = function( delay )
{
this.streamCmdTimer = this.streamCmdQuery.delay( delay, this );
}
};
this.setStateClass = function( element, stateClass )
{
@ -28,7 +28,7 @@ function Monitor( monitorData )
element.removeClass( 'idle' );
element.addClass( stateClass );
}
}
};
this.getStreamCmdResponse = function( respObj, respText )
{
@ -57,7 +57,7 @@ function Monitor( monitorData )
}
this.setStateClass( $('monitor'+this.id), stateClass );
/*Stream could be an applet so can't use moo tools*/
/*Stream could be an applet so can't use moo tools*/
stream.className = stateClass;
var isAlarmed = ( this.alarmState == STATE_ALARM || this.alarmState == STATE_ALERT );
@ -98,15 +98,14 @@ function Monitor( monitorData )
console.error( respObj.message );
// Try to reload the image stream.
if ( stream )
stream.src = stream.src.replace(/rand=\d+/i,'rand='+Math.floor((Math.random() * 1000000) ));
stream.src = stream.src.replace(/rand=\d+/i, 'rand='+Math.floor((Math.random() * 1000000) ));
}
var streamCmdTimeout = statusRefreshTimeout;
if ( this.alarmState == STATE_ALARM || this.alarmState == STATE_ALERT )
streamCmdTimeout = streamCmdTimeout/5;
this.streamCmdTimer = this.streamCmdQuery.delay( streamCmdTimeout, this );
this.lastAlarmState = this.alarmState;
}
};
this.streamCmdQuery = function( resent )
{
@ -114,7 +113,7 @@ function Monitor( monitorData )
//console.log( this.connKey+": Resending" );
//this.streamCmdReq.cancel();
this.streamCmdReq.send( this.streamCmdParms+"&command="+CMD_QUERY );
}
};
this.streamCmdReq = new Request.JSON( { url: this.server_url, method: 'get', timeout: AJAX_TIMEOUT, onSuccess: this.getStreamCmdResponse.bind( this ), onTimeout: this.streamCmdQuery.bind( this, true ), link: 'cancel' } );
@ -172,7 +171,7 @@ function changeScale() {
var monitor = monitors[x];
var newWidth = ( monitorData[x].width * scale ) / SCALE_BASE;
var newHeight = ( monitorData[x].height * scale ) / SCALE_BASE;
/*Stream could be an applet so can't use moo tools*/
/*Stream could be an applet so can't use moo tools*/
var streamImg = document.getElementById( 'liveStream'+monitor.id );
if ( streamImg ) {
var src = streamImg.src;

View File

@ -31,7 +31,7 @@ function configureButtons( element )
if(form.elements.namedItem("nextBtn")) {
form.nextBtn.disabled = (form.probe.selectedIndex==0) ||
(form.username == "") || (form.username == null) ||
(form.password == "") || (form.password == null);
(form.password == "") || (form.password == null);
}
if(form.elements.namedItem("saveBtn")) {
form.saveBtn.disabled = (form.probe.selectedIndex==0);

View File

@ -1,3 +1,4 @@
<<<<<<< HEAD
$j(document).ready(function() {
// Enable or disable the Delete button depending on the selected run state
$j("#runState").change(function() {
@ -67,3 +68,58 @@ $j(document).ready(function() {
});
=======
function checkState( element )
{
var form = element.form;
var minIndex = running?2:1;
if ( form.runState.selectedIndex < minIndex )
{
form.saveBtn.disabled = true;
form.deleteBtn.disabled = true;
}
else
{
form.saveBtn.disabled = false;
form.deleteBtn.disabled = false;
}
if ( form.newState.value != '' )
form.saveBtn.disabled = false;
// PP if we are in 'default' state, disable delete
// you can still save
if (element.value.toLowerCase() == 'default' )
{
form.saveBtn.disabled = false;
form.deleteBtn.disabled = true;
}
}
function saveState( element )
{
var form = element.form;
form.view.value = currentView;
form.action.value = 'save';
form.submit();
}
function deleteState( element )
{
var form = element.form;
form.view.value = currentView;
form.action.value = 'delete';
form.submit();
}
if ( applying )
{
function submitForm()
{
$('contentForm').submit();
}
window.addEvent( 'domready', function() { submitForm.delay( 1000 ); } );
}
>>>>>>> master

View File

@ -125,6 +125,7 @@ function loadEventImage( imagePath, eid, fid, width, height, fps, videoName, dur
{
var vid= $('preview');
var imageSrc = $('imageSrc');
<<<<<<< HEAD
if ( videoName && vid ) {
vid.show();
imageSrc.hide();
@ -160,9 +161,14 @@ function loadEventImage( imagePath, eid, fid, width, height, fps, videoName, dur
imageSrc.addEvent( 'click', showEvent.pass( [ eid, fid, width, height ] ) );
}
=======
imageSrc.setProperty( 'src', imagePrefix+imagePath );
imageSrc.removeEvent( 'click' );
imageSrc.addEvent( 'click', showEvent.pass( [eid, fid, width, height] ) );
>>>>>>> master
var eventData = $('eventData');
eventData.removeEvent( 'click' );
eventData.addEvent( 'click', showEvent.pass( [ eid, fid, width, height ] ) );
eventData.addEvent( 'click', showEvent.pass( [eid, fid, width, height] ) );
}
function tlZoomBounds( minTime, maxTime )

View File

@ -1,3 +1,4 @@
<<<<<<< HEAD
function setButtonState( element, butClass ) {
element.className = butClass;
element.disabled = (butClass != 'inactive');
@ -40,6 +41,54 @@ function changeScale() {
} else {
console.error("No element found for liveStream.");
}
=======
function setButtonState( element, butClass )
{
element.className = butClass;
element.disabled = (butClass != 'inactive');
}
function showEvents()
{
$('ptzControls').addClass( 'hidden' );
$('events').removeClass( 'hidden' );
if ( $('eventsControl') )
$('eventsControl').addClass('hidden');
if ( $('controlControl') )
$('controlControl').removeClass('hidden');
showMode = "events";
}
function showPtzControls()
{
$('events').addClass( 'hidden' );
$('ptzControls').removeClass( 'hidden' );
if ( $('eventsControl') )
$('eventsControl').removeClass('hidden');
if ( $('controlControl') )
$('controlControl').addClass('hidden');
showMode = "control";
}
function changeScale()
{
var scale = $('scale').get('value');
var newWidth = ( monitorWidth * scale ) / SCALE_BASE;
var newHeight = ( monitorHeight * scale ) / SCALE_BASE;
Cookie.write( 'zmWatchScale'+monitorId, scale, { duration: 10*365 } );
/*Stream could be an applet so can't use moo tools*/
var streamImg = document.getElementById('liveStream');
if ( streamImg ) {
streamImg.style.width = newWidth + "px";
streamImg.style.height = newHeight + "px";
streamImg.src = streamImg.src.replace(/scale=\d+/i, 'scale='+scale);
} else {
console.error("No element found for liveStream.");
}
>>>>>>> master
}
var alarmState = STATE_IDLE;
@ -143,10 +192,64 @@ function getStreamCmdResponse( respObj, respText ) {
if ( streamStatus.rate < 1 )
streamCmdSlowFwd( false );
else
<<<<<<< HEAD
streamCmdFastFwd( false );
} else {
if ( streamStatus.rate > -1 )
streamCmdSlowRev( false );
=======
$('levelValue').className = "ok";
var delayString = secsToTime( streamStatus.delay );
if ( streamStatus.paused == true )
{
$('modeValue').set( 'text', "Paused" );
$('rate').addClass( 'hidden' );
$('delayValue').set( 'text', delayString );
$('delay').removeClass( 'hidden' );
$('level').removeClass( 'hidden' );
streamCmdPause( false );
}
else if ( streamStatus.delayed == true )
{
$('modeValue').set( 'text', "Replay" );
$('rateValue').set( 'text', streamStatus.rate );
$('rate').removeClass( 'hidden' );
$('delayValue').set( 'text', delayString );
$('delay').removeClass( 'hidden' );
$('level').removeClass( 'hidden' );
if ( streamStatus.rate == 1 )
{
streamCmdPlay( false );
}
else if ( streamStatus.rate > 0 )
{
if ( streamStatus.rate < 1 )
streamCmdSlowFwd( false );
else
streamCmdFastFwd( false );
}
else
{
if ( streamStatus.rate > -1 )
streamCmdSlowRev( false );
else
streamCmdFastRev( false );
}
}
else
{
$('modeValue').set( 'text', "Live" );
$('rate').addClass( 'hidden' );
$('delay').addClass( 'hidden' );
$('level').addClass( 'hidden' );
streamCmdPlay( false );
}
$('zoomValue').set( 'text', streamStatus.zoom );
if ( streamStatus.zoom == "1.0" )
setButtonState( $('zoomOutBtn'), 'unavail' );
>>>>>>> master
else
streamCmdFastRev( false );
} // rate
@ -201,6 +304,7 @@ function getStreamCmdResponse( respObj, respText ) {
} else {
console.log("Unable to find streamImg liveStream");
}
<<<<<<< HEAD
}
var streamCmdTimeout = statusRefreshTimeout;
@ -208,6 +312,21 @@ function getStreamCmdResponse( respObj, respText ) {
streamCmdTimeout = streamCmdTimeout/5;
streamCmdTimer = streamCmdQuery.delay( streamCmdTimeout );
}
=======
else {
checkStreamForErrors("getStreamCmdResponse", respObj);//log them
// Try to reload the image stream.
var streamImg = document.getElementById('liveStream');
if ( streamImg )
streamImg.src = streamImg.src.replace(/rand=\d+/i, 'rand='+Math.floor((Math.random() * 1000000) ));
}
var streamCmdTimeout = statusRefreshTimeout;
if ( alarmState == STATE_ALARM || alarmState == STATE_ALERT )
streamCmdTimeout = streamCmdTimeout/5;
streamCmdTimer = streamCmdQuery.delay( streamCmdTimeout );
}
>>>>>>> master
function streamCmdPause( action ) {
setButtonState( $('pauseBtn'), 'active' );
@ -236,6 +355,7 @@ function streamCmdPlay( action ) {
setButtonState( $('slowFwdBtn'), 'unavail' );
setButtonState( $('slowRevBtn'), 'unavail' );
setButtonState( $('fastRevBtn'), 'unavail' );
<<<<<<< HEAD
}
if ( action )
streamCmdReq.send( streamCmdParms+"&command="+CMD_PLAY );
@ -326,6 +446,94 @@ function streamCmdPan( x, y ) {
function streamCmdQuery() {
streamCmdReq.send( streamCmdParms+"&command="+CMD_QUERY );
}
=======
if ( action )
streamCmdReq.send( streamCmdParms+"&command="+CMD_STOP );
setButtonState( $('stopBtn'), 'unavail' );
setButtonState( $('playBtn'), 'active' );
}
function streamCmdFastFwd( action )
{
setButtonState( $('pauseBtn'), 'inactive' );
setButtonState( $('playBtn'), 'inactive' );
setButtonState( $('stopBtn'), 'inactive' );
setButtonState( $('fastFwdBtn'), 'inactive' );
setButtonState( $('slowFwdBtn'), 'inactive' );
setButtonState( $('slowRevBtn'), 'inactive' );
setButtonState( $('fastRevBtn'), 'inactive' );
if ( action )
streamCmdReq.send( streamCmdParms+"&command="+CMD_FASTFWD );
}
function streamCmdSlowFwd( action )
{
setButtonState( $('pauseBtn'), 'inactive' );
setButtonState( $('playBtn'), 'inactive' );
setButtonState( $('stopBtn'), 'inactive' );
setButtonState( $('fastFwdBtn'), 'inactive' );
setButtonState( $('slowFwdBtn'), 'active' );
setButtonState( $('slowRevBtn'), 'inactive' );
setButtonState( $('fastRevBtn'), 'inactive' );
if ( action )
streamCmdReq.send( streamCmdParms+"&command="+CMD_SLOWFWD );
setButtonState( $('pauseBtn'), 'active' );
setButtonState( $('slowFwdBtn'), 'inactive' );
}
function streamCmdSlowRev( action )
{
setButtonState( $('pauseBtn'), 'inactive' );
setButtonState( $('playBtn'), 'inactive' );
setButtonState( $('stopBtn'), 'inactive' );
setButtonState( $('fastFwdBtn'), 'inactive' );
setButtonState( $('slowFwdBtn'), 'inactive' );
setButtonState( $('slowRevBtn'), 'active' );
setButtonState( $('fastRevBtn'), 'inactive' );
if ( action )
streamCmdReq.send( streamCmdParms+"&command="+CMD_SLOWREV );
setButtonState( $('pauseBtn'), 'active' );
setButtonState( $('slowRevBtn'), 'inactive' );
}
function streamCmdFastRev( action )
{
setButtonState( $('pauseBtn'), 'inactive' );
setButtonState( $('playBtn'), 'inactive' );
setButtonState( $('stopBtn'), 'inactive' );
setButtonState( $('fastFwdBtn'), 'inactive' );
setButtonState( $('slowFwdBtn'), 'inactive' );
setButtonState( $('slowRevBtn'), 'inactive' );
setButtonState( $('fastRevBtn'), 'inactive' );
if ( action )
streamCmdReq.send( streamCmdParms+"&command="+CMD_FASTREV );
}
function streamCmdZoomIn( x, y )
{
streamCmdReq.send( streamCmdParms+"&command="+CMD_ZOOMIN+"&x="+x+"&y="+y );
}
function streamCmdZoomOut()
{
streamCmdReq.send( streamCmdParms+"&command="+CMD_ZOOMOUT );
}
function streamCmdScale( scale )
{
streamCmdReq.send( streamCmdParms+"&command="+CMD_SCALE+"&scale="+scale );
}
function streamCmdPan( x, y )
{
streamCmdReq.send( streamCmdParms+"&command="+CMD_PAN+"&x="+x+"&y="+y );
}
function streamCmdQuery()
{
streamCmdReq.send( streamCmdParms+"&command="+CMD_QUERY );
}
>>>>>>> master
var statusCmdParms = "view=request&request=status&entity=monitor&id="+monitorId+"&element[]=Status&element[]=FrameRate";
if ( auth_hash )
@ -333,6 +541,7 @@ if ( auth_hash )
var statusCmdReq = new Request.JSON( { url: monitorUrl+thisUrl, method: 'get', data: statusCmdParms, timeout: AJAX_TIMEOUT, link: 'cancel', onSuccess: getStatusCmdResponse } );
var statusCmdTimer = null;
<<<<<<< HEAD
function getStatusCmdResponse( respObj, respText ) {
console.log("Got statusCmdQuery");
watchdogOk("status");
@ -358,6 +567,32 @@ function statusCmdQuery() {
console.log("Sending statusCmdQuery");
statusCmdReq.send();
}
=======
function getStatusCmdResponse( respObj, respText )
{
watchdogOk("status");
if ( statusCmdTimer )
statusCmdTimer = clearTimeout( statusCmdTimer );
if ( respObj.result == 'Ok' )
{
$('fpsValue').set( 'text', respObj.monitor.FrameRate );
setAlarmState( respObj.monitor.Status );
}
else
checkStreamForErrors("getStatusCmdResponse", respObj);
var statusCmdTimeout = statusRefreshTimeout;
if ( alarmState == STATE_ALARM || alarmState == STATE_ALERT )
statusCmdTimeout = statusCmdTimeout/5;
statusCmdTimer = statusCmdQuery.delay( statusCmdTimeout );
}
function statusCmdQuery()
{
statusCmdReq.send();
}
>>>>>>> master
var alarmCmdParms = "view=request&request=alarm&id="+monitorId;
if ( auth_hash )
@ -365,8 +600,14 @@ if ( auth_hash )
var alarmCmdReq = new Request.JSON( { url: monitorUrl+thisUrl, method: 'post', timeout: AJAX_TIMEOUT, link: 'cancel', onSuccess: getAlarmCmdResponse, onTimeout: streamCmdQuery } );
var alarmCmdFirst = true;
<<<<<<< HEAD
function getAlarmCmdResponse( respObj, respText ) {
checkStreamForErrors("getAlarmCmdResponse",respObj);
=======
function getAlarmCmdResponse( respObj, respText )
{
checkStreamForErrors("getAlarmCmdResponse", respObj);
>>>>>>> master
}
function cmdDisableAlarms() {
@ -408,6 +649,7 @@ var eventCmdReq = new Request.JSON( { url: thisUrl, method: 'post', timeout: AJA
var eventCmdTimer = null;
var eventCmdFirst = true;
<<<<<<< HEAD
function highlightRow( row ) {
$(row).toggleClass( 'highlight' );
}
@ -470,6 +712,87 @@ function getEventCmdResponse( respObj, respText ) {
row.inject( $(eventListBody), 'top' );
if ( !eventCmdFirst )
row.addClass( 'recent' );
=======
function highlightRow( row )
{
$(row).toggleClass( 'highlight' );
}
function getEventCmdResponse( respObj, respText )
{
watchdogOk("event");
if ( eventCmdTimer )
eventCmdTimer = clearTimeout( eventCmdTimer );
if ( respObj.result == 'Ok' )
{
var dbEvents = respObj.events.reverse();
var eventList = $('eventList');
var eventListBody = $(eventList).getElement( 'tbody' );
var eventListRows = $(eventListBody).getElements( 'tr' );
eventListRows.each( function( row ) { row.removeClass( 'updated' ); } );
for ( var i = 0; i < dbEvents.length; i++ )
{
var event = dbEvents[i];
var row = $('event'+event.Id);
var newEvent = (row == null ? true : false);
if ( newEvent )
{
row = new Element( 'tr', { 'id': 'event'+event.Id } );
new Element( 'td', { 'class': 'colId' } ).inject( row );
new Element( 'td', { 'class': 'colName' } ).inject( row );
new Element( 'td', { 'class': 'colTime' } ).inject( row );
new Element( 'td', { 'class': 'colSecs' } ).inject( row );
new Element( 'td', { 'class': 'colFrames' } ).inject( row );
new Element( 'td', { 'class': 'colScore' } ).inject( row );
new Element( 'td', { 'class': 'colDelete' } ).inject( row );
var cells = row.getElements( 'td' );
var link = new Element( 'a', { 'href': '#', 'events': { 'click': createEventPopup.pass( [event.Id, '&trms=1&attr1=MonitorId&op1=%3d&val1='+monitorId+'&page=1', event.Width, event.Height] ) } });
link.set( 'text', event.Id );
link.inject( row.getElement( 'td.colId' ) );
link = new Element( 'a', { 'href': '#', 'events': { 'click': createEventPopup.pass( [event.Id, '&trms=1&attr1=MonitorId&op1=%3d&val1='+monitorId+'&page=1', event.Width, event.Height] ) } });
link.set( 'text', event.Name );
link.inject( row.getElement( 'td.colName' ) );
row.getElement( 'td.colTime' ).set( 'text', event.StartTime );
row.getElement( 'td.colSecs' ).set( 'text', event.Length );
link = new Element( 'a', { 'href': '#', 'events': { 'click': createFramesPopup.pass( [event.Id, event.Width, event.Height] ) } });
link.set( 'text', event.Frames+'/'+event.AlarmFrames );
link.inject( row.getElement( 'td.colFrames' ) );
link = new Element( 'a', { 'href': '#', 'events': { 'click': createFramePopup.pass( [event.Id, '0', event.Width, event.Height] ) } });
link.set( 'text', event.AvgScore+'/'+event.MaxScore );
link.inject( row.getElement( 'td.colScore' ) );
link = new Element( 'a', { 'href': '#', 'title': deleteString, 'events': { 'click': function( e ) { deleteEvent( e, event.Id ); }, 'mouseover': highlightRow.pass( row ), 'mouseout': highlightRow.pass( row ) } });
link.set( 'text', 'X' );
link.inject( row.getElement( 'td.colDelete' ) );
if ( i == 0 )
row.inject( $(eventListBody) );
else
{
row.inject( $(eventListBody), 'top' );
if ( !eventCmdFirst )
row.addClass( 'recent' );
}
}
else
{
row.getElement( 'td.colName a' ).set( 'text', event.Name );
row.getElement( 'td.colSecs' ).set( 'text', event.Length );
row.getElement( 'td.colFrames a' ).set( 'text', event.Frames+'/'+event.AlarmFrames );
row.getElement( 'td.colScore a' ).set( 'text', event.AvgScore+'/'+event.MaxScore );
row.removeClass( 'recent' );
}
row.addClass( 'updated' );
>>>>>>> master
}
} else {
row.getElement( 'td.colName a' ).set( 'text', event.Name );
@ -489,12 +812,17 @@ function getEventCmdResponse( respObj, respText ) {
i--;
}
}
<<<<<<< HEAD
while ( rows.length > maxDisplayEvents ) {
rows[rows.length-1].destroy();
rows.length--;
}
} else
checkStreamForErrors("getEventCmdResponse",respObj);
=======
else
checkStreamForErrors("getEventCmdResponse", respObj);
>>>>>>> master
var eventCmdTimeout = eventsRefreshTimeout;
if ( alarmState == STATE_ALARM || alarmState == STATE_ALERT )
@ -543,6 +871,7 @@ function controlCmd( control, event, xtell, ytell ) {
xge = 2*(50 - xge);
locParms += "&xge="+xge;
}
<<<<<<< HEAD
if ( ytell ) {
var yge = parseInt( (y*100)/coords.height );
if ( ytell == -1 )
@ -550,6 +879,42 @@ function controlCmd( control, event, xtell, ytell ) {
else if ( ytell == 2 )
yge = 2*(50 - yge);
locParms += "&yge="+yge;
=======
}
function controlCmd( control, event, xtell, ytell )
{
var locParms = "";
if ( event && (xtell || ytell) )
{
var xEvent = new Event( event );
var target = xEvent.target;
var coords = $(target).getCoordinates();
var l = coords.left;
var t = coords.top;
var x = xEvent.page.x - l;
var y = xEvent.page.y - t;
if ( xtell )
{
var xge = parseInt( (x*100)/coords.width );
if ( xtell == -1 )
xge = 100 - xge;
else if ( xtell == 2 )
xge = 2*(50 - xge);
locParms += "&xge="+xge;
}
if ( ytell )
{
var yge = parseInt( (y*100)/coords.height );
if ( ytell == -1 )
yge = 100 - yge;
else if ( ytell == 2 )
yge = 2*(50 - yge);
locParms += "&yge="+yge;
}
>>>>>>> master
}
}
controlReq.send( controlParms+"&control="+control+locParms );
@ -562,6 +927,7 @@ function controlCmdImage( x, y ) {
imageControlParms += "&scale="+scale;
imageControlParms += "&control="+imageControlMode;
<<<<<<< HEAD
controlReq.send( imageControlParms+"&x="+x+"&y="+y );
if ( streamMode == "single" )
fetchImage.pass( $('imageFeed').getElement('img') ).delay( 1000 );
@ -569,6 +935,40 @@ function controlCmdImage( x, y ) {
function fetchImage( streamImage ) {
streamImage.src = streamImage.src.replace(/rand=\d+/i,'rand='+Math.floor((Math.random() * 1000000) ));
=======
controlReq.send( imageControlParms+"&x="+x+"&y="+y );
if ( streamMode == "single" )
fetchImage.pass( $('imageFeed').getElement('img') ).delay( 1000 );
}
var tempImage = null;
function fetchImage( streamImage )
{
var now = new Date();
if ( !tempImage )
tempImage = new Element( 'img' );
tempImage.setProperty( 'src', streamSrc+'&'+now.getTime() );
$(streamImage).setProperty( 'src', tempImage.getProperty( 'src' ) );
}
function handleClick( event )
{
var target = event.target;
var x = event.page.x - $(target).getLeft();
var y = event.page.y - $(target).getTop();
if ( showMode == "events" || !imageControlMode )
{
if ( event.shift )
streamCmdPan( x, y );
else
streamCmdZoomIn( x, y );
}
else
{
controlCmdImage( x, y );
}
>>>>>>> master
}
function handleClick( event ) {
@ -617,6 +1017,7 @@ function watchdogCheck( type ) {
console.log( "Detected streamWatch of type: " + type + " stopped, restarting" );
watchdogFunctions[type]();
watchdogInactive[type] = false;
<<<<<<< HEAD
} else {
watchdogInactive[type] = true;
}
@ -651,6 +1052,42 @@ function initPage() {
if ( refreshApplet && appletRefreshTime )
appletRefresh.delay( appletRefreshTime*1000 );
=======
}
function initPage()
{
if ( streamMode == "single" )
{
statusCmdTimer = statusCmdQuery.delay( (Math.random()+0.1)*statusRefreshTimeout );
watchdogCheck.pass('status').periodical(statusRefreshTimeout*2);
}
else
{
streamCmdTimer = streamCmdQuery.delay( (Math.random()+0.1)*statusRefreshTimeout );
watchdogCheck.pass('stream').periodical(statusRefreshTimeout*2);
}
eventCmdTimer = eventCmdQuery.delay( (Math.random()+0.1)*statusRefreshTimeout );
watchdogCheck.pass('event').periodical(eventsRefreshTimeout*2);
if ( canStreamNative || streamMode == "single" )
{
var streamImg = $('imageFeed').getElement('img');
if ( !streamImg )
streamImg = $('imageFeed').getElement('object');
if ( streamMode == "single" )
{
streamImg.addEvent( 'click', fetchImage.pass( streamImg ) );
fetchImage.pass( streamImg ).periodical( imageRefreshTimeout );
}
else
streamImg.addEvent( 'click', function( event ) { handleClick( event ); } );
}
if ( refreshApplet && appletRefreshTime )
appletRefresh.delay( appletRefreshTime*1000 );
>>>>>>> master
}
// Kick everything off

View File

@ -110,7 +110,7 @@ function applyZoneType() {
form.elements['newZone[MaxAlarmPixels]'].disabled = false;
form.elements['newZone[OverloadFrames]'].disabled = false;
form.elements['newZone[ExtendAlarmFrames]'].disabled = true;
applyCheckMethod();
applyCheckMethod();
}
}
@ -292,7 +292,7 @@ function updateActivePoint( index ) {
$('newZone[Points]['+index+'][y]').value = y;
zone['Points'][index].x = x;
zone['Points'][index].y = y;
var Point = $('zonePoly').points.getItem(index);
var Point = $('zonePoly').points.getItem(index);
Point.x =x;
Point.y =y;
updateArea();
@ -319,7 +319,12 @@ function delPoint( index ) {
drawZonePoints();
}
<<<<<<< HEAD
function limitPointValue( point, loVal, hiVal ) {
=======
function limitPointValue( point, loVal, hiVal )
{
>>>>>>> master
point.value = constrainValue(point.value, loVal, hiVal);
}
@ -329,7 +334,6 @@ function updateArea( ) {
var form = $('zoneForm');
form.elements['newZone[Area]'].value = area;
if ( form.elements['newZone[Units]'].value == 'Percent' ) {
form.elements['newZone[TempArea]'].value = Math.round( area/monitorArea*100 );
} else if ( form.elements['newZone[Units]'].value == 'Pixels' ) {
form.elements['newZone[TempArea]'].value = area;
@ -346,7 +350,7 @@ function updateX( index ) {
point.setStyle( 'left', x+'px' );
zone['Points'][index].x = x;
var Point = $('zonePoly').points.getItem(index);
var Point = $('zonePoly').points.getItem(index);
Point.x = x;
}
@ -358,7 +362,7 @@ function updateY( index ) {
point.setStyle( 'top', y+'px' );
zone['Points'][index].y = y;
var Point = $('zonePoly').points.getItem(index);
var Point = $('zonePoly').points.getItem(index);
Point.y = y;
}
@ -501,18 +505,18 @@ function getStreamCmdResponse( respObj, respText ) {
streamCmdPlay( false );
}
} else {
checkStreamForErrors("getStreamCmdResponse",respObj);//log them
checkStreamForErrors("getStreamCmdResponse", respObj);//log them
// Try to reload the image stream.
var streamImg = document.getElementById('liveStream');
if ( streamImg )
streamImg.src = streamImg.src.replace(/rand=\d+/i,'rand='+Math.floor((Math.random() * 1000000) ));
streamImg.src = streamImg.src.replace(/rand=\d+/i, 'rand='+Math.floor((Math.random() * 1000000) ));
}
var streamCmdTimeout = statusRefreshTimeout;
if ( alarmState == STATE_ALARM || alarmState == STATE_ALERT )
streamCmdTimeout = streamCmdTimeout/5;
streamCmdTimer = streamCmdQuery.delay( streamCmdTimeout );
}
}
var streamPause = false;
@ -546,7 +550,7 @@ function streamCmdStop( action ) {
function streamCmdQuery() {
streamCmdReq.send( streamCmdParms+"&command="+CMD_QUERY );
}
}
var statusCmdParms = "view=request&request=status&entity=monitor&id="+monitorId+"&element[]=Status&element[]=FrameRate";
var statusCmdReq = new Request.JSON( { url: monitorUrl+thisUrl, method: 'post', data: statusCmdParms, timeout: AJAX_TIMEOUT, link: 'cancel', onSuccess: getStatusCmdResponse } );
@ -563,13 +567,13 @@ function getStatusCmdResponse( respObj, respText ) {
setAlarmState( respObj.monitor.Status );
}
else
checkStreamForErrors("getStatusCmdResponse",respObj);
checkStreamForErrors("getStatusCmdResponse", respObj);
var statusCmdTimeout = statusRefreshTimeout;
if ( alarmState == STATE_ALARM || alarmState == STATE_ALERT )
statusCmdTimeout = statusCmdTimeout/5;
statusCmdTimer = statusCmdQuery.delay( statusCmdTimeout );
}
}
function statusCmdQuery() {
statusCmdReq.send();