Merge branch 'master' into multi-server
This commit is contained in:
commit
ace8597b8d
|
@ -4,7 +4,7 @@
|
|||
#
|
||||
cmake_minimum_required (VERSION 2.6)
|
||||
project (zoneminder)
|
||||
set(zoneminder_VERSION "1.28.1")
|
||||
set(zoneminder_VERSION "1.28.99")
|
||||
# make API version a minor of ZM version
|
||||
set(zoneminder_API_VERSION "${zoneminder_VERSION}.1")
|
||||
|
||||
|
@ -204,6 +204,16 @@ check_type_size("ucontext_t" HAVE_UCONTEXT_T)
|
|||
|
||||
# *** LIBRARY CHECKS ***
|
||||
|
||||
if (UNIX)
|
||||
include (CheckLibraryExists)
|
||||
CHECK_LIBRARY_EXISTS(rt clock_gettime "time.h" HAVE_CLOCK_GETTIME)
|
||||
if(NOT HAVE_CLOCK_GETTIME)
|
||||
message(FATAL_ERROR "clock_gettime not found")
|
||||
else(NOT HAVE_CLOCK_GETTIME)
|
||||
list(APPEND ZM_BIN_LIBS "-lrt")
|
||||
endif(NOT HAVE_CLOCK_GETTIME)
|
||||
endif(UNIX)
|
||||
|
||||
# zlib
|
||||
find_package(ZLIB)
|
||||
if(ZLIB_FOUND)
|
||||
|
@ -653,6 +663,10 @@ configure_file(zoneminder-config.cmake "${CMAKE_CURRENT_BINARY_DIR}/config.h" @O
|
|||
configure_file(zmconfgen.pl.in "${CMAKE_CURRENT_BINARY_DIR}/zmconfgen.pl" @ONLY)
|
||||
configure_file(zmlinkcontent.sh.in "${CMAKE_CURRENT_BINARY_DIR}/zmlinkcontent.sh" @ONLY)
|
||||
|
||||
# Create a target for man pages
|
||||
include(Pod2Man)
|
||||
ADD_MANPAGE_TARGET()
|
||||
|
||||
# Process subdirectories
|
||||
add_subdirectory(src)
|
||||
add_subdirectory(scripts)
|
||||
|
|
|
@ -11,9 +11,12 @@ RUN apt-get update && apt-get install -y \
|
|||
libpolkit-gobject-1-dev build-essential libmysqlclient-dev libssl-dev libbz2-dev libpcre3-dev \
|
||||
libdbi-perl libarchive-zip-perl libdate-manip-perl libdevice-serialport-perl libmime-perl libpcre3 \
|
||||
libwww-perl libdbd-mysql-perl libsys-mmap-perl yasm automake autoconf libjpeg-turbo8-dev \
|
||||
libjpeg-turbo8 libtheora-dev libvorbis-dev libvpx-dev libx264-dev libmp4v2-dev ffmpeg mysql-client \
|
||||
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 openssh-server \
|
||||
mysql-server libvlc-dev libvlc5 libvlccore-dev libvlccore5 vlc-data vlc libcurl4-openssl-dev
|
||||
mysql-server libvlc-dev libvlc5 libvlccore-dev libvlccore5 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
|
||||
|
||||
# Copy local code into our container
|
||||
ADD . /ZoneMinder
|
||||
|
|
|
@ -0,0 +1,71 @@
|
|||
#
|
||||
# Copyright (C) 2012 Emmanuel Roullit <emmanuel.roullit@gmail.com>
|
||||
#
|
||||
# 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 St, Fifth Floor, Boston, MA 02110, USA
|
||||
#
|
||||
|
||||
# Generate man pages of the project by using the
|
||||
# POD header written in the tool source code.
|
||||
# To use it, include this file in CMakeLists.txt and
|
||||
# invoke POD2MAN(<podfile> <manfile> <section>)
|
||||
|
||||
MACRO(POD2MAN PODFILE MANFILE SECTION)
|
||||
FIND_PROGRAM(POD2MAN pod2man)
|
||||
FIND_PROGRAM(GZIP gzip)
|
||||
|
||||
IF(NOT POD2MAN)
|
||||
MESSAGE(FATAL ERROR "Need pod2man installed to generate man page")
|
||||
ENDIF(NOT POD2MAN)
|
||||
|
||||
IF(NOT GZIP)
|
||||
MESSAGE(FATAL ERROR "Need gzip installed to compress man page")
|
||||
ENDIF(NOT GZIP)
|
||||
|
||||
IF(NOT EXISTS ${PODFILE})
|
||||
MESSAGE(FATAL ERROR "Could not find pod file ${PODFILE} to generate man page")
|
||||
ENDIF(NOT EXISTS ${PODFILE})
|
||||
|
||||
ADD_CUSTOM_COMMAND(
|
||||
OUTPUT ${CMAKE_CURRENT_BINARY_DIR}/${MANFILE}.${SECTION}
|
||||
DEPENDS ${PODFILE}
|
||||
COMMAND ${POD2MAN}
|
||||
ARGS --section ${SECTION} --center ${CMAKE_PROJECT_NAME} --release --stderr --name ${MANFILE}
|
||||
${PODFILE} > ${CMAKE_CURRENT_BINARY_DIR}/${MANFILE}.${SECTION}
|
||||
)
|
||||
|
||||
ADD_CUSTOM_COMMAND(
|
||||
OUTPUT ${CMAKE_CURRENT_BINARY_DIR}/${MANFILE}.${SECTION}.gz
|
||||
COMMAND ${GZIP} --best -c ${CMAKE_CURRENT_BINARY_DIR}/${MANFILE}.${SECTION} > ${CMAKE_CURRENT_BINARY_DIR}/${MANFILE}.${SECTION}.gz
|
||||
DEPENDS ${CMAKE_CURRENT_BINARY_DIR}/${MANFILE}.${SECTION}
|
||||
)
|
||||
|
||||
SET(MANPAGE_TARGET "man-${MANFILE}")
|
||||
|
||||
ADD_CUSTOM_TARGET(${MANPAGE_TARGET} DEPENDS ${CMAKE_CURRENT_BINARY_DIR}/${MANFILE}.${SECTION}.gz)
|
||||
ADD_DEPENDENCIES(man ${MANPAGE_TARGET})
|
||||
|
||||
INSTALL(
|
||||
FILES ${CMAKE_CURRENT_BINARY_DIR}/${MANFILE}.${SECTION}.gz
|
||||
DESTINATION share/man/man${SECTION}
|
||||
)
|
||||
ENDMACRO(POD2MAN PODFILE MANFILE SECTION)
|
||||
|
||||
MACRO(ADD_MANPAGE_TARGET)
|
||||
# It is not possible add a dependency to target 'install'
|
||||
# Run hard-coded 'make man' when 'make install' is invoked
|
||||
INSTALL(CODE "EXECUTE_PROCESS(COMMAND make man)")
|
||||
ADD_CUSTOM_TARGET(man)
|
||||
ENDMACRO(ADD_MANPAGE_TARGET)
|
||||
|
|
@ -3,7 +3,7 @@
|
|||
# For instructions on building with cmake, please see INSTALL
|
||||
#
|
||||
AC_PREREQ(2.59)
|
||||
AC_INIT(zm,1.28.1,[http://www.zoneminder.com/forums/ - Please check FAQ first],zoneminder,http://www.zoneminder.com/downloads.html)
|
||||
AC_INIT(zm,1.28.99,[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)
|
||||
|
|
|
@ -383,6 +383,7 @@ CREATE TABLE `Monitors` (
|
|||
|
||||
--
|
||||
-- Table structure for table `States`
|
||||
-- Added IsActive to track custom run states
|
||||
--
|
||||
|
||||
DROP TABLE IF EXISTS `States`;
|
||||
|
@ -390,6 +391,7 @@ CREATE TABLE `States` (
|
|||
`Id` int(10) unsigned NOT NULL auto_increment,
|
||||
`Name` varchar(64) NOT NULL default '',
|
||||
`Definition` text NOT NULL,
|
||||
`IsActive` tinyint(3) unsigned NOT NULL default '0',
|
||||
PRIMARY KEY (`Id`)
|
||||
) ENGINE=@ZM_MYSQL_ENGINE@;
|
||||
|
||||
|
|
|
@ -336,7 +336,23 @@ SET @s = (SELECT IF(
|
|||
AND column_name = 'Id'
|
||||
) > 0,
|
||||
"SELECT 'Column Id exists in States'",
|
||||
"ALTER TABLE States ALTER Name DROP PRIMARY KEY;ALTER TABLE `States` ADD `Id` int(10) unsigned auto_increment NOT NULL PRIMARY KEY FIRST"
|
||||
"ALTER TABLE States DROP PRIMARY KEY, ADD `Id` int(10) unsigned auto_increment NOT NULL PRIMARY KEY FIRST"
|
||||
));
|
||||
|
||||
PREPARE stmt FROM @s;
|
||||
EXECUTE stmt;
|
||||
|
||||
-- The States table will be updated to have a new column called IsActive
|
||||
-- used to keep track of which custom state is active (if any)
|
||||
SET @s = (SELECT IF(
|
||||
(SELECT COUNT(*)
|
||||
FROM INFORMATION_SCHEMA.COLUMNS
|
||||
WHERE table_name = 'States'
|
||||
AND table_schema = DATABASE()
|
||||
AND column_name = 'IsActive'
|
||||
) > 0,
|
||||
"SELECT 'Column IsActive exists in States'",
|
||||
"ALTER TABLE `States` ADD `IsActive` tinyint(3) unsigned not null default 0 AFTER `Definition`"
|
||||
));
|
||||
|
||||
PREPARE stmt FROM @s;
|
||||
|
|
|
@ -24,7 +24,7 @@ Source: ZoneMinder-%{version}.tar.gz
|
|||
|
||||
BuildRequires: cmake gnutls-devel systemd-units bzip2-devel
|
||||
BuildRequires: community-mysql-devel pcre-devel libjpeg-turbo-devel
|
||||
BuildRequires: perl(Archive::Tar) perl(Archive::Zip)
|
||||
BuildRequires: perl(Archive::Tar) perl(Archive::Zip) perl-podlators
|
||||
BuildRequires: perl(Date::Manip) perl(DBD::mysql)
|
||||
BuildRequires: perl(ExtUtils::MakeMaker) perl(LWP::UserAgent)
|
||||
BuildRequires: perl(MIME::Entity) perl(MIME::Lite)
|
||||
|
|
|
@ -24,7 +24,7 @@ Source: ZoneMinder-%{version}.tar.gz
|
|||
|
||||
BuildRequires: cmake gnutls-devel systemd-units bzip2-devel
|
||||
BuildRequires: community-mysql-devel pcre-devel libjpeg-turbo-devel
|
||||
BuildRequires: perl(Archive::Tar) perl(Archive::Zip)
|
||||
BuildRequires: perl(Archive::Tar) perl(Archive::Zip) perl-podlators
|
||||
BuildRequires: perl(Date::Manip) perl(DBD::mysql)
|
||||
BuildRequires: perl(ExtUtils::MakeMaker) perl(LWP::UserAgent)
|
||||
BuildRequires: perl(MIME::Entity) perl(MIME::Lite)
|
||||
|
|
|
@ -20,7 +20,7 @@ Source: ZoneMinder-%{version}.tar.gz
|
|||
|
||||
BuildRequires: cmake gnutls-devel systemd-units bzip2-devel
|
||||
BuildRequires: mariadb-devel pcre-devel libjpeg-turbo-devel
|
||||
BuildRequires: perl(Archive::Tar) perl(Archive::Zip)
|
||||
BuildRequires: perl(Archive::Tar) perl(Archive::Zip) perl-podlators
|
||||
BuildRequires: perl(Date::Manip) perl(DBD::mysql)
|
||||
BuildRequires: perl(ExtUtils::MakeMaker) perl(LWP::UserAgent)
|
||||
BuildRequires: perl(MIME::Entity) perl(MIME::Lite)
|
||||
|
|
File diff suppressed because it is too large
Load Diff
File diff suppressed because it is too large
Load Diff
|
@ -2,3 +2,4 @@ etc/zm
|
|||
usr/bin
|
||||
usr/share/polkit-1/actions
|
||||
usr/share/polkit-1/rules.d
|
||||
usr/share/man
|
||||
|
|
|
@ -24,6 +24,12 @@ endif(NOT ZM_NO_X10)
|
|||
configure_file(zm.in "${CMAKE_CURRENT_BINARY_DIR}/zm" @ONLY)
|
||||
#configure_file(zmeventdump.in zmeventdump @ONLY)
|
||||
|
||||
# Generate man files for the perl scripts destined for the bin folder
|
||||
file(GLOB perlscripts RELATIVE "${CMAKE_CURRENT_BINARY_DIR}" "*.pl")
|
||||
FOREACH(PERLSCRIPT ${perlscripts})
|
||||
POD2MAN(${CMAKE_CURRENT_SOURCE_DIR}/${PERLSCRIPT} zoneminder-${PERLSCRIPT} 8)
|
||||
ENDFOREACH(PERLSCRIPT ${perlscripts})
|
||||
|
||||
# Install the perl scripts
|
||||
install(FILES "${CMAKE_CURRENT_BINARY_DIR}/zmaudit.pl" "${CMAKE_CURRENT_BINARY_DIR}/zmcontrol.pl" "${CMAKE_CURRENT_BINARY_DIR}/zmdc.pl" "${CMAKE_CURRENT_BINARY_DIR}/zmfilter.pl" "${CMAKE_CURRENT_BINARY_DIR}/zmpkg.pl" "${CMAKE_CURRENT_BINARY_DIR}/zmtrack.pl" "${CMAKE_CURRENT_BINARY_DIR}/zmtrigger.pl" "${CMAKE_CURRENT_BINARY_DIR}/zmupdate.pl" "${CMAKE_CURRENT_BINARY_DIR}/zmvideo.pl" "${CMAKE_CURRENT_BINARY_DIR}/zmwatch.pl" "${CMAKE_CURRENT_BINARY_DIR}/zmcamtool.pl" "${CMAKE_CURRENT_BINARY_DIR}/zmsystemctl.pl" DESTINATION "${CMAKE_INSTALL_FULL_BINDIR}" PERMISSIONS OWNER_WRITE OWNER_READ OWNER_EXECUTE GROUP_READ GROUP_EXECUTE WORLD_READ WORLD_EXECUTE)
|
||||
if(NOT ZM_NO_X10)
|
||||
|
|
|
@ -55,6 +55,7 @@ use autouse 'Pod::Usage'=>qw(pod2usage);
|
|||
$ENV{PATH} = '/bin:/usr/bin';
|
||||
$ENV{SHELL} = '/bin/sh' if exists $ENV{SHELL};
|
||||
delete @ENV{qw(IFS CDPATH ENV BASH_ENV)};
|
||||
my $store_state=""; # PP - will remember state name passed
|
||||
|
||||
logInit();
|
||||
|
||||
|
@ -90,6 +91,7 @@ if ( !$command || $command !~ /^(?:start|stop|restart|status|logrot|version)$/ )
|
|||
{ Id=>$id, Function=>$function, Enabled=>$enabled }
|
||||
);
|
||||
}
|
||||
$store_state=$command; # PP - Remember the name that was passed to search in DB
|
||||
$command = 'state';
|
||||
}
|
||||
else
|
||||
|
@ -149,6 +151,18 @@ if ( $command eq "state" )
|
|||
}
|
||||
}
|
||||
$sth->finish();
|
||||
#PP - lets go ahead and modify States DB
|
||||
|
||||
|
||||
Debug ("Marking $store_state as Enabled");
|
||||
# PP - Zero out other states being active
|
||||
resetStates();
|
||||
# PP - Now mark a specific state as active
|
||||
$sql = "update States set IsActive = '1' where Name = ?";
|
||||
$sth = $dbh->prepare_cached( $sql )
|
||||
or Fatal( "Can't prepare '$sql': ".$dbh->errstr() );
|
||||
$res = $sth->execute( $store_state )
|
||||
or Fatal( "Can't execute: ".$sth->errstr() );
|
||||
|
||||
$command = "restart";
|
||||
}
|
||||
|
@ -159,6 +173,9 @@ if ( $command =~ /^(start|stop|restart)$/ )
|
|||
# We have to detaint to keep perl from complaining
|
||||
$command = $1;
|
||||
|
||||
# PP - if we are not switching to a custom state, zero out all isActive
|
||||
resetStates() if (!$store_state);
|
||||
|
||||
if ( systemdRunning() && !calledBysystem() ) {
|
||||
qx(@BINDIR@/zmsystemctl.pl $command);
|
||||
$command = "";
|
||||
|
@ -290,6 +307,19 @@ if ( $command eq "logrot" )
|
|||
|
||||
exit( $retval );
|
||||
|
||||
# PP - when the system is restarted/started/stopped, it will
|
||||
# not be in a custom state, so lets keep the DB consistent
|
||||
sub resetStates
|
||||
{
|
||||
$dbh = zmDbConnect() if ! $dbh;
|
||||
my $sql = "update States set IsActive = '0'";
|
||||
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() );
|
||||
|
||||
}
|
||||
|
||||
sub systemdRunning
|
||||
{
|
||||
my $result = 0;
|
||||
|
|
|
@ -31,10 +31,15 @@ zmsystemctl.pl - ZoneMinder systemctl wrapper
|
|||
|
||||
=head1 DESCRIPTION
|
||||
|
||||
This is a wrapper script that allows zoneminder to start and stop itself
|
||||
in a manner that keeps it in-sync with systemd. This script is intended
|
||||
to be called internally by zoneminder and may not give the desired results
|
||||
if run from the command line.
|
||||
This script allows an unpriveledged user to start, stop, or restart the
|
||||
zoneminder service on a system running systemd. It does this by redirecting
|
||||
commands through pkexec, which checks the available polkit policy files. The
|
||||
default policy file grants the system web account user permission. This can be
|
||||
changed or expanded by modifying the policy file. See man polkit for details.
|
||||
|
||||
=head1 SEE ALSO
|
||||
|
||||
polkit(8), pkexec(1)
|
||||
|
||||
=cut
|
||||
use warnings;
|
||||
|
|
|
@ -23,6 +23,11 @@ target_link_libraries(zmf zm ${ZM_EXTRA_LIBS} ${ZM_BIN_LIBS})
|
|||
target_link_libraries(zms zm ${ZM_EXTRA_LIBS} ${ZM_BIN_LIBS})
|
||||
target_link_libraries(zmstreamer zm ${ZM_EXTRA_LIBS} ${ZM_BIN_LIBS})
|
||||
|
||||
# Generate man files for the binaries destined for the bin folder
|
||||
FOREACH(CBINARY zma zmc zmf zmu zmstreamer)
|
||||
POD2MAN(${CMAKE_CURRENT_SOURCE_DIR}/${CBINARY}.cpp zoneminder-${CBINARY} 8)
|
||||
ENDFOREACH(CBINARY zma zmc zmf zmu zmstreamer)
|
||||
|
||||
install(TARGETS zmc zma zmu zmf zmstreamer 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 \"\$ENV{DESTDIR}${ZM_CGIDIR}\")")
|
||||
|
|
|
@ -18,6 +18,7 @@
|
|||
*/
|
||||
|
||||
#include <string.h>
|
||||
#include <fcntl.h>
|
||||
|
||||
#include "zm.h"
|
||||
#include "zm_buffer.h"
|
||||
|
@ -67,3 +68,14 @@ unsigned int Buffer::expand( unsigned int count )
|
|||
}
|
||||
return( mSize );
|
||||
}
|
||||
|
||||
int Buffer::read_into( int sd, unsigned int bytes ) {
|
||||
// Make sure there is enough space
|
||||
this->expand(bytes);
|
||||
int bytes_read = read( sd, mTail, bytes );
|
||||
if ( bytes_read > 0 ) {
|
||||
mTail += bytes_read;
|
||||
mSize += bytes_read;
|
||||
}
|
||||
return bytes_read;
|
||||
}
|
||||
|
|
|
@ -203,6 +203,7 @@ public:
|
|||
{
|
||||
return( (int)mSize );
|
||||
}
|
||||
int read_into( int sd, unsigned int bytes );
|
||||
};
|
||||
|
||||
#endif // ZM_BUFFER_H
|
||||
|
|
|
@ -471,9 +471,9 @@ public:
|
|||
{
|
||||
ttl = p_ttl;
|
||||
}
|
||||
void setStreamStart( int monitor_id )
|
||||
bool setStreamStart( int monitor_id )
|
||||
{
|
||||
loadMonitor( monitor_id );
|
||||
return loadMonitor( monitor_id );
|
||||
}
|
||||
void runStream();
|
||||
};
|
||||
|
|
|
@ -198,16 +198,21 @@ int RemoteCameraHttp::ReadData( Buffer &buffer, int bytes_expected )
|
|||
//Disconnect(); // Disconnect is done outside of ReadData now.
|
||||
return( -1 );
|
||||
}
|
||||
|
||||
// There can be lots of bytes available. I've seen 4MB or more. This will vastly inflate our buffer size unneccessarily.
|
||||
if ( total_bytes_to_read > ZM_NETWORK_BUFSIZ ) {
|
||||
total_bytes_to_read = ZM_NETWORK_BUFSIZ;
|
||||
Debug(3, "Just getting 32K" );
|
||||
} else {
|
||||
Debug(3, "Just getting %d", total_bytes_to_read );
|
||||
}
|
||||
}
|
||||
Debug( 3, "Expecting %d bytes", total_bytes_to_read );
|
||||
|
||||
int total_bytes_read = 0;
|
||||
do
|
||||
{
|
||||
static unsigned char temp_buffer[ZM_NETWORK_BUFSIZ];
|
||||
int bytes_to_read = (unsigned int)total_bytes_to_read>(unsigned int)sizeof(temp_buffer)?sizeof(temp_buffer):total_bytes_to_read;
|
||||
int bytes_read = read( sd, temp_buffer, bytes_to_read );
|
||||
|
||||
int bytes_read = buffer.read_into( sd, total_bytes_to_read );
|
||||
if ( bytes_read < 0)
|
||||
{
|
||||
Error( "Read error: %s", strerror(errno) );
|
||||
|
@ -219,13 +224,12 @@ int RemoteCameraHttp::ReadData( Buffer &buffer, int bytes_expected )
|
|||
//Disconnect(); // Disconnect is done outside of ReadData now.
|
||||
return( -1 );
|
||||
}
|
||||
else if ( bytes_read < bytes_to_read )
|
||||
else if ( bytes_read < total_bytes_to_read )
|
||||
{
|
||||
Error( "Incomplete read, expected %d, got %d", bytes_to_read, bytes_read );
|
||||
Error( "Incomplete read, expected %d, got %d", total_bytes_to_read, bytes_read );
|
||||
return( -1 );
|
||||
}
|
||||
Debug( 3, "Read %d bytes", bytes_read );
|
||||
buffer.append( temp_buffer, bytes_read );
|
||||
total_bytes_read += bytes_read;
|
||||
total_bytes_to_read -= bytes_read;
|
||||
}
|
||||
|
|
32
src/zma.cpp
32
src/zma.cpp
|
@ -17,6 +17,38 @@
|
|||
// Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
|
||||
//
|
||||
|
||||
/*
|
||||
|
||||
=head1 NAME
|
||||
|
||||
zma - The ZoneMinder Analysis daemon
|
||||
|
||||
=head1 SYNOPSIS
|
||||
|
||||
zma -m <monitor_id>
|
||||
zma --monitor <monitor_id>
|
||||
zma -h
|
||||
zma --help
|
||||
zma -v
|
||||
zma --version
|
||||
|
||||
=head1 DESCRIPTION
|
||||
|
||||
This is the component that goes through the captured frames and checks them
|
||||
for motion which might generate an alarm or event. It generally keeps up with
|
||||
the Capture daemon but if very busy may skip some frames to prevent it falling
|
||||
behind.
|
||||
|
||||
=head1 OPTIONS
|
||||
|
||||
-m, --monitor_id - ID of the monitor to analyse
|
||||
-h, --help - Display usage information
|
||||
-v, --version - Print the installed version of ZoneMinder
|
||||
|
||||
=cut
|
||||
|
||||
*/
|
||||
|
||||
#include <getopt.h>
|
||||
#include <signal.h>
|
||||
|
||||
|
|
38
src/zmc.cpp
38
src/zmc.cpp
|
@ -17,6 +17,44 @@
|
|||
// Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
|
||||
//
|
||||
|
||||
/*
|
||||
|
||||
=head1 NAME
|
||||
|
||||
zmc - The ZoneMinder Capture daemon
|
||||
|
||||
=head1 SYNOPSIS
|
||||
|
||||
zmc -d <device_path>
|
||||
zmc --device <device_path>
|
||||
zmc -r <proto> -H <host> -P <port> -p <path>
|
||||
zmc -f <file_path>
|
||||
zmc --file <file_path>
|
||||
zmc -m <monitor_id>
|
||||
zmc --monitor <monitor_id>
|
||||
zmc -h
|
||||
zmc --help
|
||||
zmc -v
|
||||
zmc --version
|
||||
|
||||
=head1 DESCRIPTION
|
||||
|
||||
This binary's job is to sit on a video device and suck frames off it as fast as
|
||||
possible, this should run at more or less constant speed.
|
||||
|
||||
=head1 OPTIONS
|
||||
|
||||
-d, --device <device_path> - For local cameras, device to access. e.g /dev/video0 etc
|
||||
-r <proto> -H <host> -P <port> -p <path> - For remote cameras
|
||||
-f, --file <file_path> - For local images, jpg file to access.
|
||||
-m, --monitor_id - ID of the monitor to analyse
|
||||
-h, --help - Display usage information
|
||||
-v, --version - Print the installed version of ZoneMinder
|
||||
|
||||
=cut
|
||||
|
||||
*/
|
||||
|
||||
#include <getopt.h>
|
||||
#include <signal.h>
|
||||
#if defined(__FreeBSD__)
|
||||
|
|
33
src/zmf.cpp
33
src/zmf.cpp
|
@ -17,6 +17,39 @@
|
|||
// Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
|
||||
//
|
||||
|
||||
/*
|
||||
|
||||
=head1 NAME
|
||||
|
||||
zmf - The ZoneMinder Frame daemon
|
||||
|
||||
=head1 SYNOPSIS
|
||||
|
||||
zmf -m <monitor_id>
|
||||
zmf --monitor <monitor_id>
|
||||
zmf -h
|
||||
zmf --help
|
||||
zmf -v
|
||||
zmf --version
|
||||
|
||||
=head1 DESCRIPTION
|
||||
|
||||
This is an optional daemon that can run in concert with the Analysis daemon and
|
||||
whose function it is to actually write captured frames to disk. This frees up
|
||||
the Analysis daemon to do more analysis (!) and so keep up with the Capture
|
||||
daemon better. If it isn’t running or dies then the Analysis daemon just writes
|
||||
them itself.
|
||||
|
||||
=head1 OPTIONS
|
||||
|
||||
-m, --monitor_id - ID of the monitor to use
|
||||
-h, --help - Display usage information
|
||||
-v, --version - Print the installed version of ZoneMinder
|
||||
|
||||
=cut
|
||||
|
||||
*/
|
||||
|
||||
#include <stdio.h>
|
||||
#include <stdlib.h>
|
||||
#include <unistd.h>
|
||||
|
|
|
@ -261,7 +261,13 @@ int main( int argc, const char *argv[] )
|
|||
stream.setStreamTTL( ttl );
|
||||
stream.setStreamQueue( connkey );
|
||||
stream.setStreamBuffer( playback_buffer );
|
||||
stream.setStreamStart( monitor_id );
|
||||
if ( ! stream.setStreamStart( monitor_id ) ) {
|
||||
Error( "Unable to connect to zmc process for monitor %d", monitor_id );
|
||||
fprintf( stderr, "Unable to connect to zmc process. Please ensure that it is running." );
|
||||
logTerm();
|
||||
zmDbClose();
|
||||
return( -1 );
|
||||
}
|
||||
|
||||
if ( mode == ZMS_JPEG )
|
||||
{
|
||||
|
|
|
@ -19,6 +19,52 @@
|
|||
// along with this program; if not, write to the Free Software
|
||||
// Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
|
||||
|
||||
/*
|
||||
|
||||
=head1 NAME
|
||||
|
||||
zmstreamer - eyeZM video streamer
|
||||
|
||||
=head1 SYNOPSIS
|
||||
|
||||
zmstreamer -e <mode>
|
||||
zmstreamer -o <format>
|
||||
zmstreamer -u <buffer size>
|
||||
zmstreamer -f <maximum fps>
|
||||
zmstreamer -s <scale>
|
||||
zmstreamer -b <bitrate in bps>
|
||||
zmstreamer -m <monitor id>
|
||||
zmstreamer -d <debug mode>
|
||||
zmstreamer -i
|
||||
zmstreamer -?
|
||||
zmstreamer -h
|
||||
zmstreamer -v
|
||||
|
||||
=head1 DESCRIPTION
|
||||
|
||||
*DEPRECIATED* The xml skin and all files associated with the xml skin are now
|
||||
depreciated. Please use the ZoneMinder API instead.
|
||||
|
||||
This binary works in conjunction with the XML skin to stream video to iPhones
|
||||
running the eyeZm app.
|
||||
|
||||
=head1 OPTIONS
|
||||
|
||||
-e <mode> - Specify output mode: mpeg/jpg/zip/single/raw.
|
||||
-o <format> - Specify output format.
|
||||
-u <buffer size> - Specify buffer size in ms.
|
||||
-f <maximum fps> - Specify maximum framerate.
|
||||
-s <scale> - Specify scale.
|
||||
-b <bitrate in bps> - Specify bitrate.
|
||||
-m <monitor id> - Specify monitor id.
|
||||
-d <debug mode> - 0 = off, 1 = no streaming, 2 = with streaming.
|
||||
-i, -?, -h - Display usage information
|
||||
-v - Print the installed version of ZoneMinder
|
||||
|
||||
=cut
|
||||
|
||||
*/
|
||||
|
||||
#include <stdio.h>
|
||||
#include <stdlib.h>
|
||||
|
||||
|
|
69
src/zmu.cpp
69
src/zmu.cpp
|
@ -17,6 +17,75 @@
|
|||
// Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
|
||||
//
|
||||
|
||||
/*
|
||||
|
||||
=head1 NAME
|
||||
|
||||
zmc - The ZoneMinder Utility
|
||||
|
||||
=head1 SYNOPSIS
|
||||
|
||||
zmu -d device_path [-v] [function] [-U<username> -P<password>]
|
||||
zmu --device device_path [-v] [function] [-U<username> -P<password>]
|
||||
|
||||
zmu -m monitor_id [-v] [function] [-U<username> -P<password>]
|
||||
zmu --monitor monitor_id [-v] [function] [-U<username> -P<password>]
|
||||
|
||||
=head1 DESCRIPTION
|
||||
|
||||
This binary is a handy command line interface to several useful functions. It’s
|
||||
not really meant to be used by anyone except the web page (there's only limited
|
||||
'help' in it so far) but can be if necessary, especially for debugging video
|
||||
problems.
|
||||
|
||||
=head1 OPTIONS
|
||||
|
||||
General options:
|
||||
-v, --verbose - Produce more verbose output
|
||||
-l, --list - List the current status of active (or all with -v) monitors
|
||||
-h, --help - Display usage information
|
||||
-v, --version - Print the installed version of ZoneMinder
|
||||
|
||||
Options for use with devices:
|
||||
-d, --device [device_path] - Get the current video device settings for [device_path] or all devices
|
||||
-V, --version <V4L version> - Set the Video 4 Linux API version to use for the query, use 1 or 2
|
||||
-q, --query - Query the current settings for the device
|
||||
|
||||
Options for use with monitors:
|
||||
-m, --monitor <monitor_id> - Specify which monitor to address, default 1 if absent
|
||||
-q, --query - Query the current settings for the monitor
|
||||
-s, --state - Output the current monitor state, 0 = idle, 1 = prealarm, 2 = alarm,
|
||||
3 = alert, 4 = tape
|
||||
-B, --brightness [value] - Output the current brightness, set to value if given
|
||||
-C, --contrast [value] - Output the current contrast, set to value if given
|
||||
-H, --hue [value] - Output the current hue, set to value if given
|
||||
-O, --colour [value] - Output the current colour, set to value if given
|
||||
-i, --image [image_index] - Write captured image to disk as <monitor_name>.jpg, last image captured
|
||||
or specified ring buffer index if given.
|
||||
-S, --scale <scale_%%ge> - With --image specify any scaling (in %%) to be applied to the image
|
||||
-t, --timestamp [image_index] - Output captured image timestamp, last image captured or specified
|
||||
ring buffer index if given
|
||||
-R, --read_index - Output ring buffer read index
|
||||
-W, --write_index - Output ring buffer write index
|
||||
-e, --event - Output last event index
|
||||
-f, --fps - Output last Frames Per Second captured reading
|
||||
-z, --zones - Write last captured image overlaid with zones to <monitor_name>-Zones.jpg
|
||||
-a, --alarm - Force alarm in monitor, this will trigger recording until cancelled with -c
|
||||
-n, --noalarm - Force no alarms in monitor, this will prevent alarms until cancelled with -c
|
||||
-c, --cancel - Cancel a forced alarm/noalarm in monitor, required after being enabled with -a or -n
|
||||
-L, --reload - Signal monitor to reload settings
|
||||
-E, --enable - Enable detection, wake monitor up
|
||||
-D, --disable - Disable detection, put monitor to sleep
|
||||
-u, --suspend - Suspend detection, useful to prevent bogus alarms when panning etc
|
||||
-r, --resume - Resume detection after a suspend
|
||||
-U, --username <username> - When running in authenticated mode the username and
|
||||
-P, --password <password> - password combination of the given user
|
||||
-A, --auth <authentication> - Pass authentication hash string instead of user details
|
||||
|
||||
=cut
|
||||
|
||||
*/
|
||||
|
||||
#include <getopt.h>
|
||||
|
||||
#include "zm.h"
|
||||
|
|
|
@ -2,4 +2,5 @@
|
|||
RewriteEngine on
|
||||
RewriteRule ^$ app/webroot/ [L]
|
||||
RewriteRule (.*) app/webroot/$1 [L]
|
||||
RewriteBase /zm/api
|
||||
</IfModule>
|
||||
|
|
|
@ -1,16 +0,0 @@
|
|||
# CMAKE generated file: DO NOT EDIT!
|
||||
# Generated by "Unix Makefiles" Generator, CMake Version 2.8
|
||||
|
||||
# Relative path conversion top directories.
|
||||
SET(CMAKE_RELATIVE_PATH_TOP_SOURCE "/home/ubuntu/zm/ZoneMinder")
|
||||
SET(CMAKE_RELATIVE_PATH_TOP_BINARY "/home/ubuntu/zm/ZoneMinder")
|
||||
|
||||
# Force unix paths in dependencies.
|
||||
SET(CMAKE_FORCE_UNIX_PATHS 1)
|
||||
|
||||
|
||||
# The C and CXX include file regular expressions for this directory.
|
||||
SET(CMAKE_C_INCLUDE_REGEX_SCAN "^.*$")
|
||||
SET(CMAKE_C_INCLUDE_REGEX_COMPLAIN "^$")
|
||||
SET(CMAKE_CXX_INCLUDE_REGEX_SCAN ${CMAKE_C_INCLUDE_REGEX_SCAN})
|
||||
SET(CMAKE_CXX_INCLUDE_REGEX_COMPLAIN ${CMAKE_C_INCLUDE_REGEX_COMPLAIN})
|
|
@ -1 +0,0 @@
|
|||
0
|
|
@ -2,4 +2,5 @@
|
|||
RewriteEngine on
|
||||
RewriteRule ^$ webroot/ [L]
|
||||
RewriteRule (.*) webroot/$1 [L]
|
||||
RewriteBase /zm/api
|
||||
</IfModule>
|
|
@ -222,12 +222,12 @@
|
|||
/**
|
||||
* A random string used in security hashing methods.
|
||||
*/
|
||||
Configure::write('Security.salt', 'y8s4nPwjdjrmAGRxtnbxWhOknOBX6y1etr6RD8XM');
|
||||
Configure::write('Security.salt', 'Q0MjGG2xRQEhJVQR85WhFJKI7f2St8RYMlVR7GNQ');
|
||||
|
||||
/**
|
||||
* A random numeric string (digits only) used to encrypt/decrypt strings.
|
||||
*/
|
||||
Configure::write('Security.cipherSeed', '28284715058574819699789789248');
|
||||
Configure::write('Security.cipherSeed', '02670120062639232092038865362');
|
||||
|
||||
/**
|
||||
* Apply timestamps with the last modified time to static assets (js, css, images).
|
||||
|
|
|
@ -1,34 +0,0 @@
|
|||
# Install script for directory: /home/ubuntu/zm/ZoneMinder/web/api
|
||||
|
||||
# Set the install prefix
|
||||
IF(NOT DEFINED CMAKE_INSTALL_PREFIX)
|
||||
SET(CMAKE_INSTALL_PREFIX "/usr/local")
|
||||
ENDIF(NOT DEFINED CMAKE_INSTALL_PREFIX)
|
||||
STRING(REGEX REPLACE "/$" "" CMAKE_INSTALL_PREFIX "${CMAKE_INSTALL_PREFIX}")
|
||||
|
||||
# Set the install configuration name.
|
||||
IF(NOT DEFINED CMAKE_INSTALL_CONFIG_NAME)
|
||||
IF(BUILD_TYPE)
|
||||
STRING(REGEX REPLACE "^[^A-Za-z0-9_]+" ""
|
||||
CMAKE_INSTALL_CONFIG_NAME "${BUILD_TYPE}")
|
||||
ELSE(BUILD_TYPE)
|
||||
SET(CMAKE_INSTALL_CONFIG_NAME "Release")
|
||||
ENDIF(BUILD_TYPE)
|
||||
MESSAGE(STATUS "Install configuration: \"${CMAKE_INSTALL_CONFIG_NAME}\"")
|
||||
ENDIF(NOT DEFINED CMAKE_INSTALL_CONFIG_NAME)
|
||||
|
||||
# Set the component getting installed.
|
||||
IF(NOT CMAKE_INSTALL_COMPONENT)
|
||||
IF(COMPONENT)
|
||||
MESSAGE(STATUS "Install component: \"${COMPONENT}\"")
|
||||
SET(CMAKE_INSTALL_COMPONENT "${COMPONENT}")
|
||||
ELSE(COMPONENT)
|
||||
SET(CMAKE_INSTALL_COMPONENT)
|
||||
ENDIF(COMPONENT)
|
||||
ENDIF(NOT CMAKE_INSTALL_COMPONENT)
|
||||
|
||||
# Install shared libraries without execute permission?
|
||||
IF(NOT DEFINED CMAKE_INSTALL_SO_NO_EXE)
|
||||
SET(CMAKE_INSTALL_SO_NO_EXE "1")
|
||||
ENDIF(NOT DEFINED CMAKE_INSTALL_SO_NO_EXE)
|
||||
|
|
@ -70,6 +70,8 @@ $eventCounts = array(
|
|||
|
||||
$running = daemonCheck();
|
||||
$status = $running?translate('Running'):translate('Stopped');
|
||||
$run_state_array = dbFetchOne('select Name from States where IsActive = 1');
|
||||
$run_state = implode($run_state_array);
|
||||
|
||||
$group = NULL;
|
||||
if ( ! empty($_COOKIE['zmGroup']) ) {
|
||||
|
@ -188,7 +190,7 @@ xhtmlHeaders( __FILE__, translate('Console') );
|
|||
<div id="header">
|
||||
<h3 id="systemTime"><?php echo preg_match( '/%/', DATE_FMT_CONSOLE_LONG )?strftime( DATE_FMT_CONSOLE_LONG ):date( DATE_FMT_CONSOLE_LONG ) ?></h3>
|
||||
<h3 id="systemStats"><?php echo translate('Load') ?>: <?php echo getLoad() ?> / <?php echo translate('Disk') ?>: <?php echo getDiskPercent() ?>%</h3>
|
||||
<h2 id="title"><a href="http://www.zoneminder.com" target="ZoneMinder">ZoneMinder</a> <?php echo translate('Console') ?> - <?php echo makePopupLink( '?view=state', 'zmState', 'state', $status, canEdit( 'System' ) ) ?> - <?php echo makePopupLink( '?view=version', 'zmVersion', 'version', '<span class="'.$versionClass.'">v'.ZM_VERSION.'</span>', canEdit( 'System' ) ) ?></h2>
|
||||
<h2 id="title"><a href="http://www.zoneminder.com" target="ZoneMinder">ZoneMinder</a> <?php echo translate('Console') ?> - <?php echo makePopupLink( '?view=state', 'zmState', 'state', $status, canEdit( 'System' ) ) ?> - <?php echo $run_state ?> <?php echo makePopupLink( '?view=version', 'zmVersion', 'version', '<span class="'.$versionClass.'">v'.ZM_VERSION.'</span>', canEdit( 'System' ) ) ?></h2>
|
||||
<div class="clear"></div>
|
||||
<div id="monitorSummary"><?php echo makePopupLink( '?view=groups', 'zmGroups', 'groups', translate('Group') . ': ' . ($group?' ('.$group['Name'].')':'All').': '. sprintf( $CLANG['MonitorCount'], count($displayMonitors), zmVlang( $VLANG['Monitor'], count($displayMonitors) ) ) ); ?></div>
|
||||
<?php
|
||||
|
|
|
@ -63,7 +63,7 @@ foreach( $monitors as $monitor )
|
|||
$scale = getDeviceScale( $monitor['Width'], $monitor['Height'], $imagesPerLine*1.1 );
|
||||
$imagePath = getStreamSrc( array( "mode=single", "monitor=".$monitor['Id'], "scale=".$scale ), '&' );
|
||||
?>
|
||||
<a href="?view=watch&mid=<?php echo $monitor['Id'] ?>"><img src="<?php echo viewImagePath( $imagePath ) ?>" alt="<?php echo $monitor['Name'] ?>"/></a>
|
||||
<a href="?view=watch&mid=<?php echo $monitor['Id'] ?>"><img src="<?php echo $imagePath ?>" alt="<?php echo $monitor['Name'] ?>"/></a>
|
||||
<?php
|
||||
}
|
||||
?>
|
||||
|
|
Loading…
Reference in New Issue