Merge branch 'master' into feature-h264-videostorage
Conflicts: configure.ac src/zm_config_defines.h src/zm_ffmpeg.h web/index.phppull/532/head
commit
33090f2264
|
@ -10,3 +10,4 @@ stamp-h1
|
|||
stamp-h.in
|
||||
scripts/ZoneMinder/blib
|
||||
Makefile.in
|
||||
docs/_build
|
||||
|
|
11
.travis.yml
11
.travis.yml
|
@ -18,8 +18,7 @@ compiler:
|
|||
- gcc
|
||||
before_install:
|
||||
- sudo apt-get update -qq
|
||||
- sudo apt-get upgrade -y -qq
|
||||
- sudo apt-get install -y -qq apache2 mysql-server php5 php5-mysql 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 subversion automake autoconf cmake libjpeg-turbo8-dev libjpeg-turbo8 apache2-mpm-prefork libapache2-mod-php5 php5-cli libtheora-dev libvorbis-dev libvpx-dev libx264-dev 2>&1 > /dev/null
|
||||
- sudo apt-get install -y -qq zlib1g-dev apache2 mysql-server php5 php5-mysql build-essential libmysqlclient-dev libssl-dev libbz2-dev libpcre3-dev libdbi-perl libarchive-zip-perl libdate-manip-perl libdevice-serialport-perl libmime-perl libwww-perl libdbd-mysql-perl libsys-mmap-perl yasm automake autoconf cmake libjpeg-turbo8-dev apache2-mpm-prefork libapache2-mod-php5 php5-cli libtheora-dev libvorbis-dev libvpx-dev libx264-dev 2>&1 > /dev/null
|
||||
install:
|
||||
- git clone --depth=10 --branch=master git://source.ffmpeg.org/ffmpeg.git
|
||||
- cd ffmpeg
|
||||
|
@ -34,16 +33,16 @@ before_script:
|
|||
- if [ "$ZM_BUILDMETHOD" = "autotools" ]; then autoheader; fi
|
||||
- if [ "$ZM_BUILDMETHOD" = "autotools" ]; then automake --force-missing --add-missing; fi
|
||||
- if [ "$ZM_BUILDMETHOD" = "autotools" ]; then autoconf; fi
|
||||
- mysql -uroot -e "CREATE DATABASE IF NOT EXISTS zm"
|
||||
- mysql -uroot -e "GRANT ALL ON zm.* TO 'zmuser'@'localhost' IDENTIFIED BY 'zmpass'";
|
||||
- mysql -uroot -e "FLUSH PRIVILEGES"
|
||||
script:
|
||||
- if [ "$ZM_BUILDMETHOD" = "autotools" ]; then ./configure --prefix=/usr --with-libarch=lib/$DEB_HOST_GNU_TYPE --host=$DEB_HOST_GNU_TYPE --build=$DEB_BUILD_GNU_TYPE --with-mysql=/usr --with-ffmpeg=/usr --with-webdir=/usr/share/zoneminder/www --with-cgidir=/usr/libexec/zoneminder/cgi-bin --with-webuser=www-data --with-webgroup=www-data --enable-crashtrace=yes --disable-debug --enable-mmap=yes ZM_SSL_LIB=openssl; fi
|
||||
- if [ "$ZM_BUILDMETHOD" = "cmake" ]; then cmake -DCMAKE_INSTALL_PREFIX="/usr"; fi
|
||||
- make
|
||||
- sudo make install
|
||||
after_success:
|
||||
- if [ "$ZM_BUILDMETHOD" = "cmake" ]; then sudo ./zmlinkcontent.sh; fi
|
||||
- mysql -uroot -e "CREATE DATABASE IF NOT EXISTS zm"
|
||||
- mysql -uroot -e "GRANT ALL ON zm.* TO 'zmuser'@'localhost' IDENTIFIED BY 'zmpass'";
|
||||
- mysql -uroot -e "FLUSH PRIVILEGES"
|
||||
- mysql -uzmuser -pzmpass < db/zm_create.sql
|
||||
- mysql -uzmuser -pzmpass zm < db/test.monitor.sql
|
||||
- sudo zmpkg.pl start
|
||||
- sudo zmfilter.pl -f purgewhenfull
|
||||
|
|
415
CMakeLists.txt
415
CMakeLists.txt
|
@ -9,15 +9,20 @@
|
|||
# For more information and installation, see the INSTALL file
|
||||
#
|
||||
cmake_minimum_required (VERSION 2.6)
|
||||
project (ZoneMinder)
|
||||
# ZoneMinder version
|
||||
set(ZoneMinder_VERSION "1.26.3")
|
||||
project (zoneminder)
|
||||
set(zoneminder_VERSION "1.27")
|
||||
|
||||
# CMake does not allow out-of-source build if CMakeCache.exists in the source folder. Abort and notify the user to save him from headache why it doesn't work.
|
||||
if((NOT (CMAKE_BINARY_DIR STREQUAL CMAKE_SOURCE_DIR)) AND (EXISTS "${CMAKE_SOURCE_DIR}/CMakeCache.txt"))
|
||||
message(FATAL_ERROR " You are attempting to do an out-of-source build, but a cmake cache file for an in-source build exists. Please delete the file CMakeCache.txt from the source folder to proceed.")
|
||||
endif((NOT (CMAKE_BINARY_DIR STREQUAL CMAKE_SOURCE_DIR)) AND (EXISTS "${CMAKE_SOURCE_DIR}/CMakeCache.txt"))
|
||||
|
||||
# Default build type. To change the build type, use the CMAKE_BUILD_TYPE configuration option.
|
||||
if(NOT CMAKE_BUILD_TYPE)
|
||||
set(CMAKE_BUILD_TYPE Release CACHE STRING "Build type: Release or Debug" FORCE)
|
||||
endif(NOT CMAKE_BUILD_TYPE)
|
||||
|
||||
# Can make finding problems easier when troubleshooting.
|
||||
# Can assist in troubleshooting
|
||||
#set(CMAKE_VERBOSE_MAKEFILE ON)
|
||||
#set(CMAKE_INSTALL_ALWAYS ON)
|
||||
|
||||
|
@ -28,25 +33,24 @@ set(CMAKE_C_FLAGS_DEBUG "-Wall -D__STDC_CONSTANT_MACROS -g")
|
|||
set(CMAKE_CXX_FLAGS_DEBUG "-Wall -D__STDC_CONSTANT_MACROS -g")
|
||||
set(CMAKE_INCLUDE_CURRENT_DIR ON)
|
||||
set(CMAKE_MODULE_PATH ${CMAKE_MODULE_PATH} "${CMAKE_SOURCE_DIR}/cmake/Modules/")
|
||||
|
||||
# Modules that we need:
|
||||
include (GNUInstallDirs)
|
||||
include (CheckIncludeFile)
|
||||
include (CheckIncludeFiles)
|
||||
include (CheckFunctionExists)
|
||||
include (CheckPrototypeDefinition)
|
||||
include (CheckPrototypeDefinition_fixed)
|
||||
include (CheckTypeSize)
|
||||
include (CheckStructHasMember)
|
||||
|
||||
# Default variables for some configuration options
|
||||
mark_as_advanced(FORCE ZM_EXTRA_LIBS ZM_MYSQL_ENGINE ZM_NO_MMAP ZM_NO_CRASHTRACE CMAKE_INSTALL_FULL_BINDIR)
|
||||
# Configuration options
|
||||
mark_as_advanced(FORCE ZM_EXTRA_LIBS ZM_MYSQL_ENGINE ZM_NO_MMAP CMAKE_INSTALL_FULL_BINDIR ZM_PERL_SUBPREFIX ZM_PERL_USE_PATH ZM_TARGET_DISTRO)
|
||||
set(ZM_RUNDIR "/var/run/zm" CACHE PATH "Location of transient process files, default: /var/run/zm")
|
||||
set(ZM_TMPDIR "/tmp/zm" CACHE PATH "Location of temporary files, default: /tmp/zm")
|
||||
set(ZM_LOGDIR "/var/log/zm" CACHE PATH "Location of generated log files, default: /var/log/zm")
|
||||
set(ZM_WEBDIR "${CMAKE_INSTALL_PREFIX}/${CMAKE_INSTALL_DATADIR}/zoneminder/www" CACHE PATH "Location of the web files, default: <prefix>/${CMAKE_INSTALL_DATADIR}/zoneminder/www")
|
||||
set(ZM_CGIDIR "${CMAKE_INSTALL_PREFIX}/${CMAKE_INSTALL_LIBEXECDIR}/zoneminder/cgi-bin" CACHE PATH "Location of the cgi-bin files, default: <prefix>/${CMAKE_INSTALL_LIBEXECDIR}/zoneminder/cgi-bin")
|
||||
set(ZM_CONTENTDIR "/var/lib/zoneminder" CACHE PATH "Location of dynamic content (events and images), default: /var/lib/zoneminder")
|
||||
# This one is not needed anymore. we do automatic detection of whats available, let ZM know and have ZM decide
|
||||
#set(ZM_SSL_LIB "openssl" CACHE STRING "Library to use for ssl functions, default: openssl")
|
||||
set(ZM_DB_HOST "localhost" CACHE STRING "Hostname where ZoneMinder database located, default: localhost")
|
||||
set(ZM_DB_NAME "zm" CACHE STRING "Name of ZoneMinder database, default: zm")
|
||||
set(ZM_DB_USER "zmuser" CACHE STRING "Name of ZoneMinder database user, default: zmuser")
|
||||
|
@ -57,34 +61,51 @@ set(ZM_WEB_GROUP "" CACHE STRING "The group apache or the local web server runs
|
|||
set(ZM_EXTRA_LIBS "" CACHE STRING "A list of optional libraries, separated by semicolons, e.g. ssl;theora")
|
||||
set(ZM_MYSQL_ENGINE "InnoDB" CACHE STRING "MySQL engine to use with database, default: InnoDB")
|
||||
set(ZM_NO_MMAP "OFF" CACHE BOOL "Set to ON to not use mmap shared memory. Shouldn't be enabled unless you experience problems with the shared memory. default: OFF")
|
||||
set(ZM_NO_CRASHTRACE "OFF" CACHE BOOL "Set to ON to skip crash trace code. Useful if zm_signal.cpp fails to compile. default: OFF")
|
||||
# Only required for cmakecacheimport:
|
||||
set(CMAKE_INSTALL_FULL_BINDIR "${CMAKE_INSTALL_PREFIX}/${CMAKE_INSTALL_BINDIR}" CACHE PATH "Override default binary directory")
|
||||
set(ZM_NO_FFMPEG "OFF" CACHE BOOL "Set to ON to skip ffmpeg checks and force building ZM without ffmpeg. default: OFF")
|
||||
set(ZM_NO_LIBVLC "OFF" CACHE BOOL "Set to ON to skip libvlc checks and force building ZM without libvlc. default: OFF")
|
||||
set(ZM_NO_CURL "OFF" CACHE BOOL "Set to ON to skip cURL checks and force building ZM without cURL. default: OFF")
|
||||
set(ZM_NO_X10 "OFF" CACHE BOOL "Set to ON to build ZoneMinder without X10 support. default: OFF")
|
||||
set(ZM_PERL_SUBPREFIX "${CMAKE_INSTALL_LIBDIR}/perl5" CACHE PATH "Use a different directory for the zm perl modules. NOTE: This is a subprefix, e.g. lib will be turned into <prefix>/lib, default: <libdir>/perl5")
|
||||
set(ZM_PERL_USE_PATH "${CMAKE_INSTALL_PREFIX}/${ZM_PERL_SUBPREFIX}" CACHE PATH "Override the include path for zm perl modules. Useful if you are moving the perl modules without using the ZM_PERL_SUBPREFIX option. default: <prefix>/<zmperlsubprefix>")
|
||||
set(ZM_TARGET_DISTRO "" CACHE STRING "Build ZoneMinder for a specific distribution. Currently, valid names are: f19, el6, OS13")
|
||||
|
||||
# Reassign some variables if a target distro has been specified
|
||||
if((ZM_TARGET_DISTRO STREQUAL "f19") OR (ZM_TARGET_DISTRO STREQUAL "el6"))
|
||||
set(ZM_RUNDIR "/var/run/zoneminder")
|
||||
set(ZM_TMPDIR "/var/lib/zoneminder/temp")
|
||||
set(ZM_LOGDIR "/var/log/zoneminder")
|
||||
elseif(ZM_TARGET_DISTRO STREQUAL "OS13")
|
||||
set(ZM_RUNDIR "/var/run/zoneminder")
|
||||
set(ZM_TMPDIR "/var/run/zoneminder")
|
||||
set(ZM_CONTENTDIR "/var/run/zoneminder")
|
||||
set(ZM_LOGDIR "/var/log/zoneminder")
|
||||
set(ZM_WEB_USER "wwwrun")
|
||||
set(ZM_WEB_GROUP "www")
|
||||
set(ZM_WEBDIR "/srv/www/htdocs/zoneminder")
|
||||
set(ZM_CGIDIR "/srv/www/cgi-bin")
|
||||
endif((ZM_TARGET_DISTRO STREQUAL "f19") OR (ZM_TARGET_DISTRO STREQUAL "el6"))
|
||||
|
||||
# Required for certain checks to work
|
||||
set(CMAKE_EXTRA_INCLUDE_FILES ${CMAKE_EXTRA_INCLUDE_FILES} stdio.h stdlib.h math.h signal.h)
|
||||
# Required for including headers from the this folder
|
||||
include_directories("${CMAKE_CURRENT_BINARY_DIR}")
|
||||
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)
|
||||
|
||||
# Check for misc required stuff
|
||||
# System checks
|
||||
check_include_file("linux/videodev.h" HAVE_LINUX_VIDEODEV_H)
|
||||
check_include_file("linux/videodev2.h" HAVE_LINUX_VIDEODEV2_H)
|
||||
check_include_file("execinfo.h" HAVE_EXECINFO_H)
|
||||
check_include_file("ucontext.h" HAVE_UCONTEXT_H)
|
||||
check_include_file("sys/sendfile.h" HAVE_SYS_SENDFILE_H)
|
||||
check_include_file("sys/syscall.h" HAVE_SYS_SYSCALL_H)
|
||||
check_function_exists("syscall" HAVE_SYSCALL)
|
||||
check_function_exists("sendfile" HAVE_SENDFILE)
|
||||
check_function_exists("backtrace" HAVE_DECL_BACKTRACE)
|
||||
check_function_exists("backtrace_symbols" HAVE_DECL_BACKTRACE_SYMBOLS)
|
||||
check_function_exists("posix_memalign" HAVE_POSIX_MEMALIGN)
|
||||
check_function_exists("strsignal" HAVE_STRSIGNAL)
|
||||
check_prototype_definition("round" "double round (double x)" "0.0" "math.h" HAVE_DECL_ROUND)
|
||||
check_type_size("siginfo_t" SIGINFO_T)
|
||||
check_type_size("ucontext_t" UCONTEXT_T)
|
||||
check_type_size("struct sigcontext" STRUCT_SIGCONTEXT)
|
||||
check_struct_has_member("struct sigcontext" eip signal.h HAVE_STRUCT_SIGCONTEXT_EIP)
|
||||
check_struct_has_member("struct sigcontext" rip signal.h HAVE_STRUCT_SIGCONTEXT_RIP)
|
||||
check_type_size("siginfo_t" HAVE_SIGINFO_T)
|
||||
check_type_size("ucontext_t" HAVE_UCONTEXT_T)
|
||||
|
||||
# *** LIBRARY CHECKS ***
|
||||
|
||||
|
@ -92,19 +113,43 @@ check_struct_has_member("struct sigcontext" rip signal.h HAVE_STRUCT_SIGCONTEXT_
|
|||
find_package(ZLIB)
|
||||
if(ZLIB_FOUND)
|
||||
set(HAVE_LIBZLIB 1)
|
||||
list(APPEND ZM_BIN_LIBS ${ZLIB_LIBRARIES})
|
||||
include_directories(${ZLIB_INCLUDE_DIR})
|
||||
list(APPEND ZM_BIN_LIBS "${ZLIB_LIBRARIES}")
|
||||
include_directories("${ZLIB_INCLUDE_DIR}")
|
||||
set(CMAKE_REQUIRED_INCLUDES "${ZLIB_INCLUDE_DIR}")
|
||||
check_include_file("zlib.h" HAVE_ZLIB_H)
|
||||
set(optlibsfound "${optlibsfound} zlib")
|
||||
else(ZLIB_FOUND)
|
||||
set(optlibsnotfound "${optlibsnotfound} zlib")
|
||||
endif(ZLIB_FOUND)
|
||||
|
||||
# Do not check for cURL if ZM_NO_CURL is on
|
||||
if(NOT ZM_NO_CURL)
|
||||
# cURL
|
||||
find_package(CURL)
|
||||
if(CURL_FOUND)
|
||||
set(HAVE_LIBCURL 1)
|
||||
list(APPEND ZM_BIN_LIBS ${CURL_LIBRARIES})
|
||||
include_directories(${CURL_INCLUDE_DIRS})
|
||||
set(CMAKE_REQUIRED_INCLUDES ${CURL_INCLUDE_DIRS})
|
||||
check_include_file("curl/curl.h" HAVE_CURL_CURL_H)
|
||||
set(optlibsfound "${optlibsfound} cURL")
|
||||
else(CURL_FOUND)
|
||||
set(optlibsnotfound "${optlibsnotfound} cURL")
|
||||
endif(CURL_FOUND)
|
||||
endif(NOT ZM_NO_CURL)
|
||||
|
||||
# jpeg
|
||||
find_package(JPEG)
|
||||
if(JPEG_FOUND)
|
||||
set(HAVE_LIBJPEG 1)
|
||||
list(APPEND ZM_BIN_LIBS ${JPEG_LIBRARIES})
|
||||
include_directories(${JPEG_INCLUDE_DIR})
|
||||
check_include_files("stdio.h;jpeglib.h" HAVE_JPEGLIB_H)
|
||||
list(APPEND ZM_BIN_LIBS "${JPEG_LIBRARIES}")
|
||||
#link_directories(${JPEG_LIBRARY})
|
||||
include_directories("${JPEG_INCLUDE_DIR}")
|
||||
set(CMAKE_REQUIRED_INCLUDES "${JPEG_INCLUDE_DIR}")
|
||||
check_include_files("stdio.h;jpeglib.h" HAVE_JPEGLIB_H)
|
||||
if(NOT HAVE_JPEGLIB_H)
|
||||
message(FATAL_ERROR " zm requires libjpeg headers - check that libjpeg development packages are installed")
|
||||
endif(NOT HAVE_JPEGLIB_H)
|
||||
else(JPEG_FOUND)
|
||||
message(FATAL_ERROR "zm requires jpeg but it was not found on your system")
|
||||
endif(JPEG_FOUND)
|
||||
|
@ -113,104 +158,225 @@ endif(JPEG_FOUND)
|
|||
find_package(OpenSSL)
|
||||
if(OPENSSL_FOUND)
|
||||
set(HAVE_LIBOPENSSL 1)
|
||||
list(APPEND ZM_BIN_LIBS ${OPENSSL_LIBRARIES})
|
||||
include_directories(${OPENSSL_INCLUDE_DIR})
|
||||
check_include_file("openssl/md5.h" HAVE_OPENSSL_MD5_H)
|
||||
endif(OPENSSL_FOUND)
|
||||
# crypto using find_library.
|
||||
# This library should be a part of the OpenSSL package but just need to be sure
|
||||
# In any case, we still need to define HAVE_LIBCRYPTO for zm if its available
|
||||
find_library(CRYPTO_LIBRARIES crypto)
|
||||
if(CRYPTO_LIBRARIES)
|
||||
set(HAVE_LIBCRYPTO 1)
|
||||
list(APPEND ZM_BIN_LIBS ${CRYPTO_LIBRARIES})
|
||||
endif(CRYPTO_LIBRARIES)
|
||||
list(APPEND ZM_BIN_LIBS "${OPENSSL_LIBRARIES}")
|
||||
include_directories("${OPENSSL_INCLUDE_DIR}")
|
||||
set(CMAKE_REQUIRED_INCLUDES "${OPENSSL_INCLUDE_DIR}")
|
||||
check_include_file("openssl/md5.h" HAVE_OPENSSL_MD5_H)
|
||||
set(optlibsfound "${optlibsfound} OpenSSL")
|
||||
else(OPENSSL_FOUND)
|
||||
set(optlibsnotfound "${optlibsnotfound} OpenSSL")
|
||||
endif(OPENSSL_FOUND)
|
||||
|
||||
# pthread using find_library
|
||||
# pthread (using find_library and find_path)
|
||||
find_library(PTHREAD_LIBRARIES pthread)
|
||||
if(PTHREAD_LIBRARIES)
|
||||
set(HAVE_LIBPTHREAD 1)
|
||||
list(APPEND ZM_BIN_LIBS ${PTHREAD_LIBRARIES})
|
||||
list(APPEND ZM_BIN_LIBS "${PTHREAD_LIBRARIES}")
|
||||
find_path(PTHREAD_INCLUDE_DIR pthread.h)
|
||||
if(PTHREAD_INCLUDE_DIR)
|
||||
include_directories("${PTHREAD_INCLUDE_DIR}")
|
||||
set(CMAKE_REQUIRED_INCLUDES "${PTHREAD_INCLUDE_DIR}")
|
||||
endif(PTHREAD_INCLUDE_DIR)
|
||||
mark_as_advanced(FORCE PTHREAD_LIBRARIES PTHREAD_INCLUDE_DIR)
|
||||
check_include_file("pthread.h" HAVE_PTHREAD_H)
|
||||
if(NOT HAVE_PTHREAD_H)
|
||||
message(FATAL_ERROR " zm requires pthread headers - check that pthread development packages are installed")
|
||||
endif(NOT HAVE_PTHREAD_H)
|
||||
else(PTHREAD_LIBRARIES)
|
||||
message(FATAL_ERROR "zm requires pthread but it was not found on your system")
|
||||
endif(PTHREAD_LIBRARIES)
|
||||
|
||||
# pcre using find_library
|
||||
# pcre (using find_library and find_path)
|
||||
find_library(PCRE_LIBRARIES pcre)
|
||||
if(PCRE_LIBRARIES)
|
||||
set(HAVE_LIBPCRE 1)
|
||||
list(APPEND ZM_BIN_LIBS ${PCRE_LIBRARIES})
|
||||
list(APPEND ZM_BIN_LIBS "${PCRE_LIBRARIES}")
|
||||
find_path(PCRE_INCLUDE_DIR pcre.h)
|
||||
if(PCRE_INCLUDE_DIR)
|
||||
include_directories("${PCRE_INCLUDE_DIR}")
|
||||
set(CMAKE_REQUIRED_INCLUDES "${PCRE_INCLUDE_DIR}")
|
||||
endif(PCRE_INCLUDE_DIR)
|
||||
mark_as_advanced(FORCE PCRE_LIBRARIES PCRE_INCLUDE_DIR)
|
||||
check_include_file("pcre.h" HAVE_PCRE_H)
|
||||
set(optlibsfound "${optlibsfound} PCRE")
|
||||
else(PCRE_LIBRARIES)
|
||||
set(optlibsnotfound "${optlibsnotfound} PCRE")
|
||||
endif(PCRE_LIBRARIES)
|
||||
|
||||
# gcrypt using find_library
|
||||
# gcrypt (using find_library and find_path)
|
||||
find_library(GCRYPT_LIBRARIES gcrypt)
|
||||
if(GCRYPT_LIBRARIES)
|
||||
set(HAVE_LIBGCRYPT 1)
|
||||
list(APPEND ZM_BIN_LIBS ${GCRYPT_LIBRARIES})
|
||||
list(APPEND ZM_BIN_LIBS "${GCRYPT_LIBRARIES}")
|
||||
find_path(GCRYPT_INCLUDE_DIR gcrypt.h)
|
||||
if(GCRYPT_INCLUDE_DIR)
|
||||
include_directories("${GCRYPT_INCLUDE_DIR}")
|
||||
set(CMAKE_REQUIRED_INCLUDES "${GCRYPT_INCLUDE_DIR}")
|
||||
endif(GCRYPT_INCLUDE_DIR)
|
||||
mark_as_advanced(FORCE GCRYPT_LIBRARIES GCRYPT_INCLUDE_DIR)
|
||||
check_include_file("gcrypt.h" HAVE_GCRYPT_H)
|
||||
set(optlibsfound "${optlibsfound} GCrypt")
|
||||
else(GCRYPT_LIBRARIES)
|
||||
set(optlibsnotfound "${optlibsnotfound} GCrypt")
|
||||
endif(GCRYPT_LIBRARIES)
|
||||
|
||||
# gnutls using find_library
|
||||
# gnutls (using find_library and find_path)
|
||||
find_library(GNUTLS_LIBRARIES gnutls)
|
||||
if(GNUTLS_LIBRARIES)
|
||||
set(HAVE_LIBGNUTLS 1)
|
||||
list(APPEND ZM_BIN_LIBS ${GNUTLS_LIBRARIES})
|
||||
list(APPEND ZM_BIN_LIBS "${GNUTLS_LIBRARIES}")
|
||||
find_path(GNUTLS_INCLUDE_DIR gnutls/gnutls.h)
|
||||
if(GNUTLS_INCLUDE_DIR)
|
||||
include_directories("${GNUTLS_INCLUDE_DIR}")
|
||||
set(CMAKE_REQUIRED_INCLUDES "${GNUTLS_INCLUDE_DIR}")
|
||||
endif(GNUTLS_INCLUDE_DIR)
|
||||
mark_as_advanced(FORCE GNUTLS_LIBRARIES GNUTLS_INCLUDE_DIR)
|
||||
check_include_file("gnutls/openssl.h" HAVE_GNUTLS_OPENSSL_H)
|
||||
check_include_file("gnutls/gnutls.h" HAVE_GNUTLS_GNUTLS_H)
|
||||
set(optlibsfound "${optlibsfound} GnuTLS")
|
||||
else(GNUTLS_LIBRARIES)
|
||||
set(optlibsnotfound "${optlibsnotfound} GnuTLS")
|
||||
endif(GNUTLS_LIBRARIES)
|
||||
|
||||
# mysqlclient using find_library
|
||||
# mysqlclient (using find_library and find_path)
|
||||
find_library(MYSQLCLIENT_LIBRARIES mysqlclient PATH_SUFFIXES mysql)
|
||||
if(MYSQLCLIENT_LIBRARIES)
|
||||
set(HAVE_LIBMYSQLCLIENT 1)
|
||||
list(APPEND ZM_BIN_LIBS ${MYSQLCLIENT_LIBRARIES})
|
||||
list(APPEND ZM_BIN_LIBS "${MYSQLCLIENT_LIBRARIES}")
|
||||
find_path(MYSQLCLIENT_INCLUDE_DIR mysql/mysql.h)
|
||||
if(MYSQLCLIENT_INCLUDE_DIR)
|
||||
include_directories("${MYSQLCLIENT_INCLUDE_DIR}")
|
||||
set(CMAKE_REQUIRED_INCLUDES "${MYSQLCLIENT_INCLUDE_DIR}")
|
||||
endif(MYSQLCLIENT_INCLUDE_DIR)
|
||||
mark_as_advanced(FORCE MYSQLCLIENT_LIBRARIES MYSQLCLIENT_INCLUDE_DIR)
|
||||
check_include_file("mysql/mysql.h" HAVE_MYSQL_H)
|
||||
if(NOT HAVE_MYSQL_H)
|
||||
message(FATAL_ERROR "zm requires MySQL headers - check that MySQL development packages are installed")
|
||||
endif(NOT HAVE_MYSQL_H)
|
||||
else(MYSQLCLIENT_LIBRARIES)
|
||||
message(FATAL_ERROR "zm requires mysqlclient but it was not found on your system")
|
||||
endif(MYSQLCLIENT_LIBRARIES)
|
||||
|
||||
# avformat using find_library
|
||||
find_library(AVFORMAT_LIBRARIES avformat)
|
||||
if(AVFORMAT_LIBRARIES)
|
||||
set(HAVE_LIBAVFORMAT 1)
|
||||
list(APPEND ZM_BIN_LIBS ${AVFORMAT_LIBRARIES})
|
||||
check_include_file("libavformat/avformat.h" HAVE_LIBAVFORMAT_AVFORMAT_H)
|
||||
endif(AVFORMAT_LIBRARIES)
|
||||
set(PATH_FFMPEG "")
|
||||
set(OPT_FFMPEG "no")
|
||||
# Do not check for ffmpeg if ZM_NO_FFMPEG is on
|
||||
if(NOT ZM_NO_FFMPEG)
|
||||
# avformat (using find_library and find_path)
|
||||
find_library(AVFORMAT_LIBRARIES avformat)
|
||||
if(AVFORMAT_LIBRARIES)
|
||||
set(HAVE_LIBAVFORMAT 1)
|
||||
list(APPEND ZM_BIN_LIBS "${AVFORMAT_LIBRARIES}")
|
||||
find_path(AVFORMAT_INCLUDE_DIR "libavformat/avformat.h")
|
||||
if(AVFORMAT_INCLUDE_DIR)
|
||||
include_directories("${AVFORMAT_INCLUDE_DIR}")
|
||||
set(CMAKE_REQUIRED_INCLUDES "${AVFORMAT_INCLUDE_DIR}")
|
||||
endif(AVFORMAT_INCLUDE_DIR)
|
||||
mark_as_advanced(FORCE AVFORMAT_LIBRARIES AVFORMAT_INCLUDE_DIR)
|
||||
check_include_file("libavformat/avformat.h" HAVE_LIBAVFORMAT_AVFORMAT_H)
|
||||
set(optlibsfound "${optlibsfound} AVFormat")
|
||||
else(AVFORMAT_LIBRARIES)
|
||||
set(optlibsnotfound "${optlibsnotfound} AVFormat")
|
||||
endif(AVFORMAT_LIBRARIES)
|
||||
|
||||
# avcodec using find_library
|
||||
find_library(AVCODEC_LIBRARIES avcodec)
|
||||
if(AVCODEC_LIBRARIES)
|
||||
set(HAVE_LIBAVCODEC 1)
|
||||
list(APPEND ZM_BIN_LIBS ${AVCODEC_LIBRARIES})
|
||||
check_include_file("libavcodec/avcodec.h" HAVE_LIBAVCODEC_AVCODEC_H)
|
||||
endif(AVCODEC_LIBRARIES)
|
||||
# avcodec (using find_library and find_path)
|
||||
find_library(AVCODEC_LIBRARIES avcodec)
|
||||
if(AVCODEC_LIBRARIES)
|
||||
set(HAVE_LIBAVCODEC 1)
|
||||
list(APPEND ZM_BIN_LIBS "${AVCODEC_LIBRARIES}")
|
||||
find_path(AVCODEC_INCLUDE_DIR "libavcodec/avcodec.h")
|
||||
if(AVCODEC_INCLUDE_DIR)
|
||||
include_directories("${AVCODEC_INCLUDE_DIR}")
|
||||
set(CMAKE_REQUIRED_INCLUDES "${AVCODEC_INCLUDE_DIR}")
|
||||
endif(AVCODEC_INCLUDE_DIR)
|
||||
mark_as_advanced(FORCE AVCODEC_LIBRARIES AVCODEC_INCLUDE_DIR)
|
||||
check_include_file("libavcodec/avcodec.h" HAVE_LIBAVCODEC_AVCODEC_H)
|
||||
set(optlibsfound "${optlibsfound} AVCodec")
|
||||
else(AVCODEC_LIBRARIES)
|
||||
set(optlibsnotfound "${optlibsnotfound} AVCodec")
|
||||
endif(AVCODEC_LIBRARIES)
|
||||
|
||||
# avdevice using find_library
|
||||
find_library(AVDEVICE_LIBRARIES avdevice)
|
||||
if(AVDEVICE_LIBRARIES)
|
||||
set(HAVE_LIBAVDEVICE 1)
|
||||
list(APPEND ZM_BIN_LIBS ${AVDEVICE_LIBRARIES})
|
||||
check_include_file("libavdevice/avdevice.h" HAVE_LIBAVDEVICE_AVDEVICE_H)
|
||||
endif(AVDEVICE_LIBRARIES)
|
||||
# avdevice (using find_library and find_path)
|
||||
find_library(AVDEVICE_LIBRARIES avdevice)
|
||||
if(AVDEVICE_LIBRARIES)
|
||||
set(HAVE_LIBAVDEVICE 1)
|
||||
list(APPEND ZM_BIN_LIBS "${AVDEVICE_LIBRARIES}")
|
||||
find_path(AVDEVICE_INCLUDE_DIR "libavdevice/avdevice.h")
|
||||
if(AVDEVICE_INCLUDE_DIR)
|
||||
include_directories("${AVDEVICE_INCLUDE_DIR}")
|
||||
set(CMAKE_REQUIRED_INCLUDES "${AVDEVICE_INCLUDE_DIR}")
|
||||
endif(AVDEVICE_INCLUDE_DIR)
|
||||
mark_as_advanced(FORCE AVDEVICE_LIBRARIES AVDEVICE_INCLUDE_DIR)
|
||||
check_include_file("libavdevice/avdevice.h" HAVE_LIBAVDEVICE_AVDEVICE_H)
|
||||
set(optlibsfound "${optlibsfound} AVDevice")
|
||||
else(AVDEVICE_LIBRARIES)
|
||||
set(optlibsnotfound "${optlibsnotfound} AVDevice")
|
||||
endif(AVDEVICE_LIBRARIES)
|
||||
|
||||
# avutil using find_library
|
||||
find_library(AVUTIL_LIBRARIES avutil)
|
||||
if(AVUTIL_LIBRARIES)
|
||||
set(HAVE_LIBAVUTIL 1)
|
||||
list(APPEND ZM_BIN_LIBS ${AVUTIL_LIBRARIES})
|
||||
check_include_file("libavutil/avutil.h" HAVE_LIBAVUTIL_AVUTIL_H)
|
||||
check_include_file("libavutil/mathematics.h" HAVE_LIBAVUTIL_MATHEMATICS_H)
|
||||
endif(AVUTIL_LIBRARIES)
|
||||
# avutil (using find_library and find_path)
|
||||
find_library(AVUTIL_LIBRARIES avutil)
|
||||
if(AVUTIL_LIBRARIES)
|
||||
set(HAVE_LIBAVUTIL 1)
|
||||
list(APPEND ZM_BIN_LIBS "${AVUTIL_LIBRARIES}")
|
||||
find_path(AVUTIL_INCLUDE_DIR "libavutil/avutil.h")
|
||||
if(AVUTIL_INCLUDE_DIR)
|
||||
include_directories("${AVUTIL_INCLUDE_DIR}")
|
||||
set(CMAKE_REQUIRED_INCLUDES "${AVUTIL_INCLUDE_DIR}")
|
||||
endif(AVUTIL_INCLUDE_DIR)
|
||||
mark_as_advanced(FORCE AVUTIL_LIBRARIES AVUTIL_INCLUDE_DIR)
|
||||
check_include_file("libavutil/avutil.h" HAVE_LIBAVUTIL_AVUTIL_H)
|
||||
check_include_file("libavutil/mathematics.h" HAVE_LIBAVUTIL_MATHEMATICS_H)
|
||||
set(optlibsfound "${optlibsfound} AVUtil")
|
||||
else(AVUTIL_LIBRARIES)
|
||||
set(optlibsnotfound "${optlibsnotfound} AVUtil")
|
||||
endif(AVUTIL_LIBRARIES)
|
||||
|
||||
# swscale using find_library
|
||||
find_library(SWSCALE_LIBRARIES swscale)
|
||||
if(SWSCALE_LIBRARIES)
|
||||
set(HAVE_LIBSWSCALE 1)
|
||||
list(APPEND ZM_BIN_LIBS ${SWSCALE_LIBRARIES})
|
||||
check_include_file("libswscale/swscale.h" HAVE_LIBSWSCALE_SWSCALE_H)
|
||||
endif(SWSCALE_LIBRARIES)
|
||||
# swscale (using find_library and find_path)
|
||||
find_library(SWSCALE_LIBRARIES swscale)
|
||||
if(SWSCALE_LIBRARIES)
|
||||
set(HAVE_LIBSWSCALE 1)
|
||||
list(APPEND ZM_BIN_LIBS "${SWSCALE_LIBRARIES}")
|
||||
find_path(SWSCALE_INCLUDE_DIR "libswscale/swscale.h")
|
||||
if(SWSCALE_INCLUDE_DIR)
|
||||
include_directories("${SWSCALE_INCLUDE_DIR}")
|
||||
set(CMAKE_REQUIRED_INCLUDES "${SWSCALE_INCLUDE_DIR}")
|
||||
endif(SWSCALE_INCLUDE_DIR)
|
||||
mark_as_advanced(FORCE SWSCALE_LIBRARIES SWSCALE_INCLUDE_DIR)
|
||||
check_include_file("libswscale/swscale.h" HAVE_LIBSWSCALE_SWSCALE_H)
|
||||
set(optlibsfound "${optlibsfound} SWScale")
|
||||
else(SWSCALE_LIBRARIES)
|
||||
set(optlibsnotfound "${optlibsnotfound} SWScale")
|
||||
endif(SWSCALE_LIBRARIES)
|
||||
|
||||
# Find the path to the ffmpeg executable
|
||||
find_program(FFMPEG_EXECUTABLE ffmpeg PATH_SUFFIXES ffmpeg)
|
||||
if(FFMPEG_EXECUTABLE)
|
||||
set(PATH_FFMPEG "${FFMPEG_EXECUTABLE}")
|
||||
set(OPT_FFMPEG "yes")
|
||||
mark_as_advanced(FFMPEG_EXECUTABLE)
|
||||
endif(FFMPEG_EXECUTABLE)
|
||||
|
||||
endif(NOT ZM_NO_FFMPEG)
|
||||
|
||||
# Do not check for libvlc if ZM_NO_LIBVLC is on
|
||||
if(NOT ZM_NO_LIBVLC)
|
||||
# libvlc (using find_library and find_path)
|
||||
find_library(LIBVLC_LIBRARIES vlc)
|
||||
if(LIBVLC_LIBRARIES)
|
||||
set(HAVE_LIBVLC 1)
|
||||
list(APPEND ZM_BIN_LIBS "${LIBVLC_LIBRARIES}")
|
||||
find_path(LIBVLC_INCLUDE_DIR "vlc/vlc.h")
|
||||
if(LIBVLC_INCLUDE_DIR)
|
||||
include_directories("${LIBVLC_INCLUDE_DIR}")
|
||||
set(CMAKE_REQUIRED_INCLUDES "${LIBVLC_INCLUDE_DIR}")
|
||||
endif(LIBVLC_INCLUDE_DIR)
|
||||
mark_as_advanced(FORCE LIBVLC_LIBRARIES LIBVLC_INCLUDE_DIR)
|
||||
check_include_file("vlc/vlc.h" HAVE_VLC_VLC_H)
|
||||
set(optlibsfound "${optlibsfound} libVLC")
|
||||
else(LIBVLC_LIBRARIES)
|
||||
set(optlibsnotfound "${optlibsnotfound} libVLC")
|
||||
endif(LIBVLC_LIBRARIES)
|
||||
endif(NOT ZM_NO_LIBVLC)
|
||||
|
||||
# *** END OF LIBRARY CHECKS ***
|
||||
|
||||
|
@ -219,17 +385,6 @@ if((NOT HAVE_LIBCRYPTO) AND (NOT HAVE_LIBGNUTLS))
|
|||
message(FATAL_ERROR " zm requires crypto or gnutls but none were found on your system")
|
||||
endif((NOT HAVE_LIBCRYPTO) AND (NOT HAVE_LIBGNUTLS))
|
||||
|
||||
# Check for absolutely required headers:
|
||||
if(NOT HAVE_MYSQL_H)
|
||||
message(FATAL_ERROR "zm requires MySQL headers - check that MySQL development packages are installed")
|
||||
endif(NOT HAVE_MYSQL_H)
|
||||
if(NOT HAVE_JPEGLIB_H)
|
||||
message(FATAL_ERROR " zm requires libjpeg headers - check that libjpeg development packages are installed")
|
||||
endif(NOT HAVE_JPEGLIB_H)
|
||||
if(NOT HAVE_PTHREAD_H)
|
||||
message(FATAL_ERROR " zm requires pthread headers - check that pthread development packages are installed")
|
||||
endif(NOT HAVE_PTHREAD_H)
|
||||
|
||||
# Check for V4L header files and enable ZM_HAS_V4L, ZM_HAS_V4L1, ZM_HAS_V4L2 accordingly
|
||||
# Setting to zeros first is required because ZM uses #define for these
|
||||
set(ZM_HAS_V4L 0)
|
||||
|
@ -251,16 +406,29 @@ set(ZM_PCRE 0)
|
|||
if(HAVE_LIBPCRE AND HAVE_PCRE_H)
|
||||
set(ZM_PCRE 1)
|
||||
endif(HAVE_LIBPCRE AND HAVE_PCRE_H)
|
||||
|
||||
# Check for mmap and enable in all components
|
||||
set(ZM_MEM_MAPPED 0)
|
||||
set(ENABLE_MMAP no)
|
||||
if(NOT ZM_NO_MMAP)
|
||||
set(ZM_MEM_MAPPED 1)
|
||||
set(ENABLE_MMAP yes)
|
||||
set(ZM_MMAP_PERLPACKAGE "Sys::Mmap")
|
||||
endif(NOT ZM_NO_MMAP)
|
||||
|
||||
# Check for authenication functions
|
||||
if(HAVE_OPENSSL_MD5_H)
|
||||
set(CMAKE_REQUIRED_LIBRARIES "${OPENSSL_LIBRARIES}")
|
||||
set(CMAKE_REQUIRED_INCLUDES "${OPENSSL_INCLUDE_DIR}")
|
||||
check_prototype_definition(MD5 "unsigned char *MD5(const unsigned char *d, size_t n, unsigned char *md)" "NULL" "openssl/md5.h" HAVE_MD5_OPENSSL)
|
||||
endif(HAVE_OPENSSL_MD5_H)
|
||||
if(HAVE_GNUTLS_OPENSSL_H)
|
||||
set(CMAKE_REQUIRED_LIBRARIES "${GNUTLS_LIBRARIES}")
|
||||
set(CMAKE_REQUIRED_INCLUDES "${GNUTLS_INCLUDE_DIR}")
|
||||
check_prototype_definition(MD5 "unsigned char *MD5 (const unsigned char *buf, unsigned long len, unsigned char *md)" "NULL" "gnutls/openssl.h" HAVE_MD5_GNUTLS)
|
||||
endif(HAVE_GNUTLS_OPENSSL_H)
|
||||
if(HAVE_GNUTLS_GNUTLS_H)
|
||||
set(CMAKE_REQUIRED_LIBRARIES "${GNUTLS_LIBRARIES}")
|
||||
set(CMAKE_REQUIRED_INCLUDES "${GNUTLS_INCLUDE_DIR}")
|
||||
check_prototype_definition(gnutls_fingerprint "int gnutls_fingerprint (gnutls_digest_algorithm_t algo, const gnutls_datum_t * data, void *result, size_t * result_size)" "0" "stdlib.h;gnutls/gnutls.h" HAVE_DECL_GNUTLS_FINGERPRINT)
|
||||
endif(HAVE_GNUTLS_GNUTLS_H)
|
||||
if(HAVE_MD5_OPENSSL OR HAVE_MD5_GNUTLS)
|
||||
|
@ -275,23 +443,12 @@ if(HAVE_LIBCRYPTO AND HAVE_OPENSSL_MD5_H AND HAVE_MD5_OPENSSL)
|
|||
set(HAVE_GNUTLS_OPENSSL_H 0)
|
||||
endif(HAVE_LIBCRYPTO AND HAVE_OPENSSL_MD5_H AND HAVE_MD5_OPENSSL)
|
||||
|
||||
# Disable backtrace if not available
|
||||
if((NOT ZM_NO_CRASHTRACE) AND ((NOT HAVE_DECL_BACKTRACE) OR (NOT HAVE_EXECINFO_H)))
|
||||
message(AUTHOR_WARNING " Backtrace is not available. disabling")
|
||||
set(ZM_NO_CRASHTRACE ON)
|
||||
set(HAVE_EXECINFO_H 0)
|
||||
set(HAVE_DECL_BACKTRACE 0)
|
||||
endif((NOT ZM_NO_CRASHTRACE) AND ((NOT HAVE_DECL_BACKTRACE) OR (NOT HAVE_EXECINFO_H)))
|
||||
|
||||
|
||||
if(NOT ZM_NO_MMAP)
|
||||
set(ZM_MMAP_PERLPACKAGE "Sys::Mmap")
|
||||
endif(NOT ZM_NO_MMAP)
|
||||
# Check for Perl. Version checking is removed because its ignored before CMake 2.8.8 and it seems that Perl is being detected as 5.16. instead of 5.6.0 ??
|
||||
# Check for Perl
|
||||
find_package(Perl)
|
||||
if(NOT PERL_FOUND)
|
||||
message(FATAL_ERROR "zm requires Perl 5.6.0 or newer but it was not found on your system")
|
||||
endif(NOT PERL_FOUND)
|
||||
|
||||
# Checking for perl modules requires FindPerlModules.cmake
|
||||
# Check all required modules at once
|
||||
# TODO: Add checking for the optional modules
|
||||
|
@ -322,9 +479,8 @@ message(STATUS "Using web group: ${ZM_WEB_GROUP}")
|
|||
# Some variables that zm expects
|
||||
set(ZM_PID "${ZM_RUNDIR}/zm.pid")
|
||||
set(ZM_CONFIG "/${CMAKE_INSTALL_SYSCONFDIR}/zm.conf")
|
||||
set(VERSION "${ZoneMinder_VERSION}")
|
||||
set(PATH_BUILD "${PROJECT_SOURCE_DIR}")
|
||||
set(TIME_BUILD "1000000") # Don't have a solution for this one yet
|
||||
set(VERSION "${zoneminder_VERSION}")
|
||||
set(PKGDATADIR "${CMAKE_INSTALL_PREFIX}/${CMAKE_INSTALL_DATADIR}/zoneminder")
|
||||
set(BINDIR "${CMAKE_INSTALL_FULL_BINDIR}")
|
||||
set(LIBDIR "${CMAKE_INSTALL_FULL_LIBDIR}")
|
||||
set(SYSCONFDIR "/${CMAKE_INSTALL_SYSCONFDIR}")
|
||||
|
@ -332,21 +488,36 @@ set(WEB_PREFIX "${ZM_WEBDIR}")
|
|||
set(CGI_PREFIX "${ZM_CGIDIR}")
|
||||
set(WEB_USER "${ZM_WEB_USER}")
|
||||
set(WEB_GROUP "${ZM_WEB_GROUP}")
|
||||
set(EXTRA_PERL_LIB "use lib '${CMAKE_INSTALL_PREFIX}/${CMAKE_INSTALL_LIBDIR}/perl5';")
|
||||
set(ZM_DB_TYPE "mysql")
|
||||
set(EXTRA_PERL_LIB "use lib '${ZM_PERL_USE_PATH}';")
|
||||
|
||||
# Generate files from the .in files
|
||||
configure_file(zoneminder-config.cmake config.h @ONLY)
|
||||
configure_file(zm.conf.in zm.conf @ONLY)
|
||||
configure_file(zmconfgen.pl.in zmconfgen.pl @ONLY)
|
||||
configure_file(zmlinkcontent.sh.in zmlinkcontent.sh @ONLY)
|
||||
configure_file(zm.conf.in "${CMAKE_CURRENT_BINARY_DIR}/zm.conf" @ONLY)
|
||||
configure_file(zoneminder-config.cmake "${CMAKE_CURRENT_BINARY_DIR}/config.h" @ONLY)
|
||||
configure_file(zmconfgen.pl.in "${CMAKE_CURRENT_BINARY_DIR}/zmconfgen.pl" @ONLY)
|
||||
configure_file(zmlinkcontent.sh.in "${CMAKE_CURRENT_BINARY_DIR}/zmlinkcontent.sh" @ONLY)
|
||||
|
||||
# Process subdirectories
|
||||
add_subdirectory(src)
|
||||
add_subdirectory(scripts)
|
||||
add_subdirectory(db)
|
||||
add_subdirectory(misc)
|
||||
add_subdirectory(web)
|
||||
|
||||
# Process misc subdirectories
|
||||
if(ZM_TARGET_DISTRO STREQUAL "f19")
|
||||
add_subdirectory(distros/fedora)
|
||||
elseif(ZM_TARGET_DISTRO STREQUAL "el6")
|
||||
add_subdirectory(distros/redhat)
|
||||
elseif(ZM_TARGET_DISTRO STREQUAL "OS13")
|
||||
add_subdirectory(distros/opensuse)
|
||||
else(ZM_TARGET_DISTRO STREQUAL "el6")
|
||||
add_subdirectory(misc)
|
||||
endif(ZM_TARGET_DISTRO STREQUAL "f19")
|
||||
|
||||
# Print optional libraries detection status
|
||||
message(STATUS "Optional libraries found:${optlibsfound}")
|
||||
message(STATUS "Optional libraries not found:${optlibsnotfound}")
|
||||
|
||||
# Run ZM configuration generator
|
||||
message(STATUS "Running ZoneMinder configuration generator")
|
||||
execute_process(COMMAND perl ./zmconfgen.pl RESULT_VARIABLE zmconfgen_result)
|
||||
|
@ -357,5 +528,13 @@ else(zmconfgen_result EQUAL 0)
|
|||
endif(zmconfgen_result EQUAL 0)
|
||||
|
||||
# Install zm.conf
|
||||
install(FILES zm.conf DESTINATION "/${CMAKE_INSTALL_SYSCONFDIR}")
|
||||
install(FILES "${CMAKE_CURRENT_BINARY_DIR}/zm.conf" DESTINATION "/${CMAKE_INSTALL_SYSCONFDIR}")
|
||||
|
||||
# Uninstall target
|
||||
configure_file(
|
||||
"${CMAKE_CURRENT_SOURCE_DIR}/cmake/cmake_uninstall.cmake.in"
|
||||
"${CMAKE_CURRENT_BINARY_DIR}/cmake/cmake_uninstall.cmake"
|
||||
IMMEDIATE @ONLY)
|
||||
add_custom_target(uninstall
|
||||
COMMAND ${CMAKE_COMMAND} -P ${CMAKE_CURRENT_BINARY_DIR}/cmake/cmake_uninstall.cmake)
|
||||
|
||||
|
|
21
INSTALL
21
INSTALL
|
@ -19,7 +19,6 @@ Important differences
|
|||
* Unlike the autotools way, the cmake way does not require any options. It attempts to detect some things by its own (system directories, libarch, web user and group) and uses defaults for others (installation paths and such).
|
||||
* Unlike the autotools way, which links the binaries to a fixed list of libraries, the cmake way only links to libraries that it found on the system. If a library is not found, but required, a fatal error will be shown during the configuration step.
|
||||
* Unlike the autotools way, the cmake way does not modify the system in any way it shouldnt. It only does what its supposed to do: Install files to your system. Nothing else and nothing leaks out of the DESTDIR environment variable (if used). This means that depending on your configuration, there might be an extra required step after installation: to link WEB_PATH/events and WEB_PATH/images folders to the correct places.
|
||||
* Currently there is no "make uninstall" target for cmake. However, its possible to do this manually. The file install_manifest.txt contains the list of files installed to the system. This can be used in many ways to delete all files installed by cmake, such as: xargs rm < install_manifest.txt
|
||||
|
||||
Configuration
|
||||
-------------
|
||||
|
@ -48,16 +47,21 @@ Advanced:
|
|||
ZM_EXTRA_LIBS A list of optional libraries, separated by semicolons, e.g. ssl;theora
|
||||
ZM_MYSQL_ENGINE MySQL engine to use with database, default: InnoDB
|
||||
ZM_NO_MMAP Set to ON to not use mmap shared memory. Shouldn't be enabled unless you experience problems with the shared memory. default: OFF
|
||||
ZM_NO_CRASHTRACE Set to ON to skip crash trace code. Useful if zm_signal.cpp fails to compile. default: OFF
|
||||
ZM_NO_FFMPEG Set to ON to skip ffmpeg checks and force building ZM without ffmpeg. default: OFF
|
||||
ZM_NO_X10 Set to ON to build ZoneMinder without X10 support. default: OFF
|
||||
ZM_PERL_SUBPREFIX Use a different directory for the zm perl modules. NOTE: This is a subprefix, e.g. lib will be turned into <prefix>/lib, default: <libarch>/perl5
|
||||
ZM_PERL_USE_PATH Override the include path for zm perl modules. Useful if you are moving the perl modules without using the ZM_PERL_SUBPREFIX option. default: <prefix>/<zmperlsubprefix>
|
||||
|
||||
|
||||
Useful configuration options provided by cmake:
|
||||
CMAKE_VERBOSE_MAKEFILE - Set this to ON (default OFF) to see what cmake is doing. Very useful for troubleshooting.
|
||||
CMAKE_BUILD_TYPE - Set this to Debug (default Release) to build ZoneMinder with debugging enabled.
|
||||
CMAKE_INSTALL_PREFIX - Use this to change the prefix (default /usr/local). This option behaves like --prefix from autoconf. Package maintainers will probably want to set this to "/usr".
|
||||
CMAKE_INCLUDE_PATH - Use this to change the include search path.
|
||||
CMAKE_LIBRARY_PATH - Use this to change the library search path.
|
||||
Also see CMAKE_PREFIX_PATH for overriding both and some others.
|
||||
|
||||
Useful environment variables provided by cmake:
|
||||
CMAKE_INCLUDE_PATH - Use this to add to the include search path.
|
||||
CMAKE_LIBRARY_PATH - Use this to add to the library search path.
|
||||
CMAKE_PREFIX_PATH - Use this to add to both include and library search paths. <path>/include will be added to the include search path and <path>/lib to the library search path. Multiple paths can be specified, separated by a : character. For example: export CMAKE_PREFIX_PATH="/opt/libjpeg-turbo:/opt/ffmpeg-from-git"
|
||||
|
||||
CFLAGS, CPPFLAGS and other environment variables:
|
||||
To append to the CFLAGS and CXXFLAGS, please use the CFLAGS and CXXFLAGS environment variables.
|
||||
|
@ -67,7 +71,7 @@ To replace the CFLAGS and CXXFLAGS entirely:
|
|||
* For the Debug build type: use CMAKE_C_FLAGS_DEBUG for the CFLAGS and CMAKE_CXX_FLAGS_DEBUG for the CXXFLAGS
|
||||
Other important environment variables (such as LDFLAGS) are also supported.
|
||||
|
||||
The DESTDIR environment variable is also supported.
|
||||
The DESTDIR environment variable is also supported, however it needs to be set before invoking make install. For example: DESTDIR=mydestdir make install
|
||||
For more information about DESTDIR, see:
|
||||
* http://www.gnu.org/prep/standards/html_node/DESTDIR.html
|
||||
|
||||
|
@ -105,6 +109,11 @@ By default, the content directory for new installations is /var/lib/zoneminder.
|
|||
|
||||
5) Run zmupdate.pl to update the database layout to the new version.
|
||||
|
||||
Uninstallation:
|
||||
---------------
|
||||
By default, cmake does not have an uninstall target, however we have added a one. Simply run make uninstall (or DESTDIR=mydestdir make uninstall if a DESTDIR was used) and it will remove all the files that cmake installed.
|
||||
It's also possible to do this manually. The file install_manifest.txt contains the list of files installed to the system. This can be used in many ways to delete all files installed by cmake, such as: xargs rm < install_manifest.txt
|
||||
|
||||
Contributions:
|
||||
--------------
|
||||
Please visit our GitHub at http://github.com/ZoneMinder/ZoneMinder
|
||||
|
|
107
README.md
107
README.md
|
@ -14,36 +14,127 @@ ZoneMinder is an integrated set of applications which provide a complete surveil
|
|||
|
||||
## Requirements
|
||||
|
||||
If you are installing from a package, that package should provide all of the needed core components.
|
||||
If you are installing ZoneMinder from a package, that package should provide all of the needed core components.
|
||||
|
||||
### Packages
|
||||
|
||||
If you are compiling from source, the below list contains the packages needed to get ZoneMinder built:
|
||||
If you are compiling ZoneMinder from source, the below list contains the packages needed to get ZoneMinder built:
|
||||
|
||||
#### Debian / Ubuntu
|
||||
#### Ubuntu
|
||||
|
||||
A fresh build based on master branch running Ubuntu 1204 LTS. Will likely work for other versions as well.
|
||||
|
||||
```bash
|
||||
root@host:~# aptitude install -y apache2 mysql-server php5 php5-mysql 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 libjpeg8-dev libjpeg8 apache2-mpm-prefork libapache2-mod-php5 php5-cli libphp-serialization-perl libgnutls-dev libjpeg8-dev libavcodec-dev libavformat-dev libswscale-dev libavutil-dev libv4l-dev libtool ffmpeg libnetpbm10-dev libavdevice-dev libmime-lite-perl dh-autoreconf dpatch;
|
||||
|
||||
root@host:~# git clone https://github.com/ZoneMinder/ZoneMinder.git zoneminder;
|
||||
root@host:~# cd zoneminder;
|
||||
root@host:~# ln -s distros/ubuntu1204 debian;
|
||||
root@host:~# dpkg-checkbuilddeps;
|
||||
root@host:~# dpkg-buildpackage;
|
||||
```
|
||||
|
||||
One level above you'll now find a deb package matching the architecture of the build host:
|
||||
|
||||
```bash
|
||||
root@host:~# ls -1 ~/zoneminder*;
|
||||
/root/zoneminder_1.26.4-1_amd64.changes
|
||||
/root/zoneminder_1.26.4-1_amd64.deb
|
||||
/root/zoneminder_1.26.4-1.dsc
|
||||
/root/zoneminder_1.26.4-1.tar.gz
|
||||
```
|
||||
|
||||
The dpkg command itself does not resolve dependencies. That's what high-level interfaces like aptitude and apt-get are normally for. Unfortunately, unlike RPM, there's no easy way to install a separate deb package not contained with any repository.
|
||||
|
||||
To overcome this "limitation" we'll use dpkg only to install the zoneminder package and apt-get to fetch all needed dependencies afterwards. Running dpkg-reconfigure in the end will ensure that the setup scripts e.g. for database provisioning were executed.
|
||||
|
||||
```bash
|
||||
root@host:~# dpkg -i /root/zoneminder_1.26.4-1_amd64.deb; apt-get install -f;
|
||||
root@host:~# dpkg-reconfigure zoneminder;
|
||||
```
|
||||
Alternatively you may also use gdebi to automatically resolve dependencies during installation:
|
||||
|
||||
```bash
|
||||
root@host:~# aptitude install -y gdebi;
|
||||
root@host:~# gdebi /root/zoneminder_1.26.4-1_amd64.deb;
|
||||
```
|
||||
```bash
|
||||
sudo apt-get install apache2 mysql-server php5 php5-mysql 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 subversion automake autoconf libjpeg-turbo8-dev libjpeg-turbo8 \
|
||||
libwww-perl libdbd-mysql-perl libsys-mmap-perl yasm automake autoconf libjpeg-turbo8-dev libjpeg-turbo8 \
|
||||
apache2-mpm-prefork libapache2-mod-php5 php5-cli
|
||||
```
|
||||
|
||||
#### CentOS / Redhat
|
||||
#### Debian
|
||||
|
||||
Two additional repositories must be added before one can build zoneminder on CentOS or RHEL:
|
||||
A fresh build based on master branch running Debian 7 (wheezy):
|
||||
|
||||
```bash
|
||||
root@host:~# aptitude install -y apache2 mysql-server php5 php5-mysql 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 libjpeg8-dev libjpeg8 apache2-mpm-prefork libapache2-mod-php5 php5-cli libphp-serialization-perl libgnutls-dev libjpeg8-dev libavcodec-dev libavformat-dev libswscale-dev libavutil-dev libv4l-dev libtool ffmpeg libnetpbm10-dev libavdevice-dev libmime-lite-perl dh-autoreconf dpatch;
|
||||
|
||||
root@host:~# git clone https://github.com/ZoneMinder/ZoneMinder.git zoneminder;
|
||||
root@host:~# cd zoneminder;
|
||||
root@host:~# ln -s distros/debian;
|
||||
root@host:~# dpkg-checkbuilddeps;
|
||||
root@host:~# dpkg-buildpackage;
|
||||
```
|
||||
|
||||
One level above you'll now find a deb package matching the architecture of the build host:
|
||||
|
||||
```bash
|
||||
root@host:~# ls -1 ~/zoneminder*;
|
||||
/root/zoneminder_1.26.4-1_amd64.changes
|
||||
/root/zoneminder_1.26.4-1_amd64.deb
|
||||
/root/zoneminder_1.26.4-1.dsc
|
||||
/root/zoneminder_1.26.4-1.tar.gz
|
||||
```
|
||||
|
||||
The dpkg command itself does not resolve dependencies. That's what high-level interfaces like aptitude and apt-get are normally for. Unfortunately, unlike RPM, there's no easy way to install a separate deb package not contained with any repository.
|
||||
|
||||
To overcome this "limitation" we'll use dpkg only to install the zoneminder package and apt-get to fetch all needed dependencies afterwards. Running dpkg-reconfigure in the end will ensure that the setup scripts e.g. for database provisioning were executed.
|
||||
|
||||
```bash
|
||||
root@host:~# dpkg -i /root/zoneminder_1.26.4-1_amd64.deb; apt-get install -f;
|
||||
root@host:~# dpkg-reconfigure zoneminder;
|
||||
```
|
||||
Alternatively you may also use gdebi to automatically resolve dependencies during installation:
|
||||
|
||||
```bash
|
||||
root@host:~# aptitude install -y gdebi;
|
||||
root@host:~# gdebi /root/zoneminder_1.26.4-1_amd64.deb;
|
||||
```
|
||||
|
||||
#### CentOS / RHEL
|
||||
|
||||
Additional repositories must be added before one can build zoneminder on CentOS or RHEL:
|
||||
|
||||
1. RepoForge (formerly RPMForge) http://repoforge.org/use/
|
||||
2. EPEL https://fedoraproject.org/wiki/EPEL
|
||||
3. Optional RPMFusion: http://rpmfusion.org/ [SEE NOTE]
|
||||
|
||||
[NOTE]<br>
|
||||
The RPMFusion repo contains significantly newer versions of ffmpeg and vlc. This leads to significantly better camera support. However, the RPMFusion repo contains packages that conflict with the other two repos. In order to resolve this, one must also install the yum priorities pacakge and use that to prioritize your repos in the following order:
|
||||
|
||||
Once those are added, install the following:
|
||||
1. Base
|
||||
2. RPMFusion
|
||||
3. EPEL
|
||||
4. RPMForge
|
||||
|
||||
For instructions on yum priorities, visit this page:
|
||||
http://wiki.centos.org/PackageManagement/Yum/Priorities
|
||||
|
||||
Once your repos are in order, install the following:
|
||||
```bash
|
||||
sudo yum install automake bzip2-devel ffmpeg ffmpeg-devel gnutls-devel httpd libjpeg-turbo libjpeg-turbo-devel mysql-devel mysql-server pcre-devel \
|
||||
perl-Archive-Tar perl-Archive-Zip perl-Convert-BinHex perl-Date-Manip perl-DBD-MySQL perl-DBI perl-Device-SerialPort perl-Email-Date-Format perl-IO-stringy \
|
||||
perl-IO-Zlib perl-MailTools perl-MIME-Lite perl-MIME-tools perl-MIME-Types perl-Module-Load perl-Package-Constants perl-Sys-Mmap perl-Time-HiRes \
|
||||
perl-TimeDate perl-YAML-Syck php php-cli php-mysql subversion x264
|
||||
perl-TimeDate perl-YAML-Syck php php-cli php-mysql x264 vlc-devel vlc-core libcurl libcurl-devel
|
||||
```
|
||||
|
||||
### ffmpeg
|
||||
|
||||
This release of ZoneMinder has been tested on and works with ffmpeg version N-55540-g93f4277.
|
||||
|
||||
|
||||
|
||||
[![Analytics](https://ga-beacon.appspot.com/UA-15147273-6/ZoneMinder/README.md)](https://github.com/igrigorik/ga-beacon)
|
||||
|
|
|
@ -44,7 +44,7 @@ if [ "$?" != "0" ]; then
|
|||
fi
|
||||
|
||||
# Print some information
|
||||
echo "Executables directory : $ZM_PATH_BIN"
|
||||
#echo "Executables directory : $ZM_PATH_BIN"
|
||||
#echo "Libraries directory : $ZM_PATH_LIB"
|
||||
#echo "System config directory : $ZM_PATH_CONF"
|
||||
echo "Web directory : $ZM_PATH_WEB"
|
||||
|
@ -60,8 +60,8 @@ echo "Database password : Not shown"
|
|||
CMPATH="CACHE PATH \"Imported by cmakecacheimport.sh\" FORCE"
|
||||
CMSTRING="CACHE STRING \"Imported by cmakecacheimport.sh\" FORCE"
|
||||
# Write
|
||||
echo "# Generated by cmakecacheimport.sh">zm_conf.cmake
|
||||
echo "set(CMAKE_INSTALL_FULL_BINDIR \"$ZM_PATH_BIN\" $CMPATH)">>zm_conf.cmake
|
||||
echo "# This file was generated by cmakecacheimport.sh">zm_conf.cmake
|
||||
#echo "set(CMAKE_INSTALL_FULL_BINDIR \"$ZM_PATH_BIN\" $CMPATH)">>zm_conf.cmake
|
||||
#echo "set(CMAKE_INSTALL_FULL_LIBDIR \"$ZM_PATH_LIB\" $CMPATH)">>zm_conf.cmake
|
||||
#echo "set(CMAKE_INSTALL_FULL_SYSCONFDIR \"$ZM_PATH_CONF\" $CMPATH)">>zm_conf.cmake
|
||||
echo "set(ZM_WEBDIR \"$ZM_PATH_WEB\" $CMPATH)">>zm_conf.cmake
|
||||
|
|
42
configure.ac
42
configure.ac
|
@ -1,16 +1,14 @@
|
|||
AC_PREREQ(2.59)
|
||||
AC_INIT(zm,1.26.4,[http://www.zoneminder.com/forums/ - Please check FAQ first],ZoneMinder,http://www.zoneminder.com/downloads.html)
|
||||
AC_INIT(zm,1.27,[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)
|
||||
|
||||
AC_SUBST([AM_CXXFLAGS], [-D__STDC_CONSTANT_MACROS])
|
||||
|
||||
PATH_BUILD=`pwd`
|
||||
AC_SUBST(PATH_BUILD)
|
||||
TIME_BUILD=`date +'%s'`
|
||||
AC_SUBST(TIME_BUILD)
|
||||
AC_SUBST(VERSION)
|
||||
|
||||
AC_ARG_VAR(ZM_DB_TYPE,[Type of the ZoneMinder database, default mysql])
|
||||
AC_ARG_VAR(ZM_DB_HOST,[Hostname where ZoneMinder database located, default localhost])
|
||||
AC_ARG_VAR(ZM_DB_NAME,[Name of ZoneMinder database, default zm])
|
||||
AC_ARG_VAR(ZM_DB_USER,[Name of ZoneMinder database user, default zmuser])
|
||||
|
@ -21,6 +19,9 @@ AC_ARG_VAR(ZM_RUNDIR,[Location of transient process files, default /var/run/zm])
|
|||
AC_ARG_VAR(ZM_TMPDIR,[Location of temporary files, default /tmp/zm])
|
||||
AC_ARG_VAR(ZM_LOGDIR,[Location of generated log files, default /var/log/zm])
|
||||
|
||||
if test "$ZM_DB_TYPE" == ""; then
|
||||
AC_SUBST(ZM_DB_TYPE,[mysql])
|
||||
fi
|
||||
if test "$ZM_DB_HOST" == ""; then
|
||||
AC_SUBST(ZM_DB_HOST,[localhost])
|
||||
fi
|
||||
|
@ -177,22 +178,6 @@ if test "$ENABLE_DEBUG" != "yes"; then
|
|||
AC_DEFINE(ZM_DBG_OFF,1,"Whether debug is switched off and compiled out")
|
||||
fi
|
||||
|
||||
ENABLE_CRASHTRACE=yes
|
||||
AC_ARG_ENABLE(crashtrace,
|
||||
[ --enable-crashtrace=<yes|no> enable or disabled crash tracing, default enabled],
|
||||
[ENABLE_CRASHTRACE=$enable_crashtrace],
|
||||
AC_MSG_WARN([You can call configure with the --enable-crashtrace=<yes|no> or --disable-crashtrace option.
|
||||
This tells configure whether to compile ZoneMinder with crash tracing included. This allows a
|
||||
dump of the stack trace when a ZoneMinder binary crashes or is killed by an unexpected signal.
|
||||
Although this should work on most systems it does rely on un(or loosely) documented features and
|
||||
so should be regarded as experimental. If you experience problems compiling zm_signal.cpp or
|
||||
ZoneMinder binaries fail to shut down correctly then you should probably disable this feature.
|
||||
e.g. --enable-crashtrace=yes or --disable-crashtrace])
|
||||
)
|
||||
if test "$ENABLE_CRASHTRACE" != "yes"; then
|
||||
AC_DEFINE(ZM_NO_CRASHTRACE,1,"Whether crash tracing is switched off and compiled out")
|
||||
fi
|
||||
|
||||
ENABLE_MMAP=yes
|
||||
AC_ARG_ENABLE(mmap,
|
||||
[ --enable-mmap=<yes|no> enable or disabled mapped memory versus shared memory, default mapped],
|
||||
|
@ -235,8 +220,6 @@ AC_STRUCT_TM
|
|||
AC_TYPE_SIGNAL
|
||||
|
||||
AC_CHECK_TYPES(siginfo_t,,,[#include <signal.h>])
|
||||
AC_CHECK_TYPES(struct sigcontext,,,[#include <signal.h>])
|
||||
AC_CHECK_MEMBERS([struct sigcontext.eip],,,[#include <signal.h>])
|
||||
AC_CHECK_TYPES(ucontext_t,,,[#include <signal.h>])
|
||||
|
||||
# Checks for library functions.
|
||||
|
@ -248,7 +231,7 @@ AC_FUNC_STAT
|
|||
AC_FUNC_STRFTIME
|
||||
AC_FUNC_STRTOD
|
||||
AC_FUNC_VPRINTF
|
||||
AC_CHECK_FUNCS([gethostbyname gethostname gettimeofday memmove memset mkdir munmap posix_memalign putenv select sendfile socket sqrt strcasecmp strchr strcspn strerror strncasecmp strrchr strsignal strspn strstr strtol strtoull])
|
||||
AC_CHECK_FUNCS([gethostbyname gethostname gettimeofday memmove memset mkdir munmap posix_memalign putenv select sendfile socket sqrt strcasecmp strchr strcspn strerror strncasecmp strrchr strspn strstr strtol strtoull])
|
||||
AC_CHECK_FUNCS([syscall sleep usleep ioctl ioctlsocket sigaction])
|
||||
|
||||
# Other programs
|
||||
|
@ -293,8 +276,10 @@ AC_CHECK_LIB(avformat,avformat_version,,AC_MSG_WARN(libavformat.a is required fo
|
|||
#AC_CHECK_LIB(avformat,av_new_stream,,AC_MSG_WARN(libavformat.a is required for MPEG streaming))
|
||||
AC_CHECK_LIB(avdevice,avdevice_register_all,,AC_MSG_WARN(libavdevice.a may be required for MPEG streaming))
|
||||
AC_CHECK_LIB(swscale,sws_scale,,,-lswscale)
|
||||
AC_CHECK_LIB(vlc,libvlc_new,,AC_MSG_WARN(libvlc.a may be required for streaming))
|
||||
AC_CHECK_LIB(bz2,BZ2_bzCompress,,AC_MSG_WARN(zm requires libbz2.a for recent versions of ffmpeg))
|
||||
AC_CHECK_LIB(z,compress,,)
|
||||
AC_CHECK_LIB(curl,curl_global_init,,)
|
||||
|
||||
# Checks for header files.
|
||||
AC_FUNC_ALLOCA
|
||||
|
@ -302,6 +287,7 @@ AC_HEADER_STDC
|
|||
AC_CHECK_HEADERS([fcntl.h limits.h memory.h stddef.h stdlib.h string.h strings.h sys/param.h sys/time.h syslog.h unistd.h values.h])
|
||||
AC_CHECK_HEADERS([netdb.h netinet/in.h arpa/inet.h sys/ioctl.h sys/socket.h sys/un.h glob.h sys/sendfile.h])
|
||||
AC_CHECK_HEADERS(execinfo.h,,,)
|
||||
AC_CHECK_HEADERS(ucontext.h,,,)
|
||||
AC_CHECK_HEADERS(sys/syscall.h,,,)
|
||||
AC_CHECK_HEADERS(pthread.h,,,)
|
||||
AC_CHECK_HEADERS(linux/videodev.h,AC_SUBST(ZM_HAS_V4L1,1),AC_SUBST(ZM_HAS_V4L1,0),)
|
||||
|
@ -330,8 +316,9 @@ AC_CHECK_HEADERS(sys/ipc.h,,,)
|
|||
AC_CHECK_HEADERS(sys/shm.h,,,)
|
||||
fi
|
||||
AC_CHECK_HEADERS(zlib.h,,,)
|
||||
AC_CHECK_HEADERS(vlc/vlc.h,,,)
|
||||
AC_CHECK_HEADERS(curl/curl.h,,,)
|
||||
|
||||
AC_CHECK_DECLS(round,,,[#include <math.h>])
|
||||
if test "$ZM_SSL_LIB" == "openssl"; then
|
||||
AC_CHECK_DECLS(MD5,,AC_MSG_ERROR([zm requires openssl/md5.h - use ZM_SSL_LIB option to select gnutls instead]),[#include <stdlib.h>
|
||||
#include <openssl/md5.h>])
|
||||
|
@ -345,6 +332,7 @@ AC_CHECK_DECLS(gnutls_fingerprint,,AC_MSG_ERROR([zm requires gnutls/gnutls.h - u
|
|||
fi
|
||||
fi
|
||||
AC_CHECK_DECLS(backtrace,,,[#include <execinfo.h>])
|
||||
AC_CHECK_DECLS(backtrace_symbols,,,[#include <execinfo.h>])
|
||||
|
||||
AC_SUBST(LDFLAGS)
|
||||
|
||||
|
@ -378,6 +366,8 @@ AC_PROG_PERL_MODULES(X10::ActiveHome,,AC_MSG_WARN(X10::ActiveHome is required fo
|
|||
|
||||
AC_DEFINE_DIR([BINDIR],[bindir],[Expanded binary directory])
|
||||
AC_DEFINE_DIR([LIBDIR],[libdir],[Expanded library directory])
|
||||
AC_DEFINE_DIR([DATADIR],[datadir],[Expanded data directory])
|
||||
AC_SUBST(PKGDATADIR,"$DATADIR/$PACKAGE")
|
||||
AC_SUBST(ZM_PID,"$ZM_RUNDIR/zm.pid")
|
||||
AC_DEFINE_DIR([SYSCONFDIR],[sysconfdir],[Expanded configuration directory])
|
||||
AC_SUBST(ZM_CONFIG,"$SYSCONFDIR/zm.conf")
|
||||
|
@ -396,7 +386,7 @@ fi
|
|||
AC_SUBST(PERL_MM_PARMS)
|
||||
AC_SUBST(EXTRA_PERL_LIB)
|
||||
|
||||
AC_CONFIG_FILES([Makefile zm.conf zmconfgen.pl db/Makefile db/zm_create.sql misc/Makefile misc/apache.conf misc/logrotate.conf misc/syslog.conf scripts/Makefile scripts/zm scripts/zmaudit.pl scripts/zmcontrol.pl scripts/zmdc.pl scripts/zmfilter.pl scripts/zmpkg.pl scripts/zmtrack.pl scripts/zmtrigger.pl scripts/zmupdate.pl scripts/zmvideo.pl scripts/zmwatch.pl scripts/zmx10.pl scripts/zmdbbackup scripts/zmdbrestore scripts/zmeventdump scripts/zmlogrotate.conf scripts/ZoneMinder/lib/ZoneMinder/Base.pm scripts/ZoneMinder/lib/ZoneMinder/Config.pm scripts/ZoneMinder/lib/ZoneMinder/Memory.pm scripts/ZoneMinder/lib/ZoneMinder/ConfigData.pm src/Makefile src/zm_config.h])
|
||||
AC_CONFIG_FILES([Makefile zm.conf zmconfgen.pl db/Makefile db/zm_create.sql misc/Makefile misc/apache.conf misc/logrotate.conf misc/syslog.conf scripts/Makefile scripts/zm scripts/zmaudit.pl scripts/zmcontrol.pl scripts/zmdc.pl scripts/zmfilter.pl scripts/zmpkg.pl scripts/zmtrack.pl scripts/zmcamtool.pl scripts/zmtrigger.pl scripts/zmupdate.pl scripts/zmvideo.pl scripts/zmwatch.pl scripts/zmx10.pl scripts/zmdbbackup scripts/zmdbrestore scripts/zmeventdump scripts/zmlogrotate.conf scripts/ZoneMinder/lib/ZoneMinder/Base.pm scripts/ZoneMinder/lib/ZoneMinder/Config.pm scripts/ZoneMinder/lib/ZoneMinder/Memory.pm scripts/ZoneMinder/lib/ZoneMinder/ConfigData.pm src/Makefile src/zm_config.h web/Makefile web/ajax/Makefile web/css/Makefile web/graphics/Makefile web/includes/Makefile web/includes/config.php web/js/Makefile web/lang/Makefile web/skins/Makefile web/skins/classic/Makefile web/skins/classic/ajax/Makefile web/skins/classic/css/Makefile web/skins/classic/graphics/Makefile web/skins/classic/includes/Makefile web/skins/classic/js/Makefile web/skins/classic/lang/Makefile web/skins/classic/views/Makefile web/skins/classic/views/css/Makefile web/skins/classic/views/js/Makefile web/skins/mobile/Makefile web/skins/mobile/ajax/Makefile web/skins/mobile/css/Makefile web/skins/mobile/graphics/Makefile web/skins/mobile/includes/Makefile web/skins/mobile/lang/Makefile web/skins/mobile/views/Makefile web/skins/mobile/views/css/Makefile web/tools/Makefile web/tools/mootools/Makefile web/views/Makefile web/skins/xml/Makefile web/skins/xml/views/Makefile web/skins/xml/includes/Makefile web/skins/flat/Makefile web/skins/flat/ajax/Makefile web/skins/flat/css/Makefile web/skins/flat/graphics/Makefile web/skins/flat/includes/Makefile web/skins/flat/js/Makefile web/skins/flat/lang/Makefile web/skins/flat/views/Makefile web/skins/flat/views/css/Makefile web/skins/flat/views/js/Makefile])
|
||||
|
||||
# Create the definitions for compilation and defaults for the database
|
||||
AC_CONFIG_COMMANDS([src/zm_config_defines.h],[perl ./zmconfgen.pl])
|
||||
|
|
|
@ -1,11 +1,13 @@
|
|||
# CMakeLists.txt for the ZoneMinder database scripts
|
||||
|
||||
# Create files from the .in files
|
||||
configure_file(zm_create.sql.in ${CMAKE_CURRENT_SOURCE_DIR}/zm_create.sql @ONLY)
|
||||
configure_file(zm_create.sql.in "${CMAKE_CURRENT_BINARY_DIR}/zm_create.sql" @ONLY)
|
||||
|
||||
# Glob all files matching zm*.sql (to exclude *.in files and autotools's files)
|
||||
file(GLOB dbfileslist RELATIVE "${CMAKE_CURRENT_SOURCE_DIR}" "zm*.sql")
|
||||
# Glob all database upgrade scripts
|
||||
file(GLOB dbfileslist RELATIVE "${CMAKE_CURRENT_SOURCE_DIR}" "zm_update-*.sql")
|
||||
|
||||
# Install the database scripts, exclude makefiles and cmake stuff
|
||||
# Install the database upgrade scripts
|
||||
install(FILES ${dbfileslist} DESTINATION "${CMAKE_INSTALL_DATADIR}/zoneminder/db")
|
||||
|
||||
# install zm_create.sql
|
||||
install(FILES "${CMAKE_CURRENT_BINARY_DIR}/zm_create.sql" DESTINATION "${CMAKE_INSTALL_DATADIR}/zoneminder/db")
|
||||
|
|
|
@ -1,48 +1,14 @@
|
|||
AUTOMAKE_OPTIONS = gnu
|
||||
AUTOMAKE_OPTIONS = foreign
|
||||
|
||||
zmdbdatadir = $(pkgdatadir)/db
|
||||
|
||||
EXTRA_DIST = \
|
||||
zm_create.sql.in \
|
||||
zm_update-0.0.1.sql \
|
||||
zm_update-0.9.7.sql \
|
||||
zm_update-0.9.8.sql \
|
||||
zm_update-0.9.9.sql \
|
||||
zm_update-0.9.10.sql \
|
||||
zm_update-0.9.11.sql \
|
||||
zm_update-0.9.12.sql \
|
||||
zm_update-0.9.13.sql \
|
||||
zm_update-0.9.15.sql \
|
||||
zm_update-0.9.16.sql \
|
||||
zm_update-1.17.1.sql \
|
||||
zm_update-1.17.2.sql \
|
||||
zm_update-1.18.0.sql \
|
||||
zm_update-1.18.1.sql \
|
||||
zm_update-1.19.0.sql \
|
||||
zm_update-1.19.1.sql \
|
||||
zm_update-1.19.2.sql \
|
||||
zm_update-1.19.3.sql \
|
||||
zm_update-1.19.4.sql \
|
||||
zm_update-1.19.5.sql \
|
||||
zm_update-1.20.0.sql \
|
||||
zm_update-1.20.1.sql \
|
||||
zm_update-1.21.0.sql \
|
||||
zm_update-1.21.1.sql \
|
||||
zm_update-1.21.2.sql \
|
||||
zm_update-1.21.3.sql \
|
||||
zm_update-1.21.4.sql \
|
||||
zm_update-1.22.0.sql \
|
||||
zm_update-1.22.1.sql \
|
||||
zm_update-1.22.2.sql \
|
||||
zm_update-1.22.3.sql \
|
||||
zm_update-1.23.0.sql \
|
||||
zm_update-1.23.1.sql \
|
||||
zm_update-1.23.2.sql \
|
||||
zm_update-1.23.3.sql \
|
||||
zm_update-1.24.0.sql \
|
||||
zm_update-1.24.1.sql \
|
||||
zm_update-1.24.2.sql \
|
||||
zm_update-1.24.3.sql \
|
||||
zm_update-1.24.4.sql \
|
||||
zm_update-1.26.0.sql \
|
||||
zm_update-1.26.1.sql \
|
||||
zm_update-1.26.2.sql \
|
||||
zm_update-1.26.3.sql
|
||||
$(dbupgrade_scripts)
|
||||
|
||||
dist_zmdbdata_DATA = \
|
||||
zm_create.sql \
|
||||
$(dbupgrade_scripts)
|
||||
|
||||
dbupgrade_scripts = $(wildcard zm_update-*.sql)
|
||||
|
||||
|
|
|
@ -1 +1,2 @@
|
|||
INSERT INTO Monitors (Name, Type, Function, Enabled, Format, Protocol, Method, Host, Port, Path, Width, Height, Colours, Palette, Orientation, Deinterlacing, Brightness, Contrast, Hue, Colour, RefBlendPerc) VALUES ('travis_test','Remote','Modect',1,255,'http','simple','50.79.143.149','21146','/mjpg/video.mjpg',1280,800,3,0,'0',0,-1,-1,-1,-1,12);
|
||||
INSERT INTO Monitors (Name, Type, Function, Enabled, Format, Protocol, Method, Host, Port, Path, Width, Height, Colours, Palette, Orientation, Deinterlacing, Brightness, Contrast, Hue, Colour, RefBlendPerc) VALUES ('travis_test1','Remote','Modect',1,255,'http','simple','50.79.143.149','21146','/mjpg/video.mjpg',1280,800,3,0,'0',0,-1,-1,-1,-1,12);
|
||||
INSERT INTO Monitors (Name, Type, Function, Enabled, Format, Protocol, Method, Host, Port, Path, Width, Height, Colours, Palette, Orientation, Deinterlacing, Brightness, Contrast, Hue, Colour, RefBlendPerc) VALUES ('travis_test2','Remote','Modect',1,255,'http','simple','50.79.143.149','21146','/mjpg/video.mjpg',1280,800,3,0,'0',0,-1,-1,-1,-1,12);
|
||||
|
|
|
@ -1,8 +1,8 @@
|
|||
-- MySQL dump 10.13 Distrib 5.6.13, for Linux (i686)
|
||||
-- MySQL dump 10.13 Distrib 5.6.13, for Linux (i686)
|
||||
--
|
||||
-- Host: localhost Database: @ZM_DB_NAME@
|
||||
-- Host: localhost Database: @ZM_DB_NAME@
|
||||
-- ------------------------------------------------------
|
||||
-- Server version 5.6.13
|
||||
-- Server version 5.6.13
|
||||
|
||||
/*!40101 SET @OLD_CHARACTER_SET_CLIENT=@@CHARACTER_SET_CLIENT */;
|
||||
/*!40101 SET @OLD_CHARACTER_SET_RESULTS=@@CHARACTER_SET_RESULTS */;
|
||||
|
@ -40,7 +40,7 @@ CREATE TABLE `Config` (
|
|||
`Category` varchar(32) NOT NULL default '',
|
||||
`Readonly` tinyint(3) unsigned NOT NULL default '0',
|
||||
`Requires` text,
|
||||
PRIMARY KEY (`Name`)
|
||||
PRIMARY KEY (`Name`)
|
||||
) ENGINE=@ZM_MYSQL_ENGINE@;
|
||||
|
||||
--
|
||||
|
@ -52,7 +52,7 @@ CREATE TABLE `ControlPresets` (
|
|||
`MonitorId` int(10) unsigned NOT NULL default '0',
|
||||
`Preset` int(10) unsigned NOT NULL default '0',
|
||||
`Label` varchar(64) NOT NULL default '',
|
||||
PRIMARY KEY (`MonitorId`,`Preset`)
|
||||
PRIMARY KEY (`MonitorId`,`Preset`)
|
||||
) ENGINE=@ZM_MYSQL_ENGINE@;
|
||||
|
||||
--
|
||||
|
@ -63,7 +63,7 @@ DROP TABLE IF EXISTS `Controls`;
|
|||
CREATE TABLE `Controls` (
|
||||
`Id` int(10) unsigned NOT NULL auto_increment,
|
||||
`Name` varchar(64) NOT NULL default '',
|
||||
`Type` enum('Local','Remote','Ffmpeg') NOT NULL default 'Local',
|
||||
`Type` enum('Local','Remote','Ffmpeg','Libvlc','cURL') NOT NULL default 'Local',
|
||||
`Protocol` varchar(64) default NULL,
|
||||
`CanWake` tinyint(3) unsigned NOT NULL default '0',
|
||||
`CanSleep` tinyint(3) unsigned NOT NULL default '0',
|
||||
|
@ -160,7 +160,7 @@ CREATE TABLE `Controls` (
|
|||
`TurboTiltSpeed` int(10) default NULL,
|
||||
`CanAutoScan` tinyint(3) unsigned NOT NULL default '0',
|
||||
`NumScanPaths` tinyint(3) unsigned NOT NULL default '0',
|
||||
PRIMARY KEY (`Id`)
|
||||
PRIMARY KEY (`Id`)
|
||||
) ENGINE=@ZM_MYSQL_ENGINE@;
|
||||
|
||||
--
|
||||
|
@ -173,7 +173,7 @@ CREATE TABLE `Devices` (
|
|||
`Name` tinytext NOT NULL,
|
||||
`Type` enum('X10') NOT NULL default 'X10',
|
||||
`KeyString` varchar(32) NOT NULL default '',
|
||||
PRIMARY KEY (`Id`)
|
||||
PRIMARY KEY (`Id`)
|
||||
) ENGINE=@ZM_MYSQL_ENGINE@;
|
||||
|
||||
--
|
||||
|
@ -203,7 +203,7 @@ CREATE TABLE `Events` (
|
|||
`Messaged` tinyint(3) unsigned NOT NULL default '0',
|
||||
`Executed` tinyint(3) unsigned NOT NULL default '0',
|
||||
`Notes` text,
|
||||
PRIMARY KEY (`Id`,`MonitorId`),
|
||||
PRIMARY KEY (`Id`,`MonitorId`),
|
||||
KEY `MonitorId` (`MonitorId`),
|
||||
KEY `StartTime` (`StartTime`),
|
||||
KEY `Frames` (`Frames`),
|
||||
|
@ -227,7 +227,7 @@ CREATE TABLE `Filters` (
|
|||
`AutoExecuteCmd` tinytext,
|
||||
`AutoDelete` tinyint(3) unsigned NOT NULL default '0',
|
||||
`Background` tinyint(1) unsigned NOT NULL default '0',
|
||||
PRIMARY KEY (`Name`)
|
||||
PRIMARY KEY (`Name`)
|
||||
) ENGINE=@ZM_MYSQL_ENGINE@;
|
||||
|
||||
--
|
||||
|
@ -256,12 +256,14 @@ CREATE TABLE `Groups` (
|
|||
`Id` int(10) unsigned NOT NULL auto_increment,
|
||||
`Name` varchar(64) NOT NULL default '',
|
||||
`MonitorIds` tinytext NOT NULL,
|
||||
PRIMARY KEY (`Id`)
|
||||
PRIMARY KEY (`Id`)
|
||||
) ENGINE=@ZM_MYSQL_ENGINE@;
|
||||
|
||||
--
|
||||
-- Table structure for table `Logs`
|
||||
--
|
||||
|
||||
DROP TABLE IF EXISTS `Logs`;
|
||||
CREATE TABLE `Logs` (
|
||||
`TimeKey` decimal(16,6) NOT NULL,
|
||||
`Component` varchar(32) NOT NULL,
|
||||
|
@ -282,7 +284,7 @@ DROP TABLE IF EXISTS `MonitorPresets`;
|
|||
CREATE TABLE `MonitorPresets` (
|
||||
`Id` int(10) unsigned NOT NULL auto_increment,
|
||||
`Name` varchar(64) NOT NULL default '',
|
||||
`Type` enum('Local','Remote','File','Ffmpeg') NOT NULL default 'Local',
|
||||
`Type` enum('Local','Remote','File','Ffmpeg','Libvlc','cURL') NOT NULL default 'Local',
|
||||
`Device` tinytext,
|
||||
`Channel` tinytext,
|
||||
`Format` int(10) unsigned default NULL,
|
||||
|
@ -302,7 +304,7 @@ CREATE TABLE `MonitorPresets` (
|
|||
`ControlAddress` varchar(255) default NULL,
|
||||
`DefaultRate` smallint(5) unsigned NOT NULL default '100',
|
||||
`DefaultScale` smallint(5) unsigned NOT NULL default '100',
|
||||
PRIMARY KEY (`Id`)
|
||||
PRIMARY KEY (`Id`)
|
||||
) ENGINE=@ZM_MYSQL_ENGINE@;
|
||||
|
||||
--
|
||||
|
@ -313,7 +315,7 @@ DROP TABLE IF EXISTS `Monitors`;
|
|||
CREATE TABLE `Monitors` (
|
||||
`Id` int(10) unsigned NOT NULL auto_increment,
|
||||
`Name` varchar(64) NOT NULL default '',
|
||||
`Type` enum('Local','Remote','File','Ffmpeg') NOT NULL default 'Local',
|
||||
`Type` enum('Local','Remote','File','Ffmpeg','Libvlc','cURL') NOT NULL default 'Local',
|
||||
`Function` enum('None','Monitor','Modect','Record','Mocord','Nodect') NOT NULL default 'Monitor',
|
||||
`Enabled` tinyint(3) unsigned NOT NULL default '1',
|
||||
`LinkedMonitors` varchar(255) NOT NULL default '',
|
||||
|
@ -327,6 +329,8 @@ CREATE TABLE `Monitors` (
|
|||
`Port` varchar(8) NOT NULL default '',
|
||||
`SubPath` varchar(64) NOT NULL default '',
|
||||
`Path` varchar(255) NOT NULL default '',
|
||||
`User` varchar(64) NOT NULL default '',
|
||||
`Pass` varchar(64) NOT NULL default '',
|
||||
`Width` smallint(5) unsigned NOT NULL default '0',
|
||||
`Height` smallint(5) unsigned NOT NULL default '0',
|
||||
`Colours` tinyint(3) unsigned NOT NULL default '1',
|
||||
|
@ -349,10 +353,12 @@ CREATE TABLE `Monitors` (
|
|||
`AlarmFrameCount` smallint(5) unsigned NOT NULL default '1',
|
||||
`SectionLength` int(10) unsigned NOT NULL default '600',
|
||||
`FrameSkip` smallint(5) unsigned NOT NULL default '0',
|
||||
`MotionFrameSkip` smallint(5) unsigned NOT NULL default '0',
|
||||
`MaxFPS` decimal(5,2) default NULL,
|
||||
`AlarmMaxFPS` decimal(5,2) default NULL,
|
||||
`FPSReportInterval` smallint(5) unsigned NOT NULL default '250',
|
||||
`RefBlendPerc` tinyint(3) unsigned NOT NULL default '10',
|
||||
`RefBlendPerc` tinyint(3) unsigned NOT NULL default '6',
|
||||
`AlarmRefBlendPerc` tinyint(3) unsigned NOT NULL default '6',
|
||||
`Controllable` tinyint(3) unsigned NOT NULL default '0',
|
||||
`ControlId` int(10) unsigned NOT NULL default '0',
|
||||
`ControlDevice` varchar(255) default NULL,
|
||||
|
@ -368,7 +374,7 @@ CREATE TABLE `Monitors` (
|
|||
`SignalCheckColour` varchar(32) NOT NULL default '#0000BE',
|
||||
`WebColour` varchar(32) NOT NULL default 'red',
|
||||
`Sequence` smallint(5) unsigned default NULL,
|
||||
PRIMARY KEY (`Id`)
|
||||
PRIMARY KEY (`Id`)
|
||||
) ENGINE=@ZM_MYSQL_ENGINE@;
|
||||
|
||||
--
|
||||
|
@ -379,7 +385,7 @@ DROP TABLE IF EXISTS `States`;
|
|||
CREATE TABLE `States` (
|
||||
`Name` varchar(64) NOT NULL default '',
|
||||
`Definition` text NOT NULL,
|
||||
PRIMARY KEY (`Name`)
|
||||
PRIMARY KEY (`Name`)
|
||||
) ENGINE=@ZM_MYSQL_ENGINE@;
|
||||
|
||||
--
|
||||
|
@ -419,7 +425,7 @@ CREATE TABLE `TriggersX10` (
|
|||
`Activation` varchar(32) default NULL,
|
||||
`AlarmInput` varchar(32) default NULL,
|
||||
`AlarmOutput` varchar(32) default NULL,
|
||||
PRIMARY KEY (`MonitorId`)
|
||||
PRIMARY KEY (`MonitorId`)
|
||||
) ENGINE=@ZM_MYSQL_ENGINE@;
|
||||
|
||||
--
|
||||
|
@ -441,7 +447,7 @@ CREATE TABLE `Users` (
|
|||
`System` enum('None','View','Edit') NOT NULL default 'None',
|
||||
`MaxBandwidth` varchar(16) NOT NULL default '',
|
||||
`MonitorIds` tinytext NOT NULL,
|
||||
PRIMARY KEY (`Id`),
|
||||
PRIMARY KEY (`Id`),
|
||||
UNIQUE KEY `UC_Username` (`Username`)
|
||||
) ENGINE=@ZM_MYSQL_ENGINE@;
|
||||
|
||||
|
@ -469,7 +475,8 @@ CREATE TABLE `ZonePresets` (
|
|||
`MinBlobs` smallint(5) unsigned default NULL,
|
||||
`MaxBlobs` smallint(5) unsigned default NULL,
|
||||
`OverloadFrames` smallint(5) unsigned NOT NULL default '0',
|
||||
PRIMARY KEY (`Id`)
|
||||
`ExtendAlarmFrames` smallint(5) unsigned not null default 0,
|
||||
PRIMARY KEY (`Id`)
|
||||
) ENGINE=@ZM_MYSQL_ENGINE@;
|
||||
|
||||
--
|
||||
|
@ -501,7 +508,8 @@ CREATE TABLE `Zones` (
|
|||
`MinBlobs` smallint(5) unsigned default NULL,
|
||||
`MaxBlobs` smallint(5) unsigned default NULL,
|
||||
`OverloadFrames` smallint(5) unsigned NOT NULL default '0',
|
||||
PRIMARY KEY (`Id`),
|
||||
`ExtendAlarmFrames` smallint(5) unsigned not null default 0,
|
||||
PRIMARY KEY (`Id`),
|
||||
KEY `MonitorId` (`MonitorId`)
|
||||
) ENGINE=@ZM_MYSQL_ENGINE@;
|
||||
|
||||
|
@ -523,26 +531,29 @@ CREATE TABLE `Zones` (
|
|||
insert into Users VALUES (NULL,'admin',password('admin'),'',1,'View','Edit','Edit','Edit','Edit','Edit','','');
|
||||
|
||||
--
|
||||
-- Add a sample filter to purge the oldest 5 events when the disk is 95% full, delete is disabled though
|
||||
-- Add a sample filter to purge the oldest 100 events when the disk is 95% full
|
||||
--
|
||||
insert into Filters values ('PurgeWhenFull','{"sort_field":"Id","terms":[{"val":0,"attr":"Archived","op":"="},{"cnj":"and","val":95,"attr":"DiskPercent","op":">="}],"limit":5,"sort_asc":1}',0,0,0,0,0,0,'',1,0);
|
||||
insert into Filters values ('PurgeWhenFull','{"sort_field":"Id","terms":[{"val":0,"attr":"Archived","op":"="},{"cnj":"and","val":95,"attr":"DiskPercent","op":">="}],"limit":100,"sort_asc":1}',0,0,0,0,0,0,'',1,1);
|
||||
|
||||
--
|
||||
-- Add in some sample control protocol definitions
|
||||
--
|
||||
insert into Controls values (1,'Pelco-D','Local','PelcoD',1,1,0,1,1,0,0,1,NULL,NULL,NULL,NULL,1,0,3,1,1,0,0,1,NULL,NULL,NULL,NULL,0,NULL,NULL,1,1,0,1,0,NULL,NULL,NULL,NULL,0,NULL,NULL,0,0,0,0,0,NULL,NULL,NULL,NULL,0,NULL,NULL,1,1,0,1,0,NULL,NULL,NULL,NULL,0,NULL,NULL,1,20,1,1,1,1,0,0,0,1,1,NULL,NULL,NULL,NULL,1,0,63,1,254,1,NULL,NULL,NULL,NULL,1,0,63,1,254,0,0);
|
||||
insert into Controls values (2,'Pelco-P','Local','PelcoP',1,1,0,1,1,0,0,1,NULL,NULL,NULL,NULL,1,0,3,1,1,0,0,1,NULL,NULL,NULL,NULL,0,NULL,NULL,1,1,0,1,0,NULL,NULL,NULL,NULL,0,NULL,NULL,0,0,0,0,0,NULL,NULL,NULL,NULL,0,NULL,NULL,1,1,0,1,0,NULL,NULL,NULL,NULL,0,NULL,NULL,1,20,1,1,1,1,0,0,0,1,1,NULL,NULL,NULL,NULL,1,0,63,1,254,1,NULL,NULL,NULL,NULL,1,0,63,1,254,0,0);
|
||||
insert into Controls values (3,'Sony VISCA','Local','Visca',1,1,0,1,0,0,0,1,0,16384,10,4000,1,1,6,1,1,1,0,1,0,1536,NULL,NULL,0,NULL,NULL,0,0,0,0,0,NULL,NULL,NULL,NULL,0,NULL,NULL,0,0,0,0,0,NULL,NULL,NULL,NULL,0,NULL,NULL,0,0,0,0,0,NULL,NULL,NULL,NULL,0,NULL,NULL,1,3,1,1,1,1,0,1,1,0,1,-15578,15578,100,10000,1,1,50,1,254,1,-7789,7789,100,5000,1,1,50,1,254,0,0);
|
||||
INSERT INTO Controls VALUES (4,'Axis API v2','Remote','AxisV2',0,0,0,1,0,0,1,0,0,9999,10,2500,0,NULL,NULL,1,1,0,1,0,0,9999,10,2500,0,NULL,NULL,1,1,0,1,0,0,9999,10,2500,0,NULL,NULL,0,0,0,0,0,NULL,NULL,NULL,NULL,0,NULL,NULL,0,0,0,0,0,NULL,NULL,NULL,NULL,0,NULL,NULL,1,12,1,1,1,1,1,0,1,0,1,-360,360,1,90,0,NULL,NULL,0,NULL,1,-360,360,1,90,0,NULL,NULL,0,NULL,0,0);
|
||||
insert into Controls values (5,'Panasonic IP','Remote','PanasonicIP',0,0,0,0,0,0,0,0,NULL,NULL,NULL,NULL,0,NULL,NULL,0,0,0,0,0,NULL,NULL,NULL,NULL,0,NULL,NULL,0,0,0,0,0,NULL,NULL,NULL,NULL,0,NULL,NULL,0,0,0,0,0,NULL,NULL,NULL,NULL,0,NULL,NULL,0,0,0,0,0,NULL,NULL,NULL,NULL,0,NULL,NULL,1,8,1,1,1,0,1,0,0,1,1,NULL,NULL,NULL,NULL,0,NULL,NULL,0,NULL,1,NULL,NULL,NULL,NULL,0,NULL,NULL,0,NULL,0,0);
|
||||
insert into Controls values (6,'Neu-Fusion NCS370','Remote','Ncs370',0,0,0,0,0,0,0,0,NULL,NULL,NULL,NULL,0,NULL,NULL,0,0,0,0,0,NULL,NULL,NULL,NULL,0,NULL,NULL,0,0,0,0,0,NULL,NULL,NULL,NULL,0,NULL,NULL,0,0,0,0,0,NULL,NULL,NULL,NULL,0,NULL,NULL,0,0,0,0,0,NULL,NULL,NULL,NULL,0,NULL,NULL,1,24,1,0,1,1,0,0,0,1,1,NULL,NULL,NULL,NULL,0,NULL,NULL,0,NULL,1,NULL,NULL,NULL,NULL,0,NULL,NULL,0,NULL,0,0);
|
||||
insert into Controls values (7,'AirLink SkyIPCam 7xx','Remote','SkyIPCam7xx',0,0,1,0,0,0,0,0,NULL,NULL,NULL,NULL,0,NULL,NULL,0,0,0,0,0,NULL,NULL,NULL,NULL,0,NULL,NULL,0,0,0,0,0,NULL,NULL,NULL,NULL,0,NULL,NULL,0,0,0,0,0,NULL,NULL,NULL,NULL,0,NULL,NULL,0,0,0,0,0,NULL,NULL,NULL,NULL,0,NULL,NULL,1,8,1,1,1,0,1,0,1,0,1,NULL,NULL,NULL,NULL,0,NULL,NULL,0,NULL,1,NULL,NULL,NULL,NULL,0,NULL,NULL,0,NULL,0,0);
|
||||
insert into Controls values (8,'Pelco-D','Ffmpeg','PelcoD',1,1,0,1,1,0,0,1,NULL,NULL,NULL,NULL,1,0,3,1,1,0,0,1,NULL,NULL,NULL,NULL,0,NULL,NULL,1,1,0,1,0,NULL,NULL,NULL,NULL,0,NULL,NULL,0,0,0,0,0,NULL,NULL,NULL,NULL,0,NULL,NULL,1,1,0,1,0,NULL,NULL,NULL,NULL,0,NULL,NULL,1,20,1,1,1,1,0,0,0,1,1,NULL,NULL,NULL,NULL,1,0,63,1,254,1,NULL,NULL,NULL,NULL,1,0,63,1,254,0,0);
|
||||
insert into Controls values (9,'Pelco-P','Ffmpeg','PelcoP',1,1,0,1,1,0,0,1,NULL,NULL,NULL,NULL,1,0,3,1,1,0,0,1,NULL,NULL,NULL,NULL,0,NULL,NULL,1,1,0,1,0,NULL,NULL,NULL,NULL,0,NULL,NULL,0,0,0,0,0,NULL,NULL,NULL,NULL,0,NULL,NULL,1,1,0,1,0,NULL,NULL,NULL,NULL,0,NULL,NULL,1,20,1,1,1,1,0,0,0,1,1,NULL,NULL,NULL,NULL,1,0,63,1,254,1,NULL,NULL,NULL,NULL,1,0,63,1,254,0,0);
|
||||
INSERT INTO Controls VALUES (10,'Foscam FI8620','Ffmpeg','FI8620_Y2k',0,0,0,1,0,0,0,1,1,10,1,10,1,1,63,1,1,0,0,1,1,63,1,63,1,1,63,1,1,0,0,1,0,0,0,0,1,0,255,0,0,0,0,0,0,0,0,0,0,0,0,1,1,0,0,1,0,0,0,0,1,0,255,1,8,0,1,1,1,0,0,0,1,1,1,360,1,360,1,1,63,0,0,1,1,90,1,90,1,1,63,0,0,0,0);
|
||||
INSERT INTO Controls VALUES (11,'Foscam FI8608W','Ffmpeg','FI8608W_Y2k',1,0,1,1,0,0,0,1,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,1,1,0,0,1,0,0,0,0,1,0,255,0,0,0,0,0,0,0,0,0,0,0,0,1,1,0,0,1,0,0,0,0,1,0,255,1,8,0,1,1,1,0,0,0,1,1,0,0,0,0,1,1,128,0,0,1,0,0,0,0,1,1,128,0,0,0,0);
|
||||
INSERT INTO Controls VALUES (12,'Foscam FI9821W','Ffmpeg','FI9821W_Y2k',1,0,1,1,0,0,0,1,0,0,0,0,0,0,0,1,1,0,0,1,0,0,0,0,1,0,100,1,1,0,0,1,0,100,0,100,1,0,100,0,0,0,0,0,0,0,0,0,0,0,0,1,1,0,0,1,0,100,0,100,1,0,100,1,16,0,1,1,1,0,0,0,1,1,0,360,0,360,1,0,4,0,0,1,0,90,0,90,1,0,4,0,0,0,0);
|
||||
INSERT INTO Controls VALUES (13,'Loftek Sentinel','Remote','LoftekSentinel',0,0,1,1,0,0,0,1,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,1,0,1,0,0,0,255,16,16,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,1,0,1,0,0,0,6,1,1,0,0,0,1,10,0,1,1,1,0,0,0,1,1,0,0,0,0,0,0,0,0,0,1,0,0,0,0,0,0,0,0,0,0,0);
|
||||
INSERT INTO Controls VALUES (NULL,'Pelco-D','Local','PelcoD',1,1,0,1,1,0,0,1,NULL,NULL,NULL,NULL,1,0,3,1,1,0,0,1,NULL,NULL,NULL,NULL,0,NULL,NULL,1,1,0,1,0,NULL,NULL,NULL,NULL,0,NULL,NULL,0,0,0,0,0,NULL,NULL,NULL,NULL,0,NULL,NULL,1,1,0,1,0,NULL,NULL,NULL,NULL,0,NULL,NULL,1,20,1,1,1,1,0,0,0,1,1,NULL,NULL,NULL,NULL,1,0,63,1,254,1,NULL,NULL,NULL,NULL,1,0,63,1,254,0,0);
|
||||
INSERT INTO Controls VALUES (NULL,'Pelco-P','Local','PelcoP',1,1,0,1,1,0,0,1,NULL,NULL,NULL,NULL,1,0,3,1,1,0,0,1,NULL,NULL,NULL,NULL,0,NULL,NULL,1,1,0,1,0,NULL,NULL,NULL,NULL,0,NULL,NULL,0,0,0,0,0,NULL,NULL,NULL,NULL,0,NULL,NULL,1,1,0,1,0,NULL,NULL,NULL,NULL,0,NULL,NULL,1,20,1,1,1,1,0,0,0,1,1,NULL,NULL,NULL,NULL,1,0,63,1,254,1,NULL,NULL,NULL,NULL,1,0,63,1,254,0,0);
|
||||
INSERT INTO Controls VALUES (NULL,'Sony VISCA','Local','Visca',1,1,0,1,0,0,0,1,0,16384,10,4000,1,1,6,1,1,1,0,1,0,1536,NULL,NULL,0,NULL,NULL,0,0,0,0,0,NULL,NULL,NULL,NULL,0,NULL,NULL,0,0,0,0,0,NULL,NULL,NULL,NULL,0,NULL,NULL,0,0,0,0,0,NULL,NULL,NULL,NULL,0,NULL,NULL,1,3,1,1,1,1,0,1,1,0,1,-15578,15578,100,10000,1,1,50,1,254,1,-7789,7789,100,5000,1,1,50,1,254,0,0);
|
||||
INSERT INTO Controls VALUES (NULL,'Axis API v2','Remote','AxisV2',0,0,0,1,0,0,1,0,0,9999,10,2500,0,NULL,NULL,1,1,0,1,0,0,9999,10,2500,0,NULL,NULL,1,1,0,1,0,0,9999,10,2500,0,NULL,NULL,0,0,0,0,0,NULL,NULL,NULL,NULL,0,NULL,NULL,0,0,0,0,0,NULL,NULL,NULL,NULL,0,NULL,NULL,1,12,1,1,1,1,1,0,1,0,1,-360,360,1,90,0,NULL,NULL,0,NULL,1,-360,360,1,90,0,NULL,NULL,0,NULL,0,0);
|
||||
INSERT INTO Controls VALUES (NULL,'Panasonic IP','Remote','PanasonicIP',0,0,0,0,0,0,0,0,NULL,NULL,NULL,NULL,0,NULL,NULL,0,0,0,0,0,NULL,NULL,NULL,NULL,0,NULL,NULL,0,0,0,0,0,NULL,NULL,NULL,NULL,0,NULL,NULL,0,0,0,0,0,NULL,NULL,NULL,NULL,0,NULL,NULL,0,0,0,0,0,NULL,NULL,NULL,NULL,0,NULL,NULL,1,8,1,1,1,0,1,0,0,1,1,NULL,NULL,NULL,NULL,0,NULL,NULL,0,NULL,1,NULL,NULL,NULL,NULL,0,NULL,NULL,0,NULL,0,0);
|
||||
INSERT INTO Controls VALUES (NULL,'Neu-Fusion NCS370','Remote','Ncs370',0,0,0,0,0,0,0,0,NULL,NULL,NULL,NULL,0,NULL,NULL,0,0,0,0,0,NULL,NULL,NULL,NULL,0,NULL,NULL,0,0,0,0,0,NULL,NULL,NULL,NULL,0,NULL,NULL,0,0,0,0,0,NULL,NULL,NULL,NULL,0,NULL,NULL,0,0,0,0,0,NULL,NULL,NULL,NULL,0,NULL,NULL,1,24,1,0,1,1,0,0,0,1,1,NULL,NULL,NULL,NULL,0,NULL,NULL,0,NULL,1,NULL,NULL,NULL,NULL,0,NULL,NULL,0,NULL,0,0);
|
||||
INSERT INTO Controls VALUES (NULL,'AirLink SkyIPCam 7xx','Remote','SkyIPCam7xx',0,0,1,0,0,0,0,0,NULL,NULL,NULL,NULL,0,NULL,NULL,0,0,0,0,0,NULL,NULL,NULL,NULL,0,NULL,NULL,0,0,0,0,0,NULL,NULL,NULL,NULL,0,NULL,NULL,0,0,0,0,0,NULL,NULL,NULL,NULL,0,NULL,NULL,0,0,0,0,0,NULL,NULL,NULL,NULL,0,NULL,NULL,1,8,1,1,1,0,1,0,1,0,1,NULL,NULL,NULL,NULL,0,NULL,NULL,0,NULL,1,NULL,NULL,NULL,NULL,0,NULL,NULL,0,NULL,0,0);
|
||||
INSERT INTO Controls VALUES (NULL,'Pelco-D','Ffmpeg','PelcoD',1,1,0,1,1,0,0,1,NULL,NULL,NULL,NULL,1,0,3,1,1,0,0,1,NULL,NULL,NULL,NULL,0,NULL,NULL,1,1,0,1,0,NULL,NULL,NULL,NULL,0,NULL,NULL,0,0,0,0,0,NULL,NULL,NULL,NULL,0,NULL,NULL,1,1,0,1,0,NULL,NULL,NULL,NULL,0,NULL,NULL,1,20,1,1,1,1,0,0,0,1,1,NULL,NULL,NULL,NULL,1,0,63,1,254,1,NULL,NULL,NULL,NULL,1,0,63,1,254,0,0);
|
||||
INSERT INTO Controls VALUES (NULL,'Pelco-P','Ffmpeg','PelcoP',1,1,0,1,1,0,0,1,NULL,NULL,NULL,NULL,1,0,3,1,1,0,0,1,NULL,NULL,NULL,NULL,0,NULL,NULL,1,1,0,1,0,NULL,NULL,NULL,NULL,0,NULL,NULL,0,0,0,0,0,NULL,NULL,NULL,NULL,0,NULL,NULL,1,1,0,1,0,NULL,NULL,NULL,NULL,0,NULL,NULL,1,20,1,1,1,1,0,0,0,1,1,NULL,NULL,NULL,NULL,1,0,63,1,254,1,NULL,NULL,NULL,NULL,1,0,63,1,254,0,0);
|
||||
INSERT INTO Controls VALUES (NULL,'Foscam FI8620','Ffmpeg','FI8620_Y2k',0,0,0,1,0,0,0,1,1,10,1,10,1,1,63,1,1,0,0,1,1,63,1,63,1,1,63,1,1,0,0,1,0,0,0,0,1,0,255,0,0,0,0,0,0,0,0,0,0,0,0,1,1,0,0,1,0,0,0,0,1,0,255,1,8,0,1,1,1,0,0,0,1,1,1,360,1,360,1,1,63,0,0,1,1,90,1,90,1,1,63,0,0,0,0);
|
||||
INSERT INTO Controls VALUES (NULL,'Foscam FI8608W','Ffmpeg','FI8608W_Y2k',1,0,1,1,0,0,0,1,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,1,1,0,0,1,0,0,0,0,1,0,255,0,0,0,0,0,0,0,0,0,0,0,0,1,1,0,0,1,0,0,0,0,1,0,255,1,8,0,1,1,1,0,0,0,1,1,0,0,0,0,1,1,128,0,0,1,0,0,0,0,1,1,128,0,0,0,0);
|
||||
INSERT INTO Controls VALUES (NULL,'Foscam FI8908W','Remote','FI8908W',0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,1,0,1,0,1,1,0,0,0,1,1,0,0,0,0,0,0,0,0,0,1,0,0,0,0,0,0,0,0,0,0,0);
|
||||
INSERT INTO Controls VALUES (NULL,'Foscam FI9821W','Ffmpeg','FI9821W_Y2k',1,0,1,1,0,0,0,1,0,0,0,0,0,0,0,1,1,0,0,1,0,0,0,0,1,0,100,1,1,0,0,1,0,100,0,100,1,0,100,0,0,0,0,0,0,0,0,0,0,0,0,1,1,0,0,1,0,100,0,100,1,0,100,1,16,0,1,1,1,0,0,0,1,1,0,360,0,360,1,0,4,0,0,1,0,90,0,90,1,0,4,0,0,0,0);
|
||||
INSERT INTO Controls VALUES (NULL,'Loftek Sentinel','Remote','LoftekSentinel',0,0,1,1,0,0,0,1,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,1,0,1,0,0,0,255,16,16,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,1,0,1,0,0,0,6,1,1,0,0,0,1,10,0,1,1,1,0,0,0,1,1,0,0,0,0,0,0,0,0,0,1,0,0,0,0,0,0,0,0,0,0,0);
|
||||
INSERT INTO Controls VALUES (NULL,'Toshiba IK-WB11A','Remote','Toshiba_IK_WB11A',0,0,1,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,1,10,0,1,1,0,1,0,1,0,1,0,0,0,0,0,0,0,0,0,1,0,0,0,0,0,0,0,0,0,0,0);
|
||||
INSERT INTO Controls VALUES (NULL,'WanscamPT','Remote','Wanscam',1,1,1,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,1,0,1,0,0,0,16,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,1,0,1,0,0,0,16,0,0,0,0,0,1,16,1,1,1,1,0,0,0,1,1,0,0,0,0,0,0,0,0,0,1,0,0,0,0,0,0,0,0,0,0,0);
|
||||
|
||||
--
|
||||
-- Add some monitor preset values
|
||||
|
@ -618,12 +629,13 @@ INSERT INTO MonitorPresets VALUES (NULL,'Airlink 777W PTZ, 640x480, mjpeg','Remo
|
|||
--
|
||||
-- Add some zone preset values
|
||||
--
|
||||
INSERT INTO ZonePresets VALUES (1,'Fast, low sensitivity','Active','Percent','AlarmedPixels',60,NULL,20,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,0);
|
||||
INSERT INTO ZonePresets VALUES (2,'Fast, medium sensitivity','Active','Percent','AlarmedPixels',40,NULL,10,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,0);
|
||||
INSERT INTO ZonePresets VALUES (3,'Fast, high sensitivity','Active','Percent','AlarmedPixels',20,NULL,5,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,0);
|
||||
INSERT INTO ZonePresets VALUES (4,'Best, low sensitivity','Active','Percent','Blobs',60,NULL,36,NULL,7,7,24,NULL,20,NULL,1,NULL,0);
|
||||
INSERT INTO ZonePresets VALUES (5,'Best, medium sensitivity','Active','Percent','Blobs',40,NULL,16,NULL,5,5,12,NULL,10,NULL,1,NULL,0);
|
||||
INSERT INTO ZonePresets VALUES (6,'Best, high sensitivity','Active','Percent','Blobs',20,NULL,8,NULL,3,3,6,NULL,5,NULL,1,NULL,0);
|
||||
INSERT INTO ZonePresets VALUES (1,'Default','Active','Percent','Blobs',25,NULL,3,75,3,3,3,75,2,NULL,1,NULL,0,0);
|
||||
INSERT INTO ZonePresets VALUES (2,'Fast, low sensitivity','Active','Percent','AlarmedPixels',60,NULL,20,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,0,0);
|
||||
INSERT INTO ZonePresets VALUES (3,'Fast, medium sensitivity','Active','Percent','AlarmedPixels',40,NULL,10,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,0,0);
|
||||
INSERT INTO ZonePresets VALUES (4,'Fast, high sensitivity','Active','Percent','AlarmedPixels',20,NULL,5,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,0,0);
|
||||
INSERT INTO ZonePresets VALUES (5,'Best, low sensitivity','Active','Percent','Blobs',60,NULL,36,NULL,7,7,24,NULL,20,NULL,1,NULL,0,0);
|
||||
INSERT INTO ZonePresets VALUES (6,'Best, medium sensitivity','Active','Percent','Blobs',40,NULL,16,NULL,5,5,12,NULL,10,NULL,1,NULL,0,0);
|
||||
INSERT INTO ZonePresets VALUES (7,'Best, high sensitivity','Active','Percent','Blobs',20,NULL,8,NULL,3,3,6,NULL,5,NULL,1,NULL,0,0);
|
||||
|
||||
--
|
||||
-- Apply the initial configuration
|
||||
|
|
|
@ -20,18 +20,18 @@ would silently revert the changes and cause event loss - refer
|
|||
bug #608793).
|
||||
|
||||
If you do want to change the location, here are a couple of suggestions.
|
||||
(thanks to vagrant@freegeek.org):
|
||||
|
||||
These lines in fstab could allow you to bind-mount an alternate location
|
||||
These lines would mount /dev/sdX1 to /video_storage, and then 'link' /video_storage
|
||||
to the locations that ZoneMinder expects them to be at.
|
||||
|
||||
/dev/sdX1 /otherdrive ext3 defaults 0 2
|
||||
/otherdrive/zoneminder/images /var/cache/zoneminder/images bind defaults 0 2
|
||||
/otherdrive/zoneminder/events /var/cache/zoneminder/events bind defaults 0 2
|
||||
/dev/sdX1 /video_storage ext4 defaults 0 2
|
||||
/video_storage/zoneminder/images /var/cache/zoneminder/images none bind 0 2
|
||||
/video_storage/zoneminder/events /var/cache/zoneminder/events none bind 0 2
|
||||
|
||||
or if you have a separate partition for each:
|
||||
|
||||
/dev/sdX1 /var/cache/zoneminder/images ext3 defaults 0 2
|
||||
/dev/sdX2 /var/cache/zoneminder/events ext3 defaults 0 2
|
||||
/dev/sdX1 /var/cache/zoneminder/images ext4 defaults 0 2
|
||||
/dev/sdX2 /var/cache/zoneminder/events ext4 defaults 0 2
|
||||
|
||||
|
||||
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
zoneminder (1.26.4-1) unstable; urgency=low
|
||||
zoneminder (1.26.5-1) unstable; urgency=low
|
||||
|
||||
* improvements to zmupdate.pl, cleanups
|
||||
|
||||
|
|
|
@ -2,13 +2,32 @@ Source: zoneminder
|
|||
Section: net
|
||||
Priority: optional
|
||||
Maintainer: Isaac Connor <iconnor@connortechnology.com>
|
||||
Build-Depends: debhelper (>= 5), autoconf, automake, dpatch, libphp-serialization-perl, libgnutls-dev, libmysqlclient-dev, libdbd-mysql-perl, libdate-manip-perl, libwww-perl, libjpeg8-dev, libpcre3-dev, libavcodec-dev, libavformat-dev (>= 3:0.svn20090204), libswscale-dev (>= 3:0.svn20090204), libavutil-dev, libv4l-dev (>= 0.8.3), libbz2-dev, libtool, libsys-mmap-perl, ffmpeg, libnetpbm10-dev, libavdevice-dev, libdevice-serialport-perl, libpcre3, libarchive-zip-perl, libmime-lite-perl, libjpeg8, dh-autoreconf
|
||||
Build-Depends: debhelper (>= 7.0.50), autoconf, automake, dpatch, libphp-serialization-perl, libgnutls-dev, libmysqlclient-dev, libdbd-mysql-perl, libdate-manip-perl, libwww-perl, libjpeg8-dev, libpcre3-dev, libavcodec-dev, libavformat-dev (>= 3:0.svn20090204), libswscale-dev (>= 3:0.svn20090204), libavutil-dev, libv4l-dev (>= 0.8.3), libbz2-dev, libtool, libsys-mmap-perl, ffmpeg, libnetpbm10-dev, libavdevice-dev, libdevice-serialport-perl, libpcre3, libarchive-zip-perl, libmime-lite-perl, libjpeg8, dh-autoreconf
|
||||
Standards-Version: 3.9.2
|
||||
|
||||
Package: zoneminder
|
||||
Architecture: any
|
||||
Depends: ${shlibs:Depends}, ${misc:Depends}, ${perl:Depends}, apache2, libapache2-mod-php5, php5, php5-mysql, libphp-serialization-perl, libdate-manip-perl, libmime-lite-perl, libmime-lite-perl, mysql-client, libwww-perl, libarchive-tar-perl, libarchive-zip-perl, libdevice-serialport-perl, libpcre3, ffmpeg, rsyslog | system-log-daemon, libmodule-load-perl, libsys-mmap-perl, libjson-any-perl, netpbm, libavdevice53, libjpeg8, zip, libnet-sftp-foreign-perl
|
||||
Description: Linux video camera security and surveillance solution
|
||||
Recommends: mysql-server
|
||||
Description: A video camera security and surveillance solution
|
||||
ZoneMinder is intended for use in single or multi-camera video security
|
||||
applications, including commercial or home CCTV, theft prevention and child
|
||||
or family member or home monitoring and other care scenarios. It
|
||||
supports capture, analysis, recording, and monitoring of video data coming
|
||||
from one or more video or network cameras attached to a Linux system.
|
||||
ZoneMinder also support web and semi-automatic control of Pan/Tilt/Zoom
|
||||
cameras using a variety of protocols. It is suitable for use as a home
|
||||
video security system and for commercial or professional video security
|
||||
and surveillance. It can also be integrated into a home automation system
|
||||
via X.10 or other protocols.
|
||||
|
||||
Package: zoneminder-dbg
|
||||
Architecture: any
|
||||
Depends:
|
||||
zoneminder (= ${binary:Version}),
|
||||
${misc:Depends}
|
||||
Description: debugging syumbols for zoneminder.
|
||||
ZoneMinder is a video camera security and surveillance solution.
|
||||
ZoneMinder is intended for use in single or multi-camera video security
|
||||
applications, including commercial or home CCTV, theft prevention and child
|
||||
or family member or home monitoring and other care scenarios. It
|
||||
|
|
|
@ -25,7 +25,6 @@ start() {
|
|||
echo -n "Starting $prog: "
|
||||
mkdir -p $RUNDIR && chown www-data:www-data $RUNDIR
|
||||
mkdir -p $TMPDIR && chown www-data:www-data $TMPDIR
|
||||
zmfix -a
|
||||
$command start
|
||||
RETVAL=$?
|
||||
[ $RETVAL = 0 ] && echo success
|
||||
|
|
|
@ -2,7 +2,7 @@
|
|||
|
||||
set -e
|
||||
|
||||
VERSION=1.26.4
|
||||
VERSION=1.26.5
|
||||
|
||||
if [ "$1" = "configure" ]; then
|
||||
#
|
||||
|
|
|
@ -43,7 +43,7 @@ override_dh_clean:
|
|||
|
||||
override_dh_install:
|
||||
# Add here commands to install the package into debian/zm.
|
||||
$(MAKE) install DESTDIR=$(CURDIR)/debian/zoneminder RUNDIR=$(CURDIR)/debian/zoneminder/var/run ZM_RUNDIR=$(CURDIR)/debian/zoneminder/var/run
|
||||
$(MAKE) install DESTDIR=$(CURDIR)/debian/zoneminder
|
||||
install -D -m 0644 db/zm_create.sql $(CURDIR)/debian/zoneminder/usr/share/zoneminder/db
|
||||
install -D -m 0644 db/zm_update-*.sql $(CURDIR)/debian/zoneminder/usr/share/zoneminder/db
|
||||
install -D -m 0644 debian/apache.conf $(CURDIR)/debian/zoneminder/etc/zm
|
||||
|
@ -71,3 +71,7 @@ override_dh_fixperms:
|
|||
|
||||
override_dh_auto_test:
|
||||
# do not run tests...
|
||||
|
||||
.PHONY: override_dh_strip
|
||||
override_dh_strip:
|
||||
dh_strip --dbg-package=zoneminder-dbg
|
||||
|
|
|
@ -4,27 +4,29 @@ New installs
|
|||
1. Unless you are already using the MySQL server or you are running it
|
||||
remotely you will need to ensure that the server is installed and secured:
|
||||
|
||||
yum install mysql-community-server
|
||||
--OR--
|
||||
yum install mariadb-server
|
||||
sudo yum install community-mysql-server
|
||||
|
||||
sudo systemctl enable mysqld
|
||||
|
||||
sudo system start mysqld
|
||||
sudo systemctl start mysqld.service
|
||||
|
||||
mysql_secure_installation
|
||||
|
||||
2. Using the password for the root account set during the previous step, you
|
||||
will need to create the ZoneMinder database, assuming your database server is local:
|
||||
NOTE: The Fedora team currently recommends mysql-community over mariadb
|
||||
|
||||
mysql -u root -p < /usr/share/zoneminder/db/zm_create.sql
|
||||
mysqladmin reload
|
||||
2. Using the password for the root account set during the previous step, you
|
||||
will need to create the ZoneMinder database, assuming your database server
|
||||
is local:
|
||||
|
||||
mysql -uroot -p < /usr/share/zoneminder/db/zm_create.sql
|
||||
mysqladmin -uroot -p reload
|
||||
|
||||
3. The database needs a user. One is not created by default because this would
|
||||
introduce an obvious security issue. The following should set this up:
|
||||
|
||||
mysql -u root -p
|
||||
grant select,insert,update,delete,alter on zm.* to 'zmuser'@localhost identified by 'zmpass';
|
||||
grant select,insert,update,delete,lock tables,alter on zm.* to
|
||||
'zmuser'@localhost identified by 'zmpass';
|
||||
|
||||
Obviously, change at least zmpass to an actual, secure password or
|
||||
passphrase. You can change zmuser as well if you like.
|
||||
|
@ -44,31 +46,32 @@ New installs
|
|||
may be necessary to disable SELinux for httpd, or even completely for
|
||||
ZoneMinder to function. This will be addressed in a later release. Run
|
||||
|
||||
setenforce 0
|
||||
sudo setenforce 0
|
||||
|
||||
for testing, and edit /etc/sysconfig/selinux to disable it at boot time.
|
||||
|
||||
7. IMPORTANT: Edit /etc/httpd/conf.d/zoneminder.conf and/or /etc/httpd/conf.
|
||||
7. IMPORTANT: Edit /etc/httpd/conf.d/zoneminder.conf and/or
|
||||
/etc/httpd/conf/httpd.conf.
|
||||
|
||||
The httpd.conf file included with this version of Fedora processes the conf.d
|
||||
folder after the default ScriptAlias directive in the httpd.conf file.
|
||||
Previously, the conf.d folder was processed before the default ScriptAlias
|
||||
directive. This causes a ScriptAlias overlap and breaks Zoneminder's streaming
|
||||
abilities.
|
||||
directive. This causes a ScriptAlias overlap and breaks Zoneminder's
|
||||
streaming abilities.
|
||||
|
||||
Reference: http://httpd.apache.org/docs/2.4/mod/mod_alias.html#order
|
||||
Bug Report: https://bugzilla.redhat.com/show_bug.cgi?id=973067
|
||||
|
||||
WORKAROUND #1
|
||||
If you are running zoneminder on a dedicated server then the simplest solution
|
||||
may be to simply comment out the line in httpd.conf that reads:
|
||||
If you are running zoneminder on a dedicated server then the simplest
|
||||
solution may be to simply comment out the line in httpd.conf that reads:
|
||||
|
||||
ScriptAlias /cgi-bin/ "/var/www/cgi-bin/"
|
||||
|
||||
WORKAROUND #2
|
||||
If you need both the default cgi-bin folder & the zoneminder cgi-bin folder then
|
||||
a solution might be to move the following line before the default ScriptAlias
|
||||
directive in the httpd.conf file:
|
||||
If you need both the default cgi-bin folder & the zoneminder cgi-bin folder
|
||||
then a solution might be to move the following line before the default
|
||||
ScriptAlias directive in the httpd.conf file:
|
||||
|
||||
IncludeOptional conf.d/*.conf
|
||||
|
||||
|
@ -84,7 +87,8 @@ New installs
|
|||
b) check OPT_USE_AUTH.
|
||||
c) set AUTH_HASH_SECRET to a random string.
|
||||
d) click Save and refresh the main browser window.
|
||||
e) You should be prompted to log in; the default username/password is admin/admin.
|
||||
e) You should be prompted to log in;
|
||||
the default username/password is admin/admin.
|
||||
f) Open Options again, choose the newly visible Users tab.
|
||||
g) click the admin user and set a password.
|
||||
h) enable OPT_CONTROL on the Ssytem tab to enable ptz camera control.
|
||||
|
@ -108,7 +112,22 @@ Upgrades
|
|||
information. Comparing /etc/zm.conf and /etc/zm.conf.rpmnew should help to
|
||||
do this.
|
||||
|
||||
2. You will need to upgrade the ZoneMinder database as described in the
|
||||
manual. This command should be sufficient when run as root:
|
||||
2. Add additional permissions to the zmuser account:
|
||||
|
||||
zmupdate.pl --user=root --pass=<mysql_root_pwd> --version=<from version>
|
||||
mysql -u root -p
|
||||
grant lock tables,alter on zm.* to
|
||||
'zmuser'@localhost identified by 'zmpass';
|
||||
|
||||
Since this is an upgrade, the assumption is that the zmuser account already
|
||||
has select, insert, update, and delete permission.
|
||||
|
||||
3. You will need to upgrade the ZoneMinder database as described in the
|
||||
manual. Only if the previous step was succesful, may you run zmupdate like
|
||||
so:
|
||||
|
||||
sudo zmupdate.pl --version=<from version>
|
||||
|
||||
|
||||
If unsure then run it this way:
|
||||
|
||||
sudo zmupdate.pl --user=root --pass=<mysql_root_pwd> --version=<from version>
|
||||
|
|
|
@ -1 +0,0 @@
|
|||
../redhat/redalert.wav
|
|
@ -1,10 +1,20 @@
|
|||
%define cambrev 0.931
|
||||
%define moorev 1.3.2
|
||||
%define jscrev 1.0
|
||||
|
||||
%define zmuid $(id -un)
|
||||
%define zmgid $(id -gn)
|
||||
%define zmuid_final apache
|
||||
%define zmgid_final apache
|
||||
|
||||
%global _hardened_build 1
|
||||
|
||||
### Delete the lines below to build with ffmpeg and/or x10
|
||||
%define _without_ffmpeg 1
|
||||
%define _without_x10 1
|
||||
|
||||
Name: zoneminder
|
||||
Version: 1.26.3
|
||||
Version: 1.27
|
||||
Release: 1%{?dist}
|
||||
Summary: A camera monitoring and analysis tool
|
||||
Group: System Environment/Daemons
|
||||
|
@ -13,55 +23,49 @@ Group: System Environment/Daemons
|
|||
License: GPLv2+ and LGPLv2+ and MIT
|
||||
URL: http://www.zoneminder.com/
|
||||
|
||||
#Source: http://www2.zoneminder.com/downloads/ZoneMinder-%{version}.tar.gz
|
||||
#Source: https://github.com/ZoneMinder/ZoneMinder/archive/v%{version}.tar.gz
|
||||
Source: ZoneMinder-%{version}.tar.gz
|
||||
Source2: zoneminder.conf
|
||||
Source3: redalert.wav
|
||||
Source4: README.Fedora
|
||||
Source5: http://downloads.sourceforge.net/jscalendar/jscalendar-1.0.zip
|
||||
Source6: zoneminder.service
|
||||
Source7: zoneminder.logrotate
|
||||
Source2: jscalendar-%{jscrev}.zip
|
||||
#Source2: http://downloads.sourceforge.net/jscalendar/jscalendar-%{jscrev}.zip
|
||||
|
||||
# Need to unravel the proper mootools files to grab from upstream, since the
|
||||
# number of them keeps multiplying. In the meantime, rely on the ones bundled
|
||||
# with zoneminder. As these are javascript, there is no guideline violation
|
||||
# here.
|
||||
#Source8: http://mootools.net/download/get/mootools-1.2.3-core-yc.js
|
||||
Patch1: zoneminder-1.26.3-dbinstall.patch
|
||||
Patch2: zoneminder-1.24.3-runlevel.patch
|
||||
#Patch3: zoneminder-1.26.3-noffmpeg.patch
|
||||
Patch10: zoneminder-1.24.4-installfix.patch
|
||||
Patch11: zoneminder-1.26.3-gcc48.patch
|
||||
#Patch12: zoneminder-1.25.0-gcrypt.patch
|
||||
#Patch13: zoneminder-1.25.0-kernel35.patch
|
||||
#Patch14: zoneminder-1.26.3-ffmpeg.patch
|
||||
#Source3: http://mootools.net/download/get/mootools-core-%{moorev}-full-compat-yc.js
|
||||
|
||||
Patch1: zoneminder-1.24.3-runlevel.patch
|
||||
Patch2: zoneminder-1.26.0-defaults.patch
|
||||
%{?_without_ffmpeg:Patch3: zoneminder-1.26.3-noffmpeg.patch}
|
||||
|
||||
BuildRequires: automake gnutls-devel systemd-units
|
||||
BuildRequires: libtool bzip2-devel
|
||||
BuildRequires: mysql-devel pcre-devel libjpeg-devel
|
||||
BuildRequires: community-mysql-devel pcre-devel libjpeg-turbo-devel
|
||||
BuildRequires: perl(Archive::Tar) perl(Archive::Zip)
|
||||
BuildRequires: perl(Date::Manip) perl(DBD::mysql)
|
||||
BuildRequires: perl(ExtUtils::MakeMaker) perl(LWP::UserAgent)
|
||||
BuildRequires: perl(ExtUtils::MakeMaker) perl(LWP::UserAgent::Determined)
|
||||
BuildRequires: perl(MIME::Entity) perl(MIME::Lite)
|
||||
BuildRequires: perl(PHP::Serialization) perl(Sys::Mmap)
|
||||
BuildRequires: perl(Time::HiRes) perl(Net::SFTP::Foreign)
|
||||
BuildRequires: perl(Expect)
|
||||
BuildRequires: gcc gcc-c++ ffmpeg-devel
|
||||
BuildRequires: perl(Expect) perl(Sys::Syslog)
|
||||
BuildRequires: gcc gcc-c++ vlc-devel libcurl-devel
|
||||
BuildRequires: autoconf autoconf-archive
|
||||
# Uncomment for X10 support
|
||||
#BuildRequires: perl(X10::ActiveHome) perl(Astro::SunTime)
|
||||
%{!?_without_ffmpeg:BuildRequires: ffmpeg-devel}
|
||||
%{!?_without_x10:BuildRequires: perl(X10::ActiveHome) perl(Astro::SunTime)}
|
||||
|
||||
Requires: httpd php php-mysql cambozola
|
||||
Requires: libjpeg-turbo ffmpeg
|
||||
Requires: libjpeg-turbo libcurl vlc-core ffmpeg
|
||||
Requires: perl(:MODULE_COMPAT_%(eval "`%{__perl} -V:version`"; echo $version))
|
||||
Requires: perl(DBD::mysql) perl(Archive::Tar) perl(Archive::Zip)
|
||||
Requires: perl(MIME::Entity) perl(MIME::Lite) perl(Net::SMTP) perl(Net::FTP)
|
||||
Requires: perl(LWP::Protocol::https)
|
||||
|
||||
Requires(post): systemd-units systemd-sysv
|
||||
Requires(post): /usr/bin/gpasswd
|
||||
Requires(post): /usr/bin/less
|
||||
Requires(preun): systemd-units
|
||||
Requires(postun): systemd-units
|
||||
|
||||
|
||||
%description
|
||||
ZoneMinder is a set of applications which is intended to provide a complete
|
||||
solution allowing you to capture, analyse, record and monitor any cameras you
|
||||
|
@ -71,29 +75,22 @@ attached to BTTV cards, various USB cameras and IP network cameras. It is
|
|||
designed to support as many cameras as you can attach to your computer without
|
||||
too much degradation of performance.
|
||||
|
||||
|
||||
%prep
|
||||
%setup -q -n ZoneMinder-%{version}
|
||||
|
||||
# Unpack jscalendar and move some files around
|
||||
%setup -q -D -T -a 5 -n ZoneMinder-%{version}
|
||||
%setup -q -D -T -a 2 -n ZoneMinder-%{version}
|
||||
mkdir jscalendar-doc
|
||||
pushd jscalendar-1.0
|
||||
mv *html *php doc/* README ../jscalendar-doc
|
||||
rmdir doc
|
||||
popd
|
||||
|
||||
%patch1 -p0 -b .dbinstall
|
||||
%patch2 -p0 -b .runlevel
|
||||
#%patch3 -p0 -b .noffmpeg
|
||||
%patch10 -p0 -b .installfix
|
||||
%patch11 -p0 -b .gcc47
|
||||
#%patch12 -p0 -b .gcrypt
|
||||
#%patch13 -p0 -b .kernel35
|
||||
#%patch14 -p0 -b .ffmpeg
|
||||
cp %{SOURCE4} README.Fedora
|
||||
chmod -x src/zm_event.cpp src/zm_user.h
|
||||
%patch1 -p0 -b .runlevel
|
||||
%patch2 -p0 -b .defaults
|
||||
%{?_without_ffmpeg:%patch3 -p0 -b .noffmpeg}
|
||||
|
||||
chmod -x src/zm_event.cpp src/zm_user.h
|
||||
|
||||
%build
|
||||
libtoolize --force
|
||||
|
@ -101,15 +98,9 @@ aclocal
|
|||
autoheader
|
||||
automake --force-missing --add-missing
|
||||
autoconf
|
||||
#autoreconf
|
||||
|
||||
OPTS=""
|
||||
#%ifnarch %{ix86} x86_64
|
||||
# OPTS="$OPTS --disable-crashtrace"
|
||||
#%endif
|
||||
|
||||
export ZM_RUNDIR=/var/run/zoneminder
|
||||
export ZM_TMPDIR=/var/lib/zoneminder/temp
|
||||
%configure \
|
||||
--disable-crashtrace \
|
||||
--with-libarch=%{_lib} \
|
||||
|
@ -125,50 +116,42 @@ export ZM_TMPDIR=/var/lib/zoneminder/temp
|
|||
ZM_SSL_LIB="gnutls" \
|
||||
ZM_RUNDIR=/var/run/zoneminder \
|
||||
ZM_TMPDIR=/var/lib/zoneminder/temp \
|
||||
%ifarch x86_64
|
||||
CXXFLAGS="-D__STDC_CONSTANT_MACROS -msse2" \
|
||||
%else
|
||||
CXXFLAGS="-D__STDC_CONSTANT_MACROS" \
|
||||
%endif
|
||||
--with-extralibs="" \
|
||||
$OPTS
|
||||
|
||||
# Have to do this now because the configure script wipes out modifications made to this file
|
||||
cat <<EOF >> db/zm_create.sql
|
||||
# Fedora change:
|
||||
# Alter some default paths to match the default URL and selinux expectations
|
||||
update Config set Value = '/cgi-bin/zm/nph-zms' where Name = 'ZM_PATH_ZMS';
|
||||
update Config set Value = '/var/log/zoneminder' where Name = 'ZM_PATH_LOGS';
|
||||
update Config set Value = '/var/log/zoneminder/zm_debug_log+' where Name = 'ZM_EXTRA_DEBUG_LOG';
|
||||
update Config set Value = '/var/log/zoneminder/zm_xml.log' where Name = 'ZM_EYEZM_LOG_FILE';
|
||||
update Config set Value = '/var/lib/zoneminder/sock' where Name = 'ZM_PATH_SOCKS';
|
||||
update Config set Value = '/var/lib/zoneminder/swap' where Name = 'ZM_PATH_SWAP';
|
||||
update Config set Value = '/var/spool/zoneminder-upload' where Name = 'ZM_UPLOAD_FTP_LOC_DIR';
|
||||
EOF
|
||||
|
||||
make %{?_smp_mflags}
|
||||
%{__perl} -pi -e 's/(ZM_WEB_USER=).*$/${1}%{zmuid_final}/;' \
|
||||
-e 's/(ZM_WEB_GROUP=).*$/${1}%{zmgid_final}/;' zm.conf
|
||||
|
||||
|
||||
%install
|
||||
install -d %{buildroot}/%{_localstatedir}/run
|
||||
make install DESTDIR=%{buildroot} \
|
||||
INSTALLDIRS=vendor
|
||||
rm -rf %{buildroot}/%{perl_vendorarch} %{buildroot}/%{perl_archlib}
|
||||
rm -f %{buildroot}/%{_bindir}/zmx10.pl
|
||||
%{?_without_x10:%{__rm} -f %{buildroot}/%{_bindir}/zmx10.pl}
|
||||
|
||||
install -m 755 -d %{buildroot}/var/log/zoneminder
|
||||
for dir in events images temp
|
||||
do
|
||||
install -m 755 -d %{buildroot}/var/lib/zoneminder/$dir
|
||||
rmdir %{buildroot}/%{_datadir}/zoneminder/www/$dir
|
||||
if [ -d %{buildroot}/%{_datadir}/zoneminder/www/$dir ]; then
|
||||
rmdir %{buildroot}/%{_datadir}/zoneminder/www/$dir
|
||||
fi
|
||||
ln -sf ../../../../var/lib/zoneminder/$dir %{buildroot}/%{_datadir}/zoneminder/www/$dir
|
||||
done
|
||||
install -m 755 -d %{buildroot}/var/lib/zoneminder/sock
|
||||
install -m 755 -d %{buildroot}/var/lib/zoneminder/swap
|
||||
install -m 755 -d %{buildroot}/var/spool/zoneminder-upload
|
||||
|
||||
install -D -m 644 %{SOURCE2} %{buildroot}/etc/httpd/conf.d/zoneminder.conf
|
||||
install -D -m 755 %{SOURCE3} %{buildroot}/%{_datadir}/zoneminder/www/sounds/redalert.wav
|
||||
install -D -m 644 %{SOURCE6} %{buildroot}/%{_unitdir}/zoneminder.service
|
||||
install -D -m 644 %{SOURCE7} %{buildroot}/etc/logrotate.d/zoneminder
|
||||
install -D -m 644 distros/fedora/zoneminder.conf %{buildroot}/etc/httpd/conf.d/zoneminder.conf
|
||||
install -D -m 755 distros/fedora/redalert.wav %{buildroot}/%{_datadir}/zoneminder/www/sounds/redalert.wav
|
||||
install -D -m 644 distros/fedora/zoneminder.service %{buildroot}/%{_unitdir}/zoneminder.service
|
||||
install -D -m 644 distros/fedora/zoneminder.logrotate %{buildroot}/etc/logrotate.d/zoneminder
|
||||
|
||||
# Install jscalendar - this really should be in its own package
|
||||
install -d -m 755 %{buildroot}/%{_datadir}/%{name}/www/jscalendar
|
||||
|
@ -176,13 +159,18 @@ cp -rp jscalendar-1.0/* %{buildroot}/%{_datadir}/zoneminder/www/jscalendar
|
|||
|
||||
# Set up cambozola
|
||||
pushd %{buildroot}/%{_datadir}/zoneminder/www
|
||||
ln -s ../../java/cambozola.jar
|
||||
%{__ln_s} ../../java/cambozola.jar
|
||||
popd
|
||||
|
||||
install -d -m 755 %{buildroot}/etc/tmpfiles.d
|
||||
cat > %{buildroot}/etc/tmpfiles.d/zoneminder.conf <<EOF
|
||||
d /run/zoneminder 0755 %{zmuid_final} %{zmgid_final}
|
||||
EOF
|
||||
# Set up mootools
|
||||
pushd %{buildroot}/%{_datadir}/%{name}/www
|
||||
ln -f -s tools/mootools/mootools-core-%{moorev}-yc.js mootools-core.js
|
||||
ln -f -s tools/mootools/mootools-more-%{moorev}.1-yc.js mootools-more.js
|
||||
popd
|
||||
|
||||
# Create an entry for tmpfiles.d
|
||||
install -D -m 755 distros/fedora/zoneminder.tmpfiles %{buildroot}/etc/tmpfiles.d/zoneminder.conf
|
||||
|
||||
install -m 755 -d %{buildroot}/run/zoneminder
|
||||
|
||||
|
||||
|
@ -192,6 +180,13 @@ if [ $1 -eq 1 ] ; then
|
|||
/bin/systemctl daemon-reload >/dev/null 2>&1 || :
|
||||
fi
|
||||
|
||||
# Allow zoneminder access to local video sources, serial ports, and x10
|
||||
/usr/bin/gpasswd -a %{zmuid_final} video
|
||||
/usr/bin/gpasswd -a %{zmuid_final} dialout
|
||||
|
||||
# Display the README for post installation instructions
|
||||
/usr/bin/less %{_docdir}/%{name}-%{version}/README.Fedora
|
||||
|
||||
%preun
|
||||
if [ $1 -eq 0 ] ; then
|
||||
# Package removal, not upgrade
|
||||
|
@ -219,8 +214,8 @@ fi
|
|||
|
||||
%files
|
||||
%defattr(-,root,root,-)
|
||||
%doc AUTHORS COPYING README.md README.Fedora jscalendar-doc
|
||||
%config(noreplace) %attr(640,root,%{zmgid_final}) /etc/zm.conf
|
||||
%doc AUTHORS COPYING README.md distros/fedora/README.Fedora jscalendar-doc
|
||||
%config %attr(640,root,%{zmgid_final}) /etc/zm.conf
|
||||
%config(noreplace) %attr(644,root,root) /etc/httpd/conf.d/zoneminder.conf
|
||||
%config(noreplace) /etc/tmpfiles.d/zoneminder.conf
|
||||
%config(noreplace) /etc/logrotate.d/zoneminder
|
||||
|
@ -234,7 +229,8 @@ fi
|
|||
%{_bindir}/zmdc.pl
|
||||
%{_bindir}/zmf
|
||||
%{_bindir}/zmfilter.pl
|
||||
%attr(4755,root,root) %{_bindir}/zmfix
|
||||
# zmfix removed from zoneminder 1.26.6
|
||||
#%attr(4755,root,root) %{_bindir}/zmfix
|
||||
%{_bindir}/zmpkg.pl
|
||||
%{_bindir}/zmstreamer
|
||||
%{_bindir}/zmtrack.pl
|
||||
|
@ -243,7 +239,8 @@ fi
|
|||
%{_bindir}/zmupdate.pl
|
||||
%{_bindir}/zmvideo.pl
|
||||
%{_bindir}/zmwatch.pl
|
||||
#%{_bindir}/zmx10.pl
|
||||
%{_bindir}/zmcamtool.pl
|
||||
%{!?_without_x10:%{_bindir}/zmx10.pl}
|
||||
|
||||
%{perl_vendorlib}/ZoneMinder*
|
||||
%{_mandir}/man*/*
|
||||
|
@ -265,8 +262,19 @@ fi
|
|||
|
||||
|
||||
%changelog
|
||||
* Sat Feb 01 2014 Andrew Bauer <knnniggett@users.sourceforge.net> - 1.27
|
||||
- Add zmcamtool.pl. Bump version for 1.27 release.
|
||||
|
||||
* Mon Dec 16 2013 Andrew Bauer <knnniggett@users.sourceforge.net> - 1.26.5
|
||||
- This is a bug fixe release
|
||||
- RTSP fixes, cmake enhancements, couple other misc fixes
|
||||
|
||||
* Sat Oct 05 2013 Andrew Bauer <knnniggett@users.sourceforge.net> - 1.26.4
|
||||
- Fedora specific path changes have been moved to zoneminder-1.26.0-defaults.patch
|
||||
- All files are now part of the zoneminder source tree. Update specfile accordingly.
|
||||
|
||||
* Sat Sep 21 2013 Andrew Bauer <knnniggett@users.sourceforge.net> - 1.26.3
|
||||
- Initial rebuild for ZoneMinder 1.26.3 release.
|
||||
- Initial rebuild for ZoneMinder 1.26.3 release.
|
||||
|
||||
* Fri Feb 15 2013 Fedora Release Engineering <rel-eng@lists.fedoraproject.org> - 1.25.0-13
|
||||
- Rebuilt for https://fedoraproject.org/wiki/Fedora_19_Mass_Rebuild
|
||||
|
|
|
@ -1,5 +1,6 @@
|
|||
[Unit]
|
||||
Description=Video security and surveillance system
|
||||
After=mysqld.service
|
||||
|
||||
[Service]
|
||||
Type=forking
|
||||
|
|
|
@ -15,16 +15,20 @@
|
|||
|
||||
mysql -uroot -p
|
||||
mysql> create database zm;
|
||||
mysql> grant select,insert,update,delete,alter on zm.* to
|
||||
mysql> grant select,insert,update,delete,lock tables,alter on zm.* to
|
||||
'zmuser'@localhost identified by 'zmpass';
|
||||
mysql> exit;
|
||||
mysql -uroot -p < /usr/share/zoneminder/db/zm_create.sql
|
||||
mysqladmin -uroot -p reload
|
||||
|
||||
3. IMPORTANT: Edit /etc/php.ini and put in the appropriate timezone for
|
||||
3. If you have chosen to change the zoneminder mysql credentials to something
|
||||
other than zmuser/zmpass then you must now edit /etc/zm.conf. Change
|
||||
ZM_DB_USER and ZM_DB_PASS to the values you created in step 2.
|
||||
|
||||
4. IMPORTANT: Edit /etc/php.ini and put in the appropriate timezone for
|
||||
date.timezone!
|
||||
|
||||
4. The ZoneMinder web interface is disabled by default, you will need
|
||||
5. The ZoneMinder web interface is disabled by default, you will need
|
||||
to edit this file to enable it:
|
||||
|
||||
/etc/httpd/conf.d/zoneminder.conf
|
||||
|
@ -32,16 +36,16 @@
|
|||
HINT: Most users will want to simply delete the line that says
|
||||
"Deny from all".
|
||||
|
||||
5. Configure the web server to start automatically:
|
||||
6. Configure the web server to start automatically:
|
||||
|
||||
sudo chkconfig httpd on
|
||||
sudo service httpd start
|
||||
|
||||
6. This package has automatically configured and installed an SELinux policy
|
||||
7. This package has automatically configured and installed an SELinux policy
|
||||
called local_zoneminder. A copy of this policy is in the documentation
|
||||
folder.
|
||||
|
||||
7. Finally, you may start the ZoneMinder service:
|
||||
8. Finally, you may start the ZoneMinder service:
|
||||
|
||||
sudo service zoneminder start
|
||||
|
||||
|
@ -51,12 +55,27 @@
|
|||
UPGRADES
|
||||
================================================================================
|
||||
|
||||
1. You will need to upgrade the ZoneMinder database as described in the
|
||||
manual. This command should be sufficient:
|
||||
1. Add additional permissions to the zmuser account:
|
||||
|
||||
sudo zmupdate.pl --user=root --pass=<mysql root pwd> --version=<from version>
|
||||
mysql -u root -p
|
||||
grant lock tables,alter on zm.* to
|
||||
'zmuser'@localhost identified by 'zmpass';
|
||||
|
||||
It is recommended to backup your database and then upgrade your tables
|
||||
to InnoDB when prompted.
|
||||
Since this is an upgrade, the assumption is that the zmuser account exists
|
||||
and already has select, insert, update, and delete permission.
|
||||
|
||||
2. If you have previsouly changed the zoneminder mysql credentials to something
|
||||
other than zmuser/zmpass then you must now edit /etc/zm.conf. Change
|
||||
ZM_DB_USER and ZM_DB_PASS to their appropriate values.
|
||||
|
||||
3. You will need to upgrade the ZoneMinder database as described in the manual.
|
||||
Only if step 1 was succesfully applied, may you run zmupdate like so:
|
||||
|
||||
sudo zmupdate.pl --version=<from version>
|
||||
|
||||
|
||||
If unsure then run it this way:
|
||||
|
||||
sudo zmupdate.pl --user=root --pass=<mysql_root_pwd> --version=<from version>
|
||||
|
||||
|
||||
|
|
|
@ -1,7 +1,33 @@
|
|||
|
||||
module local_zoneminder 1.0;
|
||||
module local_zoneminder 1.1;
|
||||
|
||||
require {
|
||||
type afs_ka_port_t;
|
||||
type netsupport_port_t;
|
||||
type port_t;
|
||||
type presence_port_t;
|
||||
type postfix_pickup_t;
|
||||
type httpd_t;
|
||||
type var_lib_t;
|
||||
type ionixnetmon_port_t;
|
||||
type glance_port_t;
|
||||
type mmcc_port_t;
|
||||
type postfix_master_t;
|
||||
type commplex_port_t;
|
||||
type syslogd_port_t;
|
||||
type dcc_port_t;
|
||||
type sip_port_t;
|
||||
type amqp_port_t;
|
||||
type condor_port_t;
|
||||
type afs_fs_port_t;
|
||||
type nodejs_debug_port_t;
|
||||
type httpd_var_lib_t;
|
||||
type websm_port_t;
|
||||
type afs_pt_port_t;
|
||||
type postfix_qmgr_t;
|
||||
type git_port_t;
|
||||
type ipp_port_t;
|
||||
type aol_port_t;
|
||||
type unconfined_t;
|
||||
type kernel_t;
|
||||
type init_t;
|
||||
|
@ -24,10 +50,11 @@ require {
|
|||
type dhcpc_t;
|
||||
type v4l_device_t;
|
||||
type file_t;
|
||||
class sock_file write;
|
||||
class sock_file { write create unlink };
|
||||
class unix_stream_socket { read connectto };
|
||||
class lnk_file { write getattr read lock unlink };
|
||||
class lnk_file { write create getattr read lock unlink };
|
||||
class dir search;
|
||||
class udp_socket name_bind;
|
||||
class file { write getattr read lock unlink open };
|
||||
class shm { unix_read unix_write associate read write getattr };
|
||||
class chr_file getattr;
|
||||
|
@ -70,3 +97,27 @@ allow httpd_t unconfined_t:dir search;
|
|||
allow httpd_t unconfined_t:file { read getattr open };
|
||||
allow httpd_t var_lib_t:lnk_file { write getattr read lock unlink };
|
||||
allow httpd_t v4l_device_t:chr_file getattr;
|
||||
allow httpd_t afs_fs_port_t:udp_socket name_bind;
|
||||
allow httpd_t afs_ka_port_t:udp_socket name_bind;
|
||||
allow httpd_t afs_pt_port_t:udp_socket name_bind;
|
||||
allow httpd_t amqp_port_t:udp_socket name_bind;
|
||||
allow httpd_t aol_port_t:udp_socket name_bind;
|
||||
allow httpd_t commplex_port_t:udp_socket name_bind;
|
||||
allow httpd_t condor_port_t:udp_socket name_bind;
|
||||
allow httpd_t dcc_port_t:udp_socket name_bind;
|
||||
allow httpd_t git_port_t:udp_socket name_bind;
|
||||
allow httpd_t glance_port_t:udp_socket name_bind;
|
||||
allow httpd_t httpd_var_lib_t:lnk_file create;
|
||||
allow httpd_t ionixnetmon_port_t:udp_socket name_bind;
|
||||
allow httpd_t ipp_port_t:udp_socket name_bind;
|
||||
allow httpd_t mmcc_port_t:udp_socket name_bind;
|
||||
allow httpd_t netsupport_port_t:udp_socket name_bind;
|
||||
allow httpd_t nodejs_debug_port_t:udp_socket name_bind;
|
||||
allow httpd_t port_t:udp_socket name_bind;
|
||||
allow httpd_t postfix_master_t:dir search;
|
||||
allow httpd_t postfix_master_t:file { read getattr open };
|
||||
allow httpd_t postfix_pickup_t:dir search;
|
||||
allow httpd_t postfix_pickup_t:file { read getattr open };
|
||||
allow httpd_t postfix_qmgr_t:dir search;
|
||||
allow httpd_t postfix_qmgr_t:file { read getattr open };
|
||||
allow httpd_t presence_port_t:udp_socket name_bind;
|
||||
|
|
|
@ -1,407 +0,0 @@
|
|||
%define cambrev 0.931
|
||||
%define moorev 1.3.2
|
||||
%define jscrev 1.0
|
||||
|
||||
%define zmuid $(id -un)
|
||||
%define zmgid $(id -gn)
|
||||
%define zmuid_final apache
|
||||
%define zmgid_final apache
|
||||
|
||||
Name: zoneminder
|
||||
Version: 1.26.0
|
||||
Release: 1%{?dist}
|
||||
Summary: A camera monitoring and analysis tool
|
||||
Group: System Environment/Daemons
|
||||
# jscalendar is LGPL (any version): http://www.dynarch.com/projects/calendar/
|
||||
# Mootools is inder the MIT license: http://mootools.net/
|
||||
# Cambozola is GPL: http://www.charliemouse.com/code/cambozola/
|
||||
License: GPLv2+ and LGPLv2+ and MIT
|
||||
URL: http://www.zoneminder.com/
|
||||
|
||||
# Some of these sources to be added upstream. Will edit once that happens.
|
||||
Source0: zoneminder-%{version}.tar.gz
|
||||
Source2: zoneminder.conf
|
||||
Source3: redalert.wav
|
||||
Source4: README.CentOS
|
||||
Source5: jscalendar-%{jscrev}.zip
|
||||
#Source5: http://downloads.sourceforge.net/jscalendar/jscalendar-%{jscrev}.zip
|
||||
Source6: mootools-core-%{moorev}-full-compat-yc.js
|
||||
#Source6: http://mootools.net/download/get/mootools-core-%{moorev}-full-compat-yc.js
|
||||
Source7: zm-init
|
||||
Source8: zm-logrotate_d
|
||||
Source9: local_zoneminder.te
|
||||
Source10: cambozola-%{cambrev}.tar.gz
|
||||
#Source10: http://www.andywilcock.com/code/cambozola/cambozola-%{cambrev}.tar.gz
|
||||
|
||||
Patch1: zoneminder-1.26.0-dbinstall.patch
|
||||
Patch2: zoneminder-runlevel.patch
|
||||
Patch3: zoneminder-1.26.0-defaults.patch
|
||||
|
||||
BuildRoot: %{_tmppath}/%{name}-%{version}-%{release}-root-%(%{__id_u} -n)
|
||||
|
||||
BuildRequires: automake gnutls-devel bzip2-devel libtool
|
||||
BuildRequires: mysql-devel pcre-devel libjpeg-turbo-devel
|
||||
BuildRequires: perl(Archive::Tar) perl(Archive::Zip)
|
||||
BuildRequires: perl(Date::Manip) perl(DBD::mysql)
|
||||
BuildRequires: perl(ExtUtils::MakeMaker) perl(LWP::UserAgent)
|
||||
BuildRequires: perl(MIME::Entity) perl(MIME::Lite)
|
||||
BuildRequires: perl(PHP::Serialization) perl(Sys::Mmap)
|
||||
BuildRequires: perl(Time::HiRes) perl(Net::SFTP::Foreign)
|
||||
BuildRequires: perl(Expect) perl(X10::ActiveHome) perl(Astro::SunTime)
|
||||
# Change this for distros compatible newer ffmpeg & gcc
|
||||
BuildRequires: ffmpeg-devel >= 0.4.9
|
||||
BuildRequires: ffmpeg-devel <= 0.6.5
|
||||
BuildRequires: gcc < 4.7
|
||||
|
||||
Requires: httpd php php-mysql mysql-server libjpeg-turbo
|
||||
Requires: perl(:MODULE_COMPAT_%(eval "`%{__perl} -V:version`"; echo $version))
|
||||
Requires: perl(DBD::mysql) perl(Archive::Tar) perl(Archive::Zip)
|
||||
Requires: perl(MIME::Entity) perl(MIME::Lite) perl(Net::SMTP) perl(Net::FTP)
|
||||
# Change this for distros compatible newer ffmpeg
|
||||
Requires: ffmpeg >= 0.4.9
|
||||
Requires: ffmpeg <= 0.6.5
|
||||
|
||||
Requires(post): /sbin/chkconfig
|
||||
Requires(post): /usr/bin/checkmodule
|
||||
Requires(post): /usr/bin/semodule_package
|
||||
Requires(post): /usr/sbin/semodule
|
||||
Requires(post): /usr/bin/gpasswd
|
||||
Requires(post): /usr/bin/less
|
||||
Requires(preun): /sbin/chkconfig
|
||||
Requires(preun): /sbin/service
|
||||
Requires(preun): /usr/sbin/semodule
|
||||
Requires(postun): /sbin/service
|
||||
|
||||
|
||||
%description
|
||||
ZoneMinder is a set of applications which is intended to provide a complete
|
||||
solution allowing you to capture, analyse, record and monitor any cameras you
|
||||
have attached to a Linux based machine. It is designed to run on kernels which
|
||||
support the Video For Linux (V4L) interface and has been tested with cameras
|
||||
attached to BTTV cards, various USB cameras and IP network cameras. It is
|
||||
designed to support as many cameras as you can attach to your computer without
|
||||
too much degradation of performance.
|
||||
|
||||
|
||||
%prep
|
||||
%setup -q -n zoneminder-%{version}
|
||||
|
||||
# Unpack jscalendar and move some files around
|
||||
%setup -q -D -T -a 5 -n zoneminder-%{version}
|
||||
mkdir jscalendar-doc
|
||||
pushd jscalendar-%{jscrev}
|
||||
mv *html *php doc/* README ../jscalendar-doc
|
||||
rmdir doc
|
||||
popd
|
||||
|
||||
# Unpack Cambozola and move some files around
|
||||
%setup -q -D -T -a 10 -n zoneminder-%{version}
|
||||
mkdir cambozola-doc
|
||||
pushd cambozola-%{cambrev}
|
||||
mv application.properties build.xml dist.sh *html LICENSE testPages/* ../cambozola-doc
|
||||
rmdir testPages
|
||||
popd
|
||||
|
||||
%patch1 -p0 -b .dbinstall
|
||||
%patch2 -p0 -b .runlevel
|
||||
%patch3 -p0
|
||||
|
||||
cp %{SOURCE4} README.CentOS
|
||||
cp %{SOURCE9} local_zoneminder.te
|
||||
|
||||
%build
|
||||
libtoolize --force
|
||||
aclocal
|
||||
autoheader
|
||||
automake --force-missing --add-missing
|
||||
autoconf
|
||||
#autoreconf
|
||||
|
||||
OPTS=""
|
||||
%ifnarch %{ix86} x86_64
|
||||
OPTS="$OPTS --disable-crashtrace"
|
||||
%endif
|
||||
|
||||
%configure \
|
||||
--with-libarch=%{_lib} \
|
||||
%ifarch %{ix86} %{x8664}
|
||||
--enable-crashtrace \
|
||||
%else
|
||||
--disable-crashtrace \
|
||||
%endif
|
||||
--with-mysql=%{_prefix} \
|
||||
--with-ffmpeg=%{_prefix} \
|
||||
--with-webdir=%{_datadir}/%{name}/www \
|
||||
--with-cgidir=%{_libexecdir}/%{name}/cgi-bin \
|
||||
--with-webuser=%{zmuid} \
|
||||
--with-webgroup=%{zmgid} \
|
||||
--enable-mmap=yes \
|
||||
--disable-debug \
|
||||
--with-webhost=zm.local \
|
||||
ZM_SSL_LIB="gnutls" \
|
||||
ZM_RUNDIR=/var/run/zoneminder \
|
||||
ZM_TMPDIR=/var/lib/zoneminder/temp \
|
||||
CXXFLAGS="-D__STDC_CONSTANT_MACROS -msse2" \
|
||||
--with-extralibs=""
|
||||
|
||||
make %{?_smp_mflags}
|
||||
%{__perl} -pi -e 's/(ZM_WEB_USER=).*$/${1}%{zmuid_final}/;' \
|
||||
-e 's/(ZM_WEB_GROUP=).*$/${1}%{zmgid_final}/;' zm.conf
|
||||
|
||||
%install
|
||||
install -d %{buildroot}/%{_localstatedir}/run
|
||||
install -d %{buildroot}/etc/logrotate.d
|
||||
|
||||
make install DESTDIR=%{buildroot} \
|
||||
INSTALLDIRS=vendor
|
||||
|
||||
rm -rf %{buildroot}/%{perl_vendorarch} %{buildroot}/%{perl_archlib}
|
||||
|
||||
install -m 755 -d %{buildroot}/%{_localstatedir}/log/zoneminder
|
||||
for dir in events images temp
|
||||
do
|
||||
install -m 755 -d %{buildroot}/%{_localstatedir}/lib/zoneminder/$dir
|
||||
rmdir %{buildroot}/%{_datadir}/%{name}/www/$dir
|
||||
ln -sf ../../../..%{_localstatedir}/lib/zoneminder/$dir %{buildroot}/%{_datadir}/%{name}/www/$dir
|
||||
done
|
||||
install -m 755 -d %{buildroot}/%{_localstatedir}/lib/zoneminder/sock
|
||||
install -m 755 -d %{buildroot}/%{_localstatedir}/lib/zoneminder/swap
|
||||
install -m 755 -d %{buildroot}/%{_localstatedir}/spool/zoneminder-upload
|
||||
|
||||
install -D -m 755 scripts/zm %{buildroot}/%{_initrddir}/zoneminder
|
||||
install -D -m 644 %{SOURCE2} %{buildroot}/%{_sysconfdir}/httpd/conf.d/zoneminder.conf
|
||||
install -D -m 755 %{SOURCE3} %{buildroot}/%{_datadir}/%{name}/www/sounds/redalert.wav
|
||||
install %{SOURCE8} $RPM_BUILD_ROOT%{_sysconfdir}/logrotate.d/%{name}
|
||||
|
||||
# Install jscalendar
|
||||
install -d -m 755 %{buildroot}/%{_datadir}/%{name}/www/jscalendar
|
||||
cp -rp jscalendar-%{jscrev}/* %{buildroot}/%{_datadir}/%{name}/www/jscalendar
|
||||
|
||||
# Install Cambozola
|
||||
cp -rp cambozola-%{cambrev}/dist/cambozola.jar %{buildroot}/%{_datadir}/%{name}/www/
|
||||
rm -rf cambozola-%{cambrev}
|
||||
|
||||
# Install mootools
|
||||
pushd %{buildroot}/%{_datadir}/%{name}/www
|
||||
install -m 644 %{SOURCE6} mootools-core-%{moorev}-full-compat-yc.js
|
||||
ln -s mootools-core-%{moorev}-full-compat-yc.js mootools.js
|
||||
popd
|
||||
|
||||
%post
|
||||
/sbin/chkconfig --add zoneminder
|
||||
/sbin/chkconfig zoneminder on
|
||||
|
||||
# Allow zoneminder access to local video sources
|
||||
echo
|
||||
/usr/bin/gpasswd -a apache video
|
||||
|
||||
# Create and load zoneminder selinux policy module
|
||||
echo -e "\nCreating and installing a ZoneMinder SELinux policy module. Please wait.\n"
|
||||
/usr/bin/checkmodule -M -m -o %{_docdir}/%{name}-%{version}/local_zoneminder.mod %{_docdir}/%{name}-%{version}/local_zoneminder.te > /dev/null
|
||||
/usr/bin/semodule_package -o %{_docdir}/%{name}-%{version}/local_zoneminder.pp -m %{_docdir}/%{name}-%{version}/local_zoneminder.mod > /dev/null
|
||||
/usr/sbin/semodule -i %{_docdir}/%{name}-%{version}/local_zoneminder.pp > /dev/null
|
||||
|
||||
# Display the README for post installation instructions
|
||||
/usr/bin/less %{_docdir}/%{name}-%{version}/README.CentOS
|
||||
|
||||
%preun
|
||||
if [ $1 -eq 0 ]; then
|
||||
/sbin/service zoneminder stop > /dev/null 2>&1 || :
|
||||
/sbin/chkconfig --del zoneminder
|
||||
echo -e "\nRemoving ZoneMinder SELinux policy module. Please wait.\n"
|
||||
/usr/sbin/semodule -r local_zoneminder.pp
|
||||
fi
|
||||
|
||||
|
||||
%postun
|
||||
if [ $1 -ge 1 ]; then
|
||||
/sbin/service zoneminder condrestart > /dev/null 2>&1 || :
|
||||
fi
|
||||
|
||||
|
||||
%files
|
||||
%defattr(-,root,root,-)
|
||||
%doc AUTHORS BUGS ChangeLog COPYING LICENSE NEWS README.md README.CentOS jscalendar-doc cambozola-doc local_zoneminder.te
|
||||
%config(noreplace) %attr(640,root,%{zmgid_final}) %{_sysconfdir}/zm.conf
|
||||
%config(noreplace) %attr(644,root,root) %{_sysconfdir}/httpd/conf.d/zoneminder.conf
|
||||
%config(noreplace) /etc/logrotate.d/%{name}
|
||||
%attr(755,root,root) %{_initrddir}/zoneminder
|
||||
|
||||
%{_bindir}/zma
|
||||
%{_bindir}/zmaudit.pl
|
||||
%{_bindir}/zmc
|
||||
%{_bindir}/zmcontrol.pl
|
||||
%{_bindir}/zmdc.pl
|
||||
%{_bindir}/zmf
|
||||
%{_bindir}/zmfilter.pl
|
||||
%attr(4755,root,root) %{_bindir}/zmfix
|
||||
%{_bindir}/zmpkg.pl
|
||||
%{_bindir}/zmstreamer
|
||||
%{_bindir}/zmtrack.pl
|
||||
%{_bindir}/zmtrigger.pl
|
||||
%{_bindir}/zmu
|
||||
%{_bindir}/zmupdate.pl
|
||||
%{_bindir}/zmvideo.pl
|
||||
%{_bindir}/zmwatch.pl
|
||||
%{_bindir}/zmx10.pl
|
||||
|
||||
%{perl_vendorlib}/ZoneMinder*
|
||||
%{_mandir}/man*/*
|
||||
%dir %{_libexecdir}/%{name}
|
||||
%{_libexecdir}/%{name}/cgi-bin
|
||||
%dir %{_datadir}/%{name}
|
||||
%{_datadir}/%{name}/db
|
||||
%{_datadir}/%{name}/www
|
||||
|
||||
%dir %attr(755,%{zmuid_final},%{zmgid_final}) %{_localstatedir}/lib/zoneminder
|
||||
%dir %attr(755,%{zmuid_final},%{zmgid_final}) %{_localstatedir}/lib/zoneminder/events
|
||||
%dir %attr(755,%{zmuid_final},%{zmgid_final}) %{_localstatedir}/lib/zoneminder/images
|
||||
%dir %attr(755,%{zmuid_final},%{zmgid_final}) %{_localstatedir}/lib/zoneminder/sock
|
||||
%dir %attr(755,%{zmuid_final},%{zmgid_final}) %{_localstatedir}/lib/zoneminder/swap
|
||||
%dir %attr(755,%{zmuid_final},%{zmgid_final}) %{_localstatedir}/lib/zoneminder/temp
|
||||
%dir %attr(755,%{zmuid_final},%{zmgid_final}) %{_localstatedir}/log/zoneminder
|
||||
%dir %attr(755,%{zmuid_final},%{zmgid_final}) %{_localstatedir}/spool/zoneminder-upload
|
||||
|
||||
|
||||
%changelog
|
||||
* Thu Sep 05 2013 Andrew Bauer <knnniggett@users.sourceforge.net> - 1.26.0
|
||||
- 1.26.0 Release
|
||||
- https://github.com/ZoneMinder/ZoneMinder/archive/v1.26.0.tar.gz
|
||||
|
||||
* Sun Sep 01 2013 Andrew Bauer <knnniggett@users.sourceforge.net> - 1.26.0-beta
|
||||
- Update SELinux policy module
|
||||
|
||||
* Thu Aug 29 2013 Andrew Bauer <knnniggett@users.sourceforge.net> - 1.26.0-beta
|
||||
- Third Beta release
|
||||
- https://github.com/ZoneMinder/ZoneMinder/tree/release-1.26
|
||||
- Reduce number of uneeded dependencies by integrating cambozola into spec file
|
||||
|
||||
* Thu Aug 15 2013 Andrew Bauer <knnniggett@users.sourceforge.net> - 1.26.0-beta
|
||||
- Initial Beta release
|
||||
- https://github.com/ZoneMinder/ZoneMinder/tree/release-1.26
|
||||
|
||||
* Sun Aug 11 2013 Andrew Bauer <knnniggett@users.sourceforge.net> - 1.25.0-kfirproper
|
||||
- Modified specfile to work with kfir-proper branch
|
||||
- https://github.com/ZoneMinder/ZoneMinder/tree/kfir-proper
|
||||
|
||||
* Wed Aug 07 2013 Andrew Bauer <knnniggett@users.sourceforge.net> - 1.25.0-2svn3827
|
||||
- Move RHEL/CentOS specific defaults to a patch file
|
||||
- Add bzip2-devel as a build dependency
|
||||
- Default ZM_SSL_LIB back to gnutls. AUTH_RELAY = hashed didn't work with openssl.
|
||||
|
||||
* Fri Aug 02 2013 Andrew Bauer <knnniggett@users.sourceforge.net> - 1.25.0-1svn3827
|
||||
- Update to latest 1.25.0 subversion.
|
||||
- Does not compile with modern versions of ffmpeg. Configure to work only with older versions.
|
||||
- Does not compile with gcc 4.7. Configure to build with gcc less than 4.7.
|
||||
|
||||
* Thu Mar 24 2011 Jason L Tibbitts III <tibbs@math.uh.edu> - 1.24.3-4.20110324svn3310
|
||||
- Update to latest 1.24.3 subversion. Turns out that what upstream was calling
|
||||
1.24.3 is really just an occasionally updated devel snapshot.
|
||||
- Rebase various patches.
|
||||
|
||||
* Wed Mar 23 2011 Dan Horák <dan@danny.cz> - 1.24.3-3
|
||||
- rebuilt for mysql 5.5.10 (soname bump in libmysqlclient)
|
||||
|
||||
* Tue Feb 08 2011 Fedora Release Engineering <rel-eng@lists.fedoraproject.org> - 1.24.3-2
|
||||
- Rebuilt for https://fedoraproject.org/wiki/Fedora_15_Mass_Rebuild
|
||||
|
||||
* Tue Jan 25 2011 Jason L Tibbitts III <tibbs@math.uh.edu> - 1.24.3-1
|
||||
- Update to latest upstream version.
|
||||
- Rebase patches.
|
||||
- Initial incomplete attempt to disable v4l1 support.
|
||||
|
||||
* Fri Jan 21 2011 Jason L Tibbitts III <tibbs@math.uh.edu> - 1.24.2-6
|
||||
- Unbundle cambozola; instead link to the separately pacakged copy.
|
||||
- Remove BuildRoot:, %%clean and buildroot cleaning in %%install.
|
||||
- Git rid of mixed space/tab usage by removing all tabs.
|
||||
- Remove unnecessary Conflicts: line.
|
||||
- Attempt to force short_open_tag on for the code directories.
|
||||
- Move default location of sockets, swaps, logfiles and some temporary files to
|
||||
make more sense and allow things to work better with a future selinux policy.
|
||||
- Fix errors in README.CentOS.
|
||||
|
||||
* Wed Jun 02 2010 Marcela Maslanova <mmaslano@redhat.com> - 1.24.2-5
|
||||
- Mass rebuild with perl-5.12.0
|
||||
|
||||
* Fri Dec 4 2009 Stepan Kasal <skasal@redhat.com> - 1.24.2-4
|
||||
- rebuild against perl 5.10.1
|
||||
- use Perl vendorarch and archlib variables correctly
|
||||
|
||||
* Mon Jul 27 2009 Fedora Release Engineering <rel-eng@lists.fedoraproject.org> - 1.24.2-3
|
||||
- Rebuilt for https://fedoraproject.org/wiki/Fedora_12_Mass_Rebuild
|
||||
|
||||
* Wed Jul 22 2009 Jason L Tibbitts III <tibbs@math.uh.edu> - 1.24.2-2
|
||||
- Bump release since 1.24.2-1 was mistakenly tagged a few months ago.
|
||||
|
||||
* Wed Jul 22 2009 Jason L Tibbitts III <tibbs@math.uh.edu> - 1.24.2-1
|
||||
- Initial update to 1.24.2.
|
||||
- Rebase patches.
|
||||
- Update mootools download location.
|
||||
- Update to mootools 1.2.3.
|
||||
- Add additional dependencies for some optional features.
|
||||
|
||||
* Sat Apr 11 2009 Martin Ebourne <martin@zepler.org> - 1.24.1-3
|
||||
- Remove unused Sys::Mmap perl dependency RPM is finding
|
||||
|
||||
* Sat Apr 11 2009 Martin Ebourne <martin@zepler.org> - 1.24.1-2
|
||||
- Update gcc44 patch to disable -frepo, seems to be broken with gcc44
|
||||
- Added noffmpeg patch to make building outside mock easier
|
||||
|
||||
* Sat Mar 21 2009 Martin Ebourne <martin@zepler.org> - 1.24.1-1
|
||||
- Patch for gcc 4.4 compilation errors
|
||||
- Upgrade to 1.24.1
|
||||
|
||||
* Wed Feb 25 2009 Fedora Release Engineering <rel-eng@lists.fedoraproject.org> - 1.23.3-4
|
||||
- Rebuilt for https://fedoraproject.org/wiki/Fedora_11_Mass_Rebuild
|
||||
|
||||
* Sat Jan 24 2009 Caolán McNamara <caolanm@redhat.com> - 1.23.3-3
|
||||
- rebuild for dependencies
|
||||
|
||||
* Mon Dec 15 2008 Martin Ebourne <martin@zepler.org> - 1.23.3-2
|
||||
- Fix permissions on zm.conf
|
||||
|
||||
* Fri Jul 11 2008 Jason L Tibbitts III <tibbs@math.uh.edu> - 1.23.3-1
|
||||
- Initial attempt at packaging 1.23.
|
||||
|
||||
* Tue Jul 1 2008 Martin Ebourne <martin@zepler.org> - 1.22.3-15
|
||||
- Add perl module compat dependency, bz #453590
|
||||
|
||||
* Tue May 6 2008 Martin Ebourne <martin@zepler.org> - 1.22.3-14
|
||||
- Remove default runlevel, bz #441315
|
||||
|
||||
* Mon Apr 28 2008 Jason L Tibbitts III <tibbs@math.uh.edu> - 1.22.3-13
|
||||
- Backport patch for CVE-2008-1381 from 1.23.3 to 1.22.3.
|
||||
|
||||
* Tue Feb 19 2008 Fedora Release Engineering <rel-eng@fedoraproject.org> - 1.22.3-12
|
||||
- Autorebuild for GCC 4.3
|
||||
|
||||
* Thu Jan 3 2008 Martin Ebourne <martin@zepler.org> - 1.22.3-11
|
||||
- Fix compilation on gcc 4.3
|
||||
|
||||
* Thu Dec 6 2007 Martin Ebourne <martin@zepler.org> - 1.22.3-10
|
||||
- Rebuild for new openssl
|
||||
|
||||
* Thu Aug 2 2007 Martin Ebourne <martin@zepler.org> - 1.22.3-8
|
||||
- Fix licence tag
|
||||
|
||||
* Thu Jul 12 2007 Martin Ebourne <martin@zepler.org> - 1.22.3-7
|
||||
- Fixes from testing by Jitz including missing dependencies and database creation
|
||||
|
||||
* Sat Jun 30 2007 Martin Ebourne <martin@zepler.org> - 1.22.3-6
|
||||
- Disable crashtrace on ppc
|
||||
|
||||
* Sat Jun 30 2007 Martin Ebourne <martin@zepler.org> - 1.22.3-5
|
||||
- Fix uid for directories in /var/lib/zoneminder
|
||||
|
||||
* Tue Jun 26 2007 Martin Ebourne <martin@zepler.org> - 1.22.3-4
|
||||
- Added perl Archive::Tar dependency
|
||||
- Disabled web interface due to lack of access control on the event images
|
||||
|
||||
* Sun Jun 10 2007 Martin Ebourne <martin@zepler.org> - 1.22.3-3
|
||||
- Changes recommended in review by Jason Tibbitts
|
||||
|
||||
* Mon Apr 2 2007 Martin Ebourne <martin@zepler.org> - 1.22.3-2
|
||||
- Standardised on package name of zoneminder
|
||||
|
||||
* Thu Dec 28 2006 Martin Ebourne <martin@zepler.org> - 1.22.3-1
|
||||
- First version. Uses some parts from zm-1.20.1 by Corey DeLasaux and Serg Oskin
|
|
@ -1,3 +1,9 @@
|
|||
zoneminder (1.27.1-1) precise; urgency=low
|
||||
|
||||
* Convert from php mysql ext to PDO
|
||||
|
||||
-- Isaac Connor <iconnor@connortechnology.com> Wed, 16 Oct 2013 15:51:39 -0400
|
||||
|
||||
zoneminder (1.26.4-2) precise; urgency=high
|
||||
|
||||
* improvements to zmupdate.pl, cleanups
|
||||
|
|
|
@ -2,13 +2,32 @@ Source: zoneminder
|
|||
Section: net
|
||||
Priority: optional
|
||||
Maintainer: Isaac Connor <iconnor@connortechnology.com>
|
||||
Build-Depends: debhelper (>= 5), autoconf, automake, dpatch, libphp-serialization-perl, libgnutls-dev, libmysqlclient-dev, libdbd-mysql-perl, libdate-manip-perl, libwww-perl, libjpeg8-dev, libpcre3-dev, libavcodec-dev, libavformat-dev (>= 3:0.svn20090204), libswscale-dev (>= 3:0.svn20090204), libavutil-dev, libv4l-dev (>= 0.8.3), libbz2-dev, libtool, libsys-mmap-perl, ffmpeg, libnetpbm10-dev, libavdevice-dev, libdevice-serialport-perl, libpcre3, libarchive-zip-perl, libmime-lite-perl, libjpeg8, dh-autoreconf
|
||||
Build-Depends: debhelper (>= 7.0.50), autoconf, automake, dpatch, libphp-serialization-perl, libgnutls-dev, libmysqlclient-dev, libdbd-mysql-perl, libdate-manip-perl, libwww-perl, libjpeg8-dev, libpcre3-dev, libavcodec-dev, libavformat-dev (>= 3:0.svn20090204), libswscale-dev (>= 3:0.svn20090204), libavutil-dev, libv4l-dev (>= 0.8.3), libbz2-dev, libtool, libsys-mmap-perl, ffmpeg, libnetpbm10-dev, libavdevice-dev, libdevice-serialport-perl, libpcre3, libarchive-zip-perl, libmime-lite-perl, libjpeg8, dh-autoreconf
|
||||
Standards-Version: 3.9.2
|
||||
|
||||
Package: zoneminder
|
||||
Architecture: any
|
||||
Depends: ${shlibs:Depends}, ${misc:Depends}, ${perl:Depends}, apache2, libapache2-mod-php5, php5, php5-mysql, libphp-serialization-perl, libdate-manip-perl, libmime-lite-perl, libmime-lite-perl, mysql-client, libwww-perl, libarchive-tar-perl, libarchive-zip-perl, libdevice-serialport-perl, libpcre3, ffmpeg, rsyslog | system-log-daemon, libmodule-load-perl, libsys-mmap-perl, libjson-any-perl, netpbm, libavdevice53, libjpeg8, zip, libnet-sftp-foreign-perl
|
||||
Description: Linux video camera security and surveillance solution
|
||||
SUggests: mysql-server
|
||||
Description: A video camera security and surveillance solution
|
||||
ZoneMinder is intended for use in single or multi-camera video security
|
||||
applications, including commercial or home CCTV, theft prevention and child
|
||||
or family member or home monitoring and other care scenarios. It
|
||||
supports capture, analysis, recording, and monitoring of video data coming
|
||||
from one or more video or network cameras attached to a Linux system.
|
||||
ZoneMinder also support web and semi-automatic control of Pan/Tilt/Zoom
|
||||
cameras using a variety of protocols. It is suitable for use as a home
|
||||
video security system and for commercial or professional video security
|
||||
and surveillance. It can also be integrated into a home automation system
|
||||
via X.10 or other protocols.
|
||||
|
||||
Package: zoneminder-dbg
|
||||
Architecture: any
|
||||
Depends:
|
||||
zoneminder (= ${binary:Version}),
|
||||
${misc:Depends}
|
||||
Description: debugging syumbols for zoneminder.
|
||||
ZoneMinder is a video camera security and surveillance solution.
|
||||
ZoneMinder is intended for use in single or multi-camera video security
|
||||
applications, including commercial or home CCTV, theft prevention and child
|
||||
or family member or home monitoring and other care scenarios. It
|
||||
|
|
|
@ -25,7 +25,6 @@ start() {
|
|||
echo -n "Starting $prog: "
|
||||
mkdir -p $RUNDIR && chown www-data:www-data $RUNDIR
|
||||
mkdir -p $TMPDIR && chown www-data:www-data $TMPDIR
|
||||
zmfix -a
|
||||
$command start
|
||||
RETVAL=$?
|
||||
[ $RETVAL = 0 ] && echo success
|
||||
|
|
|
@ -2,44 +2,36 @@
|
|||
|
||||
set -e
|
||||
|
||||
VERSION=1.26.4
|
||||
|
||||
if [ "$1" = "configure" ]; then
|
||||
#
|
||||
# Get mysql started if it isn't
|
||||
#
|
||||
if ! $(/etc/init.d/mysql status >/dev/null 2>&1); then
|
||||
invoke-rc.d mysql start
|
||||
fi
|
||||
if $(/etc/init.d/mysql status >/dev/null 2>&1); then
|
||||
mysqladmin --defaults-file=/etc/mysql/debian.cnf -f reload
|
||||
# test if database if already present...
|
||||
if ! $(echo quit | mysql --defaults-file=/etc/mysql/debian.cnf zm > /dev/null 2> /dev/null) ; then
|
||||
cat /usr/share/zoneminder/db/zm_create.sql | mysql --defaults-file=/etc/mysql/debian.cnf
|
||||
echo 'grant lock tables, alter,select,insert,update,delete on zm.* to 'zmuser'@localhost identified by "zmpass";' | mysql --defaults-file=/etc/mysql/debian.cnf mysql
|
||||
fi
|
||||
if [ -e "/etc/init.d/mysql" ]; then
|
||||
#
|
||||
# Get mysql started if it isn't
|
||||
#
|
||||
if ! $(/etc/init.d/mysql status >/dev/null 2>&1); then
|
||||
invoke-rc.d mysql start
|
||||
fi
|
||||
if $(/etc/init.d/mysql status >/dev/null 2>&1); then
|
||||
mysqladmin --defaults-file=/etc/mysql/debian.cnf -f reload
|
||||
# test if database if already present...
|
||||
if ! $(echo quit | mysql --defaults-file=/etc/mysql/debian.cnf zm > /dev/null 2> /dev/null) ; then
|
||||
cat /usr/share/zoneminder/db/zm_create.sql | mysql --defaults-file=/etc/mysql/debian.cnf
|
||||
echo 'grant lock tables, alter,select,insert,update,delete on zm.* to 'zmuser'@localhost identified by "zmpass";' | mysql --defaults-file=/etc/mysql/debian.cnf mysql
|
||||
fi
|
||||
|
||||
# get old version from upgrade...
|
||||
OLD_ZM_VERSION=${2%-*}
|
||||
if [ -z "$OLD_ZM_VERSION" ]; then
|
||||
# fall back to getting version from database itself, which may not necessarily be accurate?
|
||||
OLD_ZM_VERSION=$(echo 'select Value from Config where Name = "ZM_DYN_CURR_VERSION";' | mysql --defaults-file=/etc/mysql/debian.cnf --skip-column-names zm )
|
||||
fi
|
||||
if [ -n "$OLD_ZM_VERSION" ] && [ "$OLD_ZM_VERSION" != "$VERSION" ] ; then
|
||||
echo 'grant lock tables, create, alter on zm.* to 'zmuser'@localhost identified by "zmpass";' | mysql --defaults-file=/etc/mysql/debian.cnf mysql
|
||||
# stop zoneminder before performing database upgrade.
|
||||
invoke-rc.d zoneminder stop || true
|
||||
zmupdate.pl --nointeractive --version $OLD_ZM_VERSION
|
||||
fi
|
||||
invoke-rc.d zoneminder stop || true
|
||||
zmupdate.pl --nointeractive
|
||||
|
||||
else
|
||||
echo 'NOTE: mysql not running, please start mysql and run dpkg-reconfigure zoneminder when it is running.'
|
||||
fi
|
||||
chown www-data:www-data /var/log/zm
|
||||
chown www-data:www-data /var/lib/zm/
|
||||
if [ -z "$2" ]; then
|
||||
chown www-data:www-data -R /var/cache/zoneminder
|
||||
fi
|
||||
else
|
||||
echo 'NOTE: mysql not running, please start mysql and run dpkg-reconfigure zoneminder when it is running.'
|
||||
fi
|
||||
else
|
||||
echo 'mysql not found, assuming remote server.'
|
||||
fi
|
||||
chown www-data:www-data /var/log/zm
|
||||
chown www-data:www-data /var/lib/zm/
|
||||
if [ -z "$2" ]; then
|
||||
chown www-data:www-data -R /var/cache/zoneminder
|
||||
fi
|
||||
fi
|
||||
# Ensure zoneminder is stopped...
|
||||
if [ -x "/etc/init.d/zoneminder" ]; then
|
||||
|
@ -55,10 +47,7 @@ if [ "$1" = "configure" ]; then
|
|||
chown www-data:www-data -R /var/cache/zoneminder
|
||||
else
|
||||
chown www-data:www-data /var/log/zm
|
||||
OLD_ZM_VERSION=${2%-*}
|
||||
if [ "$OLD_ZM_VERSION" != "$VERSION" ] ; then
|
||||
zmupdate.pl --version $OLD_ZM_VERSION
|
||||
fi
|
||||
zmupdate.pl
|
||||
fi
|
||||
fi
|
||||
#DEBHELPER#
|
||||
|
|
|
@ -9,9 +9,6 @@
|
|||
# Uncomment this to turn on verbose mode.
|
||||
#export DH_VERBOSE=1
|
||||
|
||||
UPSTREAM_VERSION := $(shell dpkg-parsechangelog | egrep '^Version:' | cut -f 2 -d ' ' | cut -d - -f 1)
|
||||
POSTINST_VERSION := $(shell egrep ^VERSION= debian/postinst | cut -d = -f 2)
|
||||
|
||||
# These are used for cross-compiling and for saving the configure script
|
||||
# from having to guess our platform (since we know it already)
|
||||
DEB_HOST_GNU_TYPE ?= $(shell dpkg-architecture -qDEB_HOST_GNU_TYPE)
|
||||
|
@ -34,9 +31,6 @@ override_dh_auto_configure:
|
|||
CFLAGS="$(CFLAGS)" CXXFLAGS="$(CXXFLAGS)" ./configure --host=$(DEB_HOST_GNU_TYPE) --build=$(DEB_BUILD_GNU_TYPE) --sysconfdir=/etc/zm --prefix=/usr --mandir=\$${prefix}/share/man --infodir=\$${prefix}/share/info --with-mysql=/usr --with-webdir=/usr/share/zoneminder --with-ffmpeg=/usr --with-cgidir=/usr/lib/cgi-bin --with-webuser=www-data --with-webgroup=www-data --enable-crashtrace=no --enable-mmap=yes
|
||||
|
||||
override_dh_clean:
|
||||
# check to make sure that postinst contains the correct upstream version
|
||||
[ $(UPSTREAM_VERSION) = $(POSTINST_VERSION) ]
|
||||
|
||||
# Add here commands to clean up after the build process.
|
||||
[ ! -f Makefile ] || $(MAKE) distclean
|
||||
dh_clean
|
||||
|
@ -71,3 +65,7 @@ override_dh_fixperms:
|
|||
|
||||
override_dh_auto_test:
|
||||
# do not run tests...
|
||||
|
||||
.PHONY: override_dh_strip
|
||||
override_dh_strip:
|
||||
dh_strip --dbg-package=zoneminder-dbg
|
||||
|
|
|
@ -1,10 +1,10 @@
|
|||
# CMakeLists.txt for the ZoneMinder misc files
|
||||
|
||||
# Create files from the .in files
|
||||
configure_file(apache.conf.in ${CMAKE_CURRENT_SOURCE_DIR}/apache.conf @ONLY)
|
||||
configure_file(logrotate.conf.in ${CMAKE_CURRENT_SOURCE_DIR}/logrotate.conf @ONLY)
|
||||
configure_file(syslog.conf.in ${CMAKE_CURRENT_SOURCE_DIR}/syslog.conf @ONLY)
|
||||
configure_file(apache.conf.in "${CMAKE_CURRENT_BINARY_DIR}/apache.conf" @ONLY)
|
||||
configure_file(logrotate.conf.in "${CMAKE_CURRENT_BINARY_DIR}/logrotate.conf" @ONLY)
|
||||
configure_file(syslog.conf.in "${CMAKE_CURRENT_BINARY_DIR}/syslog.conf" @ONLY)
|
||||
|
||||
# Install the misc files
|
||||
install(FILES apache.conf logrotate.conf syslog.conf DESTINATION "${CMAKE_INSTALL_DATADIR}/zoneminder/misc")
|
||||
# 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")
|
||||
|
||||
|
|
|
@ -1,24 +1,30 @@
|
|||
# CMakeLists.txt for the ZoneMinder perl scripts.
|
||||
|
||||
# Process the perl modules subdirectory
|
||||
add_subdirectory(ZoneMinder ZoneMinder)
|
||||
add_subdirectory(ZoneMinder)
|
||||
|
||||
# Create files from the .in files
|
||||
configure_file(zmaudit.pl.in ${CMAKE_CURRENT_SOURCE_DIR}/zmaudit.pl @ONLY)
|
||||
configure_file(zmcontrol.pl.in ${CMAKE_CURRENT_SOURCE_DIR}/zmcontrol.pl @ONLY)
|
||||
configure_file(zmdc.pl.in ${CMAKE_CURRENT_SOURCE_DIR}/zmdc.pl @ONLY)
|
||||
configure_file(zmfilter.pl.in ${CMAKE_CURRENT_SOURCE_DIR}/zmfilter.pl @ONLY)
|
||||
configure_file(zmpkg.pl.in ${CMAKE_CURRENT_SOURCE_DIR}/zmpkg.pl @ONLY)
|
||||
configure_file(zmtrack.pl.in ${CMAKE_CURRENT_SOURCE_DIR}/zmtrack.pl @ONLY)
|
||||
configure_file(zmtrigger.pl.in ${CMAKE_CURRENT_SOURCE_DIR}/zmtrigger.pl @ONLY)
|
||||
configure_file(zmupdate.pl.in ${CMAKE_CURRENT_SOURCE_DIR}/zmupdate.pl @ONLY)
|
||||
configure_file(zmvideo.pl.in ${CMAKE_CURRENT_SOURCE_DIR}/zmvideo.pl @ONLY)
|
||||
configure_file(zmwatch.pl.in ${CMAKE_CURRENT_SOURCE_DIR}/zmwatch.pl @ONLY)
|
||||
configure_file(zmx10.pl.in ${CMAKE_CURRENT_SOURCE_DIR}/zmx10.pl @ONLY)
|
||||
#configure_file(zmdbbackup.in ${CMAKE_CURRENT_SOURCE_DIR}/zmdbbackup @ONLY)
|
||||
#configure_file(zmdbrestore.in ${CMAKE_CURRENT_SOURCE_DIR}/zmdbrestore @ONLY)
|
||||
#configure_file(zm.in ${CMAKE_CURRENT_SOURCE_DIR}/zm @ONLY)
|
||||
#configure_file(zmeventdump.in ${CMAKE_CURRENT_SOURCE_DIR}/zmeventdump @ONLY)
|
||||
configure_file(zmaudit.pl.in "${CMAKE_CURRENT_BINARY_DIR}/zmaudit.pl" @ONLY)
|
||||
configure_file(zmcontrol.pl.in "${CMAKE_CURRENT_BINARY_DIR}/zmcontrol.pl" @ONLY)
|
||||
configure_file(zmdc.pl.in "${CMAKE_CURRENT_BINARY_DIR}/zmdc.pl" @ONLY)
|
||||
configure_file(zmfilter.pl.in "${CMAKE_CURRENT_BINARY_DIR}/zmfilter.pl" @ONLY)
|
||||
configure_file(zmpkg.pl.in "${CMAKE_CURRENT_BINARY_DIR}/zmpkg.pl" @ONLY)
|
||||
configure_file(zmtrack.pl.in "${CMAKE_CURRENT_BINARY_DIR}/zmtrack.pl" @ONLY)
|
||||
configure_file(zmtrigger.pl.in "${CMAKE_CURRENT_BINARY_DIR}/zmtrigger.pl" @ONLY)
|
||||
configure_file(zmupdate.pl.in "${CMAKE_CURRENT_BINARY_DIR}/zmupdate.pl" @ONLY)
|
||||
configure_file(zmvideo.pl.in "${CMAKE_CURRENT_BINARY_DIR}/zmvideo.pl" @ONLY)
|
||||
configure_file(zmwatch.pl.in "${CMAKE_CURRENT_BINARY_DIR}/zmwatch.pl" @ONLY)
|
||||
configure_file(zmcamtool.pl.in "${CMAKE_CURRENT_BINARY_DIR}/zmcamtool.pl" @ONLY)
|
||||
if(NOT ZM_NO_X10)
|
||||
configure_file(zmx10.pl.in "${CMAKE_CURRENT_BINARY_DIR}/zmx10.pl" @ONLY)
|
||||
endif(NOT ZM_NO_X10)
|
||||
#configure_file(zmdbbackup.in zmdbbackup @ONLY)
|
||||
#configure_file(zmdbrestore.in zmdbrestore @ONLY)
|
||||
configure_file(zm.in "${CMAKE_CURRENT_BINARY_DIR}/zm" @ONLY)
|
||||
#configure_file(zmeventdump.in zmeventdump @ONLY)
|
||||
|
||||
# Install the perl scripts
|
||||
install(FILES zmaudit.pl zmcontrol.pl zmdc.pl zmfilter.pl zmpkg.pl zmtrack.pl zmtrigger.pl zmupdate.pl zmvideo.pl zmwatch.pl zmx10.pl DESTINATION "${CMAKE_INSTALL_FULL_BINDIR}" PERMISSIONS OWNER_WRITE OWNER_READ OWNER_EXECUTE GROUP_READ GROUP_EXECUTE WORLD_READ WORLD_EXECUTE)
|
||||
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" 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)
|
||||
install(FILES "${CMAKE_CURRENT_BINARY_DIR}/zmx10.pl" DESTINATION "${CMAKE_INSTALL_FULL_BINDIR}" PERMISSIONS OWNER_WRITE OWNER_READ OWNER_EXECUTE GROUP_READ GROUP_EXECUTE WORLD_READ WORLD_EXECUTE)
|
||||
endif(NOT ZM_NO_X10)
|
||||
|
|
|
@ -17,7 +17,8 @@ bin_SCRIPTS = \
|
|||
zmupdate.pl \
|
||||
zmvideo.pl \
|
||||
zmcontrol.pl \
|
||||
zmtrack.pl
|
||||
zmtrack.pl \
|
||||
zmcamtool.pl
|
||||
|
||||
SUBDIRS = \
|
||||
. \
|
||||
|
@ -35,6 +36,7 @@ EXTRA_DIST = \
|
|||
zmvideo.pl.in \
|
||||
zmcontrol.pl.in \
|
||||
zmtrack.pl.in \
|
||||
zmcamtool.pl.in \
|
||||
ZoneMinder/Makefile.PL \
|
||||
ZoneMinder/README \
|
||||
ZoneMinder/Changes \
|
||||
|
@ -53,17 +55,7 @@ EXTRA_DIST = \
|
|||
ZoneMinder/lib/ZoneMinder/ConfigAdmin.pm \
|
||||
ZoneMinder/lib/ZoneMinder/ConfigData.pm.in \
|
||||
ZoneMinder/lib/ZoneMinder/Control.pm \
|
||||
ZoneMinder/lib/ZoneMinder/Control/PelcoD.pm \
|
||||
ZoneMinder/lib/ZoneMinder/Control/AxisV2.pm \
|
||||
ZoneMinder/lib/ZoneMinder/Control/PanasonicIP.pm \
|
||||
ZoneMinder/lib/ZoneMinder/Control/Visca.pm \
|
||||
ZoneMinder/lib/ZoneMinder/Control/Ncs370.pm \
|
||||
ZoneMinder/lib/ZoneMinder/Control/mjpgStreamer.pm \
|
||||
ZoneMinder/lib/ZoneMinder/Control/SkyIPCam7xx.pm \
|
||||
ZoneMinder/lib/ZoneMinder/Control/FI8608W_Y2k.pm \
|
||||
ZoneMinder/lib/ZoneMinder/Control/FI8620_Y2k.pm \
|
||||
ZoneMinder/lib/ZoneMinder/Control/FI9821W_Y2k.pm \
|
||||
ZoneMinder/lib/ZoneMinder/Control/LoftekSentinel.pm \
|
||||
ZoneMinder/lib/ZoneMinder/Control \ # Grab all ptz control skips under the Control folder
|
||||
ZoneMinder/lib/ZoneMinder/Trigger/Channel.pm \
|
||||
ZoneMinder/lib/ZoneMinder/Trigger/Channel/Handle.pm \
|
||||
ZoneMinder/lib/ZoneMinder/Trigger/Channel/Spawning.pm \
|
||||
|
|
|
@ -1,19 +1,33 @@
|
|||
# CMakeLists.txt for the ZoneMinder perl module.
|
||||
|
||||
# If this is an out-of-source build, copy the files we need to the binary directory
|
||||
if(NOT (CMAKE_BINARY_DIR STREQUAL CMAKE_SOURCE_DIR))
|
||||
execute_process(COMMAND ${CMAKE_COMMAND} -E copy "${CMAKE_CURRENT_SOURCE_DIR}/Changes" "${CMAKE_CURRENT_BINARY_DIR}/Changes")
|
||||
execute_process(COMMAND ${CMAKE_COMMAND} -E copy "${CMAKE_CURRENT_SOURCE_DIR}/Makefile.PL" "${CMAKE_CURRENT_BINARY_DIR}/Makefile.PL")
|
||||
execute_process(COMMAND ${CMAKE_COMMAND} -E copy "${CMAKE_CURRENT_SOURCE_DIR}/MANIFEST" "${CMAKE_CURRENT_BINARY_DIR}/MANIFEST")
|
||||
execute_process(COMMAND ${CMAKE_COMMAND} -E copy "${CMAKE_CURRENT_SOURCE_DIR}/META.yml" "${CMAKE_CURRENT_BINARY_DIR}/META.yml")
|
||||
execute_process(COMMAND ${CMAKE_COMMAND} -E copy "${CMAKE_CURRENT_SOURCE_DIR}/README" "${CMAKE_CURRENT_BINARY_DIR}/README")
|
||||
execute_process(COMMAND ${CMAKE_COMMAND} -E copy_directory "${CMAKE_CURRENT_SOURCE_DIR}/t" "${CMAKE_CURRENT_BINARY_DIR}/t")
|
||||
execute_process(COMMAND ${CMAKE_COMMAND} -E copy_directory "${CMAKE_CURRENT_SOURCE_DIR}/lib" "${CMAKE_CURRENT_BINARY_DIR}/lib")
|
||||
endif(NOT (CMAKE_BINARY_DIR STREQUAL CMAKE_SOURCE_DIR))
|
||||
|
||||
# Create files from the .in files
|
||||
configure_file(lib/ZoneMinder/Base.pm.in ${CMAKE_CURRENT_SOURCE_DIR}/lib/ZoneMinder/Base.pm @ONLY)
|
||||
configure_file(lib/ZoneMinder/Config.pm.in ${CMAKE_CURRENT_SOURCE_DIR}/lib/ZoneMinder/Config.pm @ONLY)
|
||||
configure_file(lib/ZoneMinder/Memory.pm.in ${CMAKE_CURRENT_SOURCE_DIR}/lib/ZoneMinder/Memory.pm @ONLY)
|
||||
configure_file(lib/ZoneMinder/ConfigData.pm.in ${CMAKE_CURRENT_SOURCE_DIR}/lib/ZoneMinder/ConfigData.pm @ONLY)
|
||||
configure_file(lib/ZoneMinder/Base.pm.in "${CMAKE_CURRENT_BINARY_DIR}/lib/ZoneMinder/Base.pm" @ONLY)
|
||||
configure_file(lib/ZoneMinder/Config.pm.in "${CMAKE_CURRENT_BINARY_DIR}/lib/ZoneMinder/Config.pm" @ONLY)
|
||||
configure_file(lib/ZoneMinder/Memory.pm.in "${CMAKE_CURRENT_BINARY_DIR}/lib/ZoneMinder/Memory.pm" @ONLY)
|
||||
configure_file(lib/ZoneMinder/ConfigData.pm.in "${CMAKE_CURRENT_BINARY_DIR}/lib/ZoneMinder/ConfigData.pm" @ONLY)
|
||||
|
||||
if(CMAKE_VERBOSE_MAKEFILE)
|
||||
set(MAKEMAKER_NOECHO_COMMAND "")
|
||||
else(CMAKE_VERBOSE_MAKEFILE)
|
||||
set(MAKEMAKER_NOECHO_COMMAND "NOECHO=\"1>/dev/null\"")
|
||||
endif(CMAKE_VERBOSE_MAKEFILE)
|
||||
|
||||
# Add build target for the perl modules
|
||||
add_custom_target(zmperlmodules ALL perl Makefile.PL FIRST_MAKEFILE="${CMAKE_CURRENT_SOURCE_DIR}/MakefilePerl" INSTALL_BASE="${CMAKE_CURRENT_SOURCE_DIR}/output" INSTALLPRIVLIB="${CMAKE_CURRENT_SOURCE_DIR}/output/${CMAKE_INSTALL_LIBDIR}/perl5" INSTALLARCHLIB="${CMAKE_CURRENT_SOURCE_DIR}/optout/${CMAKE_INSTALL_LIBDIR}/perl5/arch" INSTALLSITELIB="${CMAKE_CURRENT_SOURCE_DIR}/output/${CMAKE_INSTALL_LIBDIR}/perl5" INSTALLSITEARCH="${CMAKE_CURRENT_SOURCE_DIR}/optout/${CMAKE_INSTALL_LIBDIR}/perl5/arch" COMMAND make --makefile=MakefilePerl COMMAND make --makefile=MakefilePerl pure_install COMMENT "Building ZoneMinder perl modules")
|
||||
add_custom_target(zmperlmodules ALL perl Makefile.PL FIRST_MAKEFILE=MakefilePerl PREFIX="${CMAKE_CURRENT_BINARY_DIR}/output" LIB="${CMAKE_CURRENT_BINARY_DIR}/output/${ZM_PERL_SUBPREFIX}" INSTALLSITEMAN3DIR="${CMAKE_CURRENT_BINARY_DIR}/output/${CMAKE_INSTALL_MANDIR}/man3" ${MAKEMAKER_NOECHO_COMMAND} COMMAND make --makefile=MakefilePerl COMMAND make --makefile=MakefilePerl pure_install COMMENT "Building ZoneMinder perl modules")
|
||||
|
||||
# Add install target for the perl modules
|
||||
install(DIRECTORY output/ DESTINATION "${CMAKE_INSTALL_PREFIX}")
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
install(DIRECTORY "${CMAKE_CURRENT_BINARY_DIR}/output/" DESTINATION "${CMAKE_INSTALL_PREFIX}")
|
||||
|
||||
# Add additional files and directories to make clean
|
||||
set_directory_properties(PROPERTIES ADDITIONAL_MAKE_CLEAN_FILES "output;blib;pm_to_blib;MakefilePerl")
|
||||
|
|
|
@ -6,40 +6,7 @@ WriteMakefile(
|
|||
NAME => 'ZoneMinder',
|
||||
VERSION_FROM => 'lib/ZoneMinder/Base.pm', # finds $VERSION
|
||||
PREREQ_PM => {}, # e.g., Module::Name => 1.1
|
||||
PM => {
|
||||
'lib/ZoneMinder.pm' => '$(INST_LIBDIR)/ZoneMinder.pm',
|
||||
'lib/ZoneMinder/Base.pm' => '$(INST_LIBDIR)/ZoneMinder/Base.pm',
|
||||
'lib/ZoneMinder/Config.pm' => '$(INST_LIBDIR)/ZoneMinder/Config.pm',
|
||||
'lib/ZoneMinder/General.pm' => '$(INST_LIBDIR)/ZoneMinder/General.pm',
|
||||
'lib/ZoneMinder/Database.pm' => '$(INST_LIBDIR)/ZoneMinder/Database.pm',
|
||||
'lib/ZoneMinder/Logger.pm' => '$(INST_LIBDIR)/ZoneMinder/Logger.pm',
|
||||
'lib/ZoneMinder/Memory.pm' => '$(INST_LIBDIR)/ZoneMinder/Memory.pm',
|
||||
'lib/ZoneMinder/Memory/Shared.pm' => '$(INST_LIBDIR)/ZoneMinder/Memory/Shared.pm',
|
||||
'lib/ZoneMinder/Memory/Mapped.pm' => '$(INST_LIBDIR)/ZoneMinder/Memory/Mapped.pm',
|
||||
'lib/ZoneMinder/ConfigAdmin.pm' => '$(INST_LIBDIR)/ZoneMinder/ConfigAdmin.pm',
|
||||
'lib/ZoneMinder/ConfigData.pm' => '$(INST_LIBDIR)/ZoneMinder/ConfigData.pm',
|
||||
'lib/ZoneMinder/Control.pm' => '$(INST_LIBDIR)/ZoneMinder/Control.pm',
|
||||
'lib/ZoneMinder/Control/PelcoD.pm' => '$(INST_LIBDIR)/ZoneMinder/Control/PelcoD.pm',
|
||||
'lib/ZoneMinder/Control/AxisV2.pm' => '$(INST_LIBDIR)/ZoneMinder/Control/AxisV2.pm',
|
||||
'lib/ZoneMinder/Control/PanasonicIP.pm' => '$(INST_LIBDIR)/ZoneMinder/Control/PanasonicIP.pm',
|
||||
'lib/ZoneMinder/Control/Visca.pm' => '$(INST_LIBDIR)/ZoneMinder/Control/Visca.pm',
|
||||
'lib/ZoneMinder/Control/Ncs370.pm' => '$(INST_LIBDIR)/ZoneMinder/Control/Ncs370.pm',
|
||||
'lib/ZoneMinder/Control/mjpgStreamer.pm' => '$(INST_LIBDIR)/ZoneMinder/Control/mjpgStreamer.pm',
|
||||
'lib/ZoneMinder/Control/SkyIPCam7xx.pm' => '$(INST_LIBDIR)/ZoneMinder/Control/SkyIPCam7xx.pm',
|
||||
'lib/ZoneMinder/Control/FI8608W_Y2k.pm' => '$(INST_LIBDIR)/ZoneMinder/Control/FI8608W_Y2k.pm',
|
||||
'lib/ZoneMinder/Control/FI8620_Y2k.pm' => '$(INST_LIBDIR)/ZoneMinder/Control/FI8620_Y2k.pm',
|
||||
'lib/ZoneMinder/Control/FI9821W_Y2k.pm' => '$(INST_LIBDIR)/ZoneMinder/Control/FI9821W_Y2k.pm',
|
||||
'lib/ZoneMinder/Control/LoftekSentinel.pm' => '$(INST_LIBDIR)/ZoneMinder/Control/LoftekSentinel.pm',
|
||||
'lib/ZoneMinder/Trigger/Channel.pm' => '$(INST_LIBDIR)/ZoneMinder/Trigger/Channel.pm',
|
||||
'lib/ZoneMinder/Trigger/Channel/Handle.pm' => '$(INST_LIBDIR)/ZoneMinder/Trigger/Channel/Handle.pm',
|
||||
'lib/ZoneMinder/Trigger/Channel/Spawning.pm' => '$(INST_LIBDIR)/ZoneMinder/Trigger/Channel/Spawning.pm',
|
||||
'lib/ZoneMinder/Trigger/Channel/Inet.pm' => '$(INST_LIBDIR)/ZoneMinder/Trigger/Channel/Inet.pm',
|
||||
'lib/ZoneMinder/Trigger/Channel/Unix.pm' => '$(INST_LIBDIR)/ZoneMinder/Trigger/Channel/Unix.pm',
|
||||
'lib/ZoneMinder/Trigger/Channel/File.pm' => '$(INST_LIBDIR)/ZoneMinder/Trigger/Channel/File.pm',
|
||||
'lib/ZoneMinder/Trigger/Channel/Serial.pm' => '$(INST_LIBDIR)/ZoneMinder/Trigger/Channel/Serial.pm',
|
||||
'lib/ZoneMinder/Trigger/Connection.pm' => '$(INST_LIBDIR)/ZoneMinder/Trigger/Connection.pm',
|
||||
'lib/ZoneMinder/Trigger/Connection/Example.pm' => '$(INST_LIBDIR)/ZoneMinder/Trigger/Connection/Example.pm',
|
||||
},
|
||||
# No need to specify perl modules. MakeMaker will find them automatically
|
||||
($] >= 5.005 ? ## Add these new keywords supported since 5.005
|
||||
(ABSTRACT_FROM => 'lib/ZoneMinder.pm', # retrieve abstract from module
|
||||
AUTHOR => 'Philip Coombes <philip.coombes@zoneminder.com>') : ()),
|
||||
|
|
|
@ -32,6 +32,8 @@ require Exporter;
|
|||
|
||||
our @ISA = qw(Exporter);
|
||||
|
||||
use constant ZM_VERSION => "@VERSION@";
|
||||
|
||||
# Items to export into callers namespace by default. Note: do not export
|
||||
# names by default without a very good reason. Use EXPORT_OK instead.
|
||||
# Do not simply export all your public functions/methods/constants.
|
||||
|
@ -39,7 +41,7 @@ our @ISA = qw(Exporter);
|
|||
# This allows declaration use ZoneMinder ':all';
|
||||
# If you do not need this, moving things directly into @EXPORT or @EXPORT_OK
|
||||
# will save memory.
|
||||
our %EXPORT_TAGS = ( 'all' => [ qw() ] );
|
||||
our %EXPORT_TAGS = ( 'all' => [ qw(ZM_VERSION) ] );
|
||||
|
||||
our @EXPORT_OK = ( @{ $EXPORT_TAGS{'all'} } );
|
||||
|
||||
|
|
|
@ -33,6 +33,7 @@ require ZoneMinder::Base;
|
|||
|
||||
our @ISA = qw(Exporter ZoneMinder::Base);
|
||||
|
||||
use vars qw( %Config );
|
||||
# Items to export into callers namespace by default. Note: do not export
|
||||
# names by default without a very good reason. Use EXPORT_OK instead.
|
||||
# Do not simply export all your public functions/methods/constants.
|
||||
|
@ -40,7 +41,7 @@ our @ISA = qw(Exporter ZoneMinder::Base);
|
|||
# This allows declaration use ZoneMinder ':all';
|
||||
# If you do not need this, moving things directly into @EXPORT or @EXPORT_OK
|
||||
# will save memory.
|
||||
our @EXPORT_CONFIG; # Get populated by BEGIN
|
||||
our @EXPORT_CONFIG = qw( %Config ); # Get populated by BEGIN
|
||||
|
||||
our %EXPORT_TAGS = (
|
||||
'constants' => [ qw(
|
||||
|
@ -64,11 +65,9 @@ use Carp;
|
|||
# Load the config from the database into the symbol table
|
||||
BEGIN
|
||||
{
|
||||
no strict 'refs';
|
||||
|
||||
my $config_file = ZM_CONFIG;
|
||||
( my $local_config_file = $config_file ) =~ s|^.*/|./|;
|
||||
if ( -s $local_config_file && -r $local_config_file )
|
||||
if ( -s $local_config_file and -r $local_config_file )
|
||||
{
|
||||
print( STDERR "Warning, overriding installed $local_config_file file with local copy\n" );
|
||||
$config_file = $local_config_file;
|
||||
|
@ -78,25 +77,26 @@ BEGIN
|
|||
{
|
||||
next if ( $str =~ /^\s*$/ );
|
||||
next if ( $str =~ /^\s*#/ );
|
||||
my ( $name, $value ) = $str =~ /^\s*([^=\s]+)\s*=\s*(.+?)\s*$/;
|
||||
my ( $name, $value ) = $str =~ /^\s*([^=\s]+)\s*=\s*(.*?)\s*$/;
|
||||
if ( ! $name ) {
|
||||
print( STDERR "Warning, bad line in $config_file: $str\n" );
|
||||
next;
|
||||
} # end if
|
||||
$name =~ tr/a-z/A-Z/;
|
||||
*{$name} = sub { $value };
|
||||
push( @EXPORT_CONFIG, $name );
|
||||
$Config{$name} = $value;
|
||||
}
|
||||
close( CONFIG );
|
||||
|
||||
use DBI;
|
||||
my $dbh = DBI->connect( "DBI:mysql:database=".&ZM_DB_NAME.";host=".&ZM_DB_HOST, &ZM_DB_USER, &ZM_DB_PASS );
|
||||
my $sql = "select * from Config";
|
||||
my $dbh = DBI->connect( "DBI:mysql:database=".$Config{ZM_DB_NAME}.";host=".$Config{ZM_DB_HOST}, $Config{ZM_DB_USER}, $Config{ZM_DB_PASS} ) or croak( "Can't connect to db" );
|
||||
my $sql = 'select * from Config';
|
||||
my $sth = $dbh->prepare_cached( $sql ) or croak( "Can't prepare '$sql': ".$dbh->errstr() );
|
||||
my $res = $sth->execute() or croak( "Can't execute: ".$sth->errstr() );
|
||||
while( my $config = $sth->fetchrow_hashref() )
|
||||
{
|
||||
*{$config->{Name}} = sub { $config->{Value} };
|
||||
push( @EXPORT_CONFIG, $config->{Name} );
|
||||
while( my $config = $sth->fetchrow_hashref() ) {
|
||||
$Config{$config->{Name}} = $config->{Value};
|
||||
}
|
||||
$sth->finish();
|
||||
$dbh->disconnect();
|
||||
#$dbh->disconnect();
|
||||
}
|
||||
|
||||
1;
|
||||
|
@ -116,7 +116,7 @@ The ZoneMinder::Config module is used to import the ZoneMinder configuration fro
|
|||
|
||||
Once the configuration has been imported then configuration variables are defined as constants and can be accessed directory by name, e.g.
|
||||
|
||||
$lang = ZM_LANG_DEFAULT;
|
||||
$lang = $Config{ZM_LANG_DEFAULT};
|
||||
|
||||
=head2 EXPORT
|
||||
|
||||
|
|
|
@ -68,7 +68,7 @@ use Carp;
|
|||
sub loadConfigFromDB
|
||||
{
|
||||
print( "Loading config from DB\n" );
|
||||
my $dbh = DBI->connect( "DBI:mysql:database=".ZM_DB_NAME.";host=".ZM_DB_HOST, ZM_DB_USER, ZM_DB_PASS );
|
||||
my $dbh = DBI->connect( "DBI:mysql:database=".$Config{ZM_DB_NAME}.";host=".$Config{ZM_DB_HOST}, $Config{ZM_DB_USER}, $Config{ZM_DB_PASS} );
|
||||
|
||||
if ( !$dbh )
|
||||
{
|
||||
|
@ -111,13 +111,19 @@ sub loadConfigFromDB
|
|||
sub saveConfigToDB
|
||||
{
|
||||
print( "Saving config to DB\n" );
|
||||
my $dbh = DBI->connect( "DBI:mysql:database=".ZM_DB_NAME.";host=".ZM_DB_HOST, ZM_DB_USER, ZM_DB_PASS );
|
||||
my $dbh = DBI->connect( "DBI:mysql:database=".$Config{ZM_DB_NAME}.";host=".$Config{ZM_DB_HOST}, $Config{ZM_DB_USER}, $Config{ZM_DB_PASS} );
|
||||
|
||||
if ( !$dbh )
|
||||
{
|
||||
print( "Error: unable to save options to database: $DBI::errstr\n" );
|
||||
return( 0 );
|
||||
}
|
||||
|
||||
my $ac = $dbh->{AutoCommit};
|
||||
$dbh->{AutoCommit} = 0;
|
||||
|
||||
$dbh->do('LOCK TABLE Config WRITE') or croak( "Can't lock Config table: " . $dbh->errstr() );
|
||||
|
||||
my $sql = "delete from Config";
|
||||
my $res = $dbh->do( $sql ) or croak( "Can't do '$sql': ".$dbh->errstr() );
|
||||
|
||||
|
@ -149,6 +155,10 @@ sub saveConfigToDB
|
|||
my $res = $sth->execute( $option->{id}, $option->{name}, $option->{db_value}, $option->{db_type}, $option->{default}, $option->{db_hint}, $option->{db_pattern}, $option->{db_format}, $option->{description}, $option->{help}, $option->{category}, $option->{readonly}?1:0, $option->{db_requires} ) or croak( "Can't execute: ".$sth->errstr() );
|
||||
}
|
||||
$sth->finish();
|
||||
|
||||
$dbh->do('UNLOCK TABLES');
|
||||
$dbh->{AutoCommit} = $ac;
|
||||
|
||||
$dbh->disconnect();
|
||||
}
|
||||
|
||||
|
|
|
@ -203,7 +203,7 @@ our @options =
|
|||
},
|
||||
{
|
||||
name => "ZM_COLOUR_JPEG_FILES",
|
||||
default => "yes",
|
||||
default => "no",
|
||||
description => "Colourise greyscale JPEG files",
|
||||
help => "Cameras that capture in greyscale can write their captured images to jpeg files with a corresponding greyscale colour space. This saves a small amount of disk space over colour ones. However some tools such as ffmpeg either fail to work with this colour space or have to convert it beforehand. Setting this option to yes uses up a little more space but makes creation of MPEG files much faster.",
|
||||
type => $types{boolean},
|
||||
|
@ -339,14 +339,6 @@ our @options =
|
|||
type => $types{boolean},
|
||||
category => "config",
|
||||
},
|
||||
{
|
||||
name => "ZM_BLEND_ALARMED_IMAGES",
|
||||
default => "yes",
|
||||
description => "Blend alarmed images to update the reference image",
|
||||
help => "To detect alarms ZoneMinder compares an image with a reference image which is formed from a composite of the previous images. This option determines whether images that cause events are included in this process. Doing so may increase the precision of the alarmed region but can cause problems if wholescale lighting changes cause alarms as this would not get fed back into the image and an alarm may persist indefinately. A better way to achive the same effect in most cases is to lower substantially the reference blend percentage in specific monitors.",
|
||||
type => $types{boolean},
|
||||
category => "config",
|
||||
},
|
||||
{
|
||||
name => "ZM_MAX_SUSPEND_TIME",
|
||||
default => "30",
|
||||
|
@ -376,9 +368,9 @@ our @options =
|
|||
},
|
||||
{
|
||||
name => "ZM_HTTP_VERSION",
|
||||
default => "1.1",
|
||||
default => "1.0",
|
||||
description => "The version of HTTP that ZoneMinder will use to connect",
|
||||
help => "ZoneMinder can communicate with network cameras using either of the HTTP/1.1 or HTTP/1.0 standard. A server will normally fall back to the version it supports iwht no problem so this should usually by left at the default. However it can be changed to HTTP/1.0 if necessary to resolve particular issues.",
|
||||
help => "ZoneMinder can communicate with network cameras using either of the HTTP/1.1 or HTTP/1.0 standard. A server will normally fall back to the version it supports with no problem so this should usually by left at the default. However it can be changed to HTTP/1.0 if necessary to resolve particular issues.",
|
||||
type => { db_type=>"string", hint=>"1.1|1.0", pattern=>qr|^(1\.[01])$|, format=>q( $1?$1:"" ) },
|
||||
category => "network",
|
||||
},
|
||||
|
@ -1224,7 +1216,7 @@ body = "ZM alarm detected - %EL% secs, %EF%/%EFA% frames, t%EST%/m%ESM%/a%ESA% s
|
|||
},
|
||||
{
|
||||
name => "ZM_EVENT_IMAGE_DIGITS",
|
||||
default => "3",
|
||||
default => "5",
|
||||
description => "How many significant digits are used in event image numbering",
|
||||
help => "As event images are captured they are stored to the filesystem with a numerical index. By default this index has three digits so the numbers start 001, 002 etc. This works works for most scenarios as events with more than 999 frames are rarely captured. However if you have extremely long events and use external applications then you may wish to increase this to ensure correct sorting of images in listings etc. Warning, increasing this value on a live system may render existing events unviewable as the event will have been saved with the previous scheme. Decreasing this value should have no ill effects.",
|
||||
type => $types{integer},
|
||||
|
@ -1373,7 +1365,7 @@ body = "ZM alarm detected - %EL% secs, %EF%/%EFA% frames, t%EST%/m%ESM%/a%ESA% s
|
|||
},
|
||||
{
|
||||
name => "ZM_WEB_H_REFRESH_MAIN",
|
||||
default => "300",
|
||||
default => "60",
|
||||
introduction => "There are now a number of options that are grouped into bandwidth categories, this allows you to configure the ZoneMinder client to work optimally over the various access methods you might to access the client.\n\nThe next few options control what happens when the client is running in 'high' bandwidth mode. You should set these options for when accessing the ZoneMinder client over a local network or high speed link. In most cases the default values will be suitable as a starting point.",
|
||||
description => "How often (in seconds) the main console window should refresh itself",
|
||||
help => "The main console window lists a general status and the event totals for all monitors. This is not a trivial task and should not be repeated too frequently or it may affect the performance of the rest of the system.",
|
||||
|
@ -1390,7 +1382,7 @@ body = "ZM alarm detected - %EL% secs, %EF%/%EFA% frames, t%EST%/m%ESM%/a%ESA% s
|
|||
},
|
||||
{
|
||||
name => "ZM_WEB_H_REFRESH_IMAGE",
|
||||
default => "5",
|
||||
default => "3",
|
||||
description => "How often (in seconds) the watched image is refreshed (if not streaming)",
|
||||
help => "The live images from a monitor can be viewed in either streamed or stills mode. This option determines how often a stills image is refreshed, it has no effect if streaming is selected.",
|
||||
type => $types{integer},
|
||||
|
@ -1398,7 +1390,7 @@ body = "ZM alarm detected - %EL% secs, %EF%/%EFA% frames, t%EST%/m%ESM%/a%ESA% s
|
|||
},
|
||||
{
|
||||
name => "ZM_WEB_H_REFRESH_STATUS",
|
||||
default => "3",
|
||||
default => "1",
|
||||
description => "How often (in seconds) the status refreshes itself in the watch window",
|
||||
help => "The monitor window is actually made from several frames. The one in the middle merely contains a monitor status which needs to refresh fairly frequently to give a true indication. This option determines that frequency.",
|
||||
type => $types{integer},
|
||||
|
@ -1406,7 +1398,7 @@ body = "ZM alarm detected - %EL% secs, %EF%/%EFA% frames, t%EST%/m%ESM%/a%ESA% s
|
|||
},
|
||||
{
|
||||
name => "ZM_WEB_H_REFRESH_EVENTS",
|
||||
default => "30",
|
||||
default => "5",
|
||||
description => "How often (in seconds) the event listing is refreshed in the watch window",
|
||||
help => "The monitor window is actually made from several frames. The lower framme contains a listing of the last few events for easy access. This option determines how often this is refreshed.",
|
||||
type => $types{integer},
|
||||
|
@ -1454,7 +1446,7 @@ body = "ZM alarm detected - %EL% secs, %EF%/%EFA% frames, t%EST%/m%ESM%/a%ESA% s
|
|||
},
|
||||
{
|
||||
name => "ZM_WEB_H_VIDEO_MAXFPS",
|
||||
default => "15",
|
||||
default => "30",
|
||||
description => "What the maximum frame rate for streamed video should be",
|
||||
help => "When using streamed video the main control is the bitrate which determines how much data can be transmitted. However a lower bitrate at high frame rates results in a lower quality image. This option allows you to limit the maximum frame rate to ensure that video quality is maintained. An additional advantage is that encoding video at high frame rates is a processor intensive task when for the most part a very high frame rate offers little perceptible improvement over one that has a more manageable resource requirement. Note, this option is implemented as a cap beyond which binary reduction takes place. So if you have a device capturing at 15fps and set this option to 10fps then the video is not produced at 10fps, but rather at 7.5fps (15 divided by 2) as the final frame rate must be the original divided by a power of 2.",
|
||||
type => $types{integer},
|
||||
|
|
|
@ -37,7 +37,6 @@ require ZoneMinder::Base;
|
|||
require ZoneMinder::Control;
|
||||
|
||||
our @ISA = qw(ZoneMinder::Control);
|
||||
our $VERSION = $ZoneMinder::Base::VERSION;
|
||||
# ===================================================================================================================================
|
||||
#
|
||||
# FI8608W FOSCAM PT H264 Control Protocol
|
||||
|
@ -111,7 +110,7 @@ sub open
|
|||
$self->loadMonitor();
|
||||
use LWP::UserAgent;
|
||||
$self->{ua} = LWP::UserAgent->new;
|
||||
$self->{ua}->agent( "ZoneMinder Control Agent/".ZM_VERSION );
|
||||
$self->{ua}->agent( "ZoneMinder Control Agent/".ZoneMinder::Base::ZM_VERSION );
|
||||
$self->{state} = 'open';
|
||||
}
|
||||
|
||||
|
|
|
@ -41,7 +41,6 @@ require ZoneMinder::Base;
|
|||
require ZoneMinder::Control;
|
||||
|
||||
our @ISA = qw(ZoneMinder::Control);
|
||||
our $VERSION = $ZoneMinder::Base::VERSION;
|
||||
# ===================================================================================================================================
|
||||
#
|
||||
# FI8620 FOSCAM Dome PTZ H264 Control Protocol
|
||||
|
@ -117,7 +116,7 @@ sub open
|
|||
$self->loadMonitor();
|
||||
use LWP::UserAgent;
|
||||
$self->{ua} = LWP::UserAgent->new;
|
||||
$self->{ua}->agent( "ZoneMinder Control Agent/".ZM_VERSION );
|
||||
$self->{ua}->agent( "ZoneMinder Control Agent/".ZoneMinder::Base::ZM_VERSION );
|
||||
$self->{state} = 'open';
|
||||
}
|
||||
|
||||
|
|
|
@ -36,7 +36,6 @@ require ZoneMinder::Base;
|
|||
require ZoneMinder::Control;
|
||||
|
||||
our @ISA = qw(ZoneMinder::Control);
|
||||
our $VERSION = $ZoneMinder::Base::VERSION;
|
||||
# ===================================================================================================================================
|
||||
#
|
||||
# FI9821 FOSCAM PT H264 Control Protocol
|
||||
|
@ -91,7 +90,7 @@ sub open
|
|||
$self->loadMonitor();
|
||||
use LWP::UserAgent;
|
||||
$self->{ua} = LWP::UserAgent->new;
|
||||
$self->{ua}->agent( "ZoneMinder Control Agent/".ZM_VERSION );
|
||||
$self->{ua}->agent( "ZoneMinder Control Agent/".ZoneMinder::Base::ZM_VERSION );
|
||||
$self->{state} = 'open';
|
||||
}
|
||||
|
||||
|
|
|
@ -36,8 +36,6 @@ require ZoneMinder::Control;
|
|||
|
||||
our @ISA = qw(ZoneMinder::Control);
|
||||
|
||||
our $VERSION = $ZoneMinder::Base::VERSION;
|
||||
|
||||
our %CamParams = ();
|
||||
|
||||
# ==========================================================================
|
||||
|
@ -91,7 +89,7 @@ sub open
|
|||
|
||||
use LWP::UserAgent;
|
||||
$self->{ua} = LWP::UserAgent->new;
|
||||
$self->{ua}->agent( "ZoneMinder Control Agent/".ZM_VERSION );
|
||||
$self->{ua}->agent( "ZoneMinder Control Agent/".ZoneMinder::Base::ZM_VERSION );
|
||||
|
||||
$self->{state} = 'open';
|
||||
}
|
||||
|
|
|
@ -33,8 +33,6 @@ require ZoneMinder::Control;
|
|||
|
||||
our @ISA = qw(ZoneMinder::Control);
|
||||
|
||||
our $VERSION = $ZoneMinder::Base::VERSION;
|
||||
|
||||
# ==========================================================================
|
||||
#
|
||||
# Ncs370 IP Control Protocol
|
||||
|
@ -79,7 +77,7 @@ sub open
|
|||
|
||||
use LWP::UserAgent;
|
||||
$self->{ua} = LWP::UserAgent->new;
|
||||
$self->{ua}->agent( "ZoneMinder Control Agent/".ZM_VERSION );
|
||||
$self->{ua}->agent( "ZoneMinder Control Agent/".ZoneMinder::Base::ZM_VERSION );
|
||||
|
||||
$self->{state} = 'open';
|
||||
}
|
||||
|
|
|
@ -33,8 +33,6 @@ require ZoneMinder::Control;
|
|||
|
||||
our @ISA = qw(ZoneMinder::Control);
|
||||
|
||||
our $VERSION = $ZoneMinder::Base::VERSION;
|
||||
|
||||
# ==========================================================================
|
||||
#
|
||||
# Panasonic IP Control Protocol
|
||||
|
@ -79,7 +77,7 @@ sub open
|
|||
|
||||
use LWP::UserAgent;
|
||||
$self->{ua} = LWP::UserAgent->new;
|
||||
$self->{ua}->agent( "ZoneMinder Control Agent/".ZM_VERSION );
|
||||
$self->{ua}->agent( "ZoneMinder Control Agent/".ZoneMinder::Base::ZM_VERSION );
|
||||
|
||||
$self->{state} = 'open';
|
||||
}
|
||||
|
|
|
@ -33,8 +33,6 @@ require ZoneMinder::Control;
|
|||
|
||||
our @ISA = qw(ZoneMinder::Control);
|
||||
|
||||
our $VERSION = $ZoneMinder::Base::VERSION;
|
||||
|
||||
# ==========================================================================
|
||||
#
|
||||
# Pelco-D Control Protocol
|
||||
|
|
|
@ -33,8 +33,6 @@ require ZoneMinder::Control;
|
|||
|
||||
our @ISA = qw(ZoneMinder::Control);
|
||||
|
||||
our $VERSION = $ZoneMinder::Base::VERSION;
|
||||
|
||||
# ==========================================================================
|
||||
#
|
||||
# Pelco-P Control Protocol
|
||||
|
|
|
@ -34,8 +34,6 @@ require ZoneMinder::Control;
|
|||
|
||||
our @ISA = qw(ZoneMinder::Control);
|
||||
|
||||
our $VERSION = $ZoneMinder::Base::VERSION;
|
||||
|
||||
# ==========================================================================
|
||||
#
|
||||
# Airlink SkyIPCam AICN747/AICN747W Control Protocol
|
||||
|
@ -80,7 +78,7 @@ sub open
|
|||
|
||||
use LWP::UserAgent;
|
||||
$self->{ua} = LWP::UserAgent->new;
|
||||
$self->{ua}->agent( "ZoneMinder Control Agent/".ZM_VERSION );
|
||||
$self->{ua}->agent( "ZoneMinder Control Agent/".ZoneMinder::Base::ZM_VERSION );
|
||||
|
||||
$self->{state} = 'open';
|
||||
}
|
||||
|
|
|
@ -33,8 +33,6 @@ require ZoneMinder::Control;
|
|||
|
||||
our @ISA = qw(ZoneMinder::Control);
|
||||
|
||||
our $VERSION = $ZoneMinder::Base::VERSION;
|
||||
|
||||
# ==========================================================================
|
||||
#
|
||||
# Visca Control Protocol
|
||||
|
|
|
@ -33,8 +33,6 @@ require ZoneMinder::Control;
|
|||
|
||||
our @ISA = qw(ZoneMinder::Control);
|
||||
|
||||
our $VERSION = $ZoneMinder::Base::VERSION;
|
||||
|
||||
# ==========================================================================
|
||||
#
|
||||
# mjpgSTreamer Control Protocol
|
||||
|
@ -81,7 +79,7 @@ sub open
|
|||
Debug( "Camera open" );
|
||||
use LWP::UserAgent;
|
||||
$self->{ua} = LWP::UserAgent->new;
|
||||
$self->{ua}->agent( "ZoneMinder Control Agent/".ZM_VERSION );
|
||||
$self->{ua}->agent( "ZoneMinder Control Agent/".ZoneMinder::Base::ZM_VERSION );
|
||||
|
||||
$self->{state} = 'open';
|
||||
}
|
||||
|
|
|
@ -79,15 +79,15 @@ sub zmDbConnect( ;$ )
|
|||
}
|
||||
if ( !defined( $dbh ) )
|
||||
{
|
||||
my ( $host, $port ) = ( ZM_DB_HOST =~ /^([^:]+)(?::(.+))?$/ );
|
||||
my ( $host, $port ) = ( $Config{ZM_DB_HOST} =~ /^([^:]+)(?::(.+))?$/ );
|
||||
|
||||
if ( defined($port) )
|
||||
{
|
||||
$dbh = DBI->connect( "DBI:mysql:database=".ZM_DB_NAME.";host=".$host.";port=".$port, ZM_DB_USER, ZM_DB_PASS );
|
||||
$dbh = DBI->connect( "DBI:mysql:database=".$Config{ZM_DB_NAME}.";host=".$host.";port=".$port, $Config{ZM_DB_USER}, $Config{ZM_DB_PASS} );
|
||||
}
|
||||
else
|
||||
{
|
||||
$dbh = DBI->connect( "DBI:mysql:database=".ZM_DB_NAME.";host=".ZM_DB_HOST, ZM_DB_USER, ZM_DB_PASS );
|
||||
$dbh = DBI->connect( "DBI:mysql:database=".$Config{ZM_DB_NAME}.";host=".$Config{ZM_DB_HOST}, $Config{ZM_DB_USER}, $Config{ZM_DB_PASS} );
|
||||
}
|
||||
$dbh->trace( 0 );
|
||||
}
|
||||
|
|
|
@ -95,7 +95,7 @@ sub getCmdFormat()
|
|||
Debug( "Testing valid shell syntax\n" );
|
||||
|
||||
my ( $name ) = getpwuid( $> );
|
||||
if ( $name eq ZM_WEB_USER )
|
||||
if ( $name eq $Config{ZM_WEB_USER} )
|
||||
{
|
||||
Debug( "Running as '$name', su commands not needed\n" );
|
||||
return( "" );
|
||||
|
@ -103,7 +103,7 @@ sub getCmdFormat()
|
|||
|
||||
my $null_command = "true";
|
||||
|
||||
my $prefix = "sudo -u ".ZM_WEB_USER." ";
|
||||
my $prefix = "sudo -u ".$Config{ZM_WEB_USER}." ";
|
||||
my $suffix = "";
|
||||
my $command = $prefix.$null_command.$suffix;
|
||||
Debug( "Testing \"$command\"\n" );
|
||||
|
@ -120,7 +120,7 @@ sub getCmdFormat()
|
|||
chomp( $output );
|
||||
Debug( "Test failed, '$output'\n" );
|
||||
|
||||
$prefix = "su ".ZM_WEB_USER." --shell=/bin/sh --command='";
|
||||
$prefix = "su ".$Config{ZM_WEB_USER}." --shell=/bin/sh --command='";
|
||||
$suffix = "'";
|
||||
$command = $prefix.$null_command.$suffix;
|
||||
Debug( "Testing \"$command\"\n" );
|
||||
|
@ -136,7 +136,7 @@ sub getCmdFormat()
|
|||
chomp( $output );
|
||||
Debug( "Test failed, '$output'\n" );
|
||||
|
||||
$prefix = "su ".ZM_WEB_USER." -c '";
|
||||
$prefix = "su ".$Config{ZM_WEB_USER}." -c '";
|
||||
$suffix = "'";
|
||||
$command = $prefix.$null_command.$suffix;
|
||||
Debug( "Testing \"$command\"\n" );
|
||||
|
@ -172,7 +172,7 @@ sub runCommand( $ )
|
|||
}
|
||||
|
||||
my $command = shift;
|
||||
$command = ZM_PATH_BIN."/".$command;
|
||||
$command = $Config{ZM_PATH_BIN}."/".$command;
|
||||
if ( $cmdPrefix )
|
||||
{
|
||||
$command = $cmdPrefix.$command.$cmdSuffix;
|
||||
|
@ -201,15 +201,15 @@ sub getEventPath( $ )
|
|||
my $event = shift;
|
||||
|
||||
my $event_path = "";
|
||||
if ( ZM_USE_DEEP_STORAGE )
|
||||
if ( $Config{ZM_USE_DEEP_STORAGE} )
|
||||
{
|
||||
$event_path = ZM_DIR_EVENTS.'/'.$event->{MonitorId}.'/'.strftime( "%y/%m/%d/%H/%M/%S", localtime($event->{Time}) );
|
||||
$event_path = $Config{ZM_DIR_EVENTS}.'/'.$event->{MonitorId}.'/'.strftime( "%y/%m/%d/%H/%M/%S", localtime($event->{Time}) );
|
||||
}
|
||||
else
|
||||
{
|
||||
$event_path = ZM_DIR_EVENTS.'/'.$event->{MonitorId}.'/'.$event->{Id};
|
||||
$event_path = $Config{ZM_DIR_EVENTS}.'/'.$event->{MonitorId}.'/'.$event->{Id};
|
||||
}
|
||||
$event_path = ZM_PATH_WEB.'/'.$event_path if ( index(ZM_DIR_EVENTS,'/') != 0 );
|
||||
$event_path = $Config{ZM_PATH_WEB}.'/'.$event_path if ( index($Config{ZM_DIR_EVENTS},'/') != 0 );
|
||||
return( $event_path );
|
||||
}
|
||||
|
||||
|
@ -219,10 +219,10 @@ sub createEventPath( $ )
|
|||
# WARNING assumes running from events directory
|
||||
#
|
||||
my $event = shift;
|
||||
my $eventRootPath = (ZM_DIR_EVENTS=~m|/|)?ZM_DIR_EVENTS:(ZM_PATH_WEB.'/'.ZM_DIR_EVENTS);
|
||||
my $eventRootPath = ($Config{ZM_DIR_EVENTS}=~m|/|)?$Config{ZM_DIR_EVENTS}:($Config{ZM_PATH_WEB}.'/'.$Config{ZM_DIR_EVENTS});
|
||||
my $eventPath = $eventRootPath.'/'.$event->{MonitorId};
|
||||
|
||||
if ( ZM_USE_DEEP_STORAGE )
|
||||
if ( $Config{ZM_USE_DEEP_STORAGE} )
|
||||
{
|
||||
my @startTime = localtime( $event->{StartTime} );
|
||||
|
||||
|
@ -277,10 +277,10 @@ sub _checkProcessOwner()
|
|||
if ( !defined($_setFileOwner) )
|
||||
{
|
||||
my ( $processOwner ) = getpwuid( $> );
|
||||
if ( $processOwner ne ZM_WEB_USER )
|
||||
if ( $processOwner ne $Config{ZM_WEB_USER} )
|
||||
{
|
||||
# Not running as web user, so should be root in whch case chown the temporary directory
|
||||
( my $ownerName, my $ownerPass, $_ownerUid, $_ownerGid ) = getpwnam( ZM_WEB_USER ) or Fatal( "Can't get user details for web user '".ZM_WEB_USER."': $!" );
|
||||
( my $ownerName, my $ownerPass, $_ownerUid, $_ownerGid ) = getpwnam( $Config{ZM_WEB_USER} ) or Fatal( "Can't get user details for web user '".$Config{ZM_WEB_USER}."': $!" );
|
||||
$_setFileOwner = 1;
|
||||
}
|
||||
else
|
||||
|
@ -297,7 +297,7 @@ sub setFileOwner( $ )
|
|||
|
||||
if ( _checkProcessOwner() )
|
||||
{
|
||||
chown( $_ownerUid, $_ownerGid, $file ) or Fatal( "Can't change ownership of file '$file' to '".ZM_WEB_USER.":".ZM_WEB_GROUP."': $!" );
|
||||
chown( $_ownerUid, $_ownerGid, $file ) or Fatal( "Can't change ownership of file '$file' to '".$Config{ZM_WEB_USER}.":".$Config{ZM_WEB_GROUP}."': $!" );
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -434,12 +434,12 @@ sub createEvent( $;$ )
|
|||
#$frame->{FrameId} = $dbh->{mysql_insertid};
|
||||
if ( $frame->{imagePath} )
|
||||
{
|
||||
$frame->{capturePath} = sprintf( "%s/%0".ZM_EVENT_IMAGE_DIGITS."d-capture.jpg", $eventPath, $frame->{FrameId} );
|
||||
$frame->{capturePath} = sprintf( "%s/%0".$Config{ZM_EVENT_IMAGE_DIGITS}."d-capture.jpg", $eventPath, $frame->{FrameId} );
|
||||
rename( $frame->{imagePath}, $frame->{capturePath} ) or Fatal( "Can't copy ".$frame->{imagePath}." to ".$frame->{capturePath}.": $!" );
|
||||
setFileOwner( $frame->{capturePath} );
|
||||
if ( 0 && ZM_CREATE_ANALYSIS_IMAGES )
|
||||
if ( 0 && $Config{ZM_CREATE_ANALYSIS_IMAGES} )
|
||||
{
|
||||
$frame->{analysePath} = sprintf( "%s/%0".ZM_EVENT_IMAGE_DIGITS."d-analyse.jpg", $eventPath, $frame->{FrameId} );
|
||||
$frame->{analysePath} = sprintf( "%s/%0".$Config{ZM_EVENT_IMAGE_DIGITS}."d-analyse.jpg", $eventPath, $frame->{FrameId} );
|
||||
link( $frame->{capturePath}, $frame->{analysePath} ) or Fatal( "Can't link ".$frame->{capturePath}." to ".$frame->{analysePath}.": $!" );
|
||||
setFileOwner( $frame->{analysePath} );
|
||||
}
|
||||
|
@ -497,7 +497,7 @@ sub deleteEventFiles( $;$ )
|
|||
my $monitor_id = shift;
|
||||
$monitor_id = '*' if ( !defined($monitor_id) );
|
||||
|
||||
if ( ZM_USE_DEEP_STORAGE )
|
||||
if ( $Config{ZM_USE_DEEP_STORAGE} )
|
||||
{
|
||||
my $link_path = $monitor_id."/*/*/*/.".$event_id;
|
||||
#Debug( "LP1:$link_path" );
|
||||
|
|
|
@ -150,7 +150,7 @@ sub new
|
|||
$this->{hasTerm} = -t STDERR;
|
||||
|
||||
( $this->{fileName} = $0 ) =~ s|^.*/||;
|
||||
$this->{logPath} = ZM_PATH_LOGS;
|
||||
$this->{logPath} = $Config{ZM_PATH_LOGS};
|
||||
$this->{logFile} = $this->{logPath}."/".$this->{id}.".log";
|
||||
|
||||
$this->{trace} = 0;
|
||||
|
@ -163,7 +163,7 @@ sub BEGIN
|
|||
{
|
||||
# Fake the config variables that are used in case they are not defined yet
|
||||
# Only really necessary to support upgrade from previous version
|
||||
if ( !eval('defined(ZM_LOG_DEBUG)') )
|
||||
if ( !eval('defined($Config{ZM_LOG_DEBUG})') )
|
||||
{
|
||||
no strict 'subs';
|
||||
no strict 'refs';
|
||||
|
@ -221,7 +221,7 @@ sub initialise( @ )
|
|||
}
|
||||
else
|
||||
{
|
||||
$tempDatabaseLevel = ZM_LOG_LEVEL_DATABASE;
|
||||
$tempDatabaseLevel = $Config{ZM_LOG_LEVEL_DATABASE};
|
||||
}
|
||||
if ( defined($options{fileLevel}) )
|
||||
{
|
||||
|
@ -229,7 +229,7 @@ sub initialise( @ )
|
|||
}
|
||||
else
|
||||
{
|
||||
$tempFileLevel = ZM_LOG_LEVEL_FILE;
|
||||
$tempFileLevel = $Config{ZM_LOG_LEVEL_FILE};
|
||||
}
|
||||
if ( defined($options{syslogLevel}) )
|
||||
{
|
||||
|
@ -237,7 +237,7 @@ sub initialise( @ )
|
|||
}
|
||||
else
|
||||
{
|
||||
$tempSyslogLevel = ZM_LOG_LEVEL_SYSLOG;
|
||||
$tempSyslogLevel = $Config{ZM_LOG_LEVEL_SYSLOG};
|
||||
}
|
||||
|
||||
if ( defined($ENV{'LOG_PRINT'}) )
|
||||
|
@ -253,18 +253,18 @@ sub initialise( @ )
|
|||
$tempFileLevel = $level if ( defined($level = $this->getTargettedEnv('LOG_LEVEL_FILE')) );
|
||||
$tempSyslogLevel = $level if ( defined($level = $this->getTargettedEnv('LOG_LEVEL_SYSLOG')) );
|
||||
|
||||
if ( ZM_LOG_DEBUG )
|
||||
if ( $Config{ZM_LOG_DEBUG} )
|
||||
{
|
||||
foreach my $target ( split( /\|/, ZM_LOG_DEBUG_TARGET ) )
|
||||
foreach my $target ( split( /\|/, $Config{ZM_LOG_DEBUG_TARGET} ) )
|
||||
{
|
||||
if ( $target eq $this->{id} || $target eq "_".$this->{id} || $target eq $this->{idRoot} || $target eq "_".$this->{idRoot} || $target eq "" )
|
||||
{
|
||||
if ( ZM_LOG_DEBUG_LEVEL > NOLOG )
|
||||
if ( $Config{ZM_LOG_DEBUG_LEVEL} > NOLOG )
|
||||
{
|
||||
$tempLevel = $this->limit( ZM_LOG_DEBUG_LEVEL );
|
||||
if ( ZM_LOG_DEBUG_FILE ne "" )
|
||||
$tempLevel = $this->limit( $Config{ZM_LOG_DEBUG_LEVEL} );
|
||||
if ( $Config{ZM_LOG_DEBUG_FILE} ne "" )
|
||||
{
|
||||
$tempLogFile = ZM_LOG_DEBUG_FILE;
|
||||
$tempLogFile = $Config{ZM_LOG_DEBUG_FILE};
|
||||
$tempFileLevel = $tempLevel;
|
||||
}
|
||||
}
|
||||
|
@ -447,20 +447,20 @@ sub databaseLevel( ;$ )
|
|||
{
|
||||
if ( !$this->{dbh} )
|
||||
{
|
||||
my ( $host, $port ) = ( ZM_DB_HOST =~ /^([^:]+)(?::(.+))?$/ );
|
||||
my ( $host, $port ) = ( $Config{ZM_DB_HOST} =~ /^([^:]+)(?::(.+))?$/ );
|
||||
|
||||
if ( defined($port) )
|
||||
{
|
||||
$this->{dbh} = DBI->connect( "DBI:mysql:database=".ZM_DB_NAME.";host=".$host.";port=".$port, ZM_DB_USER, ZM_DB_PASS );
|
||||
$this->{dbh} = DBI->connect( "DBI:mysql:database=".$Config{ZM_DB_NAME}.";host=".$host.";port=".$port, $Config{ZM_DB_USER}, $Config{ZM_DB_PASS} );
|
||||
}
|
||||
else
|
||||
{
|
||||
$this->{dbh} = DBI->connect( "DBI:mysql:database=".ZM_DB_NAME.";host=".ZM_DB_HOST, ZM_DB_USER, ZM_DB_PASS );
|
||||
$this->{dbh} = DBI->connect( "DBI:mysql:database=".$Config{ZM_DB_NAME}.";host=".$Config{ZM_DB_HOST}, $Config{ZM_DB_USER}, $Config{ZM_DB_PASS} );
|
||||
}
|
||||
if ( !$this->{dbh} )
|
||||
{
|
||||
$databaseLevel = NOLOG;
|
||||
Error( "Unable to write log entries to DB, can't connect to database '".ZM_DB_NAME."' on host '".ZM_DB_HOST."'" );
|
||||
Error( "Unable to write log entries to DB, can't connect to database '".$Config{ZM_DB_NAME}."' on host '".$Config{ZM_DB_HOST}."'" );
|
||||
}
|
||||
else
|
||||
{
|
||||
|
@ -553,8 +553,8 @@ sub openFile()
|
|||
{
|
||||
LOGFILE->autoflush() if ( $this->{autoFlush} );
|
||||
|
||||
my $webUid = (getpwnam( ZM_WEB_USER ))[2];
|
||||
my $webGid = (getgrnam( ZM_WEB_GROUP ))[2];
|
||||
my $webUid = (getpwnam( $Config{ZM_WEB_USER} ))[2];
|
||||
my $webGid = (getgrnam( $Config{ZM_WEB_GROUP} ))[2];
|
||||
if ( $> == 0 )
|
||||
{
|
||||
chown( $webUid, $webGid, $this->{logFile} ) or Fatal( "Can't change permissions on log file '".$this->{logFile}."': $!" )
|
||||
|
|
|
@ -76,11 +76,18 @@ sub zmMemKey( $ )
|
|||
|
||||
sub zmMemAttach( $$ )
|
||||
{
|
||||
my $monitor = shift;
|
||||
my $size = shift;
|
||||
my ( $monitor, $size ) = @_;
|
||||
if ( ! $size ) {
|
||||
Error( "No size passed to zmMemAttach for monitor $$monitor{Id}\n" );
|
||||
return( undef );
|
||||
}
|
||||
if ( !defined($monitor->{MMapAddr}) )
|
||||
{
|
||||
my $mmap_file = ZM_PATH_MAP."/zm.mmap.".$monitor->{Id};
|
||||
my $mmap_file = $Config{ZM_PATH_MAP}."/zm.mmap.".$monitor->{Id};
|
||||
if ( -s $mmap_file < $size ) {
|
||||
Error( sprintf( "Memory map file '%s' should have been %d but was instead %d", $mmap_file, $size, -s $mmap_file ) );
|
||||
return ( undef );
|
||||
}
|
||||
if ( !open( MMAP, "+<".$mmap_file ) )
|
||||
{
|
||||
Error( sprintf( "Can't open memory map file '%s': $!\n", $mmap_file ) );
|
||||
|
@ -91,6 +98,7 @@ sub zmMemAttach( $$ )
|
|||
if ( !$mmap_addr || !$mmap )
|
||||
{
|
||||
Error( sprintf( "Can't mmap to file '%s': $!\n", $mmap_file ) );
|
||||
close( MMAP );
|
||||
return( undef );
|
||||
}
|
||||
$monitor->{MMapHandle} = \*MMAP;
|
||||
|
@ -106,7 +114,9 @@ sub zmMemDetach( $ )
|
|||
|
||||
if ( $monitor->{MMap} )
|
||||
{
|
||||
munmap( ${$monitor->{MMap}} );
|
||||
if ( ! munmap( ${$monitor->{MMap}} ) ) {
|
||||
Warn( "Unable to munmap for monitor $$monitor{Id}\n");
|
||||
}
|
||||
delete $monitor->{MMap};
|
||||
}
|
||||
if ( $monitor->{MMapAddr} )
|
||||
|
@ -156,7 +166,7 @@ sub zmMemPut( $$$$ )
|
|||
sub zmMemClean
|
||||
{
|
||||
Debug( "Removing memory map files\n" );
|
||||
my $mapPath = ZM_PATH_MAP."/zm.mmap.*";
|
||||
my $mapPath = $Config{ZM_PATH_MAP}."/zm.mmap.*";
|
||||
foreach my $mapFile( glob( $mapPath ) )
|
||||
{
|
||||
( $mapFile ) = $mapFile =~ /^(.+)$/;
|
||||
|
|
|
@ -33,6 +33,8 @@ require ZoneMinder::Base;
|
|||
|
||||
our @ISA = qw(Exporter ZoneMinder::Base);
|
||||
|
||||
eval 'sub IPC_CREAT {0001000}' unless defined &IPC_CREAT;
|
||||
|
||||
# Items to export into callers namespace by default. Note: do not export
|
||||
# names by default without a very good reason. Use EXPORT_OK instead.
|
||||
# Do not simply export all your public functions/methods/constants.
|
||||
|
@ -79,8 +81,8 @@ sub zmMemAttach( $$ )
|
|||
my $size = shift;
|
||||
if ( !defined($monitor->{ShmId}) )
|
||||
{
|
||||
my $shm_key = (hex(ZM_SHM_KEY)&0xffff0000)|$monitor->{Id};
|
||||
my $shm_id = shmget( $shm_key, $size, 0 );
|
||||
my $shm_key = (hex($Config{ZM_SHM_KEY})&0xffff0000)|$monitor->{Id};
|
||||
my $shm_id = shmget( $shm_key, $size, &IPC_CREAT | 0777 );
|
||||
if ( !defined($shm_id) )
|
||||
{
|
||||
Error( sprintf( "Can't get shared memory id '%x', %d: $!\n", $shm_key, $monitor->{Id} ) );
|
||||
|
@ -139,7 +141,7 @@ sub zmMemClean
|
|||
{
|
||||
Debug( "Removing shared memory\n" );
|
||||
# Find ZoneMinder shared memory
|
||||
my $command = "ipcs -m | grep '^".substr( sprintf( "0x%x", hex(ZM_SHM_KEY) ), 0, -2 )."'";
|
||||
my $command = "ipcs -m | grep '^".substr( sprintf( "0x%x", hex($Config{ZM_SHM_KEY}) ), 0, -2 )."'";
|
||||
Debug( "Checking for shared memory with '$command'\n" );
|
||||
open( CMD, "$command |" ) or Fatal( "Can't execute '$command': $!" );
|
||||
while( <CMD> )
|
||||
|
|
|
@ -26,7 +26,8 @@ command="$ZM_PATH_BIN/zmpkg.pl"
|
|||
|
||||
start()
|
||||
{
|
||||
zmupdate || return $?
|
||||
# Commenting out as it is not needed. Leaving as a placeholder for future use.
|
||||
# zmupdate || return $?
|
||||
loadconf || return $?
|
||||
#Make sure the directory for our PID folder exists or create one.
|
||||
[ ! -d $pidfile ] \
|
||||
|
|
|
@ -57,8 +57,8 @@ use File::Find;
|
|||
use Time::HiRes qw/gettimeofday/;
|
||||
use Getopt::Long;
|
||||
|
||||
use constant IMAGE_PATH => ZM_PATH_WEB.'/'.ZM_DIR_IMAGES;
|
||||
use constant EVENT_PATH => (ZM_DIR_EVENTS=~m|/|)?ZM_DIR_EVENTS:(ZM_PATH_WEB.'/'.ZM_DIR_EVENTS);
|
||||
use constant IMAGE_PATH => $Config{ZM_PATH_WEB}.'/'.$Config{ZM_DIR_IMAGES};
|
||||
use constant EVENT_PATH => ($Config{ZM_DIR_EVENTS}=~m|/|)?$Config{ZM_DIR_EVENTS}:($Config{ZM_PATH_WEB}.'/'.$Config{ZM_DIR_EVENTS});
|
||||
|
||||
$| = 1;
|
||||
|
||||
|
@ -107,7 +107,7 @@ chdir( EVENT_PATH );
|
|||
my $max_image_age = 6/24; # 6 hours
|
||||
my $max_swap_age = 24/24; # 24 hours
|
||||
my $image_path = IMAGE_PATH;
|
||||
my $swap_image_path = ZM_PATH_SWAP;
|
||||
my $swap_image_path = $Config{ZM_PATH_SWAP};
|
||||
|
||||
my $loop = 1;
|
||||
my $cleaned = 0;
|
||||
|
@ -142,7 +142,7 @@ MAIN: while( $loop )
|
|||
my $fs_events = $fs_monitors->{$monitor} = {};
|
||||
( my $monitor_dir ) = ( $monitor =~ /^(.*)$/ ); # De-taint
|
||||
|
||||
if ( ZM_USE_DEEP_STORAGE )
|
||||
if ( $Config{ZM_USE_DEEP_STORAGE} )
|
||||
{
|
||||
foreach my $day_dir ( <$monitor_dir/*/*/*> )
|
||||
{
|
||||
|
@ -399,9 +399,9 @@ MAIN: while( $loop )
|
|||
File::Find::find( { wanted=>\&deleteSwapImage, untaint=>1 }, $swap_image_root );
|
||||
|
||||
# Prune the Logs table if required
|
||||
if ( ZM_LOG_DATABASE_LIMIT )
|
||||
if ( $Config{ZM_LOG_DATABASE_LIMIT} )
|
||||
{
|
||||
if ( ZM_LOG_DATABASE_LIMIT =~ /^\d+$/ )
|
||||
if ( $Config{ZM_LOG_DATABASE_LIMIT} =~ /^\d+$/ )
|
||||
{
|
||||
# Number of rows
|
||||
my $selectLogRowCountSql = "select count(*) as Rows from Logs";
|
||||
|
@ -410,18 +410,18 @@ MAIN: while( $loop )
|
|||
my $row = $selectLogRowCountSth->fetchrow_hashref();
|
||||
my $logRows = $row->{Rows};
|
||||
$selectLogRowCountSth->finish();
|
||||
if ( $logRows > ZM_LOG_DATABASE_LIMIT )
|
||||
if ( $logRows > $Config{ZM_LOG_DATABASE_LIMIT} )
|
||||
{
|
||||
my $deleteLogByRowsSql = "delete low_priority from Logs order by TimeKey asc limit ?";
|
||||
my $deleteLogByRowsSth = $dbh->prepare_cached( $deleteLogByRowsSql ) or Fatal( "Can't prepare '$deleteLogByRowsSql': ".$dbh->errstr() );
|
||||
$res = $deleteLogByRowsSth->execute( $logRows - ZM_LOG_DATABASE_LIMIT ) or Fatal( "Can't execute: ".$deleteLogByRowsSth->errstr() );
|
||||
$res = $deleteLogByRowsSth->execute( $logRows - $Config{ZM_LOG_DATABASE_LIMIT} ) or Fatal( "Can't execute: ".$deleteLogByRowsSth->errstr() );
|
||||
aud_print( "Deleted ".$deleteLogByRowsSth->rows()." log table entries by count\n" ) if ( $deleteLogByRowsSth->rows() );
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
# Time of record
|
||||
my $deleteLogByTimeSql = "delete low_priority from Logs where TimeKey < unix_timestamp(now() - interval ".ZM_LOG_DATABASE_LIMIT.")";
|
||||
my $deleteLogByTimeSql = "delete low_priority from Logs where TimeKey < unix_timestamp(now() - interval ".$Config{ZM_LOG_DATABASE_LIMIT}.")";
|
||||
my $deleteLogByTimeSth = $dbh->prepare_cached( $deleteLogByTimeSql ) or Fatal( "Can't prepare '$deleteLogByTimeSql': ".$dbh->errstr() );
|
||||
$res = $deleteLogByTimeSth->execute() or Fatal( "Can't execute: ".$deleteLogByTimeSth->errstr() );
|
||||
aud_print( "Deleted ".$deleteLogByTimeSth->rows()." log table entries by time\n" ) if ( $deleteLogByTimeSth->rows() );
|
||||
|
@ -429,7 +429,7 @@ MAIN: while( $loop )
|
|||
}
|
||||
$loop = $continuous;
|
||||
|
||||
sleep( ZM_AUDIT_CHECK_INTERVAL ) if ( $continuous );
|
||||
sleep( $Config{ZM_AUDIT_CHECK_INTERVAL} ) if $continuous;
|
||||
};
|
||||
|
||||
exit( 0 );
|
||||
|
|
|
@ -49,7 +49,7 @@ sub Usage
|
|||
print( "
|
||||
Usage: zmcontrol.pl --id <monitor_id> --command=<command> <various options>
|
||||
");
|
||||
exit( -1 );
|
||||
exit();
|
||||
}
|
||||
|
||||
logInit();
|
||||
|
@ -88,7 +88,7 @@ if ( !$id || !$options{command} )
|
|||
|
||||
Debug( $arg_string );
|
||||
|
||||
my $sock_file = ZM_PATH_SOCKS.'/zmcontrol-'.$id.'.sock';
|
||||
my $sock_file = $Config{ZM_PATH_SOCKS}.'/zmcontrol-'.$id.'.sock';
|
||||
|
||||
socket( CLIENT, PF_UNIX, SOCK_STREAM, 0 ) or Fatal( "Can't open socket: $!" );
|
||||
|
||||
|
|
|
@ -20,6 +20,8 @@
|
|||
# Edit these to suit your configuration
|
||||
ZM_CONFIG=@ZM_CONFIG@
|
||||
source $ZM_CONFIG
|
||||
# ZM_VERSION in the config is now deprecated but will likely still exist in people's config files. This will override it.
|
||||
ZM_VERSION=@VERSION@
|
||||
|
||||
MYSQLDUMP=/usr/bin/mysqldump
|
||||
BACKUP_PATH=/var/lib/zm
|
||||
|
|
|
@ -51,7 +51,7 @@ use Socket;
|
|||
use IO::Handle;
|
||||
use Data::Dumper;
|
||||
|
||||
use constant SOCK_FILE => ZM_PATH_SOCKS.'/zmdc.sock';
|
||||
use constant SOCK_FILE => $Config{ZM_PATH_SOCKS}.'/zmdc.sock';
|
||||
|
||||
$| = 1;
|
||||
|
||||
|
@ -437,7 +437,7 @@ sub start
|
|||
|
||||
if ( $daemon =~ /^${daemon_patt}$/ )
|
||||
{
|
||||
$daemon = ZM_PATH_BIN.'/'.$1;
|
||||
$daemon = $Config{ZM_PATH_BIN}.'/'.$1;
|
||||
}
|
||||
else
|
||||
{
|
||||
|
@ -645,7 +645,7 @@ sub reaper
|
|||
|
||||
if ( $process->{keepalive} )
|
||||
{
|
||||
if ( !$process->{delay} || ($process->{runtime} > ZM_MAX_RESTART_DELAY) )
|
||||
if ( !$process->{delay} || ($process->{runtime} > $Config{ZM_MAX_RESTART_DELAY} ) )
|
||||
{
|
||||
#start( $process->{daemon}, @{$process->{args}} );
|
||||
# Schedule for immediate restart
|
||||
|
@ -659,9 +659,9 @@ sub reaper
|
|||
$process->{pending} = $process->{stopped}+$process->{delay};
|
||||
$process->{delay} *= 2;
|
||||
# Limit the start delay to 15 minutes max
|
||||
if ( $process->{delay} > ZM_MAX_RESTART_DELAY )
|
||||
if ( $process->{delay} > $Config{ZM_MAX_RESTART_DELAY} )
|
||||
{
|
||||
$process->{delay} = ZM_MAX_RESTART_DELAY;
|
||||
$process->{delay} = $Config{ZM_MAX_RESTART_DELAY};
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -23,6 +23,8 @@
|
|||
|
||||
# Edit these to suit your configuration
|
||||
ZM_CONFIG=@ZM_CONFIG@
|
||||
# ZM_VERSION in the config is now deprecated but will likely still exist in people's config files. This will override it.
|
||||
ZM_VERSION=@VERSION@
|
||||
MYSQLDUMP=/usr/bin/mysqldump
|
||||
|
||||
# The rest should not need editing
|
||||
|
|
|
@ -51,16 +51,16 @@ use Date::Manip;
|
|||
use Getopt::Long;
|
||||
use Data::Dumper;
|
||||
|
||||
use constant EVENT_PATH => (ZM_DIR_EVENTS=~m|/|)?ZM_DIR_EVENTS:(ZM_PATH_WEB.'/'.ZM_DIR_EVENTS);
|
||||
use constant EVENT_PATH => ($Config{ZM_DIR_EVENTS}=~m|/|)?$Config{ZM_DIR_EVENTS}:($Config{ZM_PATH_WEB}.'/'.$Config{ZM_DIR_EVENTS});
|
||||
|
||||
logInit();
|
||||
logSetSignal();
|
||||
|
||||
if ( ZM_OPT_UPLOAD )
|
||||
if ( $Config{ZM_OPT_UPLOAD} )
|
||||
{
|
||||
# Comment these out if you don't have them and don't want to upload
|
||||
# or don't want to use that format
|
||||
if ( ZM_UPLOAD_ARCH_FORMAT eq "zip" )
|
||||
if ( $Config{ZM_UPLOAD_ARCH_FORMAT} eq "zip" )
|
||||
{
|
||||
require Archive::Zip;
|
||||
import Archive::Zip qw( :ERROR_CODES :CONSTANTS );
|
||||
|
@ -69,7 +69,7 @@ if ( ZM_OPT_UPLOAD )
|
|||
{
|
||||
require Archive::Tar;
|
||||
}
|
||||
if ( ZM_UPLOAD_PROTOCOL eq "ftp" )
|
||||
if ( $Config{ZM_UPLOAD_PROTOCOL} eq "ftp" )
|
||||
{
|
||||
require Net::FTP;
|
||||
}
|
||||
|
@ -79,9 +79,9 @@ if ( ZM_OPT_UPLOAD )
|
|||
}
|
||||
}
|
||||
|
||||
if ( ZM_OPT_EMAIL )
|
||||
if ( $Config{ZM_OPT_EMAIL} )
|
||||
{
|
||||
if ( ZM_NEW_MAIL_MODULES )
|
||||
if ( $Config{ZM_NEW_MAIL_MODULES} )
|
||||
{
|
||||
require MIME::Lite;
|
||||
require Net::SMTP;
|
||||
|
@ -92,9 +92,9 @@ if ( ZM_OPT_EMAIL )
|
|||
}
|
||||
}
|
||||
|
||||
if ( ZM_OPT_MESSAGE )
|
||||
if ( $Config{ZM_OPT_MESSAGE} )
|
||||
{
|
||||
if ( ZM_NEW_MAIL_MODULES )
|
||||
if ( $Config{ZM_NEW_MAIL_MODULES} )
|
||||
{
|
||||
require MIME::Lite;
|
||||
require Net::SMTP;
|
||||
|
@ -112,7 +112,7 @@ $ENV{PATH} = '/bin:/usr/bin';
|
|||
$ENV{SHELL} = '/bin/sh' if exists $ENV{SHELL};
|
||||
delete @ENV{qw(IFS CDPATH ENV BASH_ENV)};
|
||||
|
||||
my $delay = ZM_FILTER_EXECUTE_INTERVAL;
|
||||
my $delay = $Config{ZM_FILTER_EXECUTE_INTERVAL};
|
||||
my $event_id = 0;
|
||||
my $filter_parm = "";
|
||||
|
||||
|
@ -163,6 +163,11 @@ if ( !GetOptions( 'filter=s'=>\$filter_parm ) )
|
|||
Usage();
|
||||
}
|
||||
|
||||
if ( ! EVENT_PATH ) {
|
||||
Error( "No event path defined. Config was $Config{ZM_DIR_EVENTS}\n" );
|
||||
die;
|
||||
}
|
||||
|
||||
chdir( EVENT_PATH );
|
||||
|
||||
my $dbh = zmDbConnect();
|
||||
|
@ -186,7 +191,7 @@ my $last_action = 0;
|
|||
|
||||
while( 1 )
|
||||
{
|
||||
if ( (time() - $last_action) > ZM_FILTER_RELOAD_DELAY )
|
||||
if ( (time() - $last_action) > $Config{ZM_FILTER_RELOAD_DELAY} )
|
||||
{
|
||||
Debug( "Reloading filters\n" );
|
||||
$last_action = time();
|
||||
|
@ -573,28 +578,28 @@ sub checkFilter
|
|||
my $sth = $dbh->prepare_cached( $sql ) or Fatal( "Can't prepare '$sql': ".$dbh->errstr() );
|
||||
my $res = $sth->execute( $event->{Id} ) or Fatal( "Can't execute '$sql': ".$sth->errstr() );
|
||||
}
|
||||
if ( ZM_OPT_FFMPEG && $filter->{AutoVideo} )
|
||||
if ( $Config{ZM_OPT_FFMPEG} && $filter->{AutoVideo} )
|
||||
{
|
||||
if ( !$event->{Videoed} )
|
||||
{
|
||||
$delete_ok = undef if ( !generateVideo( $filter, $event ) );
|
||||
}
|
||||
}
|
||||
if ( ZM_OPT_EMAIL && $filter->{AutoEmail} )
|
||||
if ( $Config{ZM_OPT_EMAIL} && $filter->{AutoEmail} )
|
||||
{
|
||||
if ( !$event->{Emailed} )
|
||||
{
|
||||
$delete_ok = undef if ( !sendEmail( $filter, $event ) );
|
||||
}
|
||||
}
|
||||
if ( ZM_OPT_MESSAGE && $filter->{AutoMessage} )
|
||||
if ( $Config{ZM_OPT_MESSAGE} && $filter->{AutoMessage} )
|
||||
{
|
||||
if ( !$event->{Messaged} )
|
||||
{
|
||||
$delete_ok = undef if ( !sendMessage( $filter, $event ) );
|
||||
}
|
||||
}
|
||||
if ( ZM_OPT_UPLOAD && $filter->{AutoUpload} )
|
||||
if ( $Config{ZM_OPT_UPLOAD} && $filter->{AutoUpload} )
|
||||
{
|
||||
if ( !$event->{Uploaded} )
|
||||
{
|
||||
|
@ -618,7 +623,7 @@ sub checkFilter
|
|||
my $sth = $dbh->prepare_cached( $sql ) or Fatal( "Can't prepare '$sql': ".$dbh->errstr() );
|
||||
my $res = $sth->execute( $event->{Id} ) or Fatal( "Can't execute '$sql': ".$sth->errstr() );
|
||||
|
||||
if ( !ZM_OPT_FAST_DELETE )
|
||||
if ( ! $Config{ZM_OPT_FAST_DELETE} )
|
||||
{
|
||||
my $sql = "delete from Frames where EventId = ?";
|
||||
my $sth = $dbh->prepare_cached( $sql ) or Fatal( "Can't prepare '$sql': ".$dbh->errstr() );
|
||||
|
@ -650,7 +655,7 @@ sub generateVideo
|
|||
my $scale = $event->{DefaultScale}/100;
|
||||
my $format;
|
||||
|
||||
my @ffmpeg_formats = split( /\s+/, ZM_FFMPEG_FORMATS );
|
||||
my @ffmpeg_formats = split( /\s+/, $Config{ZM_FFMPEG_FORMATS} );
|
||||
my $default_video_format;
|
||||
my $default_phone_format;
|
||||
foreach my $ffmpeg_format( @ffmpeg_formats )
|
||||
|
@ -678,7 +683,7 @@ sub generateVideo
|
|||
$format = $ffmpeg_formats[0];
|
||||
}
|
||||
|
||||
my $command = ZM_PATH_BIN."/zmvideo.pl -e ".$event->{Id}." -r ".$rate." -s ".$scale." -f ".$format;
|
||||
my $command = $Config{ZM_PATH_BIN}."/zmvideo.pl -e ".$event->{Id}." -r ".$rate." -s ".$scale." -f ".$format;
|
||||
my $output = qx($command);
|
||||
chomp( $output );
|
||||
my $status = $? >> 8;
|
||||
|
@ -713,22 +718,22 @@ sub uploadArchFile
|
|||
my $filter = shift;
|
||||
my $event = shift;
|
||||
|
||||
if ( !ZM_UPLOAD_HOST )
|
||||
if ( ! $Config{ZM_UPLOAD_HOST} )
|
||||
{
|
||||
Error( "Cannot upload archive as no upload host defined" );
|
||||
return( 0 );
|
||||
}
|
||||
|
||||
my $archFile = $event->{MonitorName}.'-'.$event->{Id};
|
||||
my $archImagePath = getEventPath( $event )."/".((ZM_UPLOAD_ARCH_ANALYSE)?'{*analyse,*capture}':'*capture').".jpg";
|
||||
my $archImagePath = getEventPath( $event )."/".(( $Config{ZM_UPLOAD_ARCH_ANALYSE} )?'{*analyse,*capture}':'*capture').".jpg";
|
||||
my @archImageFiles = glob($archImagePath);
|
||||
my $archLocPath;
|
||||
|
||||
my $archError = 0;
|
||||
if ( ZM_UPLOAD_ARCH_FORMAT eq "zip" )
|
||||
if ( $Config{ZM_UPLOAD_ARCH_FORMAT} eq "zip" )
|
||||
{
|
||||
$archFile .= '.zip';
|
||||
$archLocPath = ZM_UPLOAD_LOC_DIR.'/'.$archFile;
|
||||
$archLocPath = $Config{ZM_UPLOAD_LOC_DIR}.'/'.$archFile;
|
||||
my $zip = Archive::Zip->new();
|
||||
Info( "Creating upload file '$archLocPath', ".int(@archImageFiles)." files\n" );
|
||||
|
||||
|
@ -743,7 +748,7 @@ sub uploadArchFile
|
|||
$archError = 1;
|
||||
last;
|
||||
}
|
||||
$member->desiredCompressionMethod( (ZM_UPLOAD_ARCH_COMPRESS)?&COMPRESSION_DEFLATED:&COMPRESSION_STORED );
|
||||
$member->desiredCompressionMethod( $Config{ZM_UPLOAD_ARCH_COMPRESS} ? &COMPRESSION_DEFLATED : &COMPRESSION_STORED );
|
||||
}
|
||||
if ( !$archError )
|
||||
{
|
||||
|
@ -759,9 +764,9 @@ sub uploadArchFile
|
|||
Error( "Error adding images to zip archive $archLocPath, not writing" );
|
||||
}
|
||||
}
|
||||
elsif ( ZM_UPLOAD_ARCH_FORMAT eq "tar" )
|
||||
elsif ( $Config{ZM_UPLOAD_ARCH_FORMAT} eq "tar" )
|
||||
{
|
||||
if ( ZM_UPLOAD_ARCH_COMPRESS )
|
||||
if ( $Config{ZM_UPLOAD_ARCH_COMPRESS} )
|
||||
{
|
||||
$archFile .= '.tar.gz';
|
||||
}
|
||||
|
@ -769,10 +774,10 @@ sub uploadArchFile
|
|||
{
|
||||
$archFile .= '.tar';
|
||||
}
|
||||
$archLocPath = ZM_UPLOAD_LOC_DIR.'/'.$archFile;
|
||||
$archLocPath = $Config{ZM_UPLOAD_LOC_DIR}.'/'.$archFile;
|
||||
Info( "Creating upload file '$archLocPath', ".int(@archImageFiles)." files\n" );
|
||||
|
||||
if ( $archError = !Archive::Tar->create_archive( $archLocPath, ZM_UPLOAD_ARCH_COMPRESS, @archImageFiles ) )
|
||||
if ( $archError = !Archive::Tar->create_archive( $archLocPath, $Config{ZM_UPLOAD_ARCH_COMPRESS}, @archImageFiles ) )
|
||||
{
|
||||
Error( "Tar error: ".Archive::Tar->error()."\n " );
|
||||
}
|
||||
|
@ -784,39 +789,39 @@ sub uploadArchFile
|
|||
}
|
||||
else
|
||||
{
|
||||
if ( ZM_UPLOAD_PROTOCOL eq "ftp" )
|
||||
if ( $Config{ZM_UPLOAD_PROTOCOL} eq "ftp" )
|
||||
{
|
||||
Info( "Uploading to ".ZM_UPLOAD_HOST." using FTP\n" );
|
||||
my $ftp = Net::FTP->new( ZM_UPLOAD_HOST, Timeout=>ZM_UPLOAD_TIMEOUT, Passive=>ZM_UPLOAD_FTP_PASSIVE, Debug=>ZM_UPLOAD_DEBUG );
|
||||
Info( "Uploading to ".$Config{ZM_UPLOAD_HOST}." using FTP\n" );
|
||||
my $ftp = Net::FTP->new( $Config{ZM_UPLOAD_HOST}, Timeout=>$Config{ZM_UPLOAD_TIMEOUT}, Passive=>$Config{ZM_UPLOAD_FTP_PASSIVE}, Debug=>$Config{ZM_UPLOAD_DEBUG} );
|
||||
if ( !$ftp )
|
||||
{
|
||||
Error( "Can't create FTP connection: $@" );
|
||||
return( 0 );
|
||||
}
|
||||
$ftp->login( ZM_UPLOAD_USER, ZM_UPLOAD_PASS ) or Error( "FTP - Can't login" );
|
||||
$ftp->login( $Config{ZM_UPLOAD_USER}, $Config{ZM_UPLOAD_PASS} ) or Error( "FTP - Can't login" );
|
||||
$ftp->binary() or Error( "FTP - Can't go binary" );
|
||||
$ftp->cwd( ZM_UPLOAD_REM_DIR ) or Error( "FTP - Can't cwd" ) if ( ZM_UPLOAD_REM_DIR );
|
||||
$ftp->cwd( $Config{ZM_UPLOAD_REM_DIR} ) or Error( "FTP - Can't cwd" ) if ( $Config{ZM_UPLOAD_REM_DIR} );
|
||||
$ftp->put( $archLocPath ) or Error( "FTP - Can't upload '$archLocPath'" );
|
||||
$ftp->quit() or Error( "FTP - Can't quit" );
|
||||
}
|
||||
else
|
||||
{
|
||||
my $host = ZM_UPLOAD_HOST;
|
||||
$host .= ":".ZM_UPLOAD_PORT if ( ZM_UPLOAD_PORT );
|
||||
my $host = $Config{ZM_UPLOAD_HOST};
|
||||
$host .= ":".$Config{ZM_UPLOAD_PORT} if $Config{ZM_UPLOAD_PORT};
|
||||
Info( "Uploading to ".$host." using SFTP\n" );
|
||||
my %sftpOptions = ( host=>ZM_UPLOAD_HOST, user=>ZM_UPLOAD_USER );
|
||||
$sftpOptions{password} = ZM_UPLOAD_PASS if ( ZM_UPLOAD_PASS );
|
||||
$sftpOptions{port} = ZM_UPLOAD_PORT if ( ZM_UPLOAD_PORT );
|
||||
$sftpOptions{timeout} = ZM_UPLOAD_TIMEOUT if ( ZM_UPLOAD_TIMEOUT );
|
||||
my %sftpOptions = ( host=>$Config{ZM_UPLOAD_HOST}, user=>$Config{ZM_UPLOAD_USER} );
|
||||
$sftpOptions{password} = $Config{ZM_UPLOAD_PASS} if $Config{ZM_UPLOAD_PASS};
|
||||
$sftpOptions{port} = $Config{ZM_UPLOAD_PORT} if $Config{ZM_UPLOAD_PORT};
|
||||
$sftpOptions{timeout} = $Config{ZM_UPLOAD_TIMEOUT} if $Config{ZM_UPLOAD_TIMEOUT};
|
||||
$sftpOptions{more} = [ '-o'=>'StrictHostKeyChecking=no' ];
|
||||
$Net::SFTP::Foreign::debug = -1 if ( ZM_UPLOAD_DEBUG );
|
||||
my $sftp = Net::SFTP::Foreign->new( ZM_UPLOAD_HOST, %sftpOptions );
|
||||
$Net::SFTP::Foreign::debug = -1 if $Config{ZM_UPLOAD_DEBUG};
|
||||
my $sftp = Net::SFTP::Foreign->new( $Config{ZM_UPLOAD_HOST}, %sftpOptions );
|
||||
if ( $sftp->error )
|
||||
{
|
||||
Error( "Can't create SFTP connection: ".$sftp->error );
|
||||
return( 0 );
|
||||
}
|
||||
$sftp->setcwd( ZM_UPLOAD_REM_DIR ) or Error( "SFTP - Can't setcwd: ".$sftp->error ) if ( ZM_UPLOAD_REM_DIR );
|
||||
$sftp->setcwd( $Config{ZM_UPLOAD_REM_DIR} ) or Error( "SFTP - Can't setcwd: ".$sftp->error ) if $Config{ZM_UPLOAD_REM_DIR};
|
||||
$sftp->put( $archLocPath, $archFile ) or Error( "SFTP - Can't upload '$archLocPath': ".$sftp->error );
|
||||
}
|
||||
unlink( $archLocPath );
|
||||
|
@ -876,7 +881,7 @@ sub substituteTags
|
|||
$sth->finish();
|
||||
}
|
||||
|
||||
my $url = ZM_URL;
|
||||
my $url = $Config{ZM_URL};
|
||||
$text =~ s/%ZP%/$url/g;
|
||||
$text =~ s/%MN%/$event->{MonitorName}/g;
|
||||
$text =~ s/%MET%/$monitor->{EventCount}/g;
|
||||
|
@ -908,18 +913,18 @@ sub substituteTags
|
|||
$text =~ s/%EPIM%/$url?view=frame&mid=$event->{MonitorId}&eid=$event->{Id}&fid=$max_alarm_frame->{FrameId}/g;
|
||||
if ( $attachments_ref && $text =~ s/%EI1%//g )
|
||||
{
|
||||
push( @$attachments_ref, { type=>"image/jpeg", path=>sprintf( "%s/%0".ZM_EVENT_IMAGE_DIGITS."d-capture.jpg", getEventPath( $event ), $first_alarm_frame->{FrameId} ) } );
|
||||
push( @$attachments_ref, { type=>"image/jpeg", path=>sprintf( "%s/%0".$Config{ZM_EVENT_IMAGE_DIGITS}."d-capture.jpg", getEventPath( $event ), $first_alarm_frame->{FrameId} ) } );
|
||||
}
|
||||
if ( $attachments_ref && $text =~ s/%EIM%//g )
|
||||
{
|
||||
# Don't attach the same image twice
|
||||
if ( !@$attachments_ref || ($first_alarm_frame->{FrameId} != $max_alarm_frame->{FrameId} ) )
|
||||
{
|
||||
push( @$attachments_ref, { type=>"image/jpeg", path=>sprintf( "%s/%0".ZM_EVENT_IMAGE_DIGITS."d-capture.jpg", getEventPath( $event ), $max_alarm_frame->{FrameId} ) } );
|
||||
push( @$attachments_ref, { type=>"image/jpeg", path=>sprintf( "%s/%0".$Config{ZM_EVENT_IMAGE_DIGITS}."d-capture.jpg", getEventPath( $event ), $max_alarm_frame->{FrameId} ) } );
|
||||
}
|
||||
}
|
||||
}
|
||||
if ( $attachments_ref && ZM_OPT_FFMPEG )
|
||||
if ( $attachments_ref && $Config{ZM_OPT_FFMPEG} )
|
||||
{
|
||||
if ( $text =~ s/%EV%//g )
|
||||
{
|
||||
|
@ -952,12 +957,12 @@ sub sendEmail
|
|||
my $filter = shift;
|
||||
my $event = shift;
|
||||
|
||||
if ( !ZM_FROM_EMAIL )
|
||||
if ( ! $Config{ZM_FROM_EMAIL} )
|
||||
{
|
||||
Error( "No 'from' email address defined, not sending email" );
|
||||
return( 0 );
|
||||
}
|
||||
if ( !ZM_EMAIL_ADDRESS )
|
||||
if ( ! $Config{ZM_EMAIL_ADDRESS} )
|
||||
{
|
||||
Error( "No email address defined, not sending email" );
|
||||
return( 0 );
|
||||
|
@ -965,22 +970,22 @@ sub sendEmail
|
|||
|
||||
Info( "Creating notification email\n" );
|
||||
|
||||
my $subject = substituteTags( ZM_EMAIL_SUBJECT, $filter, $event );
|
||||
my $subject = substituteTags( $Config{ZM_EMAIL_SUBJECT}, $filter, $event );
|
||||
return( 0 ) if ( !$subject );
|
||||
my @attachments;
|
||||
my $body = substituteTags( ZM_EMAIL_BODY, $filter, $event, \@attachments );
|
||||
my $body = substituteTags( $Config{ZM_EMAIL_BODY}, $filter, $event, \@attachments );
|
||||
return( 0 ) if ( !$body );
|
||||
|
||||
Info( "Sending notification email '$subject'\n" );
|
||||
|
||||
eval
|
||||
{
|
||||
if ( ZM_NEW_MAIL_MODULES )
|
||||
if ( $Config{ZM_NEW_MAIL_MODULES} )
|
||||
{
|
||||
### Create the multipart container
|
||||
my $mail = MIME::Lite->new (
|
||||
From => ZM_FROM_EMAIL,
|
||||
To => ZM_EMAIL_ADDRESS,
|
||||
From => $Config{ZM_FROM_EMAIL},
|
||||
To => $Config{ZM_EMAIL_ADDRESS},
|
||||
Subject => $subject,
|
||||
Type => "multipart/mixed"
|
||||
);
|
||||
|
@ -1000,14 +1005,14 @@ sub sendEmail
|
|||
);
|
||||
}
|
||||
### Send the Message
|
||||
MIME::Lite->send( "smtp", ZM_EMAIL_HOST, Timeout=>60 );
|
||||
MIME::Lite->send( "smtp", $Config{ZM_EMAIL_HOST}, Timeout=>60 );
|
||||
$mail->send();
|
||||
}
|
||||
else
|
||||
{
|
||||
my $mail = MIME::Entity->build(
|
||||
From => ZM_FROM_EMAIL,
|
||||
To => ZM_EMAIL_ADDRESS,
|
||||
From => $Config{ZM_FROM_EMAIL},
|
||||
To => $Config{ZM_EMAIL_ADDRESS},
|
||||
Subject => $subject,
|
||||
Type => (($body=~/<html>/)?'text/html':'text/plain'),
|
||||
Data => $body
|
||||
|
@ -1022,7 +1027,7 @@ sub sendEmail
|
|||
Encoding => "base64"
|
||||
);
|
||||
}
|
||||
$mail->smtpsend( Host => ZM_EMAIL_HOST, MailFrom => ZM_FROM_EMAIL );
|
||||
$mail->smtpsend( Host => $Config{ZM_EMAIL_HOST}, MailFrom => $Config{ZM_FROM_EMAIL} );
|
||||
}
|
||||
};
|
||||
if ( $@ )
|
||||
|
@ -1046,12 +1051,12 @@ sub sendMessage
|
|||
my $filter = shift;
|
||||
my $event = shift;
|
||||
|
||||
if ( !ZM_FROM_EMAIL )
|
||||
if ( ! $Config{ZM_FROM_EMAIL} )
|
||||
{
|
||||
Error( "No 'from' email address defined, not sending message" );
|
||||
return( 0 );
|
||||
}
|
||||
if ( !ZM_MESSAGE_ADDRESS )
|
||||
if ( ! $Config{ZM_MESSAGE_ADDRESS} )
|
||||
{
|
||||
Error( "No message address defined, not sending message" );
|
||||
return( 0 );
|
||||
|
@ -1059,22 +1064,22 @@ sub sendMessage
|
|||
|
||||
Info( "Creating notification message\n" );
|
||||
|
||||
my $subject = substituteTags( ZM_MESSAGE_SUBJECT, $filter, $event );
|
||||
my $subject = substituteTags( $Config{ZM_MESSAGE_SUBJECT}, $filter, $event );
|
||||
return( 0 ) if ( !$subject );
|
||||
my @attachments;
|
||||
my $body = substituteTags( ZM_MESSAGE_BODY, $filter, $event, \@attachments );
|
||||
my $body = substituteTags( $Config{ZM_MESSAGE_BODY}, $filter, $event, \@attachments );
|
||||
return( 0 ) if ( !$body );
|
||||
|
||||
Info( "Sending notification message '$subject'\n" );
|
||||
|
||||
eval
|
||||
{
|
||||
if ( ZM_NEW_MAIL_MODULES )
|
||||
if ( $Config{ZM_NEW_MAIL_MODULES} )
|
||||
{
|
||||
### Create the multipart container
|
||||
my $mail = MIME::Lite->new (
|
||||
From => ZM_FROM_EMAIL,
|
||||
To => ZM_MESSAGE_ADDRESS,
|
||||
From => $Config{ZM_FROM_EMAIL},
|
||||
To => $Config{ZM_MESSAGE_ADDRESS},
|
||||
Subject => $subject,
|
||||
Type => "multipart/mixed"
|
||||
);
|
||||
|
@ -1094,14 +1099,14 @@ sub sendMessage
|
|||
);
|
||||
}
|
||||
### Send the Message
|
||||
MIME::Lite->send( "smtp", ZM_EMAIL_HOST, Timeout=>60 );
|
||||
MIME::Lite->send( "smtp", $Config{ZM_EMAIL_HOST}, Timeout=>60 );
|
||||
$mail->send();
|
||||
}
|
||||
else
|
||||
{
|
||||
my $mail = MIME::Entity->build(
|
||||
From => ZM_FROM_EMAIL,
|
||||
To => ZM_MESSAGE_ADDRESS,
|
||||
From => $Config{ZM_FROM_EMAIL},
|
||||
To => $Config{ZM_MESSAGE_ADDRESS},
|
||||
Subject => $subject,
|
||||
Type => (($body=~/<html>/)?'text/html':'text/plain'),
|
||||
Data => $body
|
||||
|
@ -1116,7 +1121,7 @@ sub sendMessage
|
|||
Encoding => "base64"
|
||||
);
|
||||
}
|
||||
$mail->smtpsend( Host => ZM_EMAIL_HOST, MailFrom => ZM_FROM_EMAIL );
|
||||
$mail->smtpsend( Host => $Config{ZM_EMAIL_HOST}, MailFrom => $Config{ZM_FROM_EMAIL} );
|
||||
}
|
||||
};
|
||||
if ( $@ )
|
||||
|
|
|
@ -57,9 +57,9 @@ if ( !$command || $command !~ /^(?:start|stop|restart|status|logrot)$/ )
|
|||
if ( $command )
|
||||
{
|
||||
# Check to see if it's a valid run state
|
||||
my $sql = "select * from States where Name = '$command'";
|
||||
my $sql = 'select * from States where Name = ?';
|
||||
my $sth = $dbh->prepare_cached( $sql ) or Fatal( "Can't prepare '$sql': ".$dbh->errstr() );
|
||||
my $res = $sth->execute() or Fatal( "Can't execute: ".$sth->errstr() );
|
||||
my $res = $sth->execute( $command ) or Fatal( "Can't execute: ".$sth->errstr() );
|
||||
if ( $state = $sth->fetchrow_hashref() )
|
||||
{
|
||||
$state->{Name} = $command;
|
||||
|
@ -84,7 +84,7 @@ if ( !$command || $command !~ /^(?:start|stop|restart|status|logrot)$/ )
|
|||
}
|
||||
|
||||
# Move to the right place
|
||||
chdir( ZM_PATH_WEB ) or Fatal( "Can't chdir to '".ZM_PATH_WEB."': $!" );
|
||||
chdir( $Config{ZM_PATH_WEB} ) or Fatal( "Can't chdir to '".$Config{ZM_PATH_WEB}."': $!" );
|
||||
|
||||
my $dbg_id = "";
|
||||
|
||||
|
@ -138,7 +138,7 @@ if ( $command =~ /^(?:stop|restart)$/ )
|
|||
}
|
||||
}
|
||||
|
||||
runCommand( "zmupdate.pl -f" );
|
||||
#runCommand( "zmupdate.pl -f" );
|
||||
|
||||
if ( $command =~ /^(?:start|restart)$/ )
|
||||
{
|
||||
|
@ -146,9 +146,9 @@ if ( $command =~ /^(?:start|restart)$/ )
|
|||
|
||||
if ( $status eq "stopped" )
|
||||
{
|
||||
if ( ZM_DYN_DB_VERSION && ZM_DYN_DB_VERSION ne ZM_VERSION )
|
||||
if ( $Config{ZM_DYN_DB_VERSION} and ( $Config{ZM_DYN_DB_VERSION} ne ZM_VERSION ) )
|
||||
{
|
||||
Fatal( "Version mismatch, system is version ".ZM_VERSION.", database is ".ZM_DYN_DB_VERSION.", please run zmupdate.pl to update." );
|
||||
Fatal( "Version mismatch, system is version ".ZM_VERSION.", database is ".$Config{ZM_DYN_DB_VERSION}.", please run zmupdate.pl to update." );
|
||||
exit( -1 );
|
||||
}
|
||||
|
||||
|
@ -158,15 +158,14 @@ if ( $command =~ /^(?:start|restart)$/ )
|
|||
Debug( "Recreating temporary directory '@ZM_TMPDIR@'" );
|
||||
mkdir( "@ZM_TMPDIR@", 0700 ) or Fatal( "Can't create missing temporary directory '@ZM_TMPDIR@': $!" );
|
||||
my ( $runName ) = getpwuid( $> );
|
||||
if ( $runName ne ZM_WEB_USER )
|
||||
if ( $runName ne $Config{ZM_WEB_USER} )
|
||||
{
|
||||
# Not running as web user, so should be root in whch case chown the temporary directory
|
||||
my ( $webName, $webPass, $webUid, $webGid ) = getpwnam( ZM_WEB_USER ) or Fatal( "Can't get user details for web user '".ZM_WEB_USER."': $!" );
|
||||
chown( $webUid, $webGid, "@ZM_TMPDIR@" ) or Fatal( "Can't change ownership of temporary directory '@ZM_TMPDIR@' to '".ZM_WEB_USER.":".ZM_WEB_GROUP."': $!" );
|
||||
my ( $webName, $webPass, $webUid, $webGid ) = getpwnam( $Config{ZM_WEB_USER} ) or Fatal( "Can't get user details for web user '".$Config{ZM_WEB_USER}."': $!" );
|
||||
chown( $webUid, $webGid, "@ZM_TMPDIR@" ) or Fatal( "Can't change ownership of temporary directory '@ZM_TMPDIR@' to '".$Config{ZM_WEB_USER}.":".$Config{ZM_WEB_GROUP}."': $!" );
|
||||
}
|
||||
}
|
||||
zmMemTidy();
|
||||
runCommand( "zmfix" );
|
||||
runCommand( "zmdc.pl startup" );
|
||||
|
||||
my $sql = "select * from Monitors";
|
||||
|
@ -186,13 +185,13 @@ if ( $command =~ /^(?:start|restart)$/ )
|
|||
}
|
||||
if ( $monitor->{Function} ne 'Monitor' )
|
||||
{
|
||||
if ( ZM_OPT_FRAME_SERVER )
|
||||
if ( $Config{ZM_OPT_FRAME_SERVER} )
|
||||
{
|
||||
runCommand( "zmdc.pl start zmf -m $monitor->{Id}" );
|
||||
}
|
||||
runCommand( "zmdc.pl start zma -m $monitor->{Id}" );
|
||||
}
|
||||
if ( ZM_OPT_CONTROL )
|
||||
if ( $Config{ZM_OPT_CONTROL} )
|
||||
{
|
||||
if ( $monitor->{Function} eq 'Modect' || $monitor->{Function} eq 'Mocord' )
|
||||
{
|
||||
|
@ -208,20 +207,20 @@ if ( $command =~ /^(?:start|restart)$/ )
|
|||
|
||||
# This is now started unconditionally
|
||||
runCommand( "zmdc.pl start zmfilter.pl" );
|
||||
if ( ZM_RUN_AUDIT )
|
||||
if ( $Config{ZM_RUN_AUDIT} )
|
||||
{
|
||||
runCommand( "zmdc.pl start zmaudit.pl -c" );
|
||||
}
|
||||
if ( ZM_OPT_TRIGGERS )
|
||||
if ( $Config{ZM_OPT_TRIGGERS} )
|
||||
{
|
||||
runCommand( "zmdc.pl start zmtrigger.pl" );
|
||||
}
|
||||
if ( ZM_OPT_X10 )
|
||||
if ( $Config{ZM_OPT_X10} )
|
||||
{
|
||||
runCommand( "zmdc.pl start zmx10.pl -c start" );
|
||||
}
|
||||
runCommand( "zmdc.pl start zmwatch.pl" );
|
||||
if ( ZM_CHECK_FOR_UPDATES )
|
||||
if ( $Config{ZM_CHECK_FOR_UPDATES} )
|
||||
{
|
||||
runCommand( "zmdc.pl start zmupdate.pl -c" );
|
||||
}
|
||||
|
@ -245,3 +244,5 @@ if ( $command eq "logrot" )
|
|||
}
|
||||
|
||||
exit( $retval );
|
||||
|
||||
__END__
|
||||
|
|
|
@ -53,9 +53,9 @@ use ZoneMinder::Trigger::Connection;
|
|||
|
||||
my @connections;
|
||||
push( @connections, ZoneMinder::Trigger::Connection->new( name=>"Chan1", channel=>ZoneMinder::Trigger::Channel::Inet->new( port=>6802 ), mode=>"rw" ) );
|
||||
push( @connections, ZoneMinder::Trigger::Connection->new( name=>"Chan2", channel=>ZoneMinder::Trigger::Channel::Unix->new( path=>ZM_PATH_SOCKS.'/zmtrigger.sock' ), mode=>"rw" ) );
|
||||
push( @connections, ZoneMinder::Trigger::Connection->new( name=>"Chan2", channel=>ZoneMinder::Trigger::Channel::Unix->new( path=>$Config{ZM_PATH_SOCKS}.'/zmtrigger.sock' ), mode=>"rw" ) );
|
||||
#push( @connections, ZoneMinder::Trigger::Connection->new( name=>"Chan3", channel=>ZoneMinder::Trigger::Channel::File->new( path=>'/tmp/zmtrigger.out' ), mode=>"w" ) );
|
||||
push( @connections, ZoneMinder::Trigger::Connection->new( name=>"Chan4", channel=>ZoneMinder::Trigger::Channel::Serial->new( path=>'/dev/ttyS0' ), mode=>"rw" ) );
|
||||
#push( @connections, ZoneMinder::Trigger::Connection->new( name=>"Chan4", channel=>ZoneMinder::Trigger::Channel::Serial->new( path=>'/dev/ttyS0' ), mode=>"rw" ) );
|
||||
|
||||
# ==========================================================================
|
||||
#
|
||||
|
@ -437,4 +437,7 @@ sub handleMessage
|
|||
{
|
||||
Error( "Unrecognised action '$action' in message '$message'\n" );
|
||||
}
|
||||
}
|
||||
} # end sub handleMessage
|
||||
|
||||
1;
|
||||
__END__
|
||||
|
|
|
@ -54,7 +54,7 @@ use DBI;
|
|||
use Getopt::Long;
|
||||
use Data::Dumper;
|
||||
|
||||
use constant EVENT_PATH => (ZM_DIR_EVENTS=~m|/|)?ZM_DIR_EVENTS:(ZM_PATH_WEB.'/'.ZM_DIR_EVENTS);
|
||||
use constant EVENT_PATH => ($Config{ZM_DIR_EVENTS}=~m|/|)?$Config{ZM_DIR_EVENTS}:($Config{ZM_PATH_WEB}.'/'.$Config{ZM_DIR_EVENTS});
|
||||
|
||||
$| = 1;
|
||||
|
||||
|
@ -62,7 +62,7 @@ $ENV{PATH} = '/bin:/usr/bin:/usr/local/bin';
|
|||
$ENV{SHELL} = '/bin/sh' if exists $ENV{SHELL};
|
||||
delete @ENV{qw(IFS CDPATH ENV BASH_ENV)};
|
||||
|
||||
my $web_uid = (getpwnam( ZM_WEB_USER ))[2];
|
||||
my $web_uid = (getpwnam( $Config{ZM_WEB_USER} ))[2];
|
||||
my $use_log = (($> == 0) || ($> == $web_uid));
|
||||
|
||||
logInit( toFile=>$use_log?DEBUG:NOLOG );
|
||||
|
@ -75,8 +75,8 @@ my $rename = 0;
|
|||
my $zoneFix = 0;
|
||||
my $migrateEvents = 0;
|
||||
my $version = '';
|
||||
my $dbUser = ZM_DB_USER;
|
||||
my $dbPass = ZM_DB_PASS;
|
||||
my $dbUser = $Config{ZM_DB_USER};
|
||||
my $dbPass = $Config{ZM_DB_PASS};
|
||||
my $updateDir = '';
|
||||
sub Usage
|
||||
{
|
||||
|
@ -99,15 +99,14 @@ if ( !GetOptions( 'check'=>\$check, 'freshen'=>\$freshen, 'rename'=>\$rename, 'z
|
|||
}
|
||||
|
||||
my $dbh = zmDbConnect();
|
||||
*ZoneMinder::Database::ZM_DB_USER = sub { $dbUser } if ZoneMinder::Database::ZM_DB_USER ne $dbUser;
|
||||
*ZoneMinder::Database::ZM_DB_PASS = sub { $dbPass } if ZoneMinder::Database::ZM_DB_PASS ne $dbPass;
|
||||
zmDbDisconnect();
|
||||
$Config{ZM_DB_USER} = $dbUser;
|
||||
$Config{ZM_DB_PASS} = $dbPass;
|
||||
|
||||
if ( ! ($check || $freshen || $rename || $zoneFix || $migrateEvents || $version) )
|
||||
{
|
||||
if ( ZM_DYN_DB_VERSION )
|
||||
if ( $Config{ZM_DYN_DB_VERSION} )
|
||||
{
|
||||
$version = ZM_DYN_DB_VERSION;
|
||||
$version = $Config{ZM_DYN_DB_VERSION};
|
||||
}
|
||||
else
|
||||
{
|
||||
|
@ -122,48 +121,37 @@ if ( ($check + $freshen + $rename + $zoneFix + $migrateEvents + ($version?1:0))
|
|||
Usage();
|
||||
}
|
||||
|
||||
if ( $check && ZM_CHECK_FOR_UPDATES )
|
||||
if ( $check && $Config{ZM_CHECK_FOR_UPDATES} )
|
||||
{
|
||||
print( "Update agent starting at ".strftime( '%y/%m/%d %H:%M:%S', localtime() )."\n" );
|
||||
|
||||
my $dbh = zmDbConnect();
|
||||
|
||||
my $currVersion = ZM_DYN_CURR_VERSION;
|
||||
my $lastVersion = ZM_DYN_LAST_VERSION;
|
||||
my $lastCheck = ZM_DYN_LAST_CHECK;
|
||||
my $currVersion = $Config{ZM_DYN_CURR_VERSION};
|
||||
my $lastVersion = $Config{ZM_DYN_LAST_VERSION};
|
||||
my $lastCheck = $Config{ZM_DYN_LAST_CHECK};
|
||||
|
||||
if ( !$currVersion )
|
||||
{
|
||||
$currVersion = ZM_VERSION;
|
||||
$currVersion = $Config{ZM_VERSION};
|
||||
|
||||
my $sql = "update Config set Value = ? where Name = 'ZM_DYN_CURR_VERSION'";
|
||||
my $sth = $dbh->prepare_cached( $sql ) or die( "Can't prepare '$sql': ".$dbh->errstr() );
|
||||
my $res = $sth->execute( "$currVersion" ) or die( "Can't execute: ".$sth->errstr() );
|
||||
}
|
||||
zmDbDisconnect();
|
||||
|
||||
while( 1 )
|
||||
{
|
||||
my $now = time();
|
||||
if ( !$lastVersion || !$lastCheck || (($now-$lastCheck) > CHECK_INTERVAL) )
|
||||
{
|
||||
$dbh = zmDbConnect();
|
||||
|
||||
Info( "Checking for updates\n" );
|
||||
|
||||
use LWP::UserAgent;
|
||||
my $ua = LWP::UserAgent->new;
|
||||
$ua->agent( "ZoneMinder Update Agent/".ZM_VERSION );
|
||||
if ( eval('defined(ZM_UPDATE_CHECK_PROXY)') )
|
||||
{
|
||||
no strict 'subs';
|
||||
if ( ZM_UPDATE_CHECK_PROXY )
|
||||
{
|
||||
$ua->proxy( "http", ZM_UPDATE_CHECK_PROXY );
|
||||
}
|
||||
use strict 'subs';
|
||||
if ( $Config{ZM_UPDATE_CHECK_PROXY} ) {
|
||||
$ua->proxy( "http", $Config{ZM_UPDATE_CHECK_PROXY} );
|
||||
}
|
||||
my $req = HTTP::Request->new( GET=>'https://raw.github.com/ZoneMinder/ZoneMinder/master/version' );
|
||||
my $req = HTTP::Request->new( GET=>'http://zoneminder.github.io/ZoneMinder/version.txt' );
|
||||
my $res = $ua->request($req);
|
||||
|
||||
if ( $res->is_success )
|
||||
|
@ -186,7 +174,6 @@ if ( $check && ZM_CHECK_FOR_UPDATES )
|
|||
{
|
||||
Error( "Error check failed: '".$res->status_line()."'\n" );
|
||||
}
|
||||
zmDbDisconnect();
|
||||
}
|
||||
sleep( 3600 );
|
||||
}
|
||||
|
@ -222,9 +209,6 @@ if ( $rename )
|
|||
}
|
||||
if ( $zoneFix )
|
||||
{
|
||||
require DBI;
|
||||
|
||||
my $dbh = zmDbConnect();
|
||||
|
||||
my $sql = "select Z.*, M.Width as MonitorWidth, M.Height as MonitorHeight from Zones as Z inner join Monitors as M on Z.MonitorId = M.Id where Z.Units = 'Percent'";
|
||||
my $sth = $dbh->prepare_cached( $sql ) or die( "Can't prepare '$sql': ".$dbh->errstr() );
|
||||
|
@ -257,12 +241,12 @@ if ( $zoneFix )
|
|||
}
|
||||
if ( $migrateEvents )
|
||||
{
|
||||
my $webUid = (getpwnam( ZM_WEB_USER ))[2];
|
||||
my $webGid = (getgrnam( ZM_WEB_USER ))[2];
|
||||
my $webUid = (getpwnam( $Config{ZM_WEB_USER} ))[2];
|
||||
my $webGid = (getgrnam( $Config{ZM_WEB_USER} ))[2];
|
||||
|
||||
if ( !(($> == 0) || ($> == $webUid)) )
|
||||
{
|
||||
print( "Error, migrating events can only be done as user root or ".ZM_WEB_USER.".\n" );
|
||||
print( "Error, migrating events can only be done as user root or ".$Config{ZM_WEB_USER}.".\n" );
|
||||
exit( -1 );
|
||||
}
|
||||
|
||||
|
@ -286,8 +270,7 @@ if ( $migrateEvents )
|
|||
{
|
||||
print( "Converting all events to deep storage.\n" );
|
||||
|
||||
chdir( ZM_PATH_WEB );
|
||||
my $dbh = zmDbConnect();
|
||||
chdir( $Config{ZM_PATH_WEB} );
|
||||
my $sql = "select *, unix_timestamp(StartTime) as UnixStartTime from Events";
|
||||
my $sth = $dbh->prepare_cached( $sql ) or Fatal( "Can't prepare '$sql': ".$dbh->errstr() );
|
||||
my $res = $sth->execute();
|
||||
|
@ -298,7 +281,7 @@ if ( $migrateEvents )
|
|||
|
||||
while( my $event = $sth->fetchrow_hashref() )
|
||||
{
|
||||
my $oldEventPath = ZM_DIR_EVENTS.'/'.$event->{MonitorId}.'/'.$event->{Id};
|
||||
my $oldEventPath = $Config{ZM_DIR_EVENTS}.'/'.$event->{MonitorId}.'/'.$event->{Id};
|
||||
|
||||
if ( !-d $oldEventPath )
|
||||
{
|
||||
|
@ -307,11 +290,11 @@ if ( $migrateEvents )
|
|||
}
|
||||
|
||||
print( "Converting event ".$event->{Id}."\n" );
|
||||
my $newDatePath = ZM_DIR_EVENTS.'/'.$event->{MonitorId}.'/'.strftime( "%y/%m/%d", localtime($event->{UnixStartTime}) );
|
||||
my $newDatePath = $Config{ZM_DIR_EVENTS}.'/'.$event->{MonitorId}.'/'.strftime( "%y/%m/%d", localtime($event->{UnixStartTime}) );
|
||||
my $newTimePath = strftime( "%H/%M/%S", localtime($event->{UnixStartTime}) );
|
||||
my $newEventPath = $newDatePath.'/'.$newTimePath;
|
||||
( my $truncEventPath = $newEventPath ) =~ s|/\d+$||;
|
||||
makePath( $truncEventPath, ZM_PATH_WEB );
|
||||
makePath( $truncEventPath, $Config{ZM_PATH_WEB} );
|
||||
my $idLink = $newDatePath.'/.'.$event->{Id};
|
||||
symlink( $newTimePath, $idLink ) or die( "Can't symlink $newTimePath -> $idLink: $!" );
|
||||
rename( $oldEventPath, $newEventPath ) or die( "Can't move $oldEventPath -> $newEventPath: $!" );
|
||||
|
@ -335,6 +318,36 @@ if ( $freshen )
|
|||
loadConfigFromDB();
|
||||
saveConfigToDB();
|
||||
}
|
||||
|
||||
# Now check for MyISAM Tables
|
||||
my @MyISAM_Tables;
|
||||
my $sql = "SELECT table_name FROM INFORMATION_SCHEMA.TABLES WHERE table_schema='zm' AND engine = 'MyISAM'";
|
||||
my $sth = $dbh->prepare_cached( $sql ) or die( "Can't prepare '$sql': ".$dbh->errstr() );
|
||||
my $res = $sth->execute() or die( "Can't execute: ".$sth->errstr() );
|
||||
|
||||
while( my $dbTable = $sth->fetchrow() ) {
|
||||
push @MyISAM_Tables, $dbTable;
|
||||
}
|
||||
$sth->finish();
|
||||
|
||||
if ( @MyISAM_Tables ) {
|
||||
print( "\nPrevious versions of ZoneMinder used the MyISAM database engine.\nHowever, the recommended database engine is InnoDB.\n");
|
||||
print( "\nHint: InnoDB tables are much less likely to be corrupted during an unclean shutdown.\n\nPress 'y' to convert your tables to InnoDB or 'n' to skip : ");
|
||||
my $response = <STDIN>;
|
||||
chomp( $response );
|
||||
if ( $response =~ /^[yY]$/ ) {
|
||||
print "\nConverting MyISAM tables to InnoDB. Please wait.\n";
|
||||
foreach (@MyISAM_Tables) {
|
||||
$dbh->do(q|SET sql_mode='traditional'|); # Elevate warnings to errors
|
||||
my $sql = "ALTER TABLE $_ ENGINE = InnoDB";
|
||||
my $sth = $dbh->prepare_cached( $sql ) or die( "Can't prepare '$sql': ".$dbh->errstr() );
|
||||
my $res = $sth->execute() or die( "Can't execute: ".$sth->errstr() );
|
||||
$sth->finish();
|
||||
$dbh->do(q|SET sql_mode=''|); # Set mode back to default
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if ( $version )
|
||||
{
|
||||
my ( $detaint_version ) = $version =~ /^([\w.]+)$/;
|
||||
|
@ -343,15 +356,15 @@ if ( $version )
|
|||
if ( ZM_VERSION eq $version )
|
||||
{
|
||||
print( "\nDatabase already at version $version, update aborted.\n\n" );
|
||||
exit( -1 );
|
||||
exit( 0 );
|
||||
}
|
||||
|
||||
print( "\nInitiating database upgrade to version ".ZM_VERSION." from version $version\n" );
|
||||
if ( $interactive )
|
||||
{
|
||||
if ( ZM_DYN_DB_VERSION && ZM_DYN_DB_VERSION ne $version )
|
||||
if ( $Config{ZM_DYN_DB_VERSION} && $Config{ZM_DYN_DB_VERSION} ne $version )
|
||||
{
|
||||
print( "\nWARNING - You have specified an upgrade from version $version but the database version found is ".ZM_DYN_DB_VERSION.". Is this correct?\nPress enter to continue or ctrl-C to abort : " );
|
||||
print( "\nWARNING - You have specified an upgrade from version $version but the database version found is ".$Config{ZM_DYN_DB_VERSION}.". Is this correct?\nPress enter to continue or ctrl-C to abort : " );
|
||||
my $response = <STDIN>;
|
||||
}
|
||||
|
||||
|
@ -370,7 +383,7 @@ if ( $version )
|
|||
|
||||
if ( $response =~ /^[yY]$/ )
|
||||
{
|
||||
my ( $host, $port ) = ( ZM_DB_HOST =~ /^([^:]+)(?::(.+))?$/ );
|
||||
my ( $host, $port ) = ( $Config{ZM_DB_HOST} =~ /^([^:]+)(?::(.+))?$/ );
|
||||
my $command = "mysqldump -h".$host;
|
||||
$command .= " -P".$port if defined($port);
|
||||
if ( $dbUser )
|
||||
|
@ -381,8 +394,8 @@ if ( $version )
|
|||
$command .= " -p".$dbPass;
|
||||
}
|
||||
}
|
||||
my $backup = "@ZM_TMPDIR@/".ZM_DB_NAME."-".$version.".dump";
|
||||
$command .= " --add-drop-table --databases ".ZM_DB_NAME." > ".$backup;
|
||||
my $backup = "@ZM_TMPDIR@/".$Config{ZM_DB_NAME}."-".$version.".dump";
|
||||
$command .= " --add-drop-table --databases ".$Config{ZM_DB_NAME}." > ".$backup;
|
||||
print( "Creating backup to $backup. This may take several minutes.\n" );
|
||||
print( "Executing '$command'\n" ) if ( logDebugging() );
|
||||
my $output = qx($command);
|
||||
|
@ -411,7 +424,7 @@ if ( $version )
|
|||
my $dbh = shift;
|
||||
my $version = shift;
|
||||
|
||||
my ( $host, $port ) = ( ZM_DB_HOST =~ /^([^:]+)(?::(.+))?$/ );
|
||||
my ( $host, $port ) = ( $Config{ZM_DB_HOST} =~ /^([^:]+)(?::(.+))?$/ );
|
||||
my $command = "mysql -h".$host;
|
||||
$command .= " -P".$port if defined($port);
|
||||
if ( $dbUser )
|
||||
|
@ -422,14 +435,14 @@ if ( $version )
|
|||
$command .= " -p".$dbPass;
|
||||
}
|
||||
}
|
||||
$command .= " ".ZM_DB_NAME." < ";
|
||||
$command .= " ".$Config{ZM_DB_NAME}." < ";
|
||||
if ( $updateDir )
|
||||
{
|
||||
$command .= $updateDir;
|
||||
}
|
||||
else
|
||||
{
|
||||
$command .= ZM_PATH_BUILD."/db";
|
||||
$command .= $Config{ZM_PATH_DATA}."/db";
|
||||
}
|
||||
$command .= "/zm_update-".$version.".sql";
|
||||
|
||||
|
@ -447,41 +460,13 @@ if ( $version )
|
|||
}
|
||||
else
|
||||
{
|
||||
print( "\nDatabase successfully upgraded from version $version.\n" );
|
||||
print( "\nDatabase successfully upgraded to version $version.\n" );
|
||||
my $sql = "update Config set Value = ? where Name = 'ZM_DYN_DB_VERSION'";
|
||||
my $sth = $dbh->prepare_cached( $sql ) or die( "Can't prepare '$sql': ".$dbh->errstr() );
|
||||
my $res = $sth->execute( $version ) or die( "Can't execute: ".$sth->errstr() );
|
||||
}
|
||||
}
|
||||
|
||||
sub toInnoDB
|
||||
{
|
||||
my $dbh = shift;
|
||||
my $sql = "SELECT table_name FROM INFORMATION_SCHEMA.TABLES WHERE table_schema='zm' AND engine = 'MyISAM'";
|
||||
my $sth = $dbh->prepare_cached( $sql ) or die( "Can't prepare '$sql': ".$dbh->errstr() );
|
||||
my $res = $sth->execute() or die( "Can't execute: ".$sth->errstr() );
|
||||
|
||||
my @dbTables;
|
||||
while( my $dbTable = $sth->fetchrow() )
|
||||
{
|
||||
push( @dbTables, $dbTable );
|
||||
}
|
||||
$sth->finish();
|
||||
|
||||
if (@dbTables)
|
||||
{
|
||||
print "\nConverting MyISAM tables to InnoDB. Please wait.\n";
|
||||
foreach (@dbTables)
|
||||
{
|
||||
my $sql = "ALTER TABLE $_ ENGINE = InnoDB";
|
||||
my $sth = $dbh->prepare_cached( $sql ) or die( "Can't prepare '$sql': ".$dbh->errstr() );
|
||||
my $res = $sth->execute() or die( "Can't execute: ".$sth->errstr() );
|
||||
}
|
||||
$sth->finish();
|
||||
} else {
|
||||
print "\nNo MyISAM tables found. Skipping...\n";
|
||||
}
|
||||
}
|
||||
|
||||
print( "\nUpgrading database to version ".ZM_VERSION."\n" );
|
||||
|
||||
|
@ -489,8 +474,6 @@ if ( $version )
|
|||
loadConfigFromDB();
|
||||
saveConfigToDB();
|
||||
|
||||
my $dbh = zmDbConnect();
|
||||
|
||||
my $cascade = undef;
|
||||
if ( $cascade || $version eq "1.19.0" )
|
||||
{
|
||||
|
@ -518,8 +501,6 @@ if ( $version )
|
|||
}
|
||||
if ( $cascade || $version eq "1.19.4" )
|
||||
{
|
||||
require DBI;
|
||||
|
||||
# Rename the event directories and create a new symlink for the names
|
||||
chdir( EVENT_PATH );
|
||||
|
||||
|
@ -742,7 +723,7 @@ if ( $version )
|
|||
my ( $sql, $sth, $res );
|
||||
if ( defined(&ZM_EMAIL_TEXT) && &ZM_EMAIL_TEXT )
|
||||
{
|
||||
my ( $email_subject, $email_body ) = ZM_EMAIL_TEXT =~ /subject\s*=\s*"([^\n]*)".*body\s*=\s*"(.*)"?$/ms;
|
||||
my ( $email_subject, $email_body ) = $Config{ZM_EMAIL_TEXT} =~ /subject\s*=\s*"([^\n]*)".*body\s*=\s*"(.*)"?$/ms;
|
||||
$sql = "replace into Config set Id = 0, Name = 'ZM_EMAIL_SUBJECT', Value = '".$email_subject."', Type = 'string', DefaultValue = 'ZoneMinder: Alarm - %MN%-%EI% (%ESM% - %ESA% %EFA%)', Hint = 'string', Pattern = '(?-xism:^(.+)\$)', Format = ' \$1 ', Prompt = 'The subject of the email used to send matching event details', Help = 'This option is used to define the subject of the email that is sent for any events that match the appropriate filters.', Category = 'mail', Readonly = '0', Requires = 'ZM_OPT_EMAIL=1'";
|
||||
$sth = $dbh->prepare_cached( $sql ) or die( "Can't prepare '$sql': ".$dbh->errstr() );
|
||||
$res = $sth->execute() or die( "Can't execute: ".$sth->errstr() );
|
||||
|
@ -752,7 +733,7 @@ if ( $version )
|
|||
}
|
||||
if ( defined(&ZM_MESSAGE_TEXT) && &ZM_MESSAGE_TEXT )
|
||||
{
|
||||
my ( $message_subject, $message_body ) = ZM_MESSAGE_TEXT =~ /subject\s*=\s*"([^\n]*)".*body\s*=\s*"(.*)"?$/ms;
|
||||
my ( $message_subject, $message_body ) = $Config{ZM_MESSAGE_TEXT} =~ /subject\s*=\s*"([^\n]*)".*body\s*=\s*"(.*)"?$/ms;
|
||||
$sql = "replace into Config set Id = 0, Name = 'ZM_MESSAGE_SUBJECT', Value = '".$message_subject."', Type = 'string', DefaultValue = 'ZoneMinder: Alarm - %MN%-%EI%', Hint = 'string', Pattern = '(?-xism:^(.+)\$)', Format = ' \$1 ', Prompt = 'The subject of the message used to send matching event details', Help = 'This option is used to define the subject of the message that is sent for any events that match the appropriate filters.', Category = 'mail', Readonly = '0', Requires = 'ZM_OPT_MESSAGE=1'";
|
||||
$sth = $dbh->prepare_cached( $sql ) or die( "Can't prepare '$sql': ".$dbh->errstr() );
|
||||
$res = $sth->execute() or die( "Can't execute: ".$sth->errstr() );
|
||||
|
@ -886,7 +867,7 @@ if ( $version )
|
|||
|
||||
my $sql = "update Config set Value = ? where Name = 'ZM_JPEG_STREAM_QUALITY'";
|
||||
my $sth = $dbh->prepare_cached( $sql ) or die( "Can't prepare '$sql': ".$dbh->errstr() );
|
||||
my $res = $sth->execute( ZM_JPEG_IMAGE_QUALITY ) or die( "Can't execute: ".$sth->errstr() );
|
||||
my $res = $sth->execute( $Config{ZM_JPEG_IMAGE_QUALITY} ) or die( "Can't execute: ".$sth->errstr() );
|
||||
}
|
||||
$cascade = !undef;
|
||||
}
|
||||
|
@ -1014,14 +995,6 @@ if ( $version )
|
|||
} # end if
|
||||
$sth->finish();
|
||||
|
||||
print( "\nPrevious versions of ZoneMinder used the MyISAM database engine.\nHowever, the recommended database engine is InnoDB.\n");
|
||||
print( "\nHint: InnoDB tables are much less likely to be corrupted during an unclean shutdown.\n\nPress 'y' to convert your tables to InnoDB or 'n' to skip : ");
|
||||
my $response = <STDIN>;
|
||||
chomp( $response );
|
||||
if ( $response =~ /^[yY]$/ )
|
||||
{
|
||||
toInnoDB($dbh);
|
||||
}
|
||||
|
||||
$cascade = !undef;
|
||||
$version = '1.26.0';
|
||||
|
@ -1030,7 +1003,7 @@ if ( $version )
|
|||
if ( $version ge '1.26.0' ) {
|
||||
|
||||
my @files;
|
||||
$updateDir = ZM_PATH_BUILD."/db" if ! $updateDir;
|
||||
$updateDir = $Config{ZM_PATH_DATA}."/db" if ! $updateDir;
|
||||
opendir( my $dh, $updateDir ) || die "Can't open updateDir $!";
|
||||
@files = sort grep { (!/^\./) && /^zm_update\-[\d\.]+\.sql$/ && -f "$updateDir/$_" } readdir($dh);
|
||||
closedir $dh;
|
||||
|
@ -1061,13 +1034,13 @@ if ( $version )
|
|||
my $sth = $dbh->prepare_cached( $sql ) or die( "Can't prepare '$sql': ".$dbh->errstr() );
|
||||
my $res = $sth->execute( "$installed_version", "ZM_DYN_DB_VERSION" ) or die( "Can't execute: ".$sth->errstr() );
|
||||
$res = $sth->execute( "$installed_version", "ZM_DYN_CURR_VERSION" ) or die( "Can't execute: ".$sth->errstr() );
|
||||
$dbh->disconnect();
|
||||
}
|
||||
else
|
||||
{
|
||||
$dbh->disconnect();
|
||||
zmDbDisconnect();
|
||||
die( "Can't find upgrade from version '$version'" );
|
||||
}
|
||||
print( "\nDatabase upgrade to version ".ZM_VERSION." successful.\n\n" );
|
||||
}
|
||||
zmDbDisconnect();
|
||||
exit( 0 );
|
||||
|
|
|
@ -56,7 +56,7 @@ my $fps = '';
|
|||
my $size = '';
|
||||
my $overwrite = 0;
|
||||
|
||||
my @formats = split( /\s+/, ZM_FFMPEG_FORMATS );
|
||||
my @formats = split( /\s+/, $Config{ZM_FFMPEG_FORMATS} );
|
||||
for ( my $i = 0; $i < @formats; $i++ )
|
||||
{
|
||||
if ( $i =~ /^(.+)\*$/ )
|
||||
|
@ -92,7 +92,7 @@ if ( !$event_id || $event_id < 0 )
|
|||
Usage();
|
||||
}
|
||||
|
||||
if ( !ZM_OPT_FFMPEG )
|
||||
if ( ! $Config{ZM_OPT_FFMPEG} )
|
||||
{
|
||||
print( STDERR "Mpeg encoding is not currently enabled\n" );
|
||||
exit(-1);
|
||||
|
@ -221,7 +221,7 @@ if ( $overwrite || !-s $video_file )
|
|||
$video_size = $size;
|
||||
}
|
||||
|
||||
my $command = ZM_PATH_FFMPEG." -y -r $frame_rate ".ZM_FFMPEG_INPUT_OPTIONS." -i %0".ZM_EVENT_IMAGE_DIGITS."d-capture.jpg -s $video_size ".ZM_FFMPEG_OUTPUT_OPTIONS." '$video_file' > ffmpeg.log 2>&1";
|
||||
my $command = $Config{ZM_PATH_FFMPEG}." -y -r $frame_rate ".$Config{ZM_FFMPEG_INPUT_OPTIONS}." -i %0".$Config{ZM_EVENT_IMAGE_DIGITS}."d-capture.jpg -s $video_size ".$Config{ZM_FFMPEG_OUTPUT_OPTIONS}." '$video_file' > ffmpeg.log 2>&1";
|
||||
Debug( $command."\n" );
|
||||
my $output = qx($command);
|
||||
|
||||
|
|
|
@ -90,7 +90,7 @@ while( 1 )
|
|||
next if ( !defined($image_time) ); # Can't read from shared data
|
||||
next if ( !$image_time ); # We can't get the last capture time so can't be sure it's died.
|
||||
|
||||
my $max_image_delay = ($monitor->{MaxFPS}&&($monitor->{MaxFPS}>0)&&($monitor->{MaxFPS}<1))?(3/$monitor->{MaxFPS}):ZM_WATCH_MAX_DELAY;
|
||||
my $max_image_delay = ($monitor->{MaxFPS}&&($monitor->{MaxFPS}>0)&&($monitor->{MaxFPS}<1))?(3/$monitor->{MaxFPS}):$Config{ZM_WATCH_MAX_DELAY};
|
||||
my $image_delay = $now-$image_time;
|
||||
Debug( "Monitor $monitor->{Id} last captured $image_delay seconds ago, max is $max_image_delay\n" );
|
||||
if ( $image_delay > $max_image_delay )
|
||||
|
@ -127,7 +127,7 @@ while( 1 )
|
|||
next if ( !defined($image_time) ); # Can't read from shared data
|
||||
next if ( !$image_time ); # We can't get the last capture time so can't be sure it's died.
|
||||
|
||||
my $max_image_delay = ($monitor->{MaxFPS}&&($monitor->{MaxFPS}>0)&&($monitor->{MaxFPS}<1))?(3/$monitor->{MaxFPS}):ZM_WATCH_MAX_DELAY;
|
||||
my $max_image_delay = ($monitor->{MaxFPS}&&($monitor->{MaxFPS}>0)&&($monitor->{MaxFPS}<1))?(3/$monitor->{MaxFPS}):$Config{ZM_WATCH_MAX_DELAY};
|
||||
my $image_delay = $now-$image_time;
|
||||
Debug( "Monitor $monitor->{Id} last analysed $image_delay seconds ago, max is $max_image_delay\n" );
|
||||
if ( $image_delay > $max_image_delay )
|
||||
|
@ -142,7 +142,7 @@ while( 1 )
|
|||
# Prevent open handles building up if we have connect to shared memory
|
||||
zmMemInvalidate( $monitor );
|
||||
}
|
||||
sleep( ZM_WATCH_CHECK_INTERVAL );
|
||||
sleep( $Config{ZM_WATCH_CHECK_INTERVAL} );
|
||||
}
|
||||
Info( "Watchdog exiting\n" );
|
||||
exit();
|
||||
|
|
|
@ -48,7 +48,7 @@ use Socket;
|
|||
use Getopt::Long;
|
||||
use Data::Dumper;
|
||||
|
||||
use constant SOCK_FILE => ZM_PATH_SOCKS.'/zmx10.sock';
|
||||
use constant SOCK_FILE => $Config{ZM_PATH_SOCKS}.'/zmx10.sock';
|
||||
|
||||
$| = 1;
|
||||
|
||||
|
|
|
@ -1,10 +1,10 @@
|
|||
# CMakeLists.txt for the ZoneMinder binaries
|
||||
|
||||
# Create files from the .in files
|
||||
configure_file(zm_config.h.in ${CMAKE_CURRENT_SOURCE_DIR}/zm_config.h @ONLY)
|
||||
configure_file(zm_config.h.in "${CMAKE_CURRENT_BINARY_DIR}/zm_config.h" @ONLY)
|
||||
|
||||
# Group together all the source files that are used by all the binaries (zmc, zma, zmu, zms etc)
|
||||
set(ZM_BIN_SRC_FILES zm_box.cpp zm_buffer.cpp zm_camera.cpp zm_comms.cpp zm_config.cpp zm_coord.cpp zm.cpp zm_db.cpp zm_logger.cpp zm_event.cpp zm_exception.cpp zm_file_camera.cpp zm_ffmpeg_camera.cpp zm_image.cpp zm_jpeg.cpp zm_local_camera.cpp zm_monitor.cpp zm_ffmpeg.cpp zm_mpeg.cpp zm_poly.cpp zm_regexp.cpp zm_remote_camera.cpp zm_remote_camera_http.cpp zm_remote_camera_rtsp.cpp zm_rtp.cpp zm_rtp_ctrl.cpp zm_rtp_data.cpp zm_rtp_source.cpp zm_rtsp.cpp zm_sdp.cpp zm_signal.cpp zm_stream.cpp zm_thread.cpp zm_time.cpp zm_timer.cpp zm_user.cpp zm_utils.cpp zm_zone.cpp)
|
||||
set(ZM_BIN_SRC_FILES zm_box.cpp zm_buffer.cpp zm_camera.cpp zm_comms.cpp zm_config.cpp zm_coord.cpp zm_curl_camera.cpp zm.cpp zm_db.cpp zm_logger.cpp zm_event.cpp zm_exception.cpp zm_file_camera.cpp zm_ffmpeg_camera.cpp zm_image.cpp zm_jpeg.cpp zm_libvlc_camera.cpp zm_local_camera.cpp zm_monitor.cpp zm_ffmpeg.cpp zm_mpeg.cpp zm_poly.cpp zm_regexp.cpp zm_remote_camera.cpp zm_remote_camera_http.cpp zm_remote_camera_rtsp.cpp zm_rtp.cpp zm_rtp_ctrl.cpp zm_rtp_data.cpp zm_rtp_source.cpp zm_rtsp.cpp zm_sdp.cpp zm_signal.cpp zm_stream.cpp zm_thread.cpp zm_time.cpp zm_timer.cpp zm_user.cpp zm_utils.cpp zm_zone.cpp)
|
||||
|
||||
# A fix for cmake recompiling the source files for every target.
|
||||
add_library(zm STATIC ${ZM_BIN_SRC_FILES})
|
||||
|
@ -16,7 +16,6 @@ add_executable(zmf zmf.cpp)
|
|||
add_executable(zms zms.cpp)
|
||||
add_executable(nph-zms zms.cpp)
|
||||
add_executable(zmstreamer zmstreamer.cpp)
|
||||
add_executable(zmfix zmfix.cpp zm_config.cpp zm_regexp.cpp zm_logger.cpp zm_utils.cpp zm_db.cpp zm.cpp)
|
||||
|
||||
target_link_libraries(zmc zm ${ZM_EXTRA_LIBS} ${ZM_BIN_LIBS})
|
||||
target_link_libraries(zma zm ${ZM_EXTRA_LIBS} ${ZM_BIN_LIBS})
|
||||
|
@ -25,9 +24,8 @@ 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(nph-zms zm ${ZM_EXTRA_LIBS} ${ZM_BIN_LIBS})
|
||||
target_link_libraries(zmstreamer zm ${ZM_EXTRA_LIBS} ${ZM_BIN_LIBS})
|
||||
target_link_libraries(zmfix ${ZM_EXTRA_LIBS} ${ZM_BIN_LIBS})
|
||||
|
||||
install(TARGETS zmc zma zmu zmf zmstreamer zmfix 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 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 nph-zms RUNTIME DESTINATION "${ZM_CGIDIR}" PERMISSIONS OWNER_WRITE OWNER_READ OWNER_EXECUTE GROUP_READ GROUP_EXECUTE WORLD_READ WORLD_EXECUTE)
|
||||
|
||||
|
||||
|
|
|
@ -17,8 +17,7 @@ bin_PROGRAMS = \
|
|||
zmu \
|
||||
zms \
|
||||
zmf \
|
||||
zmstreamer \
|
||||
zmfix
|
||||
zmstreamer
|
||||
|
||||
zm_SOURCES = \
|
||||
zm_box.cpp \
|
||||
|
@ -27,6 +26,7 @@ zm_SOURCES = \
|
|||
zm_comms.cpp \
|
||||
zm_config.cpp \
|
||||
zm_coord.cpp \
|
||||
zm_curl_camera.cpp \
|
||||
zm.cpp \
|
||||
zm_db.cpp \
|
||||
zm_logger.cpp \
|
||||
|
@ -36,6 +36,7 @@ zm_SOURCES = \
|
|||
zm_ffmpeg_camera.cpp \
|
||||
zm_image.cpp \
|
||||
zm_jpeg.cpp \
|
||||
zm_libvlc_camera.cpp \
|
||||
zm_local_camera.cpp \
|
||||
zm_monitor.cpp \
|
||||
zm_ffmpeg.cpp \
|
||||
|
@ -67,7 +68,6 @@ zms_SOURCES = zms.cpp $(zm_SOURCES)
|
|||
zmu_SOURCES = zmu.cpp $(zm_SOURCES)
|
||||
zmf_SOURCES = zmf.cpp $(zm_SOURCES)
|
||||
zmstreamer_SOURCES = zmstreamer.cpp $(zm_SOURCES)
|
||||
zmfix_SOURCES = zmfix.cpp zm_config.cpp zm_regexp.cpp zm_logger.cpp zm_utils.cpp zm_db.cpp zm.cpp
|
||||
|
||||
noinst_HEADERS = \
|
||||
jinclude.h \
|
||||
|
@ -78,6 +78,7 @@ noinst_HEADERS = \
|
|||
zm_config_defines.h \
|
||||
zm_config.h \
|
||||
zm_coord.h \
|
||||
zm_curl_camera.h \
|
||||
zm_db.h \
|
||||
zm_logger.h \
|
||||
zm_event.h \
|
||||
|
@ -90,6 +91,7 @@ noinst_HEADERS = \
|
|||
zm.h \
|
||||
zm_image.h \
|
||||
zm_jpeg.h \
|
||||
zm_libvlc_camera.h \
|
||||
zm_local_camera.h \
|
||||
zm_mem_utils.h \
|
||||
zm_monitor.h \
|
||||
|
@ -128,7 +130,6 @@ dist-hook:
|
|||
install-exec-hook:
|
||||
( cd $(DESTDIR)@bindir@; mkdir -p $(DESTDIR)$(cgidir); mv zms $(DESTDIR)$(cgidir) )
|
||||
( cd $(DESTDIR)$(cgidir); chown $(webuser):$(webgroup) zms; ln -f zms nph-zms )
|
||||
( cd $(DESTDIR)@bindir@; chmod u+s zmfix )
|
||||
|
||||
uninstall-hook:
|
||||
( cd $(DESTDIR)$(cgidir); rm -f zms nph-zms )
|
||||
|
|
|
@ -19,4 +19,5 @@
|
|||
|
||||
#include "zm.h"
|
||||
|
||||
// This space intentionally left blank
|
||||
/* This is our argv[0], we need it for backtrace */
|
||||
const char* self = 0;
|
||||
|
|
9
src/zm.h
9
src/zm.h
|
@ -23,13 +23,8 @@
|
|||
#include "zm_config.h"
|
||||
#include "zm_logger.h"
|
||||
|
||||
extern "C"
|
||||
{
|
||||
#if !HAVE_DECL_ROUND
|
||||
double round(double);
|
||||
#endif
|
||||
}
|
||||
|
||||
#include <stdint.h>
|
||||
|
||||
extern const char* self;
|
||||
|
||||
#endif // ZM_H
|
||||
|
|
|
@ -32,7 +32,7 @@
|
|||
class Camera
|
||||
{
|
||||
protected:
|
||||
typedef enum { LOCAL_SRC, REMOTE_SRC, FILE_SRC, FFMPEG_SRC } SourceType;
|
||||
typedef enum { LOCAL_SRC, REMOTE_SRC, FILE_SRC, FFMPEG_SRC, LIBVLC_SRC, CURL_SRC } SourceType;
|
||||
|
||||
int id;
|
||||
SourceType type;
|
||||
|
@ -58,6 +58,8 @@ public:
|
|||
bool IsRemote() const { return( type == REMOTE_SRC ); }
|
||||
bool IsFile() const { return( type == FILE_SRC ); }
|
||||
bool IsFfmpeg() const { return( type == FFMPEG_SRC ); }
|
||||
bool IsLibvlc() const { return( type == LIBVLC_SRC ); }
|
||||
bool IscURL() const { return( type == CURL_SRC ); }
|
||||
unsigned int Width() const { return( width ); }
|
||||
unsigned int Height() const { return( height ); }
|
||||
unsigned int Colours() const { return( colours ); }
|
||||
|
|
|
@ -45,6 +45,7 @@
|
|||
#define ZM_SCALE_BASE 100 // The factor by which we bump up 'scale' to simulate FP
|
||||
#define ZM_RATE_BASE 100 // The factor by which we bump up 'rate' to simulate FP
|
||||
|
||||
#define ZM_SQL_BATCH_SIZE 50 // Limit the size of multi-row SQL statements
|
||||
#define ZM_SQL_SML_BUFSIZ 256 // Size of SQL buffer
|
||||
#define ZM_SQL_MED_BUFSIZ 1024 // Size of SQL buffer
|
||||
#define ZM_SQL_LGE_BUFSIZ 8192 // Size of SQL buffer
|
||||
|
|
|
@ -1,664 +0,0 @@
|
|||
// The file is autogenerated by zmconfgen.pl
|
||||
// Do not edit this file as any changes will be overwritten
|
||||
|
||||
#define ZM_LANG_DEFAULT 0
|
||||
#define ZM_OPT_USE_AUTH 1
|
||||
#define ZM_AUTH_TYPE 2
|
||||
#define ZM_AUTH_RELAY 3
|
||||
#define ZM_AUTH_HASH_SECRET 4
|
||||
#define ZM_AUTH_HASH_IPS 5
|
||||
#define ZM_AUTH_HASH_LOGINS 6
|
||||
#define ZM_DIR_EVENTS 7
|
||||
#define ZM_USE_DEEP_STORAGE 8
|
||||
#define ZM_DIR_IMAGES 9
|
||||
#define ZM_DIR_SOUNDS 10
|
||||
#define ZM_PATH_ZMS 11
|
||||
#define ZM_USE_MKV_STORAGE 12
|
||||
#define ZM_COLOUR_JPEG_FILES 13
|
||||
#define ZM_ADD_JPEG_COMMENTS 14
|
||||
#define ZM_JPEG_FILE_QUALITY 15
|
||||
#define ZM_JPEG_ALARM_FILE_QUALITY 16
|
||||
#define ZM_JPEG_IMAGE_QUALITY 17
|
||||
#define ZM_JPEG_STREAM_QUALITY 18
|
||||
#define ZM_MPEG_TIMED_FRAMES 19
|
||||
#define ZM_MPEG_LIVE_FORMAT 20
|
||||
#define ZM_MPEG_REPLAY_FORMAT 21
|
||||
#define ZM_RAND_STREAM 22
|
||||
#define ZM_OPT_CAMBOZOLA 23
|
||||
#define ZM_PATH_CAMBOZOLA 24
|
||||
#define ZM_RELOAD_CAMBOZOLA 25
|
||||
#define ZM_TIMESTAMP_ON_CAPTURE 26
|
||||
#define ZM_CPU_EXTENSIONS 27
|
||||
#define ZM_FAST_IMAGE_BLENDS 28
|
||||
#define ZM_OPT_ADAPTIVE_SKIP 29
|
||||
#define ZM_BLEND_ALARMED_IMAGES 30
|
||||
#define ZM_MAX_SUSPEND_TIME 31
|
||||
#define ZM_OPT_REMOTE_CAMERAS 32
|
||||
#define ZM_NETCAM_REGEXPS 33
|
||||
#define ZM_HTTP_VERSION 34
|
||||
#define ZM_HTTP_UA 35
|
||||
#define ZM_HTTP_TIMEOUT 36
|
||||
#define ZM_MIN_RTP_PORT 37
|
||||
#define ZM_MAX_RTP_PORT 38
|
||||
#define ZM_OPT_FFMPEG 39
|
||||
#define ZM_PATH_FFMPEG 40
|
||||
#define ZM_FFMPEG_INPUT_OPTIONS 41
|
||||
#define ZM_FFMPEG_OUTPUT_OPTIONS 42
|
||||
#define ZM_FFMPEG_FORMATS 43
|
||||
#define ZM_LOG_LEVEL_SYSLOG 44
|
||||
#define ZM_LOG_LEVEL_FILE 45
|
||||
#define ZM_LOG_LEVEL_WEBLOG 46
|
||||
#define ZM_LOG_LEVEL_DATABASE 47
|
||||
#define ZM_LOG_DATABASE_LIMIT 48
|
||||
#define ZM_LOG_DEBUG 49
|
||||
#define ZM_LOG_DEBUG_TARGET 50
|
||||
#define ZM_LOG_DEBUG_LEVEL 51
|
||||
#define ZM_LOG_DEBUG_FILE 52
|
||||
#define ZM_LOG_CHECK_PERIOD 53
|
||||
#define ZM_LOG_ALERT_WAR_COUNT 54
|
||||
#define ZM_LOG_ALERT_ERR_COUNT 55
|
||||
#define ZM_LOG_ALERT_FAT_COUNT 56
|
||||
#define ZM_LOG_ALARM_WAR_COUNT 57
|
||||
#define ZM_LOG_ALARM_ERR_COUNT 58
|
||||
#define ZM_LOG_ALARM_FAT_COUNT 59
|
||||
#define ZM_RECORD_EVENT_STATS 60
|
||||
#define ZM_RECORD_DIAG_IMAGES 61
|
||||
#define ZM_DUMP_CORES 62
|
||||
#define ZM_PATH_MAP 63
|
||||
#define ZM_PATH_SOCKS 64
|
||||
#define ZM_PATH_LOGS 65
|
||||
#define ZM_PATH_SWAP 66
|
||||
#define ZM_WEB_TITLE_PREFIX 67
|
||||
#define ZM_WEB_RESIZE_CONSOLE 68
|
||||
#define ZM_WEB_POPUP_ON_ALARM 69
|
||||
#define ZM_OPT_X10 70
|
||||
#define ZM_X10_DEVICE 71
|
||||
#define ZM_X10_HOUSE_CODE 72
|
||||
#define ZM_X10_DB_RELOAD_INTERVAL 73
|
||||
#define ZM_WEB_SOUND_ON_ALARM 74
|
||||
#define ZM_WEB_ALARM_SOUND 75
|
||||
#define ZM_WEB_COMPACT_MONTAGE 76
|
||||
#define ZM_OPT_FAST_DELETE 77
|
||||
#define ZM_STRICT_VIDEO_CONFIG 78
|
||||
#define ZM_SIGNAL_CHECK_POINTS 79
|
||||
#define ZM_V4L_MULTI_BUFFER 80
|
||||
#define ZM_CAPTURES_PER_FRAME 81
|
||||
#define ZM_FILTER_RELOAD_DELAY 82
|
||||
#define ZM_FILTER_EXECUTE_INTERVAL 83
|
||||
#define ZM_OPT_UPLOAD 84
|
||||
#define ZM_UPLOAD_ARCH_FORMAT 85
|
||||
#define ZM_UPLOAD_ARCH_COMPRESS 86
|
||||
#define ZM_UPLOAD_ARCH_ANALYSE 87
|
||||
#define ZM_UPLOAD_PROTOCOL 88
|
||||
#define ZM_UPLOAD_FTP_HOST 89
|
||||
#define ZM_UPLOAD_HOST 90
|
||||
#define ZM_UPLOAD_PORT 91
|
||||
#define ZM_UPLOAD_FTP_USER 92
|
||||
#define ZM_UPLOAD_USER 93
|
||||
#define ZM_UPLOAD_FTP_PASS 94
|
||||
#define ZM_UPLOAD_PASS 95
|
||||
#define ZM_UPLOAD_FTP_LOC_DIR 96
|
||||
#define ZM_UPLOAD_LOC_DIR 97
|
||||
#define ZM_UPLOAD_FTP_REM_DIR 98
|
||||
#define ZM_UPLOAD_REM_DIR 99
|
||||
#define ZM_UPLOAD_FTP_TIMEOUT 100
|
||||
#define ZM_UPLOAD_TIMEOUT 101
|
||||
#define ZM_UPLOAD_FTP_PASSIVE 102
|
||||
#define ZM_UPLOAD_FTP_DEBUG 103
|
||||
#define ZM_UPLOAD_DEBUG 104
|
||||
#define ZM_OPT_EMAIL 105
|
||||
#define ZM_EMAIL_ADDRESS 106
|
||||
#define ZM_EMAIL_TEXT 107
|
||||
#define ZM_EMAIL_SUBJECT 108
|
||||
#define ZM_EMAIL_BODY 109
|
||||
#define ZM_OPT_MESSAGE 110
|
||||
#define ZM_MESSAGE_ADDRESS 111
|
||||
#define ZM_MESSAGE_TEXT 112
|
||||
#define ZM_MESSAGE_SUBJECT 113
|
||||
#define ZM_MESSAGE_BODY 114
|
||||
#define ZM_NEW_MAIL_MODULES 115
|
||||
#define ZM_EMAIL_HOST 116
|
||||
#define ZM_FROM_EMAIL 117
|
||||
#define ZM_URL 118
|
||||
#define ZM_MAX_RESTART_DELAY 119
|
||||
#define ZM_WATCH_CHECK_INTERVAL 120
|
||||
#define ZM_WATCH_MAX_DELAY 121
|
||||
#define ZM_RUN_AUDIT 122
|
||||
#define ZM_AUDIT_CHECK_INTERVAL 123
|
||||
#define ZM_FORCED_ALARM_SCORE 124
|
||||
#define ZM_BULK_FRAME_INTERVAL 125
|
||||
#define ZM_EVENT_CLOSE_MODE 126
|
||||
#define ZM_FORCE_CLOSE_EVENTS 127
|
||||
#define ZM_CREATE_ANALYSIS_IMAGES 128
|
||||
#define ZM_WEIGHTED_ALARM_CENTRES 129
|
||||
#define ZM_EVENT_IMAGE_DIGITS 130
|
||||
#define ZM_DEFAULT_ASPECT_RATIO 131
|
||||
#define ZM_USER_SELF_EDIT 132
|
||||
#define ZM_OPT_FRAME_SERVER 133
|
||||
#define ZM_FRAME_SOCKET_SIZE 134
|
||||
#define ZM_OPT_CONTROL 135
|
||||
#define ZM_OPT_TRIGGERS 136
|
||||
#define ZM_CHECK_FOR_UPDATES 137
|
||||
#define ZM_UPDATE_CHECK_PROXY 138
|
||||
#define ZM_SHM_KEY 139
|
||||
#define ZM_WEB_REFRESH_METHOD 140
|
||||
#define ZM_WEB_EVENT_SORT_FIELD 141
|
||||
#define ZM_WEB_EVENT_SORT_ORDER 142
|
||||
#define ZM_WEB_EVENTS_PER_PAGE 143
|
||||
#define ZM_WEB_LIST_THUMBS 144
|
||||
#define ZM_WEB_LIST_THUMB_WIDTH 145
|
||||
#define ZM_WEB_LIST_THUMB_HEIGHT 146
|
||||
#define ZM_WEB_USE_OBJECT_TAGS 147
|
||||
#define ZM_WEB_H_REFRESH_MAIN 148
|
||||
#define ZM_WEB_H_REFRESH_CYCLE 149
|
||||
#define ZM_WEB_H_REFRESH_IMAGE 150
|
||||
#define ZM_WEB_H_REFRESH_STATUS 151
|
||||
#define ZM_WEB_H_REFRESH_EVENTS 152
|
||||
#define ZM_WEB_H_CAN_STREAM 153
|
||||
#define ZM_WEB_H_STREAM_METHOD 154
|
||||
#define ZM_WEB_H_DEFAULT_SCALE 155
|
||||
#define ZM_WEB_H_DEFAULT_RATE 156
|
||||
#define ZM_WEB_H_VIDEO_BITRATE 157
|
||||
#define ZM_WEB_H_VIDEO_MAXFPS 158
|
||||
#define ZM_WEB_H_SCALE_THUMBS 159
|
||||
#define ZM_WEB_H_EVENTS_VIEW 160
|
||||
#define ZM_WEB_H_SHOW_PROGRESS 161
|
||||
#define ZM_WEB_H_AJAX_TIMEOUT 162
|
||||
#define ZM_WEB_M_REFRESH_MAIN 163
|
||||
#define ZM_WEB_M_REFRESH_CYCLE 164
|
||||
#define ZM_WEB_M_REFRESH_IMAGE 165
|
||||
#define ZM_WEB_M_REFRESH_STATUS 166
|
||||
#define ZM_WEB_M_REFRESH_EVENTS 167
|
||||
#define ZM_WEB_M_CAN_STREAM 168
|
||||
#define ZM_WEB_M_STREAM_METHOD 169
|
||||
#define ZM_WEB_M_DEFAULT_SCALE 170
|
||||
#define ZM_WEB_M_DEFAULT_RATE 171
|
||||
#define ZM_WEB_M_VIDEO_BITRATE 172
|
||||
#define ZM_WEB_M_VIDEO_MAXFPS 173
|
||||
#define ZM_WEB_M_SCALE_THUMBS 174
|
||||
#define ZM_WEB_M_EVENTS_VIEW 175
|
||||
#define ZM_WEB_M_SHOW_PROGRESS 176
|
||||
#define ZM_WEB_M_AJAX_TIMEOUT 177
|
||||
#define ZM_WEB_L_REFRESH_MAIN 178
|
||||
#define ZM_WEB_L_REFRESH_CYCLE 179
|
||||
#define ZM_WEB_L_REFRESH_IMAGE 180
|
||||
#define ZM_WEB_L_REFRESH_STATUS 181
|
||||
#define ZM_WEB_L_REFRESH_EVENTS 182
|
||||
#define ZM_WEB_L_CAN_STREAM 183
|
||||
#define ZM_WEB_L_STREAM_METHOD 184
|
||||
#define ZM_WEB_L_DEFAULT_SCALE 185
|
||||
#define ZM_WEB_L_DEFAULT_RATE 186
|
||||
#define ZM_WEB_L_VIDEO_BITRATE 187
|
||||
#define ZM_WEB_L_VIDEO_MAXFPS 188
|
||||
#define ZM_WEB_L_SCALE_THUMBS 189
|
||||
#define ZM_WEB_L_EVENTS_VIEW 190
|
||||
#define ZM_WEB_L_SHOW_PROGRESS 191
|
||||
#define ZM_WEB_L_AJAX_TIMEOUT 192
|
||||
#define ZM_WEB_P_CAN_STREAM 193
|
||||
#define ZM_WEB_P_STREAM_METHOD 194
|
||||
#define ZM_WEB_P_DEFAULT_SCALE 195
|
||||
#define ZM_WEB_P_DEFAULT_RATE 196
|
||||
#define ZM_WEB_P_VIDEO_BITRATE 197
|
||||
#define ZM_WEB_P_VIDEO_MAXFPS 198
|
||||
#define ZM_WEB_P_SCALE_THUMBS 199
|
||||
#define ZM_WEB_P_AJAX_TIMEOUT 200
|
||||
#define ZM_DYN_LAST_VERSION 201
|
||||
#define ZM_DYN_CURR_VERSION 202
|
||||
#define ZM_DYN_DB_VERSION 203
|
||||
#define ZM_DYN_LAST_CHECK 204
|
||||
#define ZM_DYN_NEXT_REMINDER 205
|
||||
#define ZM_DYN_DONATE_REMINDER_TIME 206
|
||||
#define ZM_DYN_SHOW_DONATE_REMINDER 207
|
||||
#define ZM_EYEZM_DEBUG 208
|
||||
#define ZM_EYEZM_LOG_TO_FILE 209
|
||||
#define ZM_EYEZM_LOG_FILE 210
|
||||
#define ZM_EYEZM_EVENT_VCODEC 211
|
||||
#define ZM_EYEZM_FEED_VCODEC 212
|
||||
#define ZM_EYEZM_H264_DEFAULT_BR 213
|
||||
#define ZM_EYEZM_H264_DEFAULT_EVBR 214
|
||||
#define ZM_EYEZM_H264_TIMEOUT 215
|
||||
#define ZM_EYEZM_SEG_DURATION 216
|
||||
|
||||
|
||||
#define ZM_MAX_CFG_ID 216
|
||||
|
||||
#define ZM_CFG_DECLARE_LIST \
|
||||
const char *lang_default;\
|
||||
bool opt_use_auth;\
|
||||
const char *auth_type;\
|
||||
const char *auth_relay;\
|
||||
const char *auth_hash_secret;\
|
||||
bool auth_hash_ips;\
|
||||
bool auth_hash_logins;\
|
||||
const char *dir_events;\
|
||||
bool use_deep_storage;\
|
||||
const char *dir_images;\
|
||||
const char *dir_sounds;\
|
||||
const char *path_zms;\
|
||||
bool use_mkv_storage;\
|
||||
bool colour_jpeg_files;\
|
||||
bool add_jpeg_comments;\
|
||||
int jpeg_file_quality;\
|
||||
int jpeg_alarm_file_quality;\
|
||||
int jpeg_image_quality;\
|
||||
int jpeg_stream_quality;\
|
||||
bool mpeg_timed_frames;\
|
||||
const char *mpeg_live_format;\
|
||||
const char *mpeg_replay_format;\
|
||||
bool rand_stream;\
|
||||
bool opt_cambozola;\
|
||||
const char *path_cambozola;\
|
||||
int reload_cambozola;\
|
||||
bool timestamp_on_capture;\
|
||||
bool cpu_extensions;\
|
||||
bool fast_image_blends;\
|
||||
bool opt_adaptive_skip;\
|
||||
bool blend_alarmed_images;\
|
||||
int max_suspend_time;\
|
||||
bool opt_remote_cameras;\
|
||||
bool netcam_regexps;\
|
||||
const char *http_version;\
|
||||
const char *http_ua;\
|
||||
int http_timeout;\
|
||||
int min_rtp_port;\
|
||||
int max_rtp_port;\
|
||||
bool opt_ffmpeg;\
|
||||
const char *path_ffmpeg;\
|
||||
const char *ffmpeg_input_options;\
|
||||
const char *ffmpeg_output_options;\
|
||||
const char *ffmpeg_formats;\
|
||||
int log_level_syslog;\
|
||||
int log_level_file;\
|
||||
int log_level_weblog;\
|
||||
int log_level_database;\
|
||||
const char *log_database_limit;\
|
||||
bool log_debug;\
|
||||
const char *log_debug_target;\
|
||||
int log_debug_level;\
|
||||
const char *log_debug_file;\
|
||||
int log_check_period;\
|
||||
int log_alert_war_count;\
|
||||
int log_alert_err_count;\
|
||||
int log_alert_fat_count;\
|
||||
int log_alarm_war_count;\
|
||||
int log_alarm_err_count;\
|
||||
int log_alarm_fat_count;\
|
||||
bool record_event_stats;\
|
||||
bool record_diag_images;\
|
||||
bool dump_cores;\
|
||||
const char *path_map;\
|
||||
const char *path_socks;\
|
||||
const char *path_logs;\
|
||||
const char *path_swap;\
|
||||
const char *web_title_prefix;\
|
||||
bool web_resize_console;\
|
||||
bool web_popup_on_alarm;\
|
||||
bool opt_x10;\
|
||||
const char *x10_device;\
|
||||
const char *x10_house_code;\
|
||||
int x10_db_reload_interval;\
|
||||
bool web_sound_on_alarm;\
|
||||
const char *web_alarm_sound;\
|
||||
bool web_compact_montage;\
|
||||
bool opt_fast_delete;\
|
||||
bool strict_video_config;\
|
||||
int signal_check_points;\
|
||||
bool v4l_multi_buffer;\
|
||||
int captures_per_frame;\
|
||||
int filter_reload_delay;\
|
||||
int filter_execute_interval;\
|
||||
bool opt_upload;\
|
||||
const char *upload_arch_format;\
|
||||
bool upload_arch_compress;\
|
||||
bool upload_arch_analyse;\
|
||||
const char *upload_protocol;\
|
||||
const char *upload_ftp_host;\
|
||||
const char *upload_host;\
|
||||
int upload_port;\
|
||||
const char *upload_ftp_user;\
|
||||
const char *upload_user;\
|
||||
const char *upload_ftp_pass;\
|
||||
const char *upload_pass;\
|
||||
const char *upload_ftp_loc_dir;\
|
||||
const char *upload_loc_dir;\
|
||||
const char *upload_ftp_rem_dir;\
|
||||
const char *upload_rem_dir;\
|
||||
int upload_ftp_timeout;\
|
||||
int upload_timeout;\
|
||||
bool upload_ftp_passive;\
|
||||
bool upload_ftp_debug;\
|
||||
bool upload_debug;\
|
||||
bool opt_email;\
|
||||
const char *email_address;\
|
||||
const char *email_text;\
|
||||
const char *email_subject;\
|
||||
const char *email_body;\
|
||||
bool opt_message;\
|
||||
const char *message_address;\
|
||||
const char *message_text;\
|
||||
const char *message_subject;\
|
||||
const char *message_body;\
|
||||
bool new_mail_modules;\
|
||||
const char *email_host;\
|
||||
const char *from_email;\
|
||||
const char *url;\
|
||||
int max_restart_delay;\
|
||||
int watch_check_interval;\
|
||||
double watch_max_delay;\
|
||||
bool run_audit;\
|
||||
int audit_check_interval;\
|
||||
int forced_alarm_score;\
|
||||
int bulk_frame_interval;\
|
||||
const char *event_close_mode;\
|
||||
bool force_close_events;\
|
||||
bool create_analysis_images;\
|
||||
bool weighted_alarm_centres;\
|
||||
int event_image_digits;\
|
||||
const char *default_aspect_ratio;\
|
||||
bool user_self_edit;\
|
||||
bool opt_frame_server;\
|
||||
int frame_socket_size;\
|
||||
bool opt_control;\
|
||||
bool opt_triggers;\
|
||||
bool check_for_updates;\
|
||||
const char *update_check_proxy;\
|
||||
int shm_key;\
|
||||
const char *web_refresh_method;\
|
||||
const char *web_event_sort_field;\
|
||||
const char *web_event_sort_order;\
|
||||
int web_events_per_page;\
|
||||
bool web_list_thumbs;\
|
||||
int web_list_thumb_width;\
|
||||
int web_list_thumb_height;\
|
||||
bool web_use_object_tags;\
|
||||
int web_h_refresh_main;\
|
||||
int web_h_refresh_cycle;\
|
||||
int web_h_refresh_image;\
|
||||
int web_h_refresh_status;\
|
||||
int web_h_refresh_events;\
|
||||
const char *web_h_can_stream;\
|
||||
const char *web_h_stream_method;\
|
||||
int web_h_default_scale;\
|
||||
int web_h_default_rate;\
|
||||
int web_h_video_bitrate;\
|
||||
int web_h_video_maxfps;\
|
||||
bool web_h_scale_thumbs;\
|
||||
const char *web_h_events_view;\
|
||||
bool web_h_show_progress;\
|
||||
int web_h_ajax_timeout;\
|
||||
int web_m_refresh_main;\
|
||||
int web_m_refresh_cycle;\
|
||||
int web_m_refresh_image;\
|
||||
int web_m_refresh_status;\
|
||||
int web_m_refresh_events;\
|
||||
const char *web_m_can_stream;\
|
||||
const char *web_m_stream_method;\
|
||||
int web_m_default_scale;\
|
||||
int web_m_default_rate;\
|
||||
int web_m_video_bitrate;\
|
||||
int web_m_video_maxfps;\
|
||||
bool web_m_scale_thumbs;\
|
||||
const char *web_m_events_view;\
|
||||
bool web_m_show_progress;\
|
||||
int web_m_ajax_timeout;\
|
||||
int web_l_refresh_main;\
|
||||
int web_l_refresh_cycle;\
|
||||
int web_l_refresh_image;\
|
||||
int web_l_refresh_status;\
|
||||
int web_l_refresh_events;\
|
||||
const char *web_l_can_stream;\
|
||||
const char *web_l_stream_method;\
|
||||
int web_l_default_scale;\
|
||||
int web_l_default_rate;\
|
||||
int web_l_video_bitrate;\
|
||||
int web_l_video_maxfps;\
|
||||
bool web_l_scale_thumbs;\
|
||||
const char *web_l_events_view;\
|
||||
bool web_l_show_progress;\
|
||||
int web_l_ajax_timeout;\
|
||||
const char *web_p_can_stream;\
|
||||
const char *web_p_stream_method;\
|
||||
int web_p_default_scale;\
|
||||
int web_p_default_rate;\
|
||||
int web_p_video_bitrate;\
|
||||
int web_p_video_maxfps;\
|
||||
bool web_p_scale_thumbs;\
|
||||
int web_p_ajax_timeout;\
|
||||
const char *dyn_last_version;\
|
||||
const char *dyn_curr_version;\
|
||||
const char *dyn_db_version;\
|
||||
int dyn_last_check;\
|
||||
const char *dyn_next_reminder;\
|
||||
int dyn_donate_reminder_time;\
|
||||
bool dyn_show_donate_reminder;\
|
||||
bool eyezm_debug;\
|
||||
bool eyezm_log_to_file;\
|
||||
const char *eyezm_log_file;\
|
||||
const char *eyezm_event_vcodec;\
|
||||
const char *eyezm_feed_vcodec;\
|
||||
const char *eyezm_h264_default_br;\
|
||||
const char *eyezm_h264_default_evbr;\
|
||||
const char *eyezm_h264_timeout;\
|
||||
const char *eyezm_seg_duration;\
|
||||
|
||||
|
||||
#define ZM_CFG_ASSIGN_LIST \
|
||||
lang_default = (const char *)config.Item( ZM_LANG_DEFAULT );\
|
||||
opt_use_auth = (bool)config.Item( ZM_OPT_USE_AUTH );\
|
||||
auth_type = (const char *)config.Item( ZM_AUTH_TYPE );\
|
||||
auth_relay = (const char *)config.Item( ZM_AUTH_RELAY );\
|
||||
auth_hash_secret = (const char *)config.Item( ZM_AUTH_HASH_SECRET );\
|
||||
auth_hash_ips = (bool)config.Item( ZM_AUTH_HASH_IPS );\
|
||||
auth_hash_logins = (bool)config.Item( ZM_AUTH_HASH_LOGINS );\
|
||||
dir_events = (const char *)config.Item( ZM_DIR_EVENTS );\
|
||||
use_deep_storage = (bool)config.Item( ZM_USE_DEEP_STORAGE );\
|
||||
dir_images = (const char *)config.Item( ZM_DIR_IMAGES );\
|
||||
dir_sounds = (const char *)config.Item( ZM_DIR_SOUNDS );\
|
||||
path_zms = (const char *)config.Item( ZM_PATH_ZMS );\
|
||||
use_mkv_storage = (bool)config.Item( ZM_USE_MKV_STORAGE );\
|
||||
colour_jpeg_files = (bool)config.Item( ZM_COLOUR_JPEG_FILES );\
|
||||
add_jpeg_comments = (bool)config.Item( ZM_ADD_JPEG_COMMENTS );\
|
||||
jpeg_file_quality = (int)config.Item( ZM_JPEG_FILE_QUALITY );\
|
||||
jpeg_alarm_file_quality = (int)config.Item( ZM_JPEG_ALARM_FILE_QUALITY );\
|
||||
jpeg_image_quality = (int)config.Item( ZM_JPEG_IMAGE_QUALITY );\
|
||||
jpeg_stream_quality = (int)config.Item( ZM_JPEG_STREAM_QUALITY );\
|
||||
mpeg_timed_frames = (bool)config.Item( ZM_MPEG_TIMED_FRAMES );\
|
||||
mpeg_live_format = (const char *)config.Item( ZM_MPEG_LIVE_FORMAT );\
|
||||
mpeg_replay_format = (const char *)config.Item( ZM_MPEG_REPLAY_FORMAT );\
|
||||
rand_stream = (bool)config.Item( ZM_RAND_STREAM );\
|
||||
opt_cambozola = (bool)config.Item( ZM_OPT_CAMBOZOLA );\
|
||||
path_cambozola = (const char *)config.Item( ZM_PATH_CAMBOZOLA );\
|
||||
reload_cambozola = (int)config.Item( ZM_RELOAD_CAMBOZOLA );\
|
||||
timestamp_on_capture = (bool)config.Item( ZM_TIMESTAMP_ON_CAPTURE );\
|
||||
cpu_extensions = (bool)config.Item( ZM_CPU_EXTENSIONS );\
|
||||
fast_image_blends = (bool)config.Item( ZM_FAST_IMAGE_BLENDS );\
|
||||
opt_adaptive_skip = (bool)config.Item( ZM_OPT_ADAPTIVE_SKIP );\
|
||||
blend_alarmed_images = (bool)config.Item( ZM_BLEND_ALARMED_IMAGES );\
|
||||
max_suspend_time = (int)config.Item( ZM_MAX_SUSPEND_TIME );\
|
||||
opt_remote_cameras = (bool)config.Item( ZM_OPT_REMOTE_CAMERAS );\
|
||||
netcam_regexps = (bool)config.Item( ZM_NETCAM_REGEXPS );\
|
||||
http_version = (const char *)config.Item( ZM_HTTP_VERSION );\
|
||||
http_ua = (const char *)config.Item( ZM_HTTP_UA );\
|
||||
http_timeout = (int)config.Item( ZM_HTTP_TIMEOUT );\
|
||||
min_rtp_port = (int)config.Item( ZM_MIN_RTP_PORT );\
|
||||
max_rtp_port = (int)config.Item( ZM_MAX_RTP_PORT );\
|
||||
opt_ffmpeg = (bool)config.Item( ZM_OPT_FFMPEG );\
|
||||
path_ffmpeg = (const char *)config.Item( ZM_PATH_FFMPEG );\
|
||||
ffmpeg_input_options = (const char *)config.Item( ZM_FFMPEG_INPUT_OPTIONS );\
|
||||
ffmpeg_output_options = (const char *)config.Item( ZM_FFMPEG_OUTPUT_OPTIONS );\
|
||||
ffmpeg_formats = (const char *)config.Item( ZM_FFMPEG_FORMATS );\
|
||||
log_level_syslog = (int)config.Item( ZM_LOG_LEVEL_SYSLOG );\
|
||||
log_level_file = (int)config.Item( ZM_LOG_LEVEL_FILE );\
|
||||
log_level_weblog = (int)config.Item( ZM_LOG_LEVEL_WEBLOG );\
|
||||
log_level_database = (int)config.Item( ZM_LOG_LEVEL_DATABASE );\
|
||||
log_database_limit = (const char *)config.Item( ZM_LOG_DATABASE_LIMIT );\
|
||||
log_debug = (bool)config.Item( ZM_LOG_DEBUG );\
|
||||
log_debug_target = (const char *)config.Item( ZM_LOG_DEBUG_TARGET );\
|
||||
log_debug_level = (int)config.Item( ZM_LOG_DEBUG_LEVEL );\
|
||||
log_debug_file = (const char *)config.Item( ZM_LOG_DEBUG_FILE );\
|
||||
log_check_period = (int)config.Item( ZM_LOG_CHECK_PERIOD );\
|
||||
log_alert_war_count = (int)config.Item( ZM_LOG_ALERT_WAR_COUNT );\
|
||||
log_alert_err_count = (int)config.Item( ZM_LOG_ALERT_ERR_COUNT );\
|
||||
log_alert_fat_count = (int)config.Item( ZM_LOG_ALERT_FAT_COUNT );\
|
||||
log_alarm_war_count = (int)config.Item( ZM_LOG_ALARM_WAR_COUNT );\
|
||||
log_alarm_err_count = (int)config.Item( ZM_LOG_ALARM_ERR_COUNT );\
|
||||
log_alarm_fat_count = (int)config.Item( ZM_LOG_ALARM_FAT_COUNT );\
|
||||
record_event_stats = (bool)config.Item( ZM_RECORD_EVENT_STATS );\
|
||||
record_diag_images = (bool)config.Item( ZM_RECORD_DIAG_IMAGES );\
|
||||
dump_cores = (bool)config.Item( ZM_DUMP_CORES );\
|
||||
path_map = (const char *)config.Item( ZM_PATH_MAP );\
|
||||
path_socks = (const char *)config.Item( ZM_PATH_SOCKS );\
|
||||
path_logs = (const char *)config.Item( ZM_PATH_LOGS );\
|
||||
path_swap = (const char *)config.Item( ZM_PATH_SWAP );\
|
||||
web_title_prefix = (const char *)config.Item( ZM_WEB_TITLE_PREFIX );\
|
||||
web_resize_console = (bool)config.Item( ZM_WEB_RESIZE_CONSOLE );\
|
||||
web_popup_on_alarm = (bool)config.Item( ZM_WEB_POPUP_ON_ALARM );\
|
||||
opt_x10 = (bool)config.Item( ZM_OPT_X10 );\
|
||||
x10_device = (const char *)config.Item( ZM_X10_DEVICE );\
|
||||
x10_house_code = (const char *)config.Item( ZM_X10_HOUSE_CODE );\
|
||||
x10_db_reload_interval = (int)config.Item( ZM_X10_DB_RELOAD_INTERVAL );\
|
||||
web_sound_on_alarm = (bool)config.Item( ZM_WEB_SOUND_ON_ALARM );\
|
||||
web_alarm_sound = (const char *)config.Item( ZM_WEB_ALARM_SOUND );\
|
||||
web_compact_montage = (bool)config.Item( ZM_WEB_COMPACT_MONTAGE );\
|
||||
opt_fast_delete = (bool)config.Item( ZM_OPT_FAST_DELETE );\
|
||||
strict_video_config = (bool)config.Item( ZM_STRICT_VIDEO_CONFIG );\
|
||||
signal_check_points = (int)config.Item( ZM_SIGNAL_CHECK_POINTS );\
|
||||
v4l_multi_buffer = (bool)config.Item( ZM_V4L_MULTI_BUFFER );\
|
||||
captures_per_frame = (int)config.Item( ZM_CAPTURES_PER_FRAME );\
|
||||
filter_reload_delay = (int)config.Item( ZM_FILTER_RELOAD_DELAY );\
|
||||
filter_execute_interval = (int)config.Item( ZM_FILTER_EXECUTE_INTERVAL );\
|
||||
opt_upload = (bool)config.Item( ZM_OPT_UPLOAD );\
|
||||
upload_arch_format = (const char *)config.Item( ZM_UPLOAD_ARCH_FORMAT );\
|
||||
upload_arch_compress = (bool)config.Item( ZM_UPLOAD_ARCH_COMPRESS );\
|
||||
upload_arch_analyse = (bool)config.Item( ZM_UPLOAD_ARCH_ANALYSE );\
|
||||
upload_protocol = (const char *)config.Item( ZM_UPLOAD_PROTOCOL );\
|
||||
upload_ftp_host = (const char *)config.Item( ZM_UPLOAD_FTP_HOST );\
|
||||
upload_host = (const char *)config.Item( ZM_UPLOAD_HOST );\
|
||||
upload_port = (int)config.Item( ZM_UPLOAD_PORT );\
|
||||
upload_ftp_user = (const char *)config.Item( ZM_UPLOAD_FTP_USER );\
|
||||
upload_user = (const char *)config.Item( ZM_UPLOAD_USER );\
|
||||
upload_ftp_pass = (const char *)config.Item( ZM_UPLOAD_FTP_PASS );\
|
||||
upload_pass = (const char *)config.Item( ZM_UPLOAD_PASS );\
|
||||
upload_ftp_loc_dir = (const char *)config.Item( ZM_UPLOAD_FTP_LOC_DIR );\
|
||||
upload_loc_dir = (const char *)config.Item( ZM_UPLOAD_LOC_DIR );\
|
||||
upload_ftp_rem_dir = (const char *)config.Item( ZM_UPLOAD_FTP_REM_DIR );\
|
||||
upload_rem_dir = (const char *)config.Item( ZM_UPLOAD_REM_DIR );\
|
||||
upload_ftp_timeout = (int)config.Item( ZM_UPLOAD_FTP_TIMEOUT );\
|
||||
upload_timeout = (int)config.Item( ZM_UPLOAD_TIMEOUT );\
|
||||
upload_ftp_passive = (bool)config.Item( ZM_UPLOAD_FTP_PASSIVE );\
|
||||
upload_ftp_debug = (bool)config.Item( ZM_UPLOAD_FTP_DEBUG );\
|
||||
upload_debug = (bool)config.Item( ZM_UPLOAD_DEBUG );\
|
||||
opt_email = (bool)config.Item( ZM_OPT_EMAIL );\
|
||||
email_address = (const char *)config.Item( ZM_EMAIL_ADDRESS );\
|
||||
email_text = (const char *)config.Item( ZM_EMAIL_TEXT );\
|
||||
email_subject = (const char *)config.Item( ZM_EMAIL_SUBJECT );\
|
||||
email_body = (const char *)config.Item( ZM_EMAIL_BODY );\
|
||||
opt_message = (bool)config.Item( ZM_OPT_MESSAGE );\
|
||||
message_address = (const char *)config.Item( ZM_MESSAGE_ADDRESS );\
|
||||
message_text = (const char *)config.Item( ZM_MESSAGE_TEXT );\
|
||||
message_subject = (const char *)config.Item( ZM_MESSAGE_SUBJECT );\
|
||||
message_body = (const char *)config.Item( ZM_MESSAGE_BODY );\
|
||||
new_mail_modules = (bool)config.Item( ZM_NEW_MAIL_MODULES );\
|
||||
email_host = (const char *)config.Item( ZM_EMAIL_HOST );\
|
||||
from_email = (const char *)config.Item( ZM_FROM_EMAIL );\
|
||||
url = (const char *)config.Item( ZM_URL );\
|
||||
max_restart_delay = (int)config.Item( ZM_MAX_RESTART_DELAY );\
|
||||
watch_check_interval = (int)config.Item( ZM_WATCH_CHECK_INTERVAL );\
|
||||
watch_max_delay = (double) config.Item( ZM_WATCH_MAX_DELAY );\
|
||||
run_audit = (bool)config.Item( ZM_RUN_AUDIT );\
|
||||
audit_check_interval = (int)config.Item( ZM_AUDIT_CHECK_INTERVAL );\
|
||||
forced_alarm_score = (int)config.Item( ZM_FORCED_ALARM_SCORE );\
|
||||
bulk_frame_interval = (int)config.Item( ZM_BULK_FRAME_INTERVAL );\
|
||||
event_close_mode = (const char *)config.Item( ZM_EVENT_CLOSE_MODE );\
|
||||
force_close_events = (bool)config.Item( ZM_FORCE_CLOSE_EVENTS );\
|
||||
create_analysis_images = (bool)config.Item( ZM_CREATE_ANALYSIS_IMAGES );\
|
||||
weighted_alarm_centres = (bool)config.Item( ZM_WEIGHTED_ALARM_CENTRES );\
|
||||
event_image_digits = (int)config.Item( ZM_EVENT_IMAGE_DIGITS );\
|
||||
default_aspect_ratio = (const char *)config.Item( ZM_DEFAULT_ASPECT_RATIO );\
|
||||
user_self_edit = (bool)config.Item( ZM_USER_SELF_EDIT );\
|
||||
opt_frame_server = (bool)config.Item( ZM_OPT_FRAME_SERVER );\
|
||||
frame_socket_size = (int)config.Item( ZM_FRAME_SOCKET_SIZE );\
|
||||
opt_control = (bool)config.Item( ZM_OPT_CONTROL );\
|
||||
opt_triggers = (bool)config.Item( ZM_OPT_TRIGGERS );\
|
||||
check_for_updates = (bool)config.Item( ZM_CHECK_FOR_UPDATES );\
|
||||
update_check_proxy = (const char *)config.Item( ZM_UPDATE_CHECK_PROXY );\
|
||||
shm_key = (int)config.Item( ZM_SHM_KEY );\
|
||||
web_refresh_method = (const char *)config.Item( ZM_WEB_REFRESH_METHOD );\
|
||||
web_event_sort_field = (const char *)config.Item( ZM_WEB_EVENT_SORT_FIELD );\
|
||||
web_event_sort_order = (const char *)config.Item( ZM_WEB_EVENT_SORT_ORDER );\
|
||||
web_events_per_page = (int)config.Item( ZM_WEB_EVENTS_PER_PAGE );\
|
||||
web_list_thumbs = (bool)config.Item( ZM_WEB_LIST_THUMBS );\
|
||||
web_list_thumb_width = (int)config.Item( ZM_WEB_LIST_THUMB_WIDTH );\
|
||||
web_list_thumb_height = (int)config.Item( ZM_WEB_LIST_THUMB_HEIGHT );\
|
||||
web_use_object_tags = (bool)config.Item( ZM_WEB_USE_OBJECT_TAGS );\
|
||||
web_h_refresh_main = (int)config.Item( ZM_WEB_H_REFRESH_MAIN );\
|
||||
web_h_refresh_cycle = (int)config.Item( ZM_WEB_H_REFRESH_CYCLE );\
|
||||
web_h_refresh_image = (int)config.Item( ZM_WEB_H_REFRESH_IMAGE );\
|
||||
web_h_refresh_status = (int)config.Item( ZM_WEB_H_REFRESH_STATUS );\
|
||||
web_h_refresh_events = (int)config.Item( ZM_WEB_H_REFRESH_EVENTS );\
|
||||
web_h_can_stream = (const char *)config.Item( ZM_WEB_H_CAN_STREAM );\
|
||||
web_h_stream_method = (const char *)config.Item( ZM_WEB_H_STREAM_METHOD );\
|
||||
web_h_default_scale = (int)config.Item( ZM_WEB_H_DEFAULT_SCALE );\
|
||||
web_h_default_rate = (int)config.Item( ZM_WEB_H_DEFAULT_RATE );\
|
||||
web_h_video_bitrate = (int)config.Item( ZM_WEB_H_VIDEO_BITRATE );\
|
||||
web_h_video_maxfps = (int)config.Item( ZM_WEB_H_VIDEO_MAXFPS );\
|
||||
web_h_scale_thumbs = (bool)config.Item( ZM_WEB_H_SCALE_THUMBS );\
|
||||
web_h_events_view = (const char *)config.Item( ZM_WEB_H_EVENTS_VIEW );\
|
||||
web_h_show_progress = (bool)config.Item( ZM_WEB_H_SHOW_PROGRESS );\
|
||||
web_h_ajax_timeout = (int)config.Item( ZM_WEB_H_AJAX_TIMEOUT );\
|
||||
web_m_refresh_main = (int)config.Item( ZM_WEB_M_REFRESH_MAIN );\
|
||||
web_m_refresh_cycle = (int)config.Item( ZM_WEB_M_REFRESH_CYCLE );\
|
||||
web_m_refresh_image = (int)config.Item( ZM_WEB_M_REFRESH_IMAGE );\
|
||||
web_m_refresh_status = (int)config.Item( ZM_WEB_M_REFRESH_STATUS );\
|
||||
web_m_refresh_events = (int)config.Item( ZM_WEB_M_REFRESH_EVENTS );\
|
||||
web_m_can_stream = (const char *)config.Item( ZM_WEB_M_CAN_STREAM );\
|
||||
web_m_stream_method = (const char *)config.Item( ZM_WEB_M_STREAM_METHOD );\
|
||||
web_m_default_scale = (int)config.Item( ZM_WEB_M_DEFAULT_SCALE );\
|
||||
web_m_default_rate = (int)config.Item( ZM_WEB_M_DEFAULT_RATE );\
|
||||
web_m_video_bitrate = (int)config.Item( ZM_WEB_M_VIDEO_BITRATE );\
|
||||
web_m_video_maxfps = (int)config.Item( ZM_WEB_M_VIDEO_MAXFPS );\
|
||||
web_m_scale_thumbs = (bool)config.Item( ZM_WEB_M_SCALE_THUMBS );\
|
||||
web_m_events_view = (const char *)config.Item( ZM_WEB_M_EVENTS_VIEW );\
|
||||
web_m_show_progress = (bool)config.Item( ZM_WEB_M_SHOW_PROGRESS );\
|
||||
web_m_ajax_timeout = (int)config.Item( ZM_WEB_M_AJAX_TIMEOUT );\
|
||||
web_l_refresh_main = (int)config.Item( ZM_WEB_L_REFRESH_MAIN );\
|
||||
web_l_refresh_cycle = (int)config.Item( ZM_WEB_L_REFRESH_CYCLE );\
|
||||
web_l_refresh_image = (int)config.Item( ZM_WEB_L_REFRESH_IMAGE );\
|
||||
web_l_refresh_status = (int)config.Item( ZM_WEB_L_REFRESH_STATUS );\
|
||||
web_l_refresh_events = (int)config.Item( ZM_WEB_L_REFRESH_EVENTS );\
|
||||
web_l_can_stream = (const char *)config.Item( ZM_WEB_L_CAN_STREAM );\
|
||||
web_l_stream_method = (const char *)config.Item( ZM_WEB_L_STREAM_METHOD );\
|
||||
web_l_default_scale = (int)config.Item( ZM_WEB_L_DEFAULT_SCALE );\
|
||||
web_l_default_rate = (int)config.Item( ZM_WEB_L_DEFAULT_RATE );\
|
||||
web_l_video_bitrate = (int)config.Item( ZM_WEB_L_VIDEO_BITRATE );\
|
||||
web_l_video_maxfps = (int)config.Item( ZM_WEB_L_VIDEO_MAXFPS );\
|
||||
web_l_scale_thumbs = (bool)config.Item( ZM_WEB_L_SCALE_THUMBS );\
|
||||
web_l_events_view = (const char *)config.Item( ZM_WEB_L_EVENTS_VIEW );\
|
||||
web_l_show_progress = (bool)config.Item( ZM_WEB_L_SHOW_PROGRESS );\
|
||||
web_l_ajax_timeout = (int)config.Item( ZM_WEB_L_AJAX_TIMEOUT );\
|
||||
web_p_can_stream = (const char *)config.Item( ZM_WEB_P_CAN_STREAM );\
|
||||
web_p_stream_method = (const char *)config.Item( ZM_WEB_P_STREAM_METHOD );\
|
||||
web_p_default_scale = (int)config.Item( ZM_WEB_P_DEFAULT_SCALE );\
|
||||
web_p_default_rate = (int)config.Item( ZM_WEB_P_DEFAULT_RATE );\
|
||||
web_p_video_bitrate = (int)config.Item( ZM_WEB_P_VIDEO_BITRATE );\
|
||||
web_p_video_maxfps = (int)config.Item( ZM_WEB_P_VIDEO_MAXFPS );\
|
||||
web_p_scale_thumbs = (bool)config.Item( ZM_WEB_P_SCALE_THUMBS );\
|
||||
web_p_ajax_timeout = (int)config.Item( ZM_WEB_P_AJAX_TIMEOUT );\
|
||||
dyn_last_version = (const char *)config.Item( ZM_DYN_LAST_VERSION );\
|
||||
dyn_curr_version = (const char *)config.Item( ZM_DYN_CURR_VERSION );\
|
||||
dyn_db_version = (const char *)config.Item( ZM_DYN_DB_VERSION );\
|
||||
dyn_last_check = (int)config.Item( ZM_DYN_LAST_CHECK );\
|
||||
dyn_next_reminder = (const char *)config.Item( ZM_DYN_NEXT_REMINDER );\
|
||||
dyn_donate_reminder_time = (int)config.Item( ZM_DYN_DONATE_REMINDER_TIME );\
|
||||
dyn_show_donate_reminder = (bool)config.Item( ZM_DYN_SHOW_DONATE_REMINDER );\
|
||||
eyezm_debug = (bool)config.Item( ZM_EYEZM_DEBUG );\
|
||||
eyezm_log_to_file = (bool)config.Item( ZM_EYEZM_LOG_TO_FILE );\
|
||||
eyezm_log_file = (const char *)config.Item( ZM_EYEZM_LOG_FILE );\
|
||||
eyezm_event_vcodec = (const char *)config.Item( ZM_EYEZM_EVENT_VCODEC );\
|
||||
eyezm_feed_vcodec = (const char *)config.Item( ZM_EYEZM_FEED_VCODEC );\
|
||||
eyezm_h264_default_br = (const char *)config.Item( ZM_EYEZM_H264_DEFAULT_BR );\
|
||||
eyezm_h264_default_evbr = (const char *)config.Item( ZM_EYEZM_H264_DEFAULT_EVBR );\
|
||||
eyezm_h264_timeout = (const char *)config.Item( ZM_EYEZM_H264_TIMEOUT );\
|
||||
eyezm_seg_duration = (const char *)config.Item( ZM_EYEZM_SEG_DURATION );\
|
||||
|
||||
|
|
@ -490,11 +490,18 @@ void Event::updateNotes( const StringSetMap &newNoteSetMap )
|
|||
}
|
||||
|
||||
void Event::AddFrames( int n_frames, Image **images, struct timeval **timestamps )
|
||||
{
|
||||
for (int i = 0; i < n_frames; i += ZM_SQL_BATCH_SIZE) {
|
||||
AddFramesInternal(n_frames, i, images, timestamps);
|
||||
}
|
||||
}
|
||||
|
||||
void Event::AddFramesInternal( int n_frames, int start_frame, Image **images, struct timeval **timestamps )
|
||||
{
|
||||
static char sql[ZM_SQL_LGE_BUFSIZ];
|
||||
strncpy( sql, "insert into Frames ( EventId, FrameId, TimeStamp, Delta ) values ", sizeof(sql) );
|
||||
int frameCount = 0;
|
||||
for ( int i = 0; i < n_frames; i++ )
|
||||
for ( int i = start_frame; i < n_frames && i - start_frame < ZM_SQL_BATCH_SIZE; i++ )
|
||||
{
|
||||
if ( !timestamps[i]->tv_sec )
|
||||
{
|
||||
|
@ -792,7 +799,7 @@ bool EventStream::loadEventData( int event_id )
|
|||
else
|
||||
snprintf( event_data->path, sizeof(event_data->path), "%s/%s/%ld/%ld", staticConfig.PATH_WEB.c_str(), config.dir_events, event_data->monitor_id, event_data->event_id );
|
||||
}
|
||||
event_data->frame_count = atoi(dbrow[2]);
|
||||
event_data->frame_count = dbrow[2] == NULL ? 0 : atoi(dbrow[2]);
|
||||
event_data->duration = atof(dbrow[4]);
|
||||
|
||||
updateFrameRate( (double)event_data->frame_count/event_data->duration );
|
||||
|
@ -1280,15 +1287,20 @@ bool EventStream::sendFrame( int delta_us )
|
|||
case STREAM_JPEG :
|
||||
send_image->EncodeJpeg( img_buffer, &img_buffer_size );
|
||||
break;
|
||||
case STREAM_RAW :
|
||||
img_buffer = (uint8_t*)(send_image->Buffer());
|
||||
img_buffer_size = send_image->Size();
|
||||
break;
|
||||
case STREAM_ZIP :
|
||||
#if HAVE_ZLIB_H
|
||||
unsigned long zip_buffer_size;
|
||||
send_image->Zip( img_buffer, &zip_buffer_size );
|
||||
img_buffer_size = zip_buffer_size;
|
||||
break;
|
||||
#else
|
||||
Error("zlib is required for zipped images. Falling back to raw image");
|
||||
type = STREAM_RAW;
|
||||
#endif // HAVE_ZLIB_H
|
||||
case STREAM_RAW :
|
||||
img_buffer = (uint8_t*)(send_image->Buffer());
|
||||
img_buffer_size = send_image->Size();
|
||||
break;
|
||||
default:
|
||||
Fatal( "Unexpected frame type %d", type );
|
||||
break;
|
||||
|
|
|
@ -134,6 +134,9 @@ public:
|
|||
void AddFrames( int n_frames, Image **images, struct timeval **timestamps );
|
||||
void AddFrame( Image *image, struct timeval timestamp, int score=0, Image *alarm_frame=NULL );
|
||||
|
||||
private:
|
||||
void AddFramesInternal( int n_frames, int start_frame, Image **images, struct timeval **timestamps );
|
||||
|
||||
public:
|
||||
static const char *getSubPath( struct tm *time )
|
||||
{
|
||||
|
|
|
@ -17,8 +17,201 @@
|
|||
* Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
|
||||
*/
|
||||
|
||||
#if HAVE_LIBAVCODEC
|
||||
|
||||
#include "zm_ffmpeg.h"
|
||||
#include "zm_image.h"
|
||||
#include "zm_rgb.h"
|
||||
|
||||
#endif // HAVE_LIBAVCODEC
|
||||
#if HAVE_LIBAVCODEC || HAVE_LIBAVUTIL || HAVE_LIBSWSCALE
|
||||
|
||||
#if HAVE_LIBAVUTIL
|
||||
enum PixelFormat GetFFMPEGPixelFormat(unsigned int p_colours, unsigned p_subpixelorder) {
|
||||
enum PixelFormat pf;
|
||||
|
||||
Debug(8,"Colours: %d SubpixelOrder: %d",p_colours,p_subpixelorder);
|
||||
|
||||
switch(p_colours) {
|
||||
case ZM_COLOUR_RGB24:
|
||||
{
|
||||
if(p_subpixelorder == ZM_SUBPIX_ORDER_BGR) {
|
||||
/* BGR subpixel order */
|
||||
pf = PIX_FMT_BGR24;
|
||||
} else {
|
||||
/* Assume RGB subpixel order */
|
||||
pf = PIX_FMT_RGB24;
|
||||
}
|
||||
break;
|
||||
}
|
||||
case ZM_COLOUR_RGB32:
|
||||
{
|
||||
if(p_subpixelorder == ZM_SUBPIX_ORDER_ARGB) {
|
||||
/* ARGB subpixel order */
|
||||
pf = PIX_FMT_ARGB;
|
||||
} else if(p_subpixelorder == ZM_SUBPIX_ORDER_ABGR) {
|
||||
/* ABGR subpixel order */
|
||||
pf = PIX_FMT_ABGR;
|
||||
} else if(p_subpixelorder == ZM_SUBPIX_ORDER_BGRA) {
|
||||
/* BGRA subpixel order */
|
||||
pf = PIX_FMT_BGRA;
|
||||
} else {
|
||||
/* Assume RGBA subpixel order */
|
||||
pf = PIX_FMT_RGBA;
|
||||
}
|
||||
break;
|
||||
}
|
||||
case ZM_COLOUR_GRAY8:
|
||||
pf = PIX_FMT_GRAY8;
|
||||
break;
|
||||
default:
|
||||
Panic("Unexpected colours: %d",p_colours);
|
||||
pf = PIX_FMT_GRAY8; /* Just to shush gcc variable may be unused warning */
|
||||
break;
|
||||
}
|
||||
|
||||
return pf;
|
||||
}
|
||||
#endif // HAVE_LIBAVUTIL
|
||||
|
||||
#if HAVE_LIBSWSCALE && HAVE_LIBAVUTIL
|
||||
SWScale::SWScale() : gotdefaults(false), swscale_ctx(NULL), input_avframe(NULL), output_avframe(NULL) {
|
||||
Debug(4,"SWScale object created");
|
||||
|
||||
/* Allocate AVFrame for the input */
|
||||
input_avframe = avcodec_alloc_frame();
|
||||
if(input_avframe == NULL) {
|
||||
Fatal("Failed allocating AVFrame for the input");
|
||||
}
|
||||
|
||||
/* Allocate AVFrame for the output */
|
||||
output_avframe = avcodec_alloc_frame();
|
||||
if(output_avframe == NULL) {
|
||||
Fatal("Failed allocating AVFrame for the output");
|
||||
}
|
||||
}
|
||||
|
||||
SWScale::~SWScale() {
|
||||
|
||||
/* Free up everything */
|
||||
av_free(input_avframe);
|
||||
input_avframe = NULL;
|
||||
|
||||
av_free(output_avframe);
|
||||
output_avframe = NULL;
|
||||
|
||||
if(swscale_ctx) {
|
||||
sws_freeContext(swscale_ctx);
|
||||
swscale_ctx = NULL;
|
||||
}
|
||||
|
||||
Debug(4,"SWScale object destroyed");
|
||||
}
|
||||
|
||||
int SWScale::SetDefaults(enum PixelFormat in_pf, enum PixelFormat out_pf, unsigned int width, unsigned int height) {
|
||||
|
||||
/* Assign the defaults */
|
||||
default_input_pf = in_pf;
|
||||
default_output_pf = out_pf;
|
||||
default_width = width;
|
||||
default_height = height;
|
||||
|
||||
gotdefaults = true;
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
int SWScale::Convert(const uint8_t* in_buffer, const size_t in_buffer_size, uint8_t* out_buffer, const size_t out_buffer_size, enum PixelFormat in_pf, enum PixelFormat out_pf, unsigned int width, unsigned int height) {
|
||||
/* Parameter checking */
|
||||
if(in_buffer == NULL || out_buffer == NULL) {
|
||||
Error("NULL Input or output buffer");
|
||||
return -1;
|
||||
}
|
||||
if(in_pf == 0 || out_pf == 0) {
|
||||
Error("Invalid input or output pixel formats");
|
||||
return -2;
|
||||
}
|
||||
if(!width || !height) {
|
||||
Error("Invalid width or height");
|
||||
return -3;
|
||||
}
|
||||
|
||||
/* Warn if the input or output pixelformat is not supported */
|
||||
if(!sws_isSupportedInput(in_pf)) {
|
||||
Warning("swscale does not support the input format: %c%c%c%c",(in_pf)&0xff,((in_pf)&0xff),((in_pf>>16)&0xff),((in_pf>>24)&0xff));
|
||||
}
|
||||
if(!sws_isSupportedOutput(out_pf)) {
|
||||
Warning("swscale does not support the output format: %c%c%c%c",(out_pf)&0xff,((out_pf>>8)&0xff),((out_pf>>16)&0xff),((out_pf>>24)&0xff));
|
||||
}
|
||||
|
||||
/* Check the buffer sizes */
|
||||
size_t insize = avpicture_get_size(in_pf, width, height);
|
||||
if(insize != in_buffer_size) {
|
||||
Error("The input buffer size does not match the expected size for the input format. Required: %d Available: %d", insize, in_buffer_size);
|
||||
return -4;
|
||||
}
|
||||
size_t outsize = avpicture_get_size(out_pf, width, height);
|
||||
if(outsize < out_buffer_size) {
|
||||
Error("The output buffer is undersized for the output format. Required: %d Available: %d", outsize, out_buffer_size);
|
||||
return -5;
|
||||
}
|
||||
|
||||
/* Get the context */
|
||||
swscale_ctx = sws_getCachedContext( NULL, width, height, in_pf, width, height, out_pf, 0, NULL, NULL, NULL );
|
||||
if(swscale_ctx == NULL) {
|
||||
Error("Failed getting swscale context");
|
||||
return -6;
|
||||
}
|
||||
|
||||
/* Fill in the buffers */
|
||||
if(!avpicture_fill( (AVPicture*)input_avframe, (uint8_t*)in_buffer, in_pf, width, height ) ) {
|
||||
Error("Failed filling input frame with input buffer");
|
||||
return -7;
|
||||
}
|
||||
if(!avpicture_fill( (AVPicture*)output_avframe, out_buffer, out_pf, width, height ) ) {
|
||||
Error("Failed filling output frame with output buffer");
|
||||
return -8;
|
||||
}
|
||||
|
||||
/* Do the conversion */
|
||||
if(!sws_scale(swscale_ctx, input_avframe->data, input_avframe->linesize, 0, height, output_avframe->data, output_avframe->linesize ) ) {
|
||||
Error("swscale conversion failed");
|
||||
return -10;
|
||||
}
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
int SWScale::Convert(const Image* img, uint8_t* out_buffer, const size_t out_buffer_size, enum PixelFormat in_pf, enum PixelFormat out_pf, unsigned int width, unsigned int height) {
|
||||
if(img->Width() != width) {
|
||||
Error("Source image width differs. Source: %d Output: %d",img->Width(), width);
|
||||
return -12;
|
||||
}
|
||||
|
||||
if(img->Height() != height) {
|
||||
Error("Source image height differs. Source: %d Output: %d",img->Height(), height);
|
||||
return -13;
|
||||
}
|
||||
|
||||
return Convert(img->Buffer(),img->Size(),out_buffer,out_buffer_size,in_pf,out_pf,width,height);
|
||||
}
|
||||
|
||||
int SWScale::ConvertDefaults(const Image* img, uint8_t* out_buffer, const size_t out_buffer_size) {
|
||||
|
||||
if(!gotdefaults) {
|
||||
Error("Defaults are not set");
|
||||
return -24;
|
||||
}
|
||||
|
||||
return Convert(img,out_buffer,out_buffer_size,default_input_pf,default_output_pf,default_width,default_height);
|
||||
}
|
||||
|
||||
int SWScale::ConvertDefaults(const uint8_t* in_buffer, const size_t in_buffer_size, uint8_t* out_buffer, const size_t out_buffer_size) {
|
||||
|
||||
if(!gotdefaults) {
|
||||
Error("Defaults are not set");
|
||||
return -24;
|
||||
}
|
||||
|
||||
return Convert(in_buffer,in_buffer_size,out_buffer,out_buffer_size,default_input_pf,default_output_pf,default_width,default_height);
|
||||
}
|
||||
#endif // HAVE_LIBSWSCALE && HAVE_LIBAVUTIL
|
||||
|
||||
#endif // HAVE_LIBAVCODEC || HAVE_LIBAVUTIL || HAVE_LIBSWSCALE
|
||||
|
|
|
@ -20,47 +20,58 @@
|
|||
#ifndef ZM_FFMPEG_H
|
||||
#define ZM_FFMPEG_H
|
||||
#include <stdint.h>
|
||||
#if HAVE_LIBAVCODEC
|
||||
#include "zm.h"
|
||||
#include "zm_image.h"
|
||||
|
||||
#ifdef __cplusplus
|
||||
extern "C" {
|
||||
#endif
|
||||
|
||||
// AVUTIL
|
||||
#if HAVE_LIBAVUTIL_AVUTIL_H
|
||||
#include <libavutil/avutil.h>
|
||||
#include <libavutil/base64.h>
|
||||
#include <libavutil/mathematics.h>
|
||||
#elif HAVE_FFMPEG_AVUTIL_H
|
||||
#include <ffmpeg/avutil.h>
|
||||
#include <ffmpeg/base64.h>
|
||||
/*#else
|
||||
#error "No location for avutils.h found"*/
|
||||
#include <ffmpeg/mathematics.h>
|
||||
#endif
|
||||
|
||||
// AVCODEC
|
||||
#if HAVE_LIBAVCODEC_AVCODEC_H
|
||||
#include <libavcodec/avcodec.h>
|
||||
#if LIBAVCODEC_VERSION_MAJOR < 54
|
||||
#include <libavcodec/opt.h>
|
||||
#endif
|
||||
#elif HAVE_FFMPEG_AVCODEC_H
|
||||
#include <ffmpeg/avcodec.h>
|
||||
#endif
|
||||
|
||||
// AVFORMAT
|
||||
#if HAVE_LIBAVFORMAT_AVFORMAT_H
|
||||
#include <libavformat/avformat.h>
|
||||
#elif HAVE_FFMPEG_AVFORMAT_H
|
||||
#include <ffmpeg/avformat.h>
|
||||
/*#else
|
||||
#error "No location for avformat.h found"*/
|
||||
#endif
|
||||
#if HAVE_LIBSWSCALE
|
||||
|
||||
// AVDEVICE
|
||||
#if HAVE_LIBAVDEVICE_AVDEVICE_H
|
||||
#include <libavdevice/avdevice.h>
|
||||
#elif HAVE_FFMPEG_AVDEVICE_H
|
||||
#include <ffmpeg/avdevice.h>
|
||||
#endif
|
||||
|
||||
// SWSCALE
|
||||
#if HAVE_LIBSWSCALE_SWSCALE_H
|
||||
#include <libswscale/swscale.h>
|
||||
#include <libavutil/mathematics.h> // this is a fix for error: 'av_rescale_q' was not declared in this scope
|
||||
#elif HAVE_FFMPEG_SWSCALE_H
|
||||
#include <ffmpeg/swscale.h>
|
||||
/*#else
|
||||
#error "No location for swscale.h found"*/
|
||||
#endif
|
||||
#endif // HAVE_LIBSWSCALE
|
||||
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
#endif
|
||||
|
||||
#if ( HAVE_LIBAVUTIL_AVUTIL_H || HAVE_LIBAVCODEC_AVCODEC_H || HAVE_LIBAVFORMAT_AVFORMAT_H || HAVE_LIBAVDEVICE_AVDEVICE_H )
|
||||
|
||||
#if LIBAVFORMAT_VERSION_INT < AV_VERSION_INT(53, 4, 0)
|
||||
#if defined(AVIO_WRONLY)
|
||||
#define AVIO_FLAG_WRITE AVIO_WRONLY
|
||||
|
@ -85,8 +96,58 @@ extern "C" {
|
|||
#ifndef SWS_CPU_CAPS_SSE2
|
||||
#define SWS_CPU_CAPS_SSE2 0x02000000
|
||||
#endif
|
||||
|
||||
#endif // HAVE_LIBAVCODEC
|
||||
|
||||
|
||||
#if HAVE_LIBAVUTIL
|
||||
enum PixelFormat GetFFMPEGPixelFormat(unsigned int p_colours, unsigned p_subpixelorder);
|
||||
#endif // HAVE_LIBAVUTIL
|
||||
|
||||
|
||||
/* SWScale wrapper class to make our life easier and reduce code reuse */
|
||||
#if HAVE_LIBSWSCALE && HAVE_LIBAVUTIL
|
||||
class SWScale {
|
||||
public:
|
||||
SWScale();
|
||||
~SWScale();
|
||||
int SetDefaults(enum PixelFormat in_pf, enum PixelFormat out_pf, unsigned int width, unsigned int height);
|
||||
int ConvertDefaults(const Image* img, uint8_t* out_buffer, const size_t out_buffer_size);
|
||||
int ConvertDefaults(const uint8_t* in_buffer, const size_t in_buffer_size, uint8_t* out_buffer, const size_t out_buffer_size);
|
||||
int Convert(const Image* img, uint8_t* out_buffer, const size_t out_buffer_size, enum PixelFormat in_pf, enum PixelFormat out_pf, unsigned int width, unsigned int height);
|
||||
int Convert(const uint8_t* in_buffer, const size_t in_buffer_size, uint8_t* out_buffer, const size_t out_buffer_size, enum PixelFormat in_pf, enum PixelFormat out_pf, unsigned int width, unsigned int height);
|
||||
|
||||
protected:
|
||||
bool gotdefaults;
|
||||
struct SwsContext* swscale_ctx;
|
||||
AVFrame* input_avframe;
|
||||
AVFrame* output_avframe;
|
||||
enum PixelFormat default_input_pf;
|
||||
enum PixelFormat default_output_pf;
|
||||
unsigned int default_width;
|
||||
unsigned int default_height;
|
||||
};
|
||||
#endif // HAVE_LIBSWSCALE && HAVE_LIBAVUTIL
|
||||
|
||||
#if LIBAVCODEC_VERSION_INT < AV_VERSION_INT(54, 25, 0)
|
||||
#define AV_CODEC_ID_NONE CODEC_ID_NONE
|
||||
#define AV_CODEC_ID_PCM_MULAW CODEC_ID_PCM_MULAW
|
||||
#define AV_CODEC_ID_PCM_ALAW CODEC_ID_PCM_ALAW
|
||||
#define AV_CODEC_ID_PCM_S16BE CODEC_ID_PCM_S16BE
|
||||
#define AV_CODEC_ID_QCELP CODEC_ID_QCELP
|
||||
#define AV_CODEC_ID_MP2 CODEC_ID_MP2
|
||||
#define AV_CODEC_ID_MP3 CODEC_ID_MP3
|
||||
#define AV_CODEC_ID_MJPEG CODEC_ID_MJPEG
|
||||
#define AV_CODEC_ID_H261 CODEC_ID_H261
|
||||
#define AV_CODEC_ID_MPEG1VIDEO CODEC_ID_MPEG1VIDEO
|
||||
#define AV_CODEC_ID_MPEG2VIDEO CODEC_ID_MPEG2VIDEO
|
||||
#define AV_CODEC_ID_MPEG2TS CODEC_ID_MPEG2TS
|
||||
#define AV_CODEC_ID_H263 CODEC_ID_H263
|
||||
#define AV_CODEC_ID_H264 CODEC_ID_H264
|
||||
#define AV_CODEC_ID_MPEG4 CODEC_ID_MPEG4
|
||||
#define AV_CODEC_ID_AAC CODEC_ID_AAC
|
||||
#define AV_CODEC_ID_AMR_NB CODEC_ID_AMR_NB
|
||||
#endif
|
||||
|
||||
#endif // ( HAVE_LIBAVUTIL_AVUTIL_H || HAVE_LIBAVCODEC_AVCODEC_H || HAVE_LIBAVFORMAT_AVFORMAT_H || HAVE_LIBAVDEVICE_AVDEVICE_H )
|
||||
|
||||
#endif // ZM_FFMPEG_H
|
||||
|
||||
|
|
|
@ -28,8 +28,8 @@
|
|||
#include "zm_videostore.h"
|
||||
|
||||
//
|
||||
// Class representing 'remote' cameras, i.e. those which are
|
||||
// accessed over a network connection.
|
||||
// Class representing 'ffmpeg' cameras, i.e. those which are
|
||||
// accessed using ffmpeg multimedia framework
|
||||
//
|
||||
class FfmpegCamera : public Camera
|
||||
{
|
||||
|
|
|
@ -28,7 +28,7 @@
|
|||
|
||||
//
|
||||
// Class representing 'file' cameras, i.e. those which are
|
||||
// accessed over a network connection.
|
||||
// accessed using a single file which contains the latest jpeg data
|
||||
//
|
||||
class FileCamera : public Camera
|
||||
{
|
||||
|
|
358
src/zm_image.cpp
358
src/zm_image.cpp
|
@ -860,7 +860,7 @@ bool Image::WriteJpeg( const char *filename, int quality_override ) const
|
|||
}
|
||||
|
||||
jpeg_set_defaults( cinfo );
|
||||
jpeg_set_quality( cinfo, quality, false );
|
||||
jpeg_set_quality( cinfo, quality, FALSE );
|
||||
cinfo->dct_method = JDCT_FASTEST;
|
||||
|
||||
jpeg_start_compress( cinfo, TRUE );
|
||||
|
@ -1093,7 +1093,7 @@ bool Image::EncodeJpeg( JOCTET *outbuffer, int *outbuffer_size, int quality_over
|
|||
}
|
||||
|
||||
jpeg_set_defaults( cinfo );
|
||||
jpeg_set_quality( cinfo, quality, false );
|
||||
jpeg_set_quality( cinfo, quality, FALSE );
|
||||
cinfo->dct_method = JDCT_FASTEST;
|
||||
|
||||
jpeg_start_compress( cinfo, TRUE );
|
||||
|
@ -2352,10 +2352,10 @@ void Image::Rotate( int angle )
|
|||
if ( colours == ZM_COLOUR_GRAY8 )
|
||||
{
|
||||
unsigned char *d_ptr;
|
||||
for ( unsigned int i = new_width-1; i >= 0; i-- )
|
||||
for ( unsigned int i = new_width; i > 0; i-- )
|
||||
{
|
||||
d_ptr = rotate_buffer+i;
|
||||
for ( unsigned int j = new_height-1; j >= 0; j-- )
|
||||
d_ptr = rotate_buffer+(i-1);
|
||||
for ( unsigned int j = new_height; j > 0; j-- )
|
||||
{
|
||||
*d_ptr = *s_ptr++;
|
||||
d_ptr += line_bytes;
|
||||
|
@ -2366,10 +2366,10 @@ void Image::Rotate( int angle )
|
|||
{
|
||||
Rgb* s_rptr = (Rgb*)s_ptr;
|
||||
Rgb* d_rptr;
|
||||
for ( unsigned int i = new_width-1; i >= 0; i-- )
|
||||
for ( unsigned int i = new_width; i > 0; i-- )
|
||||
{
|
||||
d_rptr = (Rgb*)(rotate_buffer+(i<<2));
|
||||
for ( unsigned int j = new_height-1; j >= 0; j-- )
|
||||
d_rptr = (Rgb*)(rotate_buffer+((i-1)<<2));
|
||||
for ( unsigned int j = new_height; j > 0; j-- )
|
||||
{
|
||||
*d_rptr = *s_rptr++;
|
||||
d_rptr += new_width;
|
||||
|
@ -2379,10 +2379,10 @@ void Image::Rotate( int angle )
|
|||
else /* Assume RGB24 */
|
||||
{
|
||||
unsigned char *d_ptr;
|
||||
for ( unsigned int i = new_width-1; i >= 0; i-- )
|
||||
for ( unsigned int i = new_width; i > 0; i-- )
|
||||
{
|
||||
d_ptr = rotate_buffer+(3*i);
|
||||
for ( unsigned int j = new_height-1; j >= 0; j-- )
|
||||
d_ptr = rotate_buffer+((i-1)*3);
|
||||
for ( unsigned int j = new_height; j > 0; j-- )
|
||||
{
|
||||
*d_ptr = *s_ptr++;
|
||||
*(d_ptr+1) = *s_ptr++;
|
||||
|
@ -2439,10 +2439,10 @@ void Image::Rotate( int angle )
|
|||
if ( colours == ZM_COLOUR_GRAY8 )
|
||||
{
|
||||
unsigned char *d_ptr;
|
||||
for ( unsigned int i = new_width-1; i >= 0; i-- )
|
||||
for ( unsigned int i = new_width; i > 0; i-- )
|
||||
{
|
||||
d_ptr = rotate_buffer+i;
|
||||
for ( unsigned int j = new_height-1; j >= 0; j-- )
|
||||
d_ptr = rotate_buffer+(i-1);
|
||||
for ( unsigned int j = new_height; j > 0; j-- )
|
||||
{
|
||||
s_ptr--;
|
||||
*d_ptr = *s_ptr;
|
||||
|
@ -2454,10 +2454,10 @@ void Image::Rotate( int angle )
|
|||
{
|
||||
Rgb* s_rptr = (Rgb*)s_ptr;
|
||||
Rgb* d_rptr;
|
||||
for ( int i = new_width-1; i >= 0; i-- )
|
||||
for ( unsigned int i = new_width; i > 0; i-- )
|
||||
{
|
||||
d_rptr = (Rgb*)(rotate_buffer+(i<<2));
|
||||
for ( int j = new_height-1; j >= 0; j-- )
|
||||
d_rptr = (Rgb*)(rotate_buffer+((i-1)<<2));
|
||||
for ( unsigned int j = new_height; j > 0; j-- )
|
||||
{
|
||||
s_rptr--;
|
||||
*d_rptr = *s_rptr;
|
||||
|
@ -2468,10 +2468,10 @@ void Image::Rotate( int angle )
|
|||
else /* Assume RGB24 */
|
||||
{
|
||||
unsigned char *d_ptr;
|
||||
for ( unsigned int i = new_width-1; i >= 0; i-- )
|
||||
for ( unsigned int i = new_width; i > 0; i-- )
|
||||
{
|
||||
d_ptr = rotate_buffer+(3*i);
|
||||
for ( unsigned int j = new_height-1; j >= 0; j-- )
|
||||
d_ptr = rotate_buffer+((i-1)*3);
|
||||
for ( unsigned int j = new_height; j > 0; j-- )
|
||||
{
|
||||
*(d_ptr+2) = *(--s_ptr);
|
||||
*(d_ptr+1) = *(--s_ptr);
|
||||
|
@ -2988,7 +2988,10 @@ void Image::Deinterlace_4Field(const Image* next_image, unsigned int threshold)
|
|||
/************************************************* BLEND FUNCTIONS *************************************************/
|
||||
|
||||
|
||||
__attribute__((noinline,__target__("sse2"))) void sse2_fastblend(const uint8_t* col1, const uint8_t* col2, uint8_t* result, unsigned long count, double blendpercent) {
|
||||
#if defined(__i386__) || defined(__x86_64__)
|
||||
__attribute__((noinline,__target__("sse2")))
|
||||
#endif
|
||||
void sse2_fastblend(const uint8_t* col1, const uint8_t* col2, uint8_t* result, unsigned long count, double blendpercent) {
|
||||
#if ((defined(__i386__) || defined(__x86_64__) || defined(ZM_KEEP_SSE)) && !defined(ZM_STRIP_SSE))
|
||||
static uint32_t divider = 0;
|
||||
static uint32_t clearmask = 0;
|
||||
|
@ -3000,23 +3003,23 @@ __attribute__((noinline,__target__("sse2"))) void sse2_fastblend(const uint8_t*
|
|||
// 1.5625% blending
|
||||
divider = 6;
|
||||
clearmask = 0x03030303;
|
||||
} else if(blendpercent >= 2.34375 && blendpercent < 4.6875) {
|
||||
} else if(blendpercent < 4.6875) {
|
||||
// 3.125% blending
|
||||
divider = 5;
|
||||
clearmask = 0x07070707;
|
||||
} else if(blendpercent >= 4.6875 && blendpercent < 9.375) {
|
||||
} else if(blendpercent < 9.375) {
|
||||
// 6.25% blending
|
||||
divider = 4;
|
||||
clearmask = 0x0F0F0F0F;
|
||||
} else if(blendpercent >= 9.375 && blendpercent < 18.75) {
|
||||
} else if(blendpercent < 18.75) {
|
||||
// 12.5% blending
|
||||
divider = 3;
|
||||
clearmask = 0x1F1F1F1F;
|
||||
} else if(blendpercent >= 18.75 && blendpercent < 37.5) {
|
||||
} else if(blendpercent < 37.5) {
|
||||
// 25% blending
|
||||
divider = 2;
|
||||
clearmask = 0x3F3F3F3F;
|
||||
} else if(blendpercent >= 37.5) {
|
||||
} else {
|
||||
// 50% blending
|
||||
divider = 1;
|
||||
clearmask = 0x7F7F7F7F;
|
||||
|
@ -3063,19 +3066,19 @@ __attribute__((noinline)) void std_fastblend(const uint8_t* col1, const uint8_t*
|
|||
if(blendpercent < 2.34375) {
|
||||
// 1.5625% blending
|
||||
divider = 6;
|
||||
} else if(blendpercent >= 2.34375 && blendpercent < 4.6875) {
|
||||
} else if(blendpercent < 4.6875) {
|
||||
// 3.125% blending
|
||||
divider = 5;
|
||||
} else if(blendpercent >= 4.6875 && blendpercent < 9.375) {
|
||||
} else if(blendpercent < 9.375) {
|
||||
// 6.25% blending
|
||||
divider = 4;
|
||||
} else if(blendpercent >= 9.375 && blendpercent < 18.75) {
|
||||
} else if(blendpercent < 18.75) {
|
||||
// 12.5% blending
|
||||
divider = 3;
|
||||
} else if(blendpercent >= 18.75 && blendpercent < 37.5) {
|
||||
} else if(blendpercent < 37.5) {
|
||||
// 25% blending
|
||||
divider = 2;
|
||||
} else if(blendpercent >= 37.5) {
|
||||
} else {
|
||||
// 50% blending
|
||||
divider = 1;
|
||||
}
|
||||
|
@ -3330,7 +3333,10 @@ __attribute__((noinline)) void std_delta8_abgr(const uint8_t* col1, const uint8_
|
|||
}
|
||||
|
||||
/* Grayscale SSE2 */
|
||||
__attribute__((noinline,__target__("sse2"))) void sse2_delta8_gray8(const uint8_t* col1, const uint8_t* col2, uint8_t* result, unsigned long count) {
|
||||
#if defined(__i386__) || defined(__x86_64__)
|
||||
__attribute__((noinline,__target__("sse2")))
|
||||
#endif
|
||||
void sse2_delta8_gray8(const uint8_t* col1, const uint8_t* col2, uint8_t* result, unsigned long count) {
|
||||
#if ((defined(__i386__) || defined(__x86_64__) || defined(ZM_KEEP_SSE)) && !defined(ZM_STRIP_SSE))
|
||||
|
||||
__asm__ __volatile__ (
|
||||
|
@ -3358,7 +3364,10 @@ __attribute__((noinline,__target__("sse2"))) void sse2_delta8_gray8(const uint8_
|
|||
}
|
||||
|
||||
/* RGB32: RGBA SSE2 */
|
||||
__attribute__((noinline,__target__("sse2"))) void sse2_delta8_rgba(const uint8_t* col1, const uint8_t* col2, uint8_t* result, unsigned long count) {
|
||||
#if defined(__i386__) || defined(__x86_64__)
|
||||
__attribute__((noinline,__target__("sse2")))
|
||||
#endif
|
||||
void sse2_delta8_rgba(const uint8_t* col1, const uint8_t* col2, uint8_t* result, unsigned long count) {
|
||||
#if ((defined(__i386__) || defined(__x86_64__) || defined(ZM_KEEP_SSE)) && !defined(ZM_STRIP_SSE))
|
||||
|
||||
__asm__ __volatile__ (
|
||||
|
@ -3413,7 +3422,10 @@ __attribute__((noinline,__target__("sse2"))) void sse2_delta8_rgba(const uint8_t
|
|||
}
|
||||
|
||||
/* RGB32: BGRA SSE2 */
|
||||
__attribute__((noinline,__target__("sse2"))) void sse2_delta8_bgra(const uint8_t* col1, const uint8_t* col2, uint8_t* result, unsigned long count) {
|
||||
#if defined(__i386__) || defined(__x86_64__)
|
||||
__attribute__((noinline,__target__("sse2")))
|
||||
#endif
|
||||
void sse2_delta8_bgra(const uint8_t* col1, const uint8_t* col2, uint8_t* result, unsigned long count) {
|
||||
#if ((defined(__i386__) || defined(__x86_64__) || defined(ZM_KEEP_SSE)) && !defined(ZM_STRIP_SSE))
|
||||
|
||||
__asm__ __volatile__ (
|
||||
|
@ -3468,7 +3480,10 @@ __attribute__((noinline,__target__("sse2"))) void sse2_delta8_bgra(const uint8_t
|
|||
}
|
||||
|
||||
/* RGB32: ARGB SSE2 */
|
||||
__attribute__((noinline,__target__("sse2"))) void sse2_delta8_argb(const uint8_t* col1, const uint8_t* col2, uint8_t* result, unsigned long count) {
|
||||
#if defined(__i386__) || defined(__x86_64__)
|
||||
__attribute__((noinline,__target__("sse2")))
|
||||
#endif
|
||||
void sse2_delta8_argb(const uint8_t* col1, const uint8_t* col2, uint8_t* result, unsigned long count) {
|
||||
#if ((defined(__i386__) || defined(__x86_64__) || defined(ZM_KEEP_SSE)) && !defined(ZM_STRIP_SSE))
|
||||
|
||||
__asm__ __volatile__ (
|
||||
|
@ -3524,7 +3539,10 @@ __attribute__((noinline,__target__("sse2"))) void sse2_delta8_argb(const uint8_t
|
|||
}
|
||||
|
||||
/* RGB32: ABGR SSE2 */
|
||||
__attribute__((noinline,__target__("sse2"))) void sse2_delta8_abgr(const uint8_t* col1, const uint8_t* col2, uint8_t* result, unsigned long count) {
|
||||
#if defined(__i386__) || defined(__x86_64__)
|
||||
__attribute__((noinline,__target__("sse2")))
|
||||
#endif
|
||||
void sse2_delta8_abgr(const uint8_t* col1, const uint8_t* col2, uint8_t* result, unsigned long count) {
|
||||
#if ((defined(__i386__) || defined(__x86_64__) || defined(ZM_KEEP_SSE)) && !defined(ZM_STRIP_SSE))
|
||||
|
||||
__asm__ __volatile__ (
|
||||
|
@ -3580,7 +3598,10 @@ __attribute__((noinline,__target__("sse2"))) void sse2_delta8_abgr(const uint8_t
|
|||
}
|
||||
|
||||
/* RGB32: RGBA SSSE3 */
|
||||
__attribute__((noinline,__target__("ssse3"))) void ssse3_delta8_rgba(const uint8_t* col1, const uint8_t* col2, uint8_t* result, unsigned long count) {
|
||||
#if defined(__i386__) || defined(__x86_64__)
|
||||
__attribute__((noinline,__target__("ssse3")))
|
||||
#endif
|
||||
void ssse3_delta8_rgba(const uint8_t* col1, const uint8_t* col2, uint8_t* result, unsigned long count) {
|
||||
#if ((defined(__i386__) || defined(__x86_64__) || defined(ZM_KEEP_SSE)) && !defined(ZM_STRIP_SSE))
|
||||
|
||||
__asm__ __volatile__ (
|
||||
|
@ -3632,7 +3653,10 @@ __attribute__((noinline,__target__("ssse3"))) void ssse3_delta8_rgba(const uint8
|
|||
}
|
||||
|
||||
/* RGB32: BGRA SSSE3 */
|
||||
__attribute__((noinline,__target__("ssse3"))) void ssse3_delta8_bgra(const uint8_t* col1, const uint8_t* col2, uint8_t* result, unsigned long count) {
|
||||
#if defined(__i386__) || defined(__x86_64__)
|
||||
__attribute__((noinline,__target__("ssse3")))
|
||||
#endif
|
||||
void ssse3_delta8_bgra(const uint8_t* col1, const uint8_t* col2, uint8_t* result, unsigned long count) {
|
||||
#if ((defined(__i386__) || defined(__x86_64__) || defined(ZM_KEEP_SSE)) && !defined(ZM_STRIP_SSE))
|
||||
|
||||
__asm__ __volatile__ (
|
||||
|
@ -3684,7 +3708,10 @@ __attribute__((noinline,__target__("ssse3"))) void ssse3_delta8_bgra(const uint8
|
|||
}
|
||||
|
||||
/* RGB32: ARGB SSSE3 */
|
||||
__attribute__((noinline,__target__("ssse3"))) void ssse3_delta8_argb(const uint8_t* col1, const uint8_t* col2, uint8_t* result, unsigned long count) {
|
||||
#if defined(__i386__) || defined(__x86_64__)
|
||||
__attribute__((noinline,__target__("ssse3")))
|
||||
#endif
|
||||
void ssse3_delta8_argb(const uint8_t* col1, const uint8_t* col2, uint8_t* result, unsigned long count) {
|
||||
#if ((defined(__i386__) || defined(__x86_64__) || defined(ZM_KEEP_SSE)) && !defined(ZM_STRIP_SSE))
|
||||
|
||||
__asm__ __volatile__ (
|
||||
|
@ -3737,7 +3764,10 @@ __attribute__((noinline,__target__("ssse3"))) void ssse3_delta8_argb(const uint8
|
|||
}
|
||||
|
||||
/* RGB32: ABGR SSSE3 */
|
||||
__attribute__((noinline,__target__("ssse3"))) void ssse3_delta8_abgr(const uint8_t* col1, const uint8_t* col2, uint8_t* result, unsigned long count) {
|
||||
#if defined(__i386__) || defined(__x86_64__)
|
||||
__attribute__((noinline,__target__("ssse3")))
|
||||
#endif
|
||||
void ssse3_delta8_abgr(const uint8_t* col1, const uint8_t* col2, uint8_t* result, unsigned long count) {
|
||||
#if ((defined(__i386__) || defined(__x86_64__) || defined(ZM_KEEP_SSE)) && !defined(ZM_STRIP_SSE))
|
||||
|
||||
__asm__ __volatile__ (
|
||||
|
@ -3989,7 +4019,10 @@ __attribute__((noinline)) void std_convert_yuyv_gray8(const uint8_t* col1, uint8
|
|||
}
|
||||
|
||||
/* RGBA to grayscale SSSE3 */
|
||||
__attribute__((noinline,__target__("ssse3"))) void ssse3_convert_rgba_gray8(const uint8_t* col1, uint8_t* result, unsigned long count) {
|
||||
#if defined(__i386__) || defined(__x86_64__)
|
||||
__attribute__((noinline,__target__("ssse3")))
|
||||
#endif
|
||||
void ssse3_convert_rgba_gray8(const uint8_t* col1, uint8_t* result, unsigned long count) {
|
||||
#if ((defined(__i386__) || defined(__x86_64__) || defined(ZM_KEEP_SSE)) && !defined(ZM_STRIP_SSE))
|
||||
|
||||
__asm__ __volatile__ (
|
||||
|
@ -4035,7 +4068,10 @@ __attribute__((noinline,__target__("ssse3"))) void ssse3_convert_rgba_gray8(cons
|
|||
}
|
||||
|
||||
/* Converts a YUYV image into grayscale by extracting the Y channel */
|
||||
__attribute__((noinline,__target__("ssse3"))) void ssse3_convert_yuyv_gray8(const uint8_t* col1, uint8_t* result, unsigned long count) {
|
||||
#if defined(__i386__) || defined(__x86_64__)
|
||||
__attribute__((noinline,__target__("ssse3")))
|
||||
#endif
|
||||
void ssse3_convert_yuyv_gray8(const uint8_t* col1, uint8_t* result, unsigned long count) {
|
||||
#if ((defined(__i386__) || defined(__x86_64__) || defined(ZM_KEEP_SSE)) && !defined(ZM_STRIP_SSE))
|
||||
unsigned long i = 0;
|
||||
|
||||
|
@ -4652,8 +4688,12 @@ __attribute__((noinline)) void std_deinterlace_4field_abgr(uint8_t* col1, uint8_
|
|||
}
|
||||
|
||||
/* Grayscale SSSE3 */
|
||||
__attribute__((noinline,__target__("ssse3"))) void ssse3_deinterlace_4field_gray8(uint8_t* col1, uint8_t* col2, unsigned int threshold, unsigned int width, unsigned int height) {
|
||||
|
||||
#if defined(__i386__) || defined(__x86_64__)
|
||||
__attribute__((noinline,__target__("ssse3")))
|
||||
#endif
|
||||
void ssse3_deinterlace_4field_gray8(uint8_t* col1, uint8_t* col2, unsigned int threshold, unsigned int width, unsigned int height) {
|
||||
|
||||
#if ((defined(__i386__) || defined(__x86_64__) || defined(ZM_KEEP_SSE)) && !defined(ZM_STRIP_SSE))
|
||||
union {
|
||||
uint32_t int32;
|
||||
uint8_t int8a[4];
|
||||
|
@ -4662,11 +4702,11 @@ __attribute__((noinline,__target__("ssse3"))) void ssse3_deinterlace_4field_gray
|
|||
threshold_mask.int8a[1] = 0;
|
||||
threshold_mask.int8a[2] = threshold;
|
||||
threshold_mask.int8a[3] = 0;
|
||||
|
||||
|
||||
unsigned long row_width = width;
|
||||
uint8_t* max_ptr = col1 + (row_width * (height-2));
|
||||
uint8_t* max_ptr2 = col1 + row_width;
|
||||
|
||||
|
||||
__asm__ __volatile__ (
|
||||
/* Load the threshold */
|
||||
"mov %5, %%eax\n\t"
|
||||
|
@ -4674,9 +4714,9 @@ __attribute__((noinline,__target__("ssse3"))) void ssse3_deinterlace_4field_gray
|
|||
"pshufd $0x0, %%xmm4, %%xmm4\n\t"
|
||||
/* Zero the temporary register */
|
||||
"pxor %%xmm0, %%xmm0\n\t"
|
||||
|
||||
|
||||
"algo_ssse3_deinterlace_4field_gray8:\n\t"
|
||||
|
||||
|
||||
/* Load pabove into xmm1 and pnabove into xmm2 */
|
||||
"movdqa (%0), %%xmm1\n\t"
|
||||
"movdqa (%1), %%xmm2\n\t"
|
||||
|
@ -4685,11 +4725,11 @@ __attribute__((noinline,__target__("ssse3"))) void ssse3_deinterlace_4field_gray
|
|||
"pminub %%xmm5, %%xmm2\n\t"
|
||||
"psubb %%xmm2, %%xmm1\n\t"
|
||||
"movdqa %%xmm1, %%xmm7\n\t" /* Backup of delta2 in xmm7 for now */
|
||||
|
||||
|
||||
/* Next row */
|
||||
"add %4, %0\n\t"
|
||||
"add %4, %1\n\t"
|
||||
|
||||
|
||||
/* Load pcurrent into xmm1 and pncurrent into xmm2 */
|
||||
"movdqa (%0), %%xmm1\n\t"
|
||||
"movdqa (%1), %%xmm2\n\t"
|
||||
|
@ -4697,17 +4737,17 @@ __attribute__((noinline,__target__("ssse3"))) void ssse3_deinterlace_4field_gray
|
|||
"pmaxub %%xmm2, %%xmm1\n\t"
|
||||
"pminub %%xmm6, %%xmm2\n\t"
|
||||
"psubb %%xmm2, %%xmm1\n\t"
|
||||
|
||||
|
||||
"pavgb %%xmm7, %%xmm1\n\t" // Average the two deltas together
|
||||
"movdqa %%xmm1, %%xmm2\n\t"
|
||||
|
||||
|
||||
/* Do the comparison on words instead of bytes because we don't have unsigned comparison */
|
||||
"punpcklbw %%xmm0, %%xmm1\n\t" // Expand pixels 0-7 into words into xmm1
|
||||
"punpckhbw %%xmm0, %%xmm2\n\t" // Expand pixels 8-15 into words into xmm2
|
||||
"pcmpgtw %%xmm4, %%xmm1\n\t" // Compare average delta with threshold for pixels 0-7
|
||||
"pcmpgtw %%xmm4, %%xmm2\n\t" // Compare average delta with threshold for pixels 8-15
|
||||
"packsswb %%xmm2, %%xmm1\n\t" // Pack the comparison results into xmm1
|
||||
|
||||
|
||||
"movdqa (%0,%4), %%xmm2\n\t" // Load pbelow
|
||||
"pavgb %%xmm5, %%xmm2\n\t" // Average pabove and pbelow
|
||||
"pand %%xmm1, %%xmm2\n\t" // Filter out pixels in avg that shouldn't be copied
|
||||
|
@ -4715,24 +4755,24 @@ __attribute__((noinline,__target__("ssse3"))) void ssse3_deinterlace_4field_gray
|
|||
|
||||
"por %%xmm2, %%xmm1\n\t" // Put the new values in pcurrent
|
||||
"movntdq %%xmm1, (%0)\n\t" // Write pcurrent
|
||||
|
||||
|
||||
"sub %4, %0\n\t" // Restore pcurrent to pabove
|
||||
"sub %4, %1\n\t" // Restore pncurrent to pnabove
|
||||
|
||||
|
||||
/* Next pixels */
|
||||
"add $0x10, %0\n\t" // Add 16 to pcurrent
|
||||
"add $0x10, %1\n\t" // Add 16 to pncurrent
|
||||
|
||||
|
||||
/* Check if we reached the row end */
|
||||
"cmp %2, %0\n\t"
|
||||
"jb algo_ssse3_deinterlace_4field_gray8\n\t" // Go for another iteration
|
||||
|
||||
|
||||
/* Next row */
|
||||
"add %4, %0\n\t" // Add width to pcurrent
|
||||
"add %4, %1\n\t" // Add width to pncurrent
|
||||
"mov %0, %2\n\t"
|
||||
"add %4, %2\n\t" // Add width to max_ptr2
|
||||
|
||||
|
||||
/* Check if we reached the end */
|
||||
"cmp %3, %0\n\t"
|
||||
"jb algo_ssse3_deinterlace_4field_gray8\n\t" // Go for another iteration
|
||||
|
@ -4746,11 +4786,11 @@ __attribute__((noinline,__target__("ssse3"))) void ssse3_deinterlace_4field_gray
|
|||
"pminub %%xmm5, %%xmm2\n\t"
|
||||
"psubb %%xmm2, %%xmm1\n\t"
|
||||
"movdqa %%xmm1, %%xmm7\n\t" /* Backup of delta2 in xmm7 for now */
|
||||
|
||||
|
||||
/* Next row */
|
||||
"add %4, %0\n\t"
|
||||
"add %4, %1\n\t"
|
||||
|
||||
|
||||
/* Load pcurrent into xmm1 and pncurrent into xmm2 */
|
||||
"movdqa (%0), %%xmm1\n\t"
|
||||
"movdqa (%1), %%xmm2\n\t"
|
||||
|
@ -4758,17 +4798,17 @@ __attribute__((noinline,__target__("ssse3"))) void ssse3_deinterlace_4field_gray
|
|||
"pmaxub %%xmm2, %%xmm1\n\t"
|
||||
"pminub %%xmm6, %%xmm2\n\t"
|
||||
"psubb %%xmm2, %%xmm1\n\t"
|
||||
|
||||
|
||||
"pavgb %%xmm7, %%xmm1\n\t" // Average the two deltas together
|
||||
"movdqa %%xmm1, %%xmm2\n\t"
|
||||
|
||||
|
||||
/* Do the comparison on words instead of bytes because we don't have unsigned comparison */
|
||||
"punpcklbw %%xmm0, %%xmm1\n\t" // Expand pixels 0-7 into words into xmm1
|
||||
"punpckhbw %%xmm0, %%xmm2\n\t" // Expand pixels 8-15 into words into xmm2
|
||||
"pcmpgtw %%xmm4, %%xmm1\n\t" // Compare average delta with threshold for pixels 0-7
|
||||
"pcmpgtw %%xmm4, %%xmm2\n\t" // Compare average delta with threshold for pixels 8-15
|
||||
"packsswb %%xmm2, %%xmm1\n\t" // Pack the comparison results into xmm1
|
||||
|
||||
|
||||
"pand %%xmm1, %%xmm5\n\t" // Filter out pixels in pabove that shouldn't be copied
|
||||
"pandn %%xmm6, %%xmm1\n\t" // Filter out pixels in pcurrent that should be replaced
|
||||
|
||||
|
@ -4778,18 +4818,25 @@ __attribute__((noinline,__target__("ssse3"))) void ssse3_deinterlace_4field_gray
|
|||
: "r" (col1), "r" (col2), "r" (max_ptr2), "r" (max_ptr), "r" (row_width), "m" (threshold_mask.int32)
|
||||
: "%eax", "%xmm0", "%xmm1", "%xmm2", "%xmm3", "%xmm4", "%xmm5", "%xmm6", "%xmm7", "cc", "memory"
|
||||
);
|
||||
#else
|
||||
Panic("SSE function called on a non x86\\x86-64 platform");
|
||||
#endif
|
||||
}
|
||||
|
||||
/* RGBA SSSE3 */
|
||||
__attribute__((noinline,__target__("ssse3"))) void ssse3_deinterlace_4field_rgba(uint8_t* col1, uint8_t* col2, unsigned int threshold, unsigned int width, unsigned int height) {
|
||||
#if defined(__i386__) || defined(__x86_64__)
|
||||
__attribute__((noinline,__target__("ssse3")))
|
||||
#endif
|
||||
void ssse3_deinterlace_4field_rgba(uint8_t* col1, uint8_t* col2, unsigned int threshold, unsigned int width, unsigned int height) {
|
||||
#if ((defined(__i386__) || defined(__x86_64__) || defined(ZM_KEEP_SSE)) && !defined(ZM_STRIP_SSE))
|
||||
__attribute__((aligned(16))) static const uint8_t movemask2[16] = {1,1,1,1,1,0,0,2,9,9,9,9,9,8,8,10};
|
||||
|
||||
|
||||
const uint32_t threshold_val = threshold;
|
||||
|
||||
|
||||
unsigned long row_width = width*4;
|
||||
uint8_t* max_ptr = col1 + (row_width * (height-2));
|
||||
uint8_t* max_ptr2 = col1 + row_width;
|
||||
|
||||
|
||||
__asm__ __volatile__ (
|
||||
"mov $0x1F1F1F1F, %%eax\n\t"
|
||||
"movd %%eax, %%xmm4\n\t"
|
||||
|
@ -4802,9 +4849,9 @@ __attribute__((noinline,__target__("ssse3"))) void ssse3_deinterlace_4field_rgba
|
|||
#endif
|
||||
/* Zero the temporary register */
|
||||
"pxor %%xmm0, %%xmm0\n\t"
|
||||
|
||||
|
||||
"algo_ssse3_deinterlace_4field_rgba:\n\t"
|
||||
|
||||
|
||||
/* Load pabove into xmm1 and pnabove into xmm2 */
|
||||
"movdqa (%0), %%xmm1\n\t"
|
||||
"movdqa (%1), %%xmm2\n\t"
|
||||
|
@ -4824,11 +4871,11 @@ __attribute__((noinline,__target__("ssse3"))) void ssse3_deinterlace_4field_rgba
|
|||
"psadbw %%xmm0, %%xmm2\n\t"
|
||||
"packuswb %%xmm2, %%xmm1\n\t"
|
||||
"movdqa %%xmm1, %%xmm7\n\t" /* Backup of delta2 in xmm7 for now */
|
||||
|
||||
|
||||
/* Next row */
|
||||
"add %4, %0\n\t"
|
||||
"add %4, %1\n\t"
|
||||
|
||||
|
||||
/* Load pcurrent into xmm1 and pncurrent into xmm2 */
|
||||
"movdqa (%0), %%xmm1\n\t"
|
||||
"movdqa (%1), %%xmm2\n\t"
|
||||
|
@ -4847,7 +4894,7 @@ __attribute__((noinline,__target__("ssse3"))) void ssse3_deinterlace_4field_rgba
|
|||
"pshufb %%xmm3, %%xmm2\n\t"
|
||||
"psadbw %%xmm0, %%xmm2\n\t"
|
||||
"packuswb %%xmm2, %%xmm1\n\t"
|
||||
|
||||
|
||||
"pavgb %%xmm7, %%xmm1\n\t" // Average the two deltas together
|
||||
|
||||
#if defined(__x86_64__)
|
||||
|
@ -4855,7 +4902,7 @@ __attribute__((noinline,__target__("ssse3"))) void ssse3_deinterlace_4field_rgba
|
|||
#else
|
||||
"movd %%eax, %%xmm7\n\t" // Setup the threshold
|
||||
"pshufd $0x0, %%xmm7, %%xmm7\n\t"
|
||||
|
||||
|
||||
"pcmpgtd %%xmm7, %%xmm1\n\t" // Compare average delta with the threshold
|
||||
#endif
|
||||
"movdqa (%0,%4), %%xmm2\n\t" // Load pbelow
|
||||
|
@ -4865,28 +4912,28 @@ __attribute__((noinline,__target__("ssse3"))) void ssse3_deinterlace_4field_rgba
|
|||
|
||||
"por %%xmm2, %%xmm1\n\t" // Put the new values in pcurrent
|
||||
"movntdq %%xmm1, (%0)\n\t" // Write pcurrent
|
||||
|
||||
|
||||
"sub %4, %0\n\t" // Restore pcurrent to pabove
|
||||
"sub %4, %1\n\t" // Restore pncurrent to pnabove
|
||||
|
||||
|
||||
/* Next pixels */
|
||||
"add $0x10, %0\n\t" // Add 16 to pcurrent
|
||||
"add $0x10, %1\n\t" // Add 16 to pncurrent
|
||||
|
||||
|
||||
/* Check if we reached the row end */
|
||||
"cmp %2, %0\n\t"
|
||||
"jb algo_ssse3_deinterlace_4field_rgba\n\t" // Go for another iteration
|
||||
|
||||
|
||||
/* Next row */
|
||||
"add %4, %0\n\t" // Add width to pcurrent
|
||||
"add %4, %1\n\t" // Add width to pncurrent
|
||||
"mov %0, %2\n\t"
|
||||
"add %4, %2\n\t" // Add width to max_ptr2
|
||||
|
||||
|
||||
/* Check if we reached the end */
|
||||
"cmp %3, %0\n\t"
|
||||
"jb algo_ssse3_deinterlace_4field_rgba\n\t" // Go for another iteration
|
||||
|
||||
|
||||
/* Special case for the last line */
|
||||
/* Load pabove into xmm1 and pnabove into xmm2 */
|
||||
"movdqa (%0), %%xmm1\n\t"
|
||||
|
@ -4907,11 +4954,11 @@ __attribute__((noinline,__target__("ssse3"))) void ssse3_deinterlace_4field_rgba
|
|||
"psadbw %%xmm0, %%xmm2\n\t"
|
||||
"packuswb %%xmm2, %%xmm1\n\t"
|
||||
"movdqa %%xmm1, %%xmm7\n\t" /* Backup of delta2 in xmm7 for now */
|
||||
|
||||
|
||||
/* Next row */
|
||||
"add %4, %0\n\t"
|
||||
"add %4, %1\n\t"
|
||||
|
||||
|
||||
/* Load pcurrent into xmm1 and pncurrent into xmm2 */
|
||||
"movdqa (%0), %%xmm1\n\t"
|
||||
"movdqa (%1), %%xmm2\n\t"
|
||||
|
@ -4930,7 +4977,7 @@ __attribute__((noinline,__target__("ssse3"))) void ssse3_deinterlace_4field_rgba
|
|||
"pshufb %%xmm3, %%xmm2\n\t"
|
||||
"psadbw %%xmm0, %%xmm2\n\t"
|
||||
"packuswb %%xmm2, %%xmm1\n\t"
|
||||
|
||||
|
||||
"pavgb %%xmm7, %%xmm1\n\t" // Average the two deltas together
|
||||
|
||||
#if defined(__x86_64__)
|
||||
|
@ -4938,7 +4985,7 @@ __attribute__((noinline,__target__("ssse3"))) void ssse3_deinterlace_4field_rgba
|
|||
#else
|
||||
"movd %%eax, %%xmm7\n\t" // Setup the threshold
|
||||
"pshufd $0x0, %%xmm7, %%xmm7\n\t"
|
||||
|
||||
|
||||
"pcmpgtd %%xmm7, %%xmm1\n\t" // Compare average delta with the threshold
|
||||
#endif
|
||||
"pand %%xmm1, %%xmm5\n\t" // Filter out pixels in pabove that shouldn't be copied
|
||||
|
@ -4954,18 +5001,25 @@ __attribute__((noinline,__target__("ssse3"))) void ssse3_deinterlace_4field_rgba
|
|||
: "%eax", "%xmm0", "%xmm1", "%xmm2", "%xmm3", "%xmm4", "%xmm5", "%xmm6", "%xmm7", "cc", "memory"
|
||||
#endif
|
||||
);
|
||||
#else
|
||||
Panic("SSE function called on a non x86\\x86-64 platform");
|
||||
#endif
|
||||
}
|
||||
|
||||
/* BGRA SSSE3 */
|
||||
__attribute__((noinline,__target__("ssse3"))) void ssse3_deinterlace_4field_bgra(uint8_t* col1, uint8_t* col2, unsigned int threshold, unsigned int width, unsigned int height) {
|
||||
#if defined(__i386__) || defined(__x86_64__)
|
||||
__attribute__((noinline,__target__("ssse3")))
|
||||
#endif
|
||||
void ssse3_deinterlace_4field_bgra(uint8_t* col1, uint8_t* col2, unsigned int threshold, unsigned int width, unsigned int height) {
|
||||
#if ((defined(__i386__) || defined(__x86_64__) || defined(ZM_KEEP_SSE)) && !defined(ZM_STRIP_SSE))
|
||||
__attribute__((aligned(16))) static const uint8_t movemask2[16] = {1,1,1,1,1,2,2,0,9,9,9,9,9,10,10,8};
|
||||
|
||||
|
||||
const uint32_t threshold_val = threshold;
|
||||
|
||||
|
||||
unsigned long row_width = width*4;
|
||||
uint8_t* max_ptr = col1 + (row_width * (height-2));
|
||||
uint8_t* max_ptr2 = col1 + row_width;
|
||||
|
||||
|
||||
__asm__ __volatile__ (
|
||||
"mov $0x1F1F1F1F, %%eax\n\t"
|
||||
"movd %%eax, %%xmm4\n\t"
|
||||
|
@ -4978,9 +5032,9 @@ __attribute__((noinline,__target__("ssse3"))) void ssse3_deinterlace_4field_bgra
|
|||
#endif
|
||||
/* Zero the temporary register */
|
||||
"pxor %%xmm0, %%xmm0\n\t"
|
||||
|
||||
|
||||
"algo_ssse3_deinterlace_4field_bgra:\n\t"
|
||||
|
||||
|
||||
/* Load pabove into xmm1 and pnabove into xmm2 */
|
||||
"movdqa (%0), %%xmm1\n\t"
|
||||
"movdqa (%1), %%xmm2\n\t"
|
||||
|
@ -5000,11 +5054,11 @@ __attribute__((noinline,__target__("ssse3"))) void ssse3_deinterlace_4field_bgra
|
|||
"psadbw %%xmm0, %%xmm2\n\t"
|
||||
"packuswb %%xmm2, %%xmm1\n\t"
|
||||
"movdqa %%xmm1, %%xmm7\n\t" /* Backup of delta2 in xmm7 for now */
|
||||
|
||||
|
||||
/* Next row */
|
||||
"add %4, %0\n\t"
|
||||
"add %4, %1\n\t"
|
||||
|
||||
|
||||
/* Load pcurrent into xmm1 and pncurrent into xmm2 */
|
||||
"movdqa (%0), %%xmm1\n\t"
|
||||
"movdqa (%1), %%xmm2\n\t"
|
||||
|
@ -5023,7 +5077,7 @@ __attribute__((noinline,__target__("ssse3"))) void ssse3_deinterlace_4field_bgra
|
|||
"pshufb %%xmm3, %%xmm2\n\t"
|
||||
"psadbw %%xmm0, %%xmm2\n\t"
|
||||
"packuswb %%xmm2, %%xmm1\n\t"
|
||||
|
||||
|
||||
"pavgb %%xmm7, %%xmm1\n\t" // Average the two deltas together
|
||||
|
||||
#if defined(__x86_64__)
|
||||
|
@ -5031,7 +5085,7 @@ __attribute__((noinline,__target__("ssse3"))) void ssse3_deinterlace_4field_bgra
|
|||
#else
|
||||
"movd %%eax, %%xmm7\n\t" // Setup the threshold
|
||||
"pshufd $0x0, %%xmm7, %%xmm7\n\t"
|
||||
|
||||
|
||||
"pcmpgtd %%xmm7, %%xmm1\n\t" // Compare average delta with the threshold
|
||||
#endif
|
||||
"movdqa (%0,%4), %%xmm2\n\t" // Load pbelow
|
||||
|
@ -5041,28 +5095,28 @@ __attribute__((noinline,__target__("ssse3"))) void ssse3_deinterlace_4field_bgra
|
|||
|
||||
"por %%xmm2, %%xmm1\n\t" // Put the new values in pcurrent
|
||||
"movntdq %%xmm1, (%0)\n\t" // Write pcurrent
|
||||
|
||||
|
||||
"sub %4, %0\n\t" // Restore pcurrent to pabove
|
||||
"sub %4, %1\n\t" // Restore pncurrent to pnabove
|
||||
|
||||
|
||||
/* Next pixels */
|
||||
"add $0x10, %0\n\t" // Add 16 to pcurrent
|
||||
"add $0x10, %1\n\t" // Add 16 to pncurrent
|
||||
|
||||
|
||||
/* Check if we reached the row end */
|
||||
"cmp %2, %0\n\t"
|
||||
"jb algo_ssse3_deinterlace_4field_bgra\n\t" // Go for another iteration
|
||||
|
||||
|
||||
/* Next row */
|
||||
"add %4, %0\n\t" // Add width to pcurrent
|
||||
"add %4, %1\n\t" // Add width to pncurrent
|
||||
"mov %0, %2\n\t"
|
||||
"add %4, %2\n\t" // Add width to max_ptr2
|
||||
|
||||
|
||||
/* Check if we reached the end */
|
||||
"cmp %3, %0\n\t"
|
||||
"jb algo_ssse3_deinterlace_4field_bgra\n\t" // Go for another iteration
|
||||
|
||||
|
||||
/* Special case for the last line */
|
||||
/* Load pabove into xmm1 and pnabove into xmm2 */
|
||||
"movdqa (%0), %%xmm1\n\t"
|
||||
|
@ -5083,11 +5137,11 @@ __attribute__((noinline,__target__("ssse3"))) void ssse3_deinterlace_4field_bgra
|
|||
"psadbw %%xmm0, %%xmm2\n\t"
|
||||
"packuswb %%xmm2, %%xmm1\n\t"
|
||||
"movdqa %%xmm1, %%xmm7\n\t" /* Backup of delta2 in xmm7 for now */
|
||||
|
||||
|
||||
/* Next row */
|
||||
"add %4, %0\n\t"
|
||||
"add %4, %1\n\t"
|
||||
|
||||
|
||||
/* Load pcurrent into xmm1 and pncurrent into xmm2 */
|
||||
"movdqa (%0), %%xmm1\n\t"
|
||||
"movdqa (%1), %%xmm2\n\t"
|
||||
|
@ -5106,7 +5160,7 @@ __attribute__((noinline,__target__("ssse3"))) void ssse3_deinterlace_4field_bgra
|
|||
"pshufb %%xmm3, %%xmm2\n\t"
|
||||
"psadbw %%xmm0, %%xmm2\n\t"
|
||||
"packuswb %%xmm2, %%xmm1\n\t"
|
||||
|
||||
|
||||
"pavgb %%xmm7, %%xmm1\n\t" // Average the two deltas together
|
||||
|
||||
#if defined(__x86_64__)
|
||||
|
@ -5114,7 +5168,7 @@ __attribute__((noinline,__target__("ssse3"))) void ssse3_deinterlace_4field_bgra
|
|||
#else
|
||||
"movd %%eax, %%xmm7\n\t" // Setup the threshold
|
||||
"pshufd $0x0, %%xmm7, %%xmm7\n\t"
|
||||
|
||||
|
||||
"pcmpgtd %%xmm7, %%xmm1\n\t" // Compare average delta with the threshold
|
||||
#endif
|
||||
"pand %%xmm1, %%xmm5\n\t" // Filter out pixels in pabove that shouldn't be copied
|
||||
|
@ -5130,18 +5184,25 @@ __attribute__((noinline,__target__("ssse3"))) void ssse3_deinterlace_4field_bgra
|
|||
: "%eax", "%xmm0", "%xmm1", "%xmm2", "%xmm3", "%xmm4", "%xmm5", "%xmm6", "%xmm7", "cc", "memory"
|
||||
#endif
|
||||
);
|
||||
#else
|
||||
Panic("SSE function called on a non x86\\x86-64 platform");
|
||||
#endif
|
||||
}
|
||||
|
||||
/* ARGB SSSE3 */
|
||||
__attribute__((noinline,__target__("ssse3"))) void ssse3_deinterlace_4field_argb(uint8_t* col1, uint8_t* col2, unsigned int threshold, unsigned int width, unsigned int height) {
|
||||
#if defined(__i386__) || defined(__x86_64__)
|
||||
__attribute__((noinline,__target__("ssse3")))
|
||||
#endif
|
||||
void ssse3_deinterlace_4field_argb(uint8_t* col1, uint8_t* col2, unsigned int threshold, unsigned int width, unsigned int height) {
|
||||
#if ((defined(__i386__) || defined(__x86_64__) || defined(ZM_KEEP_SSE)) && !defined(ZM_STRIP_SSE))
|
||||
__attribute__((aligned(16))) static const uint8_t movemask2[16] = {2,2,2,2,2,1,1,3,10,10,10,10,10,9,9,11};
|
||||
|
||||
|
||||
const uint32_t threshold_val = threshold;
|
||||
|
||||
|
||||
unsigned long row_width = width*4;
|
||||
uint8_t* max_ptr = col1 + (row_width * (height-2));
|
||||
uint8_t* max_ptr2 = col1 + row_width;
|
||||
|
||||
|
||||
__asm__ __volatile__ (
|
||||
"mov $0x1F1F1F1F, %%eax\n\t"
|
||||
"movd %%eax, %%xmm4\n\t"
|
||||
|
@ -5154,9 +5215,9 @@ __attribute__((noinline,__target__("ssse3"))) void ssse3_deinterlace_4field_argb
|
|||
#endif
|
||||
/* Zero the temporary register */
|
||||
"pxor %%xmm0, %%xmm0\n\t"
|
||||
|
||||
|
||||
"algo_ssse3_deinterlace_4field_argb:\n\t"
|
||||
|
||||
|
||||
/* Load pabove into xmm1 and pnabove into xmm2 */
|
||||
"movdqa (%0), %%xmm1\n\t"
|
||||
"movdqa (%1), %%xmm2\n\t"
|
||||
|
@ -5176,11 +5237,11 @@ __attribute__((noinline,__target__("ssse3"))) void ssse3_deinterlace_4field_argb
|
|||
"psadbw %%xmm0, %%xmm2\n\t"
|
||||
"packuswb %%xmm2, %%xmm1\n\t"
|
||||
"movdqa %%xmm1, %%xmm7\n\t" /* Backup of delta2 in xmm7 for now */
|
||||
|
||||
|
||||
/* Next row */
|
||||
"add %4, %0\n\t"
|
||||
"add %4, %1\n\t"
|
||||
|
||||
|
||||
/* Load pcurrent into xmm1 and pncurrent into xmm2 */
|
||||
"movdqa (%0), %%xmm1\n\t"
|
||||
"movdqa (%1), %%xmm2\n\t"
|
||||
|
@ -5199,7 +5260,7 @@ __attribute__((noinline,__target__("ssse3"))) void ssse3_deinterlace_4field_argb
|
|||
"pshufb %%xmm3, %%xmm2\n\t"
|
||||
"psadbw %%xmm0, %%xmm2\n\t"
|
||||
"packuswb %%xmm2, %%xmm1\n\t"
|
||||
|
||||
|
||||
"pavgb %%xmm7, %%xmm1\n\t" // Average the two deltas together
|
||||
|
||||
#if defined(__x86_64__)
|
||||
|
@ -5207,7 +5268,7 @@ __attribute__((noinline,__target__("ssse3"))) void ssse3_deinterlace_4field_argb
|
|||
#else
|
||||
"movd %%eax, %%xmm7\n\t" // Setup the threshold
|
||||
"pshufd $0x0, %%xmm7, %%xmm7\n\t"
|
||||
|
||||
|
||||
"pcmpgtd %%xmm7, %%xmm1\n\t" // Compare average delta with the threshold
|
||||
#endif
|
||||
"movdqa (%0,%4), %%xmm2\n\t" // Load pbelow
|
||||
|
@ -5217,28 +5278,28 @@ __attribute__((noinline,__target__("ssse3"))) void ssse3_deinterlace_4field_argb
|
|||
|
||||
"por %%xmm2, %%xmm1\n\t" // Put the new values in pcurrent
|
||||
"movntdq %%xmm1, (%0)\n\t" // Write pcurrent
|
||||
|
||||
|
||||
"sub %4, %0\n\t" // Restore pcurrent to pabove
|
||||
"sub %4, %1\n\t" // Restore pncurrent to pnabove
|
||||
|
||||
|
||||
/* Next pixels */
|
||||
"add $0x10, %0\n\t" // Add 16 to pcurrent
|
||||
"add $0x10, %1\n\t" // Add 16 to pncurrent
|
||||
|
||||
|
||||
/* Check if we reached the row end */
|
||||
"cmp %2, %0\n\t"
|
||||
"jb algo_ssse3_deinterlace_4field_argb\n\t" // Go for another iteration
|
||||
|
||||
|
||||
/* Next row */
|
||||
"add %4, %0\n\t" // Add width to pcurrent
|
||||
"add %4, %1\n\t" // Add width to pncurrent
|
||||
"mov %0, %2\n\t"
|
||||
"add %4, %2\n\t" // Add width to max_ptr2
|
||||
|
||||
|
||||
/* Check if we reached the end */
|
||||
"cmp %3, %0\n\t"
|
||||
"jb algo_ssse3_deinterlace_4field_argb\n\t" // Go for another iteration
|
||||
|
||||
|
||||
/* Special case for the last line */
|
||||
/* Load pabove into xmm1 and pnabove into xmm2 */
|
||||
"movdqa (%0), %%xmm1\n\t"
|
||||
|
@ -5259,11 +5320,11 @@ __attribute__((noinline,__target__("ssse3"))) void ssse3_deinterlace_4field_argb
|
|||
"psadbw %%xmm0, %%xmm2\n\t"
|
||||
"packuswb %%xmm2, %%xmm1\n\t"
|
||||
"movdqa %%xmm1, %%xmm7\n\t" /* Backup of delta2 in xmm7 for now */
|
||||
|
||||
|
||||
/* Next row */
|
||||
"add %4, %0\n\t"
|
||||
"add %4, %1\n\t"
|
||||
|
||||
|
||||
/* Load pcurrent into xmm1 and pncurrent into xmm2 */
|
||||
"movdqa (%0), %%xmm1\n\t"
|
||||
"movdqa (%1), %%xmm2\n\t"
|
||||
|
@ -5282,7 +5343,7 @@ __attribute__((noinline,__target__("ssse3"))) void ssse3_deinterlace_4field_argb
|
|||
"pshufb %%xmm3, %%xmm2\n\t"
|
||||
"psadbw %%xmm0, %%xmm2\n\t"
|
||||
"packuswb %%xmm2, %%xmm1\n\t"
|
||||
|
||||
|
||||
"pavgb %%xmm7, %%xmm1\n\t" // Average the two deltas together
|
||||
|
||||
#if defined(__x86_64__)
|
||||
|
@ -5290,7 +5351,7 @@ __attribute__((noinline,__target__("ssse3"))) void ssse3_deinterlace_4field_argb
|
|||
#else
|
||||
"movd %%eax, %%xmm7\n\t" // Setup the threshold
|
||||
"pshufd $0x0, %%xmm7, %%xmm7\n\t"
|
||||
|
||||
|
||||
"pcmpgtd %%xmm7, %%xmm1\n\t" // Compare average delta with the threshold
|
||||
#endif
|
||||
"pand %%xmm1, %%xmm5\n\t" // Filter out pixels in pabove that shouldn't be copied
|
||||
|
@ -5306,18 +5367,25 @@ __attribute__((noinline,__target__("ssse3"))) void ssse3_deinterlace_4field_argb
|
|||
: "%eax", "%xmm0", "%xmm1", "%xmm2", "%xmm3", "%xmm4", "%xmm5", "%xmm6", "%xmm7", "cc", "memory"
|
||||
#endif
|
||||
);
|
||||
#else
|
||||
Panic("SSE function called on a non x86\\x86-64 platform");
|
||||
#endif
|
||||
}
|
||||
|
||||
/* ABGR SSSE3 */
|
||||
__attribute__((noinline,__target__("ssse3"))) void ssse3_deinterlace_4field_abgr(uint8_t* col1, uint8_t* col2, unsigned int threshold, unsigned int width, unsigned int height) {
|
||||
#if defined(__i386__) || defined(__x86_64__)
|
||||
__attribute__((noinline,__target__("ssse3")))
|
||||
#endif
|
||||
void ssse3_deinterlace_4field_abgr(uint8_t* col1, uint8_t* col2, unsigned int threshold, unsigned int width, unsigned int height) {
|
||||
#if ((defined(__i386__) || defined(__x86_64__) || defined(ZM_KEEP_SSE)) && !defined(ZM_STRIP_SSE))
|
||||
__attribute__((aligned(16))) static const uint8_t movemask2[16] = {2,2,2,2,2,3,3,1,10,10,10,10,10,11,11,9};
|
||||
|
||||
|
||||
const uint32_t threshold_val = threshold;
|
||||
|
||||
|
||||
unsigned long row_width = width*4;
|
||||
uint8_t* max_ptr = col1 + (row_width * (height-2));
|
||||
uint8_t* max_ptr2 = col1 + row_width;
|
||||
|
||||
|
||||
__asm__ __volatile__ (
|
||||
"mov $0x1F1F1F1F, %%eax\n\t"
|
||||
"movd %%eax, %%xmm4\n\t"
|
||||
|
@ -5330,9 +5398,9 @@ __attribute__((noinline,__target__("ssse3"))) void ssse3_deinterlace_4field_abgr
|
|||
#endif
|
||||
/* Zero the temporary register */
|
||||
"pxor %%xmm0, %%xmm0\n\t"
|
||||
|
||||
|
||||
"algo_ssse3_deinterlace_4field_abgr:\n\t"
|
||||
|
||||
|
||||
/* Load pabove into xmm1 and pnabove into xmm2 */
|
||||
"movdqa (%0), %%xmm1\n\t"
|
||||
"movdqa (%1), %%xmm2\n\t"
|
||||
|
@ -5352,11 +5420,11 @@ __attribute__((noinline,__target__("ssse3"))) void ssse3_deinterlace_4field_abgr
|
|||
"psadbw %%xmm0, %%xmm2\n\t"
|
||||
"packuswb %%xmm2, %%xmm1\n\t"
|
||||
"movdqa %%xmm1, %%xmm7\n\t" /* Backup of delta2 in xmm7 for now */
|
||||
|
||||
|
||||
/* Next row */
|
||||
"add %4, %0\n\t"
|
||||
"add %4, %1\n\t"
|
||||
|
||||
|
||||
/* Load pcurrent into xmm1 and pncurrent into xmm2 */
|
||||
"movdqa (%0), %%xmm1\n\t"
|
||||
"movdqa (%1), %%xmm2\n\t"
|
||||
|
@ -5375,7 +5443,7 @@ __attribute__((noinline,__target__("ssse3"))) void ssse3_deinterlace_4field_abgr
|
|||
"pshufb %%xmm3, %%xmm2\n\t"
|
||||
"psadbw %%xmm0, %%xmm2\n\t"
|
||||
"packuswb %%xmm2, %%xmm1\n\t"
|
||||
|
||||
|
||||
"pavgb %%xmm7, %%xmm1\n\t" // Average the two deltas together
|
||||
|
||||
#if defined(__x86_64__)
|
||||
|
@ -5383,7 +5451,7 @@ __attribute__((noinline,__target__("ssse3"))) void ssse3_deinterlace_4field_abgr
|
|||
#else
|
||||
"movd %%eax, %%xmm7\n\t" // Setup the threshold
|
||||
"pshufd $0x0, %%xmm7, %%xmm7\n\t"
|
||||
|
||||
|
||||
"pcmpgtd %%xmm7, %%xmm1\n\t" // Compare average delta with the threshold
|
||||
#endif
|
||||
"movdqa (%0,%4), %%xmm2\n\t" // Load pbelow
|
||||
|
@ -5393,28 +5461,28 @@ __attribute__((noinline,__target__("ssse3"))) void ssse3_deinterlace_4field_abgr
|
|||
|
||||
"por %%xmm2, %%xmm1\n\t" // Put the new values in pcurrent
|
||||
"movntdq %%xmm1, (%0)\n\t" // Write pcurrent
|
||||
|
||||
|
||||
"sub %4, %0\n\t" // Restore pcurrent to pabove
|
||||
"sub %4, %1\n\t" // Restore pncurrent to pnabove
|
||||
|
||||
|
||||
/* Next pixels */
|
||||
"add $0x10, %0\n\t" // Add 16 to pcurrent
|
||||
"add $0x10, %1\n\t" // Add 16 to pncurrent
|
||||
|
||||
|
||||
/* Check if we reached the row end */
|
||||
"cmp %2, %0\n\t"
|
||||
"jb algo_ssse3_deinterlace_4field_abgr\n\t" // Go for another iteration
|
||||
|
||||
|
||||
/* Next row */
|
||||
"add %4, %0\n\t" // Add width to pcurrent
|
||||
"add %4, %1\n\t" // Add width to pncurrent
|
||||
"mov %0, %2\n\t"
|
||||
"add %4, %2\n\t" // Add width to max_ptr2
|
||||
|
||||
|
||||
/* Check if we reached the end */
|
||||
"cmp %3, %0\n\t"
|
||||
"jb algo_ssse3_deinterlace_4field_abgr\n\t" // Go for another iteration
|
||||
|
||||
|
||||
/* Special case for the last line */
|
||||
/* Load pabove into xmm1 and pnabove into xmm2 */
|
||||
"movdqa (%0), %%xmm1\n\t"
|
||||
|
@ -5435,11 +5503,11 @@ __attribute__((noinline,__target__("ssse3"))) void ssse3_deinterlace_4field_abgr
|
|||
"psadbw %%xmm0, %%xmm2\n\t"
|
||||
"packuswb %%xmm2, %%xmm1\n\t"
|
||||
"movdqa %%xmm1, %%xmm7\n\t" /* Backup of delta2 in xmm7 for now */
|
||||
|
||||
|
||||
/* Next row */
|
||||
"add %4, %0\n\t"
|
||||
"add %4, %1\n\t"
|
||||
|
||||
|
||||
/* Load pcurrent into xmm1 and pncurrent into xmm2 */
|
||||
"movdqa (%0), %%xmm1\n\t"
|
||||
"movdqa (%1), %%xmm2\n\t"
|
||||
|
@ -5458,7 +5526,7 @@ __attribute__((noinline,__target__("ssse3"))) void ssse3_deinterlace_4field_abgr
|
|||
"pshufb %%xmm3, %%xmm2\n\t"
|
||||
"psadbw %%xmm0, %%xmm2\n\t"
|
||||
"packuswb %%xmm2, %%xmm1\n\t"
|
||||
|
||||
|
||||
"pavgb %%xmm7, %%xmm1\n\t" // Average the two deltas together
|
||||
|
||||
#if defined(__x86_64__)
|
||||
|
@ -5466,7 +5534,7 @@ __attribute__((noinline,__target__("ssse3"))) void ssse3_deinterlace_4field_abgr
|
|||
#else
|
||||
"movd %%eax, %%xmm7\n\t" // Setup the threshold
|
||||
"pshufd $0x0, %%xmm7, %%xmm7\n\t"
|
||||
|
||||
|
||||
"pcmpgtd %%xmm7, %%xmm1\n\t" // Compare average delta with the threshold
|
||||
#endif
|
||||
"pand %%xmm1, %%xmm5\n\t" // Filter out pixels in pabove that shouldn't be copied
|
||||
|
@ -5482,5 +5550,7 @@ __attribute__((noinline,__target__("ssse3"))) void ssse3_deinterlace_4field_abgr
|
|||
: "%eax", "%xmm0", "%xmm1", "%xmm2", "%xmm3", "%xmm4", "%xmm5", "%xmm6", "%xmm7", "cc", "memory"
|
||||
#endif
|
||||
);
|
||||
#else
|
||||
Panic("SSE function called on a non x86\\x86-64 platform");
|
||||
#endif
|
||||
}
|
||||
|
||||
|
|
|
@ -187,11 +187,12 @@ public:
|
|||
|
||||
inline void CopyBuffer( const Image &image )
|
||||
{
|
||||
if ( image.size != size )
|
||||
{
|
||||
Panic( "Attempt to copy different size image buffers, expected %d, got %d", size, image.size );
|
||||
}
|
||||
(*fptr_imgbufcpy)(buffer, image.buffer, size);
|
||||
Assign(image);
|
||||
}
|
||||
inline Image &operator=( const Image &image )
|
||||
{
|
||||
Assign(image);
|
||||
return *this;
|
||||
}
|
||||
inline Image &operator=( const unsigned char *new_buffer )
|
||||
{
|
||||
|
|
|
@ -399,12 +399,12 @@ void zm_use_std_huff_tables( j_decompress_ptr cinfo ) {
|
|||
static const JHUFF_TBL dclumin = {
|
||||
{ /* 0-base */ 0, 0, 1, 5, 1, 1, 1, 1, 1, 1, 0, 0, 0, 0, 0, 0, 0 },
|
||||
{ 0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11 },
|
||||
0
|
||||
FALSE
|
||||
};
|
||||
static const JHUFF_TBL dcchrome = {
|
||||
{ /* 0-base */ 0, 0, 3, 1, 1, 1, 1, 1, 1, 1, 1, 1, 0, 0, 0, 0, 0 },
|
||||
{ 0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11 },
|
||||
0
|
||||
FALSE
|
||||
};
|
||||
static const JHUFF_TBL aclumin = {
|
||||
{ /* 0-base */ 0, 0, 2, 1, 3, 3, 2, 4, 3, 5, 5, 4, 4, 0, 0, 1, 0x7d },
|
||||
|
@ -429,7 +429,7 @@ void zm_use_std_huff_tables( j_decompress_ptr cinfo ) {
|
|||
0xe3, 0xe4, 0xe5, 0xe6, 0xe7, 0xe8, 0xe9, 0xea,
|
||||
0xf1, 0xf2, 0xf3, 0xf4, 0xf5, 0xf6, 0xf7, 0xf8,
|
||||
0xf9, 0xfa },
|
||||
0
|
||||
FALSE
|
||||
};
|
||||
static const JHUFF_TBL acchrome = {
|
||||
{ /* 0-base */ 0, 0, 2, 1, 2, 4, 4, 3, 4, 7, 5, 4, 4, 0, 1, 2, 0x77 },
|
||||
|
@ -454,7 +454,7 @@ void zm_use_std_huff_tables( j_decompress_ptr cinfo ) {
|
|||
0xe2, 0xe3, 0xe4, 0xe5, 0xe6, 0xe7, 0xe8, 0xe9,
|
||||
0xea, 0xf2, 0xf3, 0xf4, 0xf5, 0xf6, 0xf7, 0xf8,
|
||||
0xf9, 0xfa },
|
||||
0
|
||||
FALSE
|
||||
};
|
||||
|
||||
cinfo->dc_huff_tbl_ptrs[0] = (JHUFF_TBL*)&dclumin;
|
||||
|
|
|
@ -104,9 +104,11 @@ static PixelFormat getFfPixFormatFromV4lPalette( int v4l_version, int palette )
|
|||
case V4L2_PIX_FMT_MJPEG :
|
||||
pixFormat = PIX_FMT_YUVJ444P;
|
||||
break;
|
||||
case V4L2_PIX_FMT_UYVY :
|
||||
pixFormat = PIX_FMT_UYVY422;
|
||||
break;
|
||||
// These don't seem to have ffmpeg equivalents
|
||||
// See if you can match any of the ones in the default clause below!?
|
||||
case V4L2_PIX_FMT_UYVY :
|
||||
case V4L2_PIX_FMT_RGB332 :
|
||||
case V4L2_PIX_FMT_RGB555X :
|
||||
case V4L2_PIX_FMT_RGB565X :
|
||||
|
@ -1268,7 +1270,7 @@ bool LocalCamera::GetCurrentSettings( const char *device, char *output, int vers
|
|||
|
||||
if ( vidioctl( vid_fd, VIDIOC_ENUMSTD, &standard ) < 0 )
|
||||
{
|
||||
if ( errno == EINVAL )
|
||||
if ( errno == EINVAL || errno == ENODATA )
|
||||
{
|
||||
standardIndex = -1;
|
||||
break;
|
||||
|
|
|
@ -40,6 +40,12 @@
|
|||
#if HAVE_LIBAVFORMAT
|
||||
#include "zm_ffmpeg_camera.h"
|
||||
#endif // HAVE_LIBAVFORMAT
|
||||
#if HAVE_LIBVLC
|
||||
#include "zm_libvlc_camera.h"
|
||||
#endif // HAVE_LIBVLC
|
||||
#if HAVE_LIBCURL
|
||||
#include "zm_curl_camera.h"
|
||||
#endif // HAVE_LIBCURL
|
||||
|
||||
#if ZM_MEM_MAPPED
|
||||
#include <sys/mman.h>
|
||||
|
@ -285,10 +291,12 @@ Monitor::Monitor(
|
|||
int p_alarm_frame_count,
|
||||
int p_section_length,
|
||||
int p_frame_skip,
|
||||
int p_motion_frame_skip,
|
||||
int p_capture_delay,
|
||||
int p_alarm_capture_delay,
|
||||
int p_fps_report_interval,
|
||||
int p_ref_blend_perc,
|
||||
int p_alarm_ref_blend_perc,
|
||||
bool p_track_motion,
|
||||
Rgb p_signal_check_colour,
|
||||
Purpose p_purpose,
|
||||
|
@ -309,16 +317,19 @@ Monitor::Monitor(
|
|||
stream_replay_buffer( p_stream_replay_buffer ),
|
||||
section_length( p_section_length ),
|
||||
frame_skip( p_frame_skip ),
|
||||
motion_frame_skip( p_motion_frame_skip ),
|
||||
capture_delay( p_capture_delay ),
|
||||
alarm_capture_delay( p_alarm_capture_delay ),
|
||||
alarm_frame_count( p_alarm_frame_count ),
|
||||
fps_report_interval( p_fps_report_interval ),
|
||||
ref_blend_perc( p_ref_blend_perc ),
|
||||
alarm_ref_blend_perc( p_alarm_ref_blend_perc ),
|
||||
track_motion( p_track_motion ),
|
||||
signal_check_colour( p_signal_check_colour ),
|
||||
delta_image( width, height, ZM_COLOUR_GRAY8, ZM_SUBPIX_ORDER_NONE ),
|
||||
ref_image( width, height, p_camera->Colours(), p_camera->SubpixelOrder() ),
|
||||
purpose( p_purpose ),
|
||||
last_motion_score(0),
|
||||
camera( p_camera ),
|
||||
n_zones( p_n_zones ),
|
||||
zones( p_zones )
|
||||
|
@ -515,7 +526,7 @@ Monitor::Monitor(
|
|||
|
||||
Debug( 1, "Monitor %s has function %d", name, function );
|
||||
Debug( 1, "Monitor %s LBF = '%s', LBX = %d, LBY = %d", name, label_format, label_coord.X(), label_coord.Y() );
|
||||
Debug( 1, "Monitor %s IBC = %d, WUC = %d, pEC = %d, PEC = %d, EAF = %d, FRI = %d, RBP = %d, FM = %d", name, image_buffer_count, warmup_count, pre_event_count, post_event_count, alarm_frame_count, fps_report_interval, ref_blend_perc, track_motion );
|
||||
Debug( 1, "Monitor %s IBC = %d, WUC = %d, pEC = %d, PEC = %d, EAF = %d, FRI = %d, RBP = %d, ARBP = %d, FM = %d", name, image_buffer_count, warmup_count, pre_event_count, post_event_count, alarm_frame_count, fps_report_interval, ref_blend_perc, alarm_ref_blend_perc, track_motion );
|
||||
|
||||
if ( purpose == ANALYSIS )
|
||||
{
|
||||
|
@ -1310,7 +1321,12 @@ bool Monitor::Analyse()
|
|||
else if ( signal && Active() && (function == MODECT || function == MOCORD) )
|
||||
{
|
||||
Event::StringSet zoneSet;
|
||||
int motion_score = DetectMotion( *snap_image, zoneSet );
|
||||
int motion_score = last_motion_score;
|
||||
if ( !(image_count % (motion_frame_skip+1) ) )
|
||||
{
|
||||
// Get new score.
|
||||
motion_score = last_motion_score = DetectMotion( *snap_image, zoneSet );
|
||||
}
|
||||
//int motion_score = DetectBlack( *snap_image, zoneSet );
|
||||
if ( motion_score )
|
||||
{
|
||||
|
@ -1609,9 +1625,13 @@ bool Monitor::Analyse()
|
|||
shared_data->state = state = IDLE;
|
||||
last_section_mod = 0;
|
||||
}
|
||||
if ( (!signal_change && signal) && (function == MODECT || function == MOCORD) && (config.blend_alarmed_images || state != ALARM) )
|
||||
if ( (!signal_change && signal) && (function == MODECT || function == MOCORD) )
|
||||
{
|
||||
ref_image.Blend( *snap_image, ref_blend_perc );
|
||||
if ( state == ALARM ) {
|
||||
ref_image.Blend( *snap_image, alarm_ref_blend_perc );
|
||||
} else {
|
||||
ref_image.Blend( *snap_image, ref_blend_perc );
|
||||
}
|
||||
}
|
||||
last_signal = signal;
|
||||
}
|
||||
|
@ -1634,7 +1654,7 @@ void Monitor::Reload()
|
|||
closeEvent();
|
||||
|
||||
static char sql[ZM_SQL_MED_BUFSIZ];
|
||||
snprintf( sql, sizeof(sql), "select Function+0, Enabled, LinkedMonitors, EventPrefix, LabelFormat, LabelX, LabelY, WarmupCount, PreEventCount, PostEventCount, AlarmFrameCount, SectionLength, FrameSkip, MaxFPS, AlarmMaxFPS, FPSReportInterval, RefBlendPerc, TrackMotion, SignalCheckColour from Monitors where Id = '%d'", id );
|
||||
snprintf( sql, sizeof(sql), "select Function+0, Enabled, LinkedMonitors, EventPrefix, LabelFormat, LabelX, LabelY, WarmupCount, PreEventCount, PostEventCount, AlarmFrameCount, SectionLength, FrameSkip, MotionFrameSkip, MaxFPS, AlarmMaxFPS, FPSReportInterval, RefBlendPerc, AlarmRefBlendPerc, TrackMotion, SignalCheckColour from Monitors where Id = '%d'", id );
|
||||
|
||||
if ( mysql_query( &dbconn, sql ) )
|
||||
{
|
||||
|
@ -1670,10 +1690,12 @@ void Monitor::Reload()
|
|||
alarm_frame_count = atoi(dbrow[index++]);
|
||||
section_length = atoi(dbrow[index++]);
|
||||
frame_skip = atoi(dbrow[index++]);
|
||||
motion_frame_skip = atoi(dbrow[index++]);
|
||||
capture_delay = (dbrow[index]&&atof(dbrow[index])>0.0)?int(DT_PREC_3/atof(dbrow[index])):0; index++;
|
||||
alarm_capture_delay = (dbrow[index]&&atof(dbrow[index])>0.0)?int(DT_PREC_3/atof(dbrow[index])):0; index++;
|
||||
fps_report_interval = atoi(dbrow[index++]);
|
||||
ref_blend_perc = atoi(dbrow[index++]);
|
||||
alarm_ref_blend_perc = atoi(dbrow[index++]);
|
||||
track_motion = atoi(dbrow[index++]);
|
||||
|
||||
|
||||
|
@ -1824,11 +1846,11 @@ int Monitor::LoadLocalMonitors( const char *device, Monitor **&monitors, Purpose
|
|||
static char sql[ZM_SQL_MED_BUFSIZ];
|
||||
if ( !device[0] )
|
||||
{
|
||||
strncpy( sql, "select Id, Name, Function+0, Enabled, LinkedMonitors, Device, Channel, Format, Method, Width, Height, Colours, Palette, Orientation+0, Deinterlacing, Brightness, Contrast, Hue, Colour, EventPrefix, LabelFormat, LabelX, LabelY, ImageBufferCount, WarmupCount, PreEventCount, PostEventCount, StreamReplayBuffer, AlarmFrameCount, SectionLength, FrameSkip, MaxFPS, AlarmMaxFPS, FPSReportInterval, RefBlendPerc, TrackMotion, SignalCheckColour from Monitors where Function != 'None' and Type = 'Local' order by Device, Channel", sizeof(sql) );
|
||||
strncpy( sql, "select Id, Name, Function+0, Enabled, LinkedMonitors, Device, Channel, Format, Method, Width, Height, Colours, Palette, Orientation+0, Deinterlacing, Brightness, Contrast, Hue, Colour, EventPrefix, LabelFormat, LabelX, LabelY, ImageBufferCount, WarmupCount, PreEventCount, PostEventCount, StreamReplayBuffer, AlarmFrameCount, SectionLength, FrameSkip, MotionFrameSkip, MaxFPS, AlarmMaxFPS, FPSReportInterval, RefBlendPerc, AlarmRefBlendPerc, TrackMotion, SignalCheckColour from Monitors where Function != 'None' and Type = 'Local' order by Device, Channel", sizeof(sql) );
|
||||
}
|
||||
else
|
||||
{
|
||||
snprintf( sql, sizeof(sql), "select Id, Name, Function+0, Enabled, LinkedMonitors, Device, Channel, Format, Method, Width, Height, Colours, Palette, Orientation+0, Deinterlacing, Brightness, Contrast, Hue, Colour, EventPrefix, LabelFormat, LabelX, LabelY, ImageBufferCount, WarmupCount, PreEventCount, PostEventCount, StreamReplayBuffer, AlarmFrameCount, SectionLength, FrameSkip, MaxFPS, AlarmMaxFPS, FPSReportInterval, RefBlendPerc, TrackMotion, SignalCheckColour from Monitors where Function != 'None' and Type = 'Local' and Device = '%s' order by Channel", device );
|
||||
snprintf( sql, sizeof(sql), "select Id, Name, Function+0, Enabled, LinkedMonitors, Device, Channel, Format, Method, Width, Height, Colours, Palette, Orientation+0, Deinterlacing, Brightness, Contrast, Hue, Colour, EventPrefix, LabelFormat, LabelX, LabelY, ImageBufferCount, WarmupCount, PreEventCount, PostEventCount, StreamReplayBuffer, AlarmFrameCount, SectionLength, FrameSkip, MotionFrameSkip, MaxFPS, AlarmMaxFPS, FPSReportInterval, RefBlendPerc, AlarmRefBlendPerc, TrackMotion, SignalCheckColour from Monitors where Function != 'None' and Type = 'Local' and Device = '%s' order by Channel", device );
|
||||
}
|
||||
if ( mysql_query( &dbconn, sql ) )
|
||||
{
|
||||
|
@ -1886,10 +1908,12 @@ int Monitor::LoadLocalMonitors( const char *device, Monitor **&monitors, Purpose
|
|||
int alarm_frame_count = atoi(dbrow[col]); col++;
|
||||
int section_length = atoi(dbrow[col]); col++;
|
||||
int frame_skip = atoi(dbrow[col]); col++;
|
||||
int motion_frame_skip = atoi(dbrow[col]); col++;
|
||||
int capture_delay = (dbrow[col]&&atof(dbrow[col])>0.0)?int(DT_PREC_3/atof(dbrow[col])):0; col++;
|
||||
int alarm_capture_delay = (dbrow[col]&&atof(dbrow[col])>0.0)?int(DT_PREC_3/atof(dbrow[col])):0; col++;
|
||||
int fps_report_interval = atoi(dbrow[col]); col++;
|
||||
int ref_blend_perc = atoi(dbrow[col]); col++;
|
||||
int alarm_ref_blend_perc = atoi(dbrow[col]); col++;
|
||||
int track_motion = atoi(dbrow[col]); col++;
|
||||
|
||||
int signal_check_colour;
|
||||
|
@ -1942,10 +1966,12 @@ int Monitor::LoadLocalMonitors( const char *device, Monitor **&monitors, Purpose
|
|||
alarm_frame_count,
|
||||
section_length,
|
||||
frame_skip,
|
||||
motion_frame_skip,
|
||||
capture_delay,
|
||||
alarm_capture_delay,
|
||||
fps_report_interval,
|
||||
ref_blend_perc,
|
||||
alarm_ref_blend_perc,
|
||||
track_motion,
|
||||
signal_check_colour,
|
||||
purpose,
|
||||
|
@ -1974,11 +2000,11 @@ int Monitor::LoadRemoteMonitors( const char *protocol, const char *host, const c
|
|||
static char sql[ZM_SQL_MED_BUFSIZ];
|
||||
if ( !protocol )
|
||||
{
|
||||
strncpy( sql, "select Id, Name, Function+0, Enabled, LinkedMonitors, Protocol, Method, Host, Port, Path, Width, Height, Colours, Palette, Orientation+0, Deinterlacing, Brightness, Contrast, Hue, Colour, EventPrefix, LabelFormat, LabelX, LabelY, ImageBufferCount, WarmupCount, PreEventCount, PostEventCount, StreamReplayBuffer, AlarmFrameCount, SectionLength, FrameSkip, MaxFPS, AlarmMaxFPS, FPSReportInterval, RefBlendPerc, TrackMotion from Monitors where Function != 'None' and Type = 'Remote'", sizeof(sql) );
|
||||
strncpy( sql, "select Id, Name, Function+0, Enabled, LinkedMonitors, Protocol, Method, Host, Port, Path, Width, Height, Colours, Palette, Orientation+0, Deinterlacing, Brightness, Contrast, Hue, Colour, EventPrefix, LabelFormat, LabelX, LabelY, ImageBufferCount, WarmupCount, PreEventCount, PostEventCount, StreamReplayBuffer, AlarmFrameCount, SectionLength, FrameSkip, MotionFrameSkip, MaxFPS, AlarmMaxFPS, FPSReportInterval, RefBlendPerc, AlarmRefBlendPerc, TrackMotion from Monitors where Function != 'None' and Type = 'Remote'", sizeof(sql) );
|
||||
}
|
||||
else
|
||||
{
|
||||
snprintf( sql, sizeof(sql), "select Id, Name, Function+0, Enabled, LinkedMonitors, Protocol, Method, Host, Port, Path, Width, Height, Colours, Palette, Orientation+0, Deinterlacing, Brightness, Contrast, Hue, Colour, EventPrefix, LabelFormat, LabelX, LabelY, ImageBufferCount, WarmupCount, PreEventCount, PostEventCount, StreamReplayBuffer, AlarmFrameCount, SectionLength, FrameSkip, MaxFPS, AlarmMaxFPS, FPSReportInterval, RefBlendPerc, TrackMotion from Monitors where Function != 'None' and Type = 'Remote' and Protocol = '%s' and Host = '%s' and Port = '%s' and Path = '%s'", protocol, host, port, path );
|
||||
snprintf( sql, sizeof(sql), "select Id, Name, Function+0, Enabled, LinkedMonitors, Protocol, Method, Host, Port, Path, Width, Height, Colours, Palette, Orientation+0, Deinterlacing, Brightness, Contrast, Hue, Colour, EventPrefix, LabelFormat, LabelX, LabelY, ImageBufferCount, WarmupCount, PreEventCount, PostEventCount, StreamReplayBuffer, AlarmFrameCount, SectionLength, FrameSkip, MotionFrameSkip, MaxFPS, AlarmMaxFPS, FPSReportInterval, RefBlendPerc, AlarmRefBlendPerc, TrackMotion from Monitors where Function != 'None' and Type = 'Remote' and Protocol = '%s' and Host = '%s' and Port = '%s' and Path = '%s'", protocol, host, port, path );
|
||||
}
|
||||
if ( mysql_query( &dbconn, sql ) )
|
||||
{
|
||||
|
@ -2037,10 +2063,12 @@ int Monitor::LoadRemoteMonitors( const char *protocol, const char *host, const c
|
|||
int alarm_frame_count = atoi(dbrow[col]); col++;
|
||||
int section_length = atoi(dbrow[col]); col++;
|
||||
int frame_skip = atoi(dbrow[col]); col++;
|
||||
int motion_frame_skip = atoi(dbrow[col]); col++;
|
||||
int capture_delay = (dbrow[col]&&atof(dbrow[col])>0.0)?int(DT_PREC_3/atof(dbrow[col])):0; col++;
|
||||
int alarm_capture_delay = (dbrow[col]&&atof(dbrow[col])>0.0)?int(DT_PREC_3/atof(dbrow[col])):0; col++;
|
||||
int fps_report_interval = atoi(dbrow[col]); col++;
|
||||
int ref_blend_perc = atoi(dbrow[col]); col++;
|
||||
int alarm_ref_blend_perc = atoi(dbrow[col]); col++;
|
||||
int track_motion = atoi(dbrow[col]); col++;
|
||||
|
||||
|
||||
|
@ -2111,10 +2139,12 @@ int Monitor::LoadRemoteMonitors( const char *protocol, const char *host, const c
|
|||
alarm_frame_count,
|
||||
section_length,
|
||||
frame_skip,
|
||||
motion_frame_skip,
|
||||
capture_delay,
|
||||
alarm_capture_delay,
|
||||
fps_report_interval,
|
||||
ref_blend_perc,
|
||||
alarm_ref_blend_perc,
|
||||
track_motion,
|
||||
RGB_WHITE,
|
||||
purpose,
|
||||
|
@ -2143,11 +2173,11 @@ int Monitor::LoadFileMonitors( const char *file, Monitor **&monitors, Purpose pu
|
|||
static char sql[ZM_SQL_MED_BUFSIZ];
|
||||
if ( !file[0] )
|
||||
{
|
||||
strncpy( sql, "select Id, Name, Function+0, Enabled, LinkedMonitors, Path, Width, Height, Colours, Palette, Orientation+0, Deinterlacing, Brightness, Contrast, Hue, Colour, EventPrefix, LabelFormat, LabelX, LabelY, ImageBufferCount, WarmupCount, PreEventCount, PostEventCount, StreamReplayBuffer, AlarmFrameCount, SectionLength, FrameSkip, MaxFPS, AlarmMaxFPS, FPSReportInterval, RefBlendPerc, TrackMotion from Monitors where Function != 'None' and Type = 'File'", sizeof(sql) );
|
||||
strncpy( sql, "select Id, Name, Function+0, Enabled, LinkedMonitors, Path, Width, Height, Colours, Palette, Orientation+0, Deinterlacing, Brightness, Contrast, Hue, Colour, EventPrefix, LabelFormat, LabelX, LabelY, ImageBufferCount, WarmupCount, PreEventCount, PostEventCount, StreamReplayBuffer, AlarmFrameCount, SectionLength, FrameSkip, MotionFrameSkip, MaxFPS, AlarmMaxFPS, FPSReportInterval, RefBlendPerc, AlarmRefBlendPerc, TrackMotion from Monitors where Function != 'None' and Type = 'File'", sizeof(sql) );
|
||||
}
|
||||
else
|
||||
{
|
||||
snprintf( sql, sizeof(sql), "select Id, Name, Function+0, Enabled, LinkedMonitors, Path, Width, Height, Colours, Palette, Orientation+0, Deinterlacing, Brightness, Contrast, Hue, Colour, EventPrefix, LabelFormat, LabelX, LabelY, ImageBufferCount, WarmupCount, PreEventCount, PostEventCount, StreamReplayBuffer, AlarmFrameCount, SectionLength, FrameSkip, MaxFPS, AlarmMaxFPS, FPSReportInterval, RefBlendPerc, TrackMotion from Monitors where Function != 'None' and Type = 'File' and Path = '%s'", file );
|
||||
snprintf( sql, sizeof(sql), "select Id, Name, Function+0, Enabled, LinkedMonitors, Path, Width, Height, Colours, Palette, Orientation+0, Deinterlacing, Brightness, Contrast, Hue, Colour, EventPrefix, LabelFormat, LabelX, LabelY, ImageBufferCount, WarmupCount, PreEventCount, PostEventCount, StreamReplayBuffer, AlarmFrameCount, SectionLength, FrameSkip, MotionFrameSkip, MaxFPS, AlarmMaxFPS, FPSReportInterval, RefBlendPerc, AlarmRefBlendPerc, TrackMotion from Monitors where Function != 'None' and Type = 'File' and Path = '%s'", file );
|
||||
}
|
||||
if ( mysql_query( &dbconn, sql ) )
|
||||
{
|
||||
|
@ -2202,10 +2232,12 @@ int Monitor::LoadFileMonitors( const char *file, Monitor **&monitors, Purpose pu
|
|||
int alarm_frame_count = atoi(dbrow[col]); col++;
|
||||
int section_length = atoi(dbrow[col]); col++;
|
||||
int frame_skip = atoi(dbrow[col]); col++;
|
||||
int motion_frame_skip = atoi(dbrow[col]); col++;
|
||||
int capture_delay = (dbrow[col]&&atof(dbrow[col])>0.0)?int(DT_PREC_3/atof(dbrow[col])):0; col++;
|
||||
int alarm_capture_delay = (dbrow[col]&&atof(dbrow[col])>0.0)?int(DT_PREC_3/atof(dbrow[col])):0; col++;
|
||||
int fps_report_interval = atoi(dbrow[col]); col++;
|
||||
int ref_blend_perc = atoi(dbrow[col]); col++;
|
||||
int alarm_ref_blend_perc = atoi(dbrow[col]); col++;
|
||||
int track_motion = atoi(dbrow[col]); col++;
|
||||
|
||||
int cam_width = ((orientation==ROTATE_90||orientation==ROTATE_270)?height:width);
|
||||
|
@ -2244,16 +2276,17 @@ int Monitor::LoadFileMonitors( const char *file, Monitor **&monitors, Purpose pu
|
|||
alarm_frame_count,
|
||||
section_length,
|
||||
frame_skip,
|
||||
motion_frame_skip,
|
||||
capture_delay,
|
||||
alarm_capture_delay,
|
||||
fps_report_interval,
|
||||
ref_blend_perc,
|
||||
alarm_ref_blend_perc,
|
||||
track_motion,
|
||||
RGB_WHITE,
|
||||
purpose,
|
||||
0,
|
||||
0
|
||||
|
||||
);
|
||||
Zone **zones = 0;
|
||||
int n_zones = Zone::Load( monitors[i], zones );
|
||||
|
@ -2277,11 +2310,11 @@ int Monitor::LoadFfmpegMonitors( const char *file, Monitor **&monitors, Purpose
|
|||
static char sql[ZM_SQL_MED_BUFSIZ];
|
||||
if ( !file[0] )
|
||||
{
|
||||
strncpy( sql, "select Id, Name, Function+0, Enabled, LinkedMonitors, Path, Width, Height, Colours, Palette, Orientation+0, Deinterlacing, Brightness, Contrast, Hue, Colour, EventPrefix, LabelFormat, LabelX, LabelY, ImageBufferCount, WarmupCount, PreEventCount, PostEventCount, StreamReplayBuffer, AlarmFrameCount, SectionLength, FrameSkip, MaxFPS, AlarmMaxFPS, FPSReportInterval, RefBlendPerc, TrackMotion from Monitors where Function != 'None' and Type = 'Ffmpeg'", sizeof(sql) );
|
||||
strncpy( sql, "select Id, Name, Function+0, Enabled, LinkedMonitors, Path, Width, Height, Colours, Palette, Orientation+0, Deinterlacing, Brightness, Contrast, Hue, Colour, EventPrefix, LabelFormat, LabelX, LabelY, ImageBufferCount, WarmupCount, PreEventCount, PostEventCount, StreamReplayBuffer, AlarmFrameCount, SectionLength, FrameSkip, MotionFrameSkip, MaxFPS, AlarmMaxFPS, FPSReportInterval, RefBlendPerc, AlarmRefBlendPerc, TrackMotion from Monitors where Function != 'None' and Type = 'Ffmpeg'", sizeof(sql) );
|
||||
}
|
||||
else
|
||||
{
|
||||
snprintf( sql, sizeof(sql), "select Id, Name, Function+0, Enabled, LinkedMonitors, Path, Width, Height, Colours, Palette, Orientation+0, Deinterlacing, Brightness, Contrast, Hue, Colour, EventPrefix, LabelFormat, LabelX, LabelY, ImageBufferCount, WarmupCount, PreEventCount, PostEventCount, StreamReplayBuffer, AlarmFrameCount, SectionLength, FrameSkip, MaxFPS, AlarmMaxFPS, FPSReportInterval, RefBlendPerc, TrackMotion from Monitors where Function != 'None' and Type = 'Ffmpeg' and Path = '%s'", file );
|
||||
snprintf( sql, sizeof(sql), "select Id, Name, Function+0, Enabled, LinkedMonitors, Path, Width, Height, Colours, Palette, Orientation+0, Deinterlacing, Brightness, Contrast, Hue, Colour, EventPrefix, LabelFormat, LabelX, LabelY, ImageBufferCount, WarmupCount, PreEventCount, PostEventCount, StreamReplayBuffer, AlarmFrameCount, SectionLength, FrameSkip, MotionFrameSkip, MaxFPS, AlarmMaxFPS, FPSReportInterval, RefBlendPerc, AlarmRefBlendPerc, TrackMotion from Monitors where Function != 'None' and Type = 'Ffmpeg' and Path = '%s'", file );
|
||||
}
|
||||
if ( mysql_query( &dbconn, sql ) )
|
||||
{
|
||||
|
@ -2336,10 +2369,12 @@ int Monitor::LoadFfmpegMonitors( const char *file, Monitor **&monitors, Purpose
|
|||
int alarm_frame_count = atoi(dbrow[col]); col++;
|
||||
int section_length = atoi(dbrow[col]); col++;
|
||||
int frame_skip = atoi(dbrow[col]); col++;
|
||||
int motion_frame_skip = atoi(dbrow[col]); col++;
|
||||
int capture_delay = (dbrow[col]&&atof(dbrow[col])>0.0)?int(DT_PREC_3/atof(dbrow[col])):0; col++;
|
||||
int alarm_capture_delay = (dbrow[col]&&atof(dbrow[col])>0.0)?int(DT_PREC_3/atof(dbrow[col])):0; col++;
|
||||
int fps_report_interval = atoi(dbrow[col]); col++;
|
||||
int ref_blend_perc = atoi(dbrow[col]); col++;
|
||||
int alarm_ref_blend_perc = atoi(dbrow[col]); col++;
|
||||
int track_motion = atoi(dbrow[col]); col++;
|
||||
|
||||
int cam_width = ((orientation==ROTATE_90||orientation==ROTATE_270)?height:width);
|
||||
|
@ -2378,10 +2413,12 @@ int Monitor::LoadFfmpegMonitors( const char *file, Monitor **&monitors, Purpose
|
|||
alarm_frame_count,
|
||||
section_length,
|
||||
frame_skip,
|
||||
motion_frame_skip,
|
||||
capture_delay,
|
||||
alarm_capture_delay,
|
||||
fps_report_interval,
|
||||
ref_blend_perc,
|
||||
alarm_ref_blend_perc,
|
||||
track_motion,
|
||||
RGB_WHITE,
|
||||
purpose,
|
||||
|
@ -2408,7 +2445,7 @@ int Monitor::LoadFfmpegMonitors( const char *file, Monitor **&monitors, Purpose
|
|||
Monitor *Monitor::Load( int id, bool load_zones, Purpose purpose )
|
||||
{
|
||||
static char sql[ZM_SQL_MED_BUFSIZ];
|
||||
snprintf( sql, sizeof(sql), "select Id, Name, Type, Function+0, Enabled, LinkedMonitors, Device, Channel, Format, Protocol, Method, Host, Port, Path, Width, Height, Colours, Palette, Orientation+0, Deinterlacing, Brightness, Contrast, Hue, Colour, EventPrefix, LabelFormat, LabelX, LabelY, ImageBufferCount, WarmupCount, PreEventCount, PostEventCount, StreamReplayBuffer, AlarmFrameCount, SectionLength, FrameSkip, MaxFPS, AlarmMaxFPS, FPSReportInterval, RefBlendPerc, TrackMotion, SignalCheckColour from Monitors where Id = %d", id );
|
||||
snprintf( sql, sizeof(sql), "select Id, Name, Type, Function+0, Enabled, LinkedMonitors, Device, Channel, Format, Protocol, Method, Host, Port, Path, User, Pass, Width, Height, Colours, Palette, Orientation+0, Deinterlacing, Brightness, Contrast, Hue, Colour, EventPrefix, LabelFormat, LabelX, LabelY, ImageBufferCount, WarmupCount, PreEventCount, PostEventCount, StreamReplayBuffer, AlarmFrameCount, SectionLength, FrameSkip, MotionFrameSkip, MaxFPS, AlarmMaxFPS, FPSReportInterval, RefBlendPerc, AlarmRefBlendPerc, TrackMotion, SignalCheckColour from Monitors where Id = %d", id );
|
||||
if ( mysql_query( &dbconn, sql ) )
|
||||
{
|
||||
Error( "Can't run query: %s", mysql_error( &dbconn ) );
|
||||
|
@ -2444,6 +2481,8 @@ Monitor *Monitor::Load( int id, bool load_zones, Purpose purpose )
|
|||
std::string host = dbrow[col]; col++;
|
||||
std::string port = dbrow[col]; col++;
|
||||
std::string path = dbrow[col]; col++;
|
||||
std::string user = dbrow[col]; col++;
|
||||
std::string pass = dbrow[col]; col++;
|
||||
|
||||
int width = atoi(dbrow[col]); col++;
|
||||
int height = atoi(dbrow[col]); col++;
|
||||
|
@ -2470,10 +2509,12 @@ Monitor *Monitor::Load( int id, bool load_zones, Purpose purpose )
|
|||
int alarm_frame_count = atoi(dbrow[col]); col++;
|
||||
int section_length = atoi(dbrow[col]); col++;
|
||||
int frame_skip = atoi(dbrow[col]); col++;
|
||||
int motion_frame_skip = atoi(dbrow[col]); col++;
|
||||
int capture_delay = (dbrow[col]&&atof(dbrow[col])>0.0)?int(DT_PREC_3/atof(dbrow[col])):0; col++;
|
||||
int alarm_capture_delay = (dbrow[col]&&atof(dbrow[col])>0.0)?int(DT_PREC_3/atof(dbrow[col])):0; col++;
|
||||
int fps_report_interval = atoi(dbrow[col]); col++;
|
||||
int ref_blend_perc = atoi(dbrow[col]); col++;
|
||||
int alarm_ref_blend_perc = atoi(dbrow[col]); col++;
|
||||
int track_motion = atoi(dbrow[col]); col++;
|
||||
|
||||
int signal_check_colour;
|
||||
|
@ -2592,6 +2633,46 @@ Monitor *Monitor::Load( int id, bool load_zones, Purpose purpose )
|
|||
#else // HAVE_LIBAVFORMAT
|
||||
Fatal( "You must have ffmpeg libraries installed to use ffmpeg cameras for monitor %d", id );
|
||||
#endif // HAVE_LIBAVFORMAT
|
||||
}
|
||||
else if (type == "Libvlc")
|
||||
{
|
||||
#if HAVE_LIBVLC
|
||||
camera = new LibvlcCamera(
|
||||
id,
|
||||
path.c_str(),
|
||||
cam_width,
|
||||
cam_height,
|
||||
colours,
|
||||
brightness,
|
||||
contrast,
|
||||
hue,
|
||||
colour,
|
||||
purpose==CAPTURE
|
||||
);
|
||||
#else // HAVE_LIBVLC
|
||||
Fatal( "You must have vlc libraries installed to use vlc cameras for monitor %d", id );
|
||||
#endif // HAVE_LIBVLC
|
||||
}
|
||||
else if ( type == "cURL" )
|
||||
{
|
||||
#if HAVE_LIBCURL
|
||||
camera = new cURLCamera(
|
||||
id,
|
||||
path.c_str(),
|
||||
user.c_str(),
|
||||
pass.c_str(),
|
||||
cam_width,
|
||||
cam_height,
|
||||
colours,
|
||||
brightness,
|
||||
contrast,
|
||||
hue,
|
||||
colour,
|
||||
purpose==CAPTURE
|
||||
);
|
||||
#else // HAVE_LIBCURL
|
||||
Fatal( "You must have libcurl installed to use ffmpeg cameras for monitor %d", id );
|
||||
#endif // HAVE_LIBCURL
|
||||
}
|
||||
else
|
||||
{
|
||||
|
@ -2617,10 +2698,12 @@ Monitor *Monitor::Load( int id, bool load_zones, Purpose purpose )
|
|||
alarm_frame_count,
|
||||
section_length,
|
||||
frame_skip,
|
||||
motion_frame_skip,
|
||||
capture_delay,
|
||||
alarm_capture_delay,
|
||||
fps_report_interval,
|
||||
ref_blend_perc,
|
||||
alarm_ref_blend_perc,
|
||||
track_motion,
|
||||
signal_check_colour,
|
||||
purpose,
|
||||
|
@ -2698,7 +2781,9 @@ int Monitor::Capture()
|
|||
{
|
||||
// Unable to capture image for temporary reason
|
||||
// Fake a signal loss image
|
||||
capture_image->Fill( signal_check_colour );
|
||||
Rgb signalcolor;
|
||||
signalcolor = rgb_convert(signal_check_colour, ZM_SUBPIX_ORDER_BGR); /* HTML colour code is actually BGR in memory, we want RGB */
|
||||
capture_image->Fill(signalcolor);
|
||||
captureResult = 0;
|
||||
} else {
|
||||
captureResult = 1;
|
||||
|
@ -3089,7 +3174,9 @@ unsigned int Monitor::DetectMotion( const Image &comp_image, Event::StringSet &z
|
|||
for ( int n_zone = 0; n_zone < n_zones; n_zone++ )
|
||||
{
|
||||
Zone *zone = zones[n_zone];
|
||||
zone->ClearAlarm();
|
||||
// need previous alarmed state for preclusive zone, so don't clear just yet
|
||||
if (!zone->IsPreclusive())
|
||||
zone->ClearAlarm();
|
||||
if ( !zone->IsInactive() )
|
||||
{
|
||||
continue;
|
||||
|
@ -3106,14 +3193,31 @@ unsigned int Monitor::DetectMotion( const Image &comp_image, Event::StringSet &z
|
|||
{
|
||||
continue;
|
||||
}
|
||||
Debug( 3, "Checking preclusive zone %s", zone->Label() );
|
||||
int old_zone_score = zone->Score();
|
||||
bool old_zone_alarmed = zone->Alarmed();
|
||||
Debug( 3, "Checking preclusive zone %s - old score: %d, state: %s", zone->Label(),old_zone_score, zone->Alarmed()?"alarmed":"quiet" );
|
||||
if ( zone->CheckAlarms( &delta_image ) )
|
||||
{
|
||||
alarm = true;
|
||||
score += zone->Score();
|
||||
zone->SetAlarm();
|
||||
Debug( 3, "Zone is alarmed, zone score = %d", zone->Score() );
|
||||
zoneSet.insert( zone->Label() );
|
||||
//zone->ResetStats();
|
||||
} else {
|
||||
// check if end of alarm
|
||||
if (old_zone_alarmed) {
|
||||
Debug(3, "Preclusive Zone %s alarm Ends. Prevíous score: %d", zone->Label(), old_zone_score);
|
||||
if (old_zone_score > 0) {
|
||||
zone->SetExtendAlarmCount(zone->GetExtendAlarmFrames());
|
||||
}
|
||||
if (zone->CheckExtendAlarmCount()) {
|
||||
alarm=true;
|
||||
zone->SetAlarm();
|
||||
} else {
|
||||
zone->ClearAlarm();
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -3131,7 +3235,7 @@ unsigned int Monitor::DetectMotion( const Image &comp_image, Event::StringSet &z
|
|||
for ( int n_zone = 0; n_zone < n_zones; n_zone++ )
|
||||
{
|
||||
Zone *zone = zones[n_zone];
|
||||
if ( !zone->IsActive() )
|
||||
if ( !zone->IsActive() || zone->IsPreclusive())
|
||||
{
|
||||
continue;
|
||||
}
|
||||
|
@ -3277,6 +3381,7 @@ bool Monitor::DumpSettings( char *output, bool verbose )
|
|||
sprintf( output+strlen(output), "Maximum FPS : %.2f\n", capture_delay?DT_PREC_3/capture_delay:0.0 );
|
||||
sprintf( output+strlen(output), "Alarm Maximum FPS : %.2f\n", alarm_capture_delay?DT_PREC_3/alarm_capture_delay:0.0 );
|
||||
sprintf( output+strlen(output), "Reference Blend %%ge : %d\n", ref_blend_perc );
|
||||
sprintf( output+strlen(output), "Alarm Reference Blend %%ge : %d\n", alarm_ref_blend_perc );
|
||||
sprintf( output+strlen(output), "Track Motion : %d\n", track_motion );
|
||||
sprintf( output+strlen(output), "Function: %d - %s\n", function,
|
||||
function==NONE?"None":(
|
||||
|
|
|
@ -181,7 +181,7 @@ protected:
|
|||
#else // ZM_MEM_MAPPED
|
||||
int shm_id;
|
||||
#endif // ZM_MEM_MAPPED
|
||||
int mem_size;
|
||||
unsigned long mem_size;
|
||||
unsigned char *mem_ptr;
|
||||
|
||||
volatile SharedData *shared_data;
|
||||
|
@ -245,11 +245,13 @@ protected:
|
|||
int stream_replay_buffer; // How many frames to store to support DVR functions, IGNORED from this object, passed directly into zms now
|
||||
int section_length; // How long events should last in continuous modes
|
||||
int frame_skip; // How many frames to skip in continuous modes
|
||||
int motion_frame_skip; // How many frames to skip in motion detection
|
||||
int capture_delay; // How long we wait between capture frames
|
||||
int alarm_capture_delay; // How long we wait between capture frames when in alarm state
|
||||
int alarm_frame_count; // How many alarm frames are required before an event is triggered
|
||||
int fps_report_interval; // How many images should be captured/processed between reporting the current FPS
|
||||
int ref_blend_perc; // Percentage of new image going into reference image.
|
||||
int alarm_ref_blend_perc; // Percentage of new image going into reference image during alarm.
|
||||
bool track_motion; // Whether this monitor tries to track detected motion
|
||||
Rgb signal_check_colour; // The colour that the camera will emit when no video signal detected
|
||||
|
||||
|
@ -269,6 +271,7 @@ protected:
|
|||
time_t start_time;
|
||||
time_t last_fps_time;
|
||||
time_t auto_resume_time;
|
||||
unsigned int last_motion_score;
|
||||
|
||||
EventCloseMode event_close_mode;
|
||||
|
||||
|
@ -278,7 +281,7 @@ protected:
|
|||
#else // ZM_MEM_MAPPED
|
||||
int shm_id;
|
||||
#endif // ZM_MEM_MAPPED
|
||||
int mem_size;
|
||||
unsigned long mem_size;
|
||||
unsigned char *mem_ptr;
|
||||
|
||||
SharedData *shared_data;
|
||||
|
@ -303,7 +306,7 @@ protected:
|
|||
public:
|
||||
// OurCheckAlarms seems to be unused. Check it on zm_monitor.cpp for more info.
|
||||
//bool OurCheckAlarms( Zone *zone, const Image *pImage );
|
||||
Monitor( int p_id, const char *p_name, int p_function, bool p_enabled, const char *p_linked_monitors, Camera *p_camera, int p_orientation, unsigned int p_deinterlacing, const char *p_event_prefix, const char *p_label_format, const Coord &p_label_coord, int p_image_buffer_count, int p_warmup_count, int p_pre_event_count, int p_post_event_count, int p_stream_replay_buffer, int p_alarm_frame_count, int p_section_length, int p_frame_skip, int p_capture_delay, int p_alarm_capture_delay, int p_fps_report_interval, int p_ref_blend_perc, bool p_track_motion, Rgb p_signal_check_colour, Purpose p_purpose, int p_n_zones=0, Zone *p_zones[]=0 );
|
||||
Monitor( int p_id, const char *p_name, int p_function, bool p_enabled, const char *p_linked_monitors, Camera *p_camera, int p_orientation, unsigned int p_deinterlacing, const char *p_event_prefix, const char *p_label_format, const Coord &p_label_coord, int p_image_buffer_count, int p_warmup_count, int p_pre_event_count, int p_post_event_count, int p_stream_replay_buffer, int p_alarm_frame_count, int p_section_length, int p_frame_skip, int p_motion_frame_skip, int p_capture_delay, int p_alarm_capture_delay, int p_fps_report_interval, int p_ref_blend_perc, int p_alarm_ref_blend_perc, bool p_track_motion, Rgb p_signal_check_colour, Purpose p_purpose, int p_n_zones=0, Zone *p_zones[]=0 );
|
||||
~Monitor();
|
||||
|
||||
void AddZones( int p_n_zones, Zone *p_zones[] );
|
||||
|
|
|
@ -133,7 +133,7 @@ void VideoStream::SetupCodec( int colours, int subpixelorder, int width, int hei
|
|||
/* add the video streams using the default format codecs
|
||||
and initialize the codecs */
|
||||
ost = NULL;
|
||||
if (of->video_codec != CODEC_ID_NONE)
|
||||
if (of->video_codec != AV_CODEC_ID_NONE)
|
||||
{
|
||||
#if LIBAVFORMAT_VERSION_INT < AV_VERSION_INT(53, 4, 0)
|
||||
ost = av_new_stream(ofc, 0);
|
||||
|
|
|
@ -35,6 +35,10 @@ RemoteCamera::RemoteCamera( int p_id, const std::string &p_protocol, const std::
|
|||
|
||||
RemoteCamera::~RemoteCamera()
|
||||
{
|
||||
if(hp != NULL) {
|
||||
freeaddrinfo(hp);
|
||||
hp = NULL;
|
||||
}
|
||||
}
|
||||
|
||||
void RemoteCamera::Initialise()
|
||||
|
@ -61,15 +65,15 @@ void RemoteCamera::Initialise()
|
|||
auth64 = base64Encode( auth );
|
||||
}
|
||||
|
||||
if ( !hp )
|
||||
struct addrinfo hints;
|
||||
memset(&hints, 0, sizeof(hints));
|
||||
hints.ai_family = AF_UNSPEC;
|
||||
hints.ai_socktype = SOCK_STREAM;
|
||||
|
||||
int ret = getaddrinfo(host.c_str(), port.c_str(), &hints, &hp);
|
||||
if ( ret != 0 )
|
||||
{
|
||||
if ( !(hp = gethostbyname(host.c_str())) )
|
||||
{
|
||||
Fatal( "Can't gethostbyname(%s): %s", host.c_str(), strerror(h_errno) );
|
||||
}
|
||||
memcpy((char *)&sa.sin_addr, (char *)hp->h_addr, hp->h_length);
|
||||
sa.sin_family = hp->h_addrtype;
|
||||
sa.sin_port = htons(atoi(port.c_str()));
|
||||
Fatal( "Can't getaddrinfo(%s port %s): %s", host.c_str(), port.c_str(), gai_strerror(ret) );
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -23,6 +23,8 @@
|
|||
#include "zm_camera.h"
|
||||
|
||||
#include <string>
|
||||
#include <sys/types.h>
|
||||
#include <sys/socket.h>
|
||||
#include <netdb.h>
|
||||
|
||||
//
|
||||
|
@ -40,8 +42,7 @@ protected:
|
|||
std::string auth64;
|
||||
|
||||
protected:
|
||||
struct hostent *hp;
|
||||
struct sockaddr_in sa;
|
||||
struct addrinfo *hp;
|
||||
|
||||
public:
|
||||
RemoteCamera( int p_id, const std::string &p_proto, const std::string &p_host, const std::string &p_port, const std::string &p_path, int p_width, int p_height, int p_colours, int p_brightness, int p_contrast, int p_hue, int p_colour, bool p_capture );
|
||||
|
|
|
@ -24,6 +24,7 @@
|
|||
#include <sys/types.h>
|
||||
#include <sys/socket.h>
|
||||
#include <errno.h>
|
||||
#include <netdb.h>
|
||||
|
||||
RemoteCameraHttp::RemoteCameraHttp( int p_id, const std::string &p_method, const std::string &p_host, const std::string &p_port, const std::string &p_path, int p_width, int p_height, int p_colours, int p_brightness, int p_contrast, int p_hue, int p_colour, bool p_capture ) :
|
||||
RemoteCamera( p_id, "http", p_host, p_port, p_path, p_width, p_height, p_colours, p_brightness, p_contrast, p_hue, p_colour, p_capture )
|
||||
|
@ -87,22 +88,34 @@ void RemoteCameraHttp::Initialise()
|
|||
|
||||
int RemoteCameraHttp::Connect()
|
||||
{
|
||||
if ( sd < 0 )
|
||||
struct addrinfo *p;
|
||||
|
||||
for(p = hp; p != NULL; p = p->ai_next)
|
||||
{
|
||||
sd = socket( hp->h_addrtype, SOCK_STREAM, 0 );
|
||||
sd = socket( p->ai_family, p->ai_socktype, p->ai_protocol );
|
||||
if ( sd < 0 )
|
||||
{
|
||||
Error( "Can't create socket: %s", strerror(errno) );
|
||||
return( -1 );
|
||||
Warning("Can't create socket: %s", strerror(errno) );
|
||||
continue;
|
||||
}
|
||||
|
||||
if ( connect( sd, (struct sockaddr *)&sa, sizeof(sa) ) < 0 )
|
||||
if ( connect( sd, p->ai_addr, p->ai_addrlen ) < 0 )
|
||||
{
|
||||
Error( "Can't connect to remote camera: %s", strerror(errno) );
|
||||
Disconnect();
|
||||
return( -1 );
|
||||
close(sd);
|
||||
sd = -1;
|
||||
Warning("Can't connect to remote camera: %s", strerror(errno) );
|
||||
continue;
|
||||
}
|
||||
|
||||
/* If we got here, we must have connected successfully */
|
||||
break;
|
||||
}
|
||||
|
||||
if(p == NULL) {
|
||||
Error("Unable to connect to the remote camera, aborting");
|
||||
return( -1 );
|
||||
}
|
||||
|
||||
Debug( 3, "Connected to host, socket = %d", sd );
|
||||
return( sd );
|
||||
}
|
||||
|
@ -428,7 +441,7 @@ int RemoteCameraHttp::GetResponse()
|
|||
|
||||
if ( content_length )
|
||||
{
|
||||
while ( buffer.size() < (unsigned int)content_length )
|
||||
while ( (long)buffer.size() < content_length )
|
||||
{
|
||||
int buffer_len = ReadData( buffer );
|
||||
if ( buffer_len == 0 )
|
||||
|
@ -960,7 +973,7 @@ int RemoteCameraHttp::GetResponse()
|
|||
|
||||
if ( content_length )
|
||||
{
|
||||
while ( buffer.size() < (unsigned int)content_length )
|
||||
while ( (long)buffer.size() < content_length )
|
||||
{
|
||||
//int buffer_len = ReadData( buffer, content_length-buffer.size() );
|
||||
int buffer_len = ReadData( buffer );
|
||||
|
@ -1086,7 +1099,7 @@ int RemoteCameraHttp::PreCapture()
|
|||
|
||||
int RemoteCameraHttp::Capture( Image &image )
|
||||
{
|
||||
unsigned int content_length = GetResponse();
|
||||
int content_length = GetResponse();
|
||||
if ( content_length == 0 )
|
||||
{
|
||||
Warning( "Unable to capture image, retrying" );
|
||||
|
@ -1112,7 +1125,7 @@ int RemoteCameraHttp::Capture( Image &image )
|
|||
}
|
||||
case X_RGB :
|
||||
{
|
||||
if ( content_length != image.Size() )
|
||||
if ( content_length != (long)image.Size() )
|
||||
{
|
||||
Error( "Image length mismatch, expected %d bytes, content length was %d", image.Size(), content_length );
|
||||
Disconnect();
|
||||
|
|
|
@ -27,8 +27,8 @@
|
|||
#include "zm_utils.h"
|
||||
|
||||
//
|
||||
// Class representing 'remote' cameras, i.e. those which are
|
||||
// accessed over a network connection.
|
||||
// Class representing 'http' cameras, i.e. those which are
|
||||
// accessed over a network connection using http
|
||||
//
|
||||
class RemoteCameraHttp : public RemoteCamera
|
||||
{
|
||||
|
|
|
@ -261,6 +261,31 @@ int RemoteCameraRtsp::Capture( Image &image )
|
|||
if ( !buffer.size() )
|
||||
return( -1 );
|
||||
|
||||
if(mCodecContext->codec_id == AV_CODEC_ID_H264)
|
||||
{
|
||||
// SPS and PPS frames should be saved and appended to IDR frames
|
||||
int nalType = (buffer.head()[3] & 0x1f);
|
||||
|
||||
// SPS
|
||||
if(nalType == 7)
|
||||
{
|
||||
lastSps = buffer;
|
||||
continue;
|
||||
}
|
||||
// PPS
|
||||
else if(nalType == 8)
|
||||
{
|
||||
lastPps = buffer;
|
||||
continue;
|
||||
}
|
||||
// IDR
|
||||
else if(nalType == 5)
|
||||
{
|
||||
buffer += lastSps;
|
||||
buffer += lastPps;
|
||||
}
|
||||
}
|
||||
|
||||
av_init_packet( &packet );
|
||||
|
||||
while ( !frameComplete && buffer.size() > 0 )
|
||||
|
|
|
@ -28,8 +28,9 @@
|
|||
#include "zm_ffmpeg.h"
|
||||
|
||||
//
|
||||
// Class representing 'remote' cameras, i.e. those which are
|
||||
// accessed over a network connection.
|
||||
// Class representing 'rtsp' cameras, i.e. those which are
|
||||
// accessed over a network connection using rtsp protocol
|
||||
// (Real Time Streaming Protocol)
|
||||
//
|
||||
class RemoteCameraRtsp : public RemoteCamera
|
||||
{
|
||||
|
@ -41,6 +42,8 @@ protected:
|
|||
int rtcp_sd;
|
||||
|
||||
Buffer buffer;
|
||||
Buffer lastSps;
|
||||
Buffer lastPps;
|
||||
|
||||
RtspThread::RtspMethod method;
|
||||
|
||||
|
|
|
@ -143,8 +143,13 @@ int RtpCtrlThread::recvPacket( const unsigned char *packet, ssize_t packetLen )
|
|||
mStop = true;
|
||||
break;
|
||||
}
|
||||
case RTCP_RR :
|
||||
case RTCP_APP :
|
||||
{
|
||||
// Ignoring as per RFC 3550
|
||||
Debug( 5, "Received RTCP_APP packet, ignoring.");
|
||||
break;
|
||||
}
|
||||
case RTCP_RR :
|
||||
default :
|
||||
{
|
||||
Error( "Received unexpected packet type %d, ignoring", pt );
|
||||
|
|
|
@ -24,12 +24,21 @@
|
|||
|
||||
#include <arpa/inet.h>
|
||||
|
||||
RtpSource::RtpSource( int id, const std::string &localHost, int localPortBase, const std::string &remoteHost, int remotePortBase, uint32_t ssrc, uint16_t seq, uint32_t rtpClock, uint32_t rtpTime ) :
|
||||
#if HAVE_LIBAVCODEC
|
||||
|
||||
#if LIBAVCODEC_VERSION_INT >= AV_VERSION_INT(54,25,0)
|
||||
#define _AVCODECID AVCodecID
|
||||
#else
|
||||
#define _AVCODECID CodecID
|
||||
#endif
|
||||
|
||||
RtpSource::RtpSource( int id, const std::string &localHost, int localPortBase, const std::string &remoteHost, int remotePortBase, uint32_t ssrc, uint16_t seq, uint32_t rtpClock, uint32_t rtpTime, _AVCODECID codecId ) :
|
||||
mId( id ),
|
||||
mSsrc( ssrc ),
|
||||
mLocalHost( localHost ),
|
||||
mRemoteHost( remoteHost ),
|
||||
mRtpClock( rtpClock ),
|
||||
mCodecId( codecId ),
|
||||
mFrame( 65536 ),
|
||||
mFrameCount( 0 ),
|
||||
mFrameGood( true ),
|
||||
|
@ -61,6 +70,9 @@ RtpSource::RtpSource( int id, const std::string &localHost, int localPortBase, c
|
|||
mLastSrTimeReal = tvZero();
|
||||
mLastSrTimeNtp = tvZero();
|
||||
mLastSrTimeRtp = 0;
|
||||
|
||||
if(mCodecId != AV_CODEC_ID_H264 && mCodecId != AV_CODEC_ID_MPEG4)
|
||||
Warning( "The device is using a codec that may not be supported. Do not be surprised if things don't work." );
|
||||
}
|
||||
|
||||
void RtpSource::init( uint16_t seq )
|
||||
|
@ -253,57 +265,63 @@ bool RtpSource::handlePacket( const unsigned char *packet, size_t packetLen )
|
|||
{
|
||||
const RtpDataHeader *rtpHeader;
|
||||
rtpHeader = (RtpDataHeader *)packet;
|
||||
bool fragmentEnd = false;
|
||||
|
||||
// Each RTP packet delivers only one NAL. It can be either the Single NAL
|
||||
// ( in that case it must be in one packet ) or the Fragmentation NALs
|
||||
// that delivers large single NAL...
|
||||
int rtpHeaderSize = 12 + rtpHeader->cc * 4;
|
||||
// No need to check for nal type as non fragmented packets already have 001 start sequence appended
|
||||
bool h264FragmentEnd = (mCodecId == AV_CODEC_ID_H264) && (packet[rtpHeaderSize+1] & 0x40);
|
||||
bool thisM = rtpHeader->m || h264FragmentEnd;
|
||||
|
||||
if ( updateSeq( ntohs(rtpHeader->seqN) ) )
|
||||
{
|
||||
Hexdump( 4, packet+sizeof(RtpDataHeader), 16 );
|
||||
if ( ((packet[sizeof(RtpDataHeader)] & 0x1f) == 28 &&
|
||||
(packet[sizeof(RtpDataHeader)+1] & 0x80)) ||
|
||||
((packet[sizeof(RtpDataHeader)] & 0x1f) != 28 &&
|
||||
prevM && rtpHeader->m) )
|
||||
mFrameGood = true; // This means that if packet is in sequence
|
||||
// and is single NAL with mark set (and prev packet
|
||||
// was NAL with mark set or it is Fragmentation NAL with
|
||||
// Start bit set then we assume that sequence
|
||||
// was restored and we can handle packet
|
||||
Hexdump( 4, packet+rtpHeaderSize, 16 );
|
||||
|
||||
if ( mFrameGood )
|
||||
{
|
||||
// check if there fragmentation NAL
|
||||
if ( (packet[sizeof(RtpDataHeader)] & 0x1f) == 28 )
|
||||
{
|
||||
// is this NAL the first NAL in fragmentation sequence
|
||||
if ( packet[sizeof(RtpDataHeader)+1] & 0x80 )
|
||||
{
|
||||
// if there is any data in frame then we must
|
||||
// discard it because that frame was incomplete
|
||||
if ( mFrame.size() )
|
||||
mFrame.clear();
|
||||
// Now we will form new header of frame
|
||||
mFrame.append("\x0\x0\x1\x0",4);
|
||||
*(mFrame+3) = (packet[sizeof(RtpDataHeader)+1] & 0x1f) |
|
||||
(packet[sizeof(RtpDataHeader)] & 0x60);
|
||||
}
|
||||
else
|
||||
if ( packet[sizeof(RtpDataHeader)+1] & 0x40 )
|
||||
fragmentEnd = true;
|
||||
mFrame.append(packet+sizeof(RtpDataHeader)+2, packetLen-sizeof(RtpDataHeader)-2);
|
||||
}
|
||||
else
|
||||
{
|
||||
// mframe.clear();
|
||||
if ( !mFrame.size() )
|
||||
mFrame.append("\x0\x0\x1",3);
|
||||
mFrame.append( packet+sizeof(RtpDataHeader), packetLen-sizeof(RtpDataHeader) );
|
||||
}
|
||||
int extraHeader = 0;
|
||||
|
||||
if( mCodecId == AV_CODEC_ID_H264 )
|
||||
{
|
||||
int nalType = (packet[rtpHeaderSize] & 0x1f);
|
||||
|
||||
switch (nalType)
|
||||
{
|
||||
case 24:
|
||||
{
|
||||
extraHeader = 2;
|
||||
break;
|
||||
}
|
||||
case 25: case 26: case 27:
|
||||
{
|
||||
extraHeader = 3;
|
||||
break;
|
||||
}
|
||||
// FU-A and FU-B
|
||||
case 28: case 29:
|
||||
{
|
||||
// Is this NAL the first NAL in fragmentation sequence
|
||||
if ( packet[rtpHeaderSize+1] & 0x80 )
|
||||
{
|
||||
// Now we will form new header of frame
|
||||
mFrame.append( "\x0\x0\x1\x0", 4 );
|
||||
// Reconstruct NAL header from FU headers
|
||||
*(mFrame+3) = (packet[rtpHeaderSize+1] & 0x1f) |
|
||||
(packet[rtpHeaderSize] & 0xe0);
|
||||
}
|
||||
|
||||
extraHeader = 2;
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
// Append NAL frame start code
|
||||
if ( !mFrame.size() )
|
||||
mFrame.append( "\x0\x0\x1", 3 );
|
||||
}
|
||||
mFrame.append( packet+rtpHeaderSize+extraHeader, packetLen-rtpHeaderSize-extraHeader );
|
||||
}
|
||||
|
||||
Hexdump( 4, mFrame.head(), 16 );
|
||||
|
||||
if ( rtpHeader->m || fragmentEnd )
|
||||
if ( thisM )
|
||||
{
|
||||
if ( mFrameGood )
|
||||
{
|
||||
|
@ -339,7 +357,7 @@ bool RtpSource::handlePacket( const unsigned char *packet, size_t packetLen )
|
|||
mFrameGood = false;
|
||||
mFrame.clear();
|
||||
}
|
||||
if ( rtpHeader->m || fragmentEnd )
|
||||
if ( thisM )
|
||||
{
|
||||
mFrameGood = true;
|
||||
prevM = true;
|
||||
|
@ -368,3 +386,7 @@ bool RtpSource::getFrame( Buffer &buffer )
|
|||
Debug( 3, "Copied %d bytes", buffer.size() );
|
||||
return( true );
|
||||
}
|
||||
|
||||
#undef _AVCODECID
|
||||
|
||||
#endif // HAVE_LIBAVCODEC
|
||||
|
|
|
@ -21,12 +21,21 @@
|
|||
#define ZM_RTP_SOURCE_H
|
||||
|
||||
#include "zm_buffer.h"
|
||||
#include "zm_ffmpeg.h"
|
||||
#include "zm_thread.h"
|
||||
|
||||
#include <sys/time.h>
|
||||
#include <stdint.h>
|
||||
#include <string>
|
||||
|
||||
#if HAVE_LIBAVCODEC
|
||||
|
||||
#if LIBAVCODEC_VERSION_INT >= AV_VERSION_INT(54,25,0)
|
||||
#define _AVCODECID AVCodecID
|
||||
#else
|
||||
#define _AVCODECID CodecID
|
||||
#endif
|
||||
|
||||
struct RtpDataHeader;
|
||||
|
||||
class RtpSource
|
||||
|
@ -81,6 +90,8 @@ private:
|
|||
uint32_t mLostPackets;
|
||||
uint8_t mLostFraction;
|
||||
|
||||
_AVCODECID mCodecId;
|
||||
|
||||
Buffer mFrame;
|
||||
int mFrameCount;
|
||||
bool mFrameGood;
|
||||
|
@ -92,7 +103,8 @@ private:
|
|||
void init( uint16_t seq );
|
||||
|
||||
public:
|
||||
RtpSource( int id, const std::string &localHost, int localPortBase, const std::string &remoteHost, int remotePortBase, uint32_t ssrc, uint16_t seq, uint32_t rtpClock, uint32_t rtpTime );
|
||||
RtpSource( int id, const std::string &localHost, int localPortBase, const std::string &remoteHost, int remotePortBase, uint32_t ssrc, uint16_t seq, uint32_t rtpClock, uint32_t rtpTime, _AVCODECID codecId );
|
||||
|
||||
bool updateSeq( uint16_t seq );
|
||||
void updateJitter( const RtpDataHeader *header );
|
||||
void updateRtcpData( uint32_t ntpTimeSecs, uint32_t ntpTimeFrac, uint32_t rtpTime );
|
||||
|
@ -177,4 +189,8 @@ public:
|
|||
}
|
||||
};
|
||||
|
||||
#undef _AVCODECID
|
||||
|
||||
#endif // HAVE_LIBAVCODEC
|
||||
|
||||
#endif // ZM_RTP_SOURCE_H
|
||||
|
|
|
@ -330,6 +330,13 @@ int RtspThread::run()
|
|||
|
||||
uint32_t rtpClock = 0;
|
||||
std::string trackUrl = mUrl;
|
||||
|
||||
#if LIBAVCODEC_VERSION_INT >= AV_VERSION_INT(54,25,0)
|
||||
enum AVCodecID codecId;
|
||||
#else
|
||||
enum CodecID codecId;
|
||||
#endif
|
||||
|
||||
if ( mFormatContext->nb_streams >= 1 )
|
||||
{
|
||||
for ( unsigned int i = 0; i < mFormatContext->nb_streams; i++ )
|
||||
|
@ -343,6 +350,7 @@ int RtspThread::run()
|
|||
{
|
||||
trackUrl += "/"+mediaDesc->getControlUrl();
|
||||
rtpClock = mediaDesc->getClock();
|
||||
codecId = mFormatContext->streams[i]->codec->codec_id;
|
||||
// Hackery pokery
|
||||
//rtpClock = mFormatContext->streams[i]->codec->sample_rate;
|
||||
break;
|
||||
|
@ -500,7 +508,7 @@ int RtspThread::run()
|
|||
{
|
||||
case RTP_UNICAST :
|
||||
{
|
||||
RtpSource *source = new RtpSource( mId, "", localPorts[0], mHost, remotePorts[0], ssrc, seq, rtpClock, rtpTime );
|
||||
RtpSource *source = new RtpSource( mId, "", localPorts[0], mHost, remotePorts[0], ssrc, seq, rtpClock, rtpTime, codecId );
|
||||
mSources[ssrc] = source;
|
||||
RtpDataThread rtpDataThread( *this, *source );
|
||||
RtpCtrlThread rtpCtrlThread( *this, *source );
|
||||
|
@ -545,7 +553,7 @@ int RtspThread::run()
|
|||
case RTP_RTSP :
|
||||
case RTP_RTSP_HTTP :
|
||||
{
|
||||
RtpSource *source = new RtpSource( mId, "", remoteChannels[0], mHost, remoteChannels[0], ssrc, seq, rtpClock, rtpTime );
|
||||
RtpSource *source = new RtpSource( mId, "", remoteChannels[0], mHost, remoteChannels[0], ssrc, seq, rtpClock, rtpTime, codecId );
|
||||
mSources[ssrc] = source;
|
||||
// These never actually run
|
||||
RtpDataThread rtpDataThread( *this, *source );
|
||||
|
@ -673,7 +681,7 @@ int RtspThread::run()
|
|||
}
|
||||
case RTP_MULTICAST :
|
||||
{
|
||||
RtpSource *source = new RtpSource( mId, localHost, localPorts[0], mHost, remotePorts[0], ssrc, seq, rtpClock, rtpTime );
|
||||
RtpSource *source = new RtpSource( mId, localHost, localPorts[0], mHost, remotePorts[0], ssrc, seq, rtpClock, rtpTime, codecId );
|
||||
mSources[ssrc] = source;
|
||||
RtpDataThread rtpDataThread( *this, *source );
|
||||
RtpCtrlThread rtpCtrlThread( *this, *source );
|
||||
|
|
|
@ -25,44 +25,44 @@
|
|||
|
||||
#if LIBAVUTIL_VERSION_INT >= AV_VERSION_INT(51,2,1)
|
||||
SessionDescriptor::StaticPayloadDesc SessionDescriptor::smStaticPayloads[] = {
|
||||
{ 0, "PCMU", AVMEDIA_TYPE_AUDIO, CODEC_ID_PCM_MULAW, 8000, 1 },
|
||||
{ 3, "GSM", AVMEDIA_TYPE_AUDIO, CODEC_ID_NONE, 8000, 1 },
|
||||
{ 4, "G723", AVMEDIA_TYPE_AUDIO, CODEC_ID_NONE, 8000, 1 },
|
||||
{ 5, "DVI4", AVMEDIA_TYPE_AUDIO, CODEC_ID_NONE, 8000, 1 },
|
||||
{ 6, "DVI4", AVMEDIA_TYPE_AUDIO, CODEC_ID_NONE, 16000, 1 },
|
||||
{ 7, "LPC", AVMEDIA_TYPE_AUDIO, CODEC_ID_NONE, 8000, 1 },
|
||||
{ 8, "PCMA", AVMEDIA_TYPE_AUDIO, CODEC_ID_PCM_ALAW, 8000, 1 },
|
||||
{ 9, "G722", AVMEDIA_TYPE_AUDIO, CODEC_ID_NONE, 8000, 1 },
|
||||
{ 10, "L16", AVMEDIA_TYPE_AUDIO, CODEC_ID_PCM_S16BE, 44100, 2 },
|
||||
{ 11, "L16", AVMEDIA_TYPE_AUDIO, CODEC_ID_PCM_S16BE, 44100, 1 },
|
||||
{ 12, "QCELP", AVMEDIA_TYPE_AUDIO, CODEC_ID_QCELP, 8000, 1 },
|
||||
{ 13, "CN", AVMEDIA_TYPE_AUDIO, CODEC_ID_NONE, 8000, 1 },
|
||||
{ 14, "MPA", AVMEDIA_TYPE_AUDIO, CODEC_ID_MP2, -1, -1 },
|
||||
{ 14, "MPA", AVMEDIA_TYPE_AUDIO, CODEC_ID_MP3, -1, -1 },
|
||||
{ 15, "G728", AVMEDIA_TYPE_AUDIO, CODEC_ID_NONE, 8000, 1 },
|
||||
{ 16, "DVI4", AVMEDIA_TYPE_AUDIO, CODEC_ID_NONE, 11025, 1 },
|
||||
{ 17, "DVI4", AVMEDIA_TYPE_AUDIO, CODEC_ID_NONE, 22050, 1 },
|
||||
{ 18, "G729", AVMEDIA_TYPE_AUDIO, CODEC_ID_NONE, 8000, 1 },
|
||||
{ 25, "CelB", AVMEDIA_TYPE_VIDEO, CODEC_ID_NONE, 90000, -1 },
|
||||
{ 26, "JPEG", AVMEDIA_TYPE_VIDEO, CODEC_ID_MJPEG, 90000, -1 },
|
||||
{ 28, "nv", AVMEDIA_TYPE_VIDEO, CODEC_ID_NONE, 90000, -1 },
|
||||
{ 31, "H261", AVMEDIA_TYPE_VIDEO, CODEC_ID_H261, 90000, -1 },
|
||||
{ 32, "MPV", AVMEDIA_TYPE_VIDEO, CODEC_ID_MPEG1VIDEO, 90000, -1 },
|
||||
{ 32, "MPV", AVMEDIA_TYPE_VIDEO, CODEC_ID_MPEG2VIDEO, 90000, -1 },
|
||||
{ 33, "MP2T", AVMEDIA_TYPE_DATA, CODEC_ID_MPEG2TS, 90000, -1 },
|
||||
{ 34, "H263", AVMEDIA_TYPE_VIDEO, CODEC_ID_H263, 90000, -1 },
|
||||
{ -1, "", AVMEDIA_TYPE_UNKNOWN, CODEC_ID_NONE, -1, -1 }
|
||||
{ 0, "PCMU", AVMEDIA_TYPE_AUDIO, AV_CODEC_ID_PCM_MULAW, 8000, 1 },
|
||||
{ 3, "GSM", AVMEDIA_TYPE_AUDIO, AV_CODEC_ID_NONE, 8000, 1 },
|
||||
{ 4, "G723", AVMEDIA_TYPE_AUDIO, AV_CODEC_ID_NONE, 8000, 1 },
|
||||
{ 5, "DVI4", AVMEDIA_TYPE_AUDIO, AV_CODEC_ID_NONE, 8000, 1 },
|
||||
{ 6, "DVI4", AVMEDIA_TYPE_AUDIO, AV_CODEC_ID_NONE, 16000, 1 },
|
||||
{ 7, "LPC", AVMEDIA_TYPE_AUDIO, AV_CODEC_ID_NONE, 8000, 1 },
|
||||
{ 8, "PCMA", AVMEDIA_TYPE_AUDIO, AV_CODEC_ID_PCM_ALAW, 8000, 1 },
|
||||
{ 9, "G722", AVMEDIA_TYPE_AUDIO, AV_CODEC_ID_NONE, 8000, 1 },
|
||||
{ 10, "L16", AVMEDIA_TYPE_AUDIO, AV_CODEC_ID_PCM_S16BE, 44100, 2 },
|
||||
{ 11, "L16", AVMEDIA_TYPE_AUDIO, AV_CODEC_ID_PCM_S16BE, 44100, 1 },
|
||||
{ 12, "QCELP", AVMEDIA_TYPE_AUDIO, AV_CODEC_ID_QCELP, 8000, 1 },
|
||||
{ 13, "CN", AVMEDIA_TYPE_AUDIO, AV_CODEC_ID_NONE, 8000, 1 },
|
||||
{ 14, "MPA", AVMEDIA_TYPE_AUDIO, AV_CODEC_ID_MP2, -1, -1 },
|
||||
{ 14, "MPA", AVMEDIA_TYPE_AUDIO, AV_CODEC_ID_MP3, -1, -1 },
|
||||
{ 15, "G728", AVMEDIA_TYPE_AUDIO, AV_CODEC_ID_NONE, 8000, 1 },
|
||||
{ 16, "DVI4", AVMEDIA_TYPE_AUDIO, AV_CODEC_ID_NONE, 11025, 1 },
|
||||
{ 17, "DVI4", AVMEDIA_TYPE_AUDIO, AV_CODEC_ID_NONE, 22050, 1 },
|
||||
{ 18, "G729", AVMEDIA_TYPE_AUDIO, AV_CODEC_ID_NONE, 8000, 1 },
|
||||
{ 25, "CelB", AVMEDIA_TYPE_VIDEO, AV_CODEC_ID_NONE, 90000, -1 },
|
||||
{ 26, "JPEG", AVMEDIA_TYPE_VIDEO, AV_CODEC_ID_MJPEG, 90000, -1 },
|
||||
{ 28, "nv", AVMEDIA_TYPE_VIDEO, AV_CODEC_ID_NONE, 90000, -1 },
|
||||
{ 31, "H261", AVMEDIA_TYPE_VIDEO, AV_CODEC_ID_H261, 90000, -1 },
|
||||
{ 32, "MPV", AVMEDIA_TYPE_VIDEO, AV_CODEC_ID_MPEG1VIDEO, 90000, -1 },
|
||||
{ 32, "MPV", AVMEDIA_TYPE_VIDEO, AV_CODEC_ID_MPEG2VIDEO, 90000, -1 },
|
||||
{ 33, "MP2T", AVMEDIA_TYPE_DATA, AV_CODEC_ID_MPEG2TS, 90000, -1 },
|
||||
{ 34, "H263", AVMEDIA_TYPE_VIDEO, AV_CODEC_ID_H263, 90000, -1 },
|
||||
{ -1, "", AVMEDIA_TYPE_UNKNOWN, AV_CODEC_ID_NONE, -1, -1 }
|
||||
};
|
||||
|
||||
SessionDescriptor::DynamicPayloadDesc SessionDescriptor::smDynamicPayloads[] = {
|
||||
{ "MP4V-ES", AVMEDIA_TYPE_VIDEO, CODEC_ID_MPEG4 },
|
||||
{ "mpeg4-generic", AVMEDIA_TYPE_AUDIO, CODEC_ID_AAC },
|
||||
{ "H264", AVMEDIA_TYPE_VIDEO, CODEC_ID_H264 },
|
||||
{ "AMR", AVMEDIA_TYPE_AUDIO, CODEC_ID_AMR_NB }
|
||||
{ "MP4V-ES", AVMEDIA_TYPE_VIDEO, AV_CODEC_ID_MPEG4 },
|
||||
{ "mpeg4-generic", AVMEDIA_TYPE_AUDIO, AV_CODEC_ID_AAC },
|
||||
{ "H264", AVMEDIA_TYPE_VIDEO, AV_CODEC_ID_H264 },
|
||||
{ "AMR", AVMEDIA_TYPE_AUDIO, AV_CODEC_ID_AMR_NB }
|
||||
};
|
||||
#else
|
||||
SessionDescriptor::StaticPayloadDesc SessionDescriptor::smStaticPayloads[] = {
|
||||
{ 0, "PCMU", CODEC_TYPE_AUDIO, CODEC_ID_PCM_MULAW, 8000, 1 },
|
||||
{ 0, "PCMU", CODEC_TYPE_AUDIO, CODEC_ID_PCM_MULAW, 8001, 1 },
|
||||
{ 3, "GSM", CODEC_TYPE_AUDIO, CODEC_ID_NONE, 8000, 1 },
|
||||
{ 4, "G723", CODEC_TYPE_AUDIO, CODEC_ID_NONE, 8000, 1 },
|
||||
{ 5, "DVI4", CODEC_TYPE_AUDIO, CODEC_ID_NONE, 8000, 1 },
|
||||
|
@ -415,7 +415,7 @@ AVFormatContext *SessionDescriptor::generateFormatContext() const
|
|||
stream->codec->width = mediaDesc->getWidth();
|
||||
if ( mediaDesc->getHeight() )
|
||||
stream->codec->height = mediaDesc->getHeight();
|
||||
if ( stream->codec->codec_id == CODEC_ID_H264 && mediaDesc->getSprops().size())
|
||||
if ( stream->codec->codec_id == AV_CODEC_ID_H264 && mediaDesc->getSprops().size())
|
||||
{
|
||||
uint8_t start_sequence[]= { 0, 0, 1 };
|
||||
stream->codec->extradata_size= 0;
|
||||
|
@ -431,7 +431,7 @@ AVFormatContext *SessionDescriptor::generateFormatContext() const
|
|||
char *dst = base64packet;
|
||||
|
||||
while (*value && *value != ','
|
||||
&& (dst - base64packet) < sizeof(base64packet) - 1) {
|
||||
&& (dst - base64packet) < (long)(sizeof(base64packet)) - 1) {
|
||||
*dst++ = *value++;
|
||||
}
|
||||
*dst++ = '\0';
|
||||
|
|
|
@ -24,174 +24,154 @@
|
|||
#include <string.h>
|
||||
#include <stdlib.h>
|
||||
|
||||
bool zm_reload = false;
|
||||
#define TRACE_SIZE 16
|
||||
|
||||
RETSIGTYPE zm_hup_handler( int signal )
|
||||
bool zm_reload = false;
|
||||
bool zm_terminate = false;
|
||||
|
||||
RETSIGTYPE zm_hup_handler(int signal)
|
||||
{
|
||||
#if HAVE_STRSIGNAL
|
||||
Info( "Got signal %d (%s), reloading", signal, strsignal(signal) );
|
||||
#else // HAVE_STRSIGNAL
|
||||
Info( "Got HUP signal, reloading" );
|
||||
#endif // HAVE_STRSIGNAL
|
||||
Info("Got signal %d (%s), reloading", signal, strsignal(signal));
|
||||
zm_reload = true;
|
||||
}
|
||||
|
||||
bool zm_terminate = false;
|
||||
|
||||
RETSIGTYPE zm_term_handler( int signal )
|
||||
RETSIGTYPE zm_term_handler(int signal)
|
||||
{
|
||||
#if HAVE_STRSIGNAL
|
||||
Info( "Got signal %d (%s), exiting", signal, strsignal(signal) );
|
||||
#else // HAVE_STRSIGNAL
|
||||
Info( "Got TERM signal, exiting" );
|
||||
#endif // HAVE_STRSIGNAL
|
||||
Info("Got signal %d (%s), exiting", signal, strsignal(signal));
|
||||
zm_terminate = true;
|
||||
}
|
||||
|
||||
#define TRACE_SIZE 16
|
||||
|
||||
#if HAVE_STRUCT_SIGCONTEXT
|
||||
RETSIGTYPE zm_die_handler( int signal, struct sigcontext context )
|
||||
#elif ( HAVE_SIGINFO_T && HAVE_UCONTEXT_T )
|
||||
#include <ucontext.h>
|
||||
RETSIGTYPE zm_die_handler( int signal, siginfo_t *info, void *context )
|
||||
#if ( HAVE_SIGINFO_T && HAVE_UCONTEXT_T )
|
||||
RETSIGTYPE zm_die_handler(int signal, siginfo_t * info, void *context)
|
||||
#else
|
||||
RETSIGTYPE zm_die_handler( int signal )
|
||||
RETSIGTYPE zm_die_handler(int signal)
|
||||
#endif
|
||||
{
|
||||
if ( signal == SIGABRT )
|
||||
{
|
||||
#if HAVE_STRSIGNAL
|
||||
Info( "Got signal %d (%s), exiting and forcing backtrace", signal, strsignal(signal) );
|
||||
#else // HAVE_STRSIGNAL
|
||||
Error( "Got signal %d, exiting and forcing backtrace", signal );
|
||||
#endif // HAVE_STRSIGNAL
|
||||
}
|
||||
else
|
||||
{
|
||||
#if HAVE_STRSIGNAL
|
||||
Info( "Got signal %d (%s), crashing", signal, strsignal(signal) );
|
||||
#else // HAVE_STRSIGNAL
|
||||
Error( "Got signal %d, crashing", signal );
|
||||
#endif // HAVE_STRSIGNAL
|
||||
}
|
||||
#if (defined(__i386__) || defined(__x86_64__))
|
||||
void *cr2 = 0;
|
||||
void *ip = 0;
|
||||
#endif
|
||||
Error("Got signal %d (%s), crashing", signal, strsignal(signal));
|
||||
|
||||
#ifndef ZM_NO_CRASHTRACE
|
||||
#if ( ( HAVE_SIGINFO_T && HAVE_UCONTEXT_T ) || HAVE_STRUCT_SIGCONTEXT )
|
||||
#if (defined(__i386__) || defined(__x86_64__))
|
||||
// Get more information if available
|
||||
#if ( HAVE_SIGINFO_T && HAVE_UCONTEXT_T )
|
||||
if (info && context) {
|
||||
|
||||
Debug(1,
|
||||
"Signal information: number %d code %d errno %d pid %d uid %d status %d",
|
||||
signal, info->si_code, info->si_errno, info->si_pid,
|
||||
info->si_uid, info->si_status);
|
||||
|
||||
ucontext_t *uc = (ucontext_t *) context;
|
||||
#if defined(__x86_64__)
|
||||
cr2 = info->si_addr;
|
||||
ip = (void *)(uc->uc_mcontext.gregs[REG_RIP]);
|
||||
#else
|
||||
cr2 = info->si_addr;
|
||||
ip = (void *)(uc->uc_mcontext.gregs[REG_EIP]);
|
||||
#endif // defined(__x86_64__)
|
||||
|
||||
// Print the signal address and instruction pointer if available
|
||||
if (ip) {
|
||||
Error("Signal address is %p, from %p", cr2, ip);
|
||||
} else {
|
||||
Error("Signal address is %p, no instruction pointer", cr2);
|
||||
}
|
||||
}
|
||||
#endif // ( HAVE_SIGINFO_T && HAVE_UCONTEXT_T )
|
||||
|
||||
|
||||
// Print backtrace if enabled and available
|
||||
#if ( !defined(ZM_NO_CRASHTRACE) && HAVE_DECL_BACKTRACE && HAVE_DECL_BACKTRACE_SYMBOLS )
|
||||
void *trace[TRACE_SIZE];
|
||||
int trace_size = 0;
|
||||
trace_size = backtrace(trace, TRACE_SIZE);
|
||||
|
||||
#if HAVE_STRUCT_SIGCONTEXT_EIP
|
||||
Error( "Signal address is %p, from %p", (void *)context.cr2, (void *)context.eip );
|
||||
char cmd[1024] = "addr2line -e ";
|
||||
char *cmd_ptr = cmd + strlen(cmd);
|
||||
cmd_ptr += snprintf(cmd_ptr, sizeof(cmd) - (cmd_ptr - cmd), "%s", self);
|
||||
|
||||
trace_size = backtrace( trace, TRACE_SIZE );
|
||||
// overwrite sigaction with caller's address
|
||||
trace[1] = (void *)context.eip;
|
||||
#elif HAVE_STRUCT_SIGCONTEXT
|
||||
Error( "Signal address is %p, no eip", (void *)context.cr2 );
|
||||
|
||||
trace_size = backtrace( trace, TRACE_SIZE );
|
||||
#else // HAVE_STRUCT_SIGCONTEXT
|
||||
if ( info && context )
|
||||
{
|
||||
ucontext_t *uc = (ucontext_t *)context;
|
||||
|
||||
Error( "Signal address is %p, from %p", info->si_addr, uc->uc_mcontext.gregs[REG_EIP] );
|
||||
|
||||
trace_size = backtrace( trace, TRACE_SIZE );
|
||||
// overwrite sigaction with caller's address
|
||||
trace[1] = (void *) uc->uc_mcontext.gregs[REG_EIP];
|
||||
char **messages = backtrace_symbols(trace, trace_size);
|
||||
// Print the full backtrace
|
||||
for (int i = 0; i < trace_size; i++) {
|
||||
Error("Backtrace %u: %s", i, messages[i]);
|
||||
cmd_ptr +=
|
||||
snprintf(cmd_ptr, sizeof(cmd) - (cmd_ptr - cmd), " %p",
|
||||
trace[i]);
|
||||
}
|
||||
#endif // HAVE_STRUCT_SIGCONTEXT
|
||||
#if HAVE_DECL_BACKTRACE
|
||||
char cmd[1024] = "addr2line -e ";
|
||||
char *cmd_ptr = cmd+strlen(cmd);
|
||||
// Try and extract the binary path from the last backtrace frame
|
||||
char **messages = backtrace_symbols( trace, trace_size );
|
||||
if ( size_t offset = strcspn( messages[trace_size-1], " " ) )
|
||||
{
|
||||
snprintf( cmd_ptr, sizeof(cmd)-(cmd_ptr-cmd), "%s", messages[trace_size-1] );
|
||||
cmd_ptr += offset;
|
||||
}
|
||||
else
|
||||
{
|
||||
cmd_ptr += snprintf( cmd_ptr, sizeof(cmd)-(cmd_ptr-cmd), "/path/to/%s", logId().c_str() );
|
||||
}
|
||||
// skip first stack frame (points here)
|
||||
for ( int i=1; i < trace_size; i++ )
|
||||
{
|
||||
Error( "Backtrace: %s", messages[i] );
|
||||
cmd_ptr += snprintf( cmd_ptr, sizeof(cmd)-(cmd_ptr-cmd), " %p", trace[i] );
|
||||
}
|
||||
Info( "Backtrace complete, please execute the following command for more information" );
|
||||
Info( cmd );
|
||||
#endif // HAVE_DECL_BACKTRACE
|
||||
#endif // ( HAVE_SIGINFO_T && HAVE_UCONTEXT_T ) || HAVE_STRUCT_SIGCONTEXT
|
||||
#endif // ZM_NO_CRASHTRACE
|
||||
free(messages);
|
||||
|
||||
exit( signal );
|
||||
Info("Backtrace complete, please execute the following command for more information");
|
||||
Info(cmd);
|
||||
#endif // ( !defined(ZM_NO_CRASHTRACE) && HAVE_DECL_BACKTRACE && HAVE_DECL_BACKTRACE_SYMBOLS )
|
||||
#endif // (defined(__i386__) || defined(__x86_64__)
|
||||
exit(signal);
|
||||
}
|
||||
|
||||
void zmSetHupHandler( SigHandler *handler )
|
||||
void zmSetHupHandler(SigHandler * handler)
|
||||
{
|
||||
sigset_t block_set;
|
||||
sigemptyset( &block_set );
|
||||
sigemptyset(&block_set);
|
||||
struct sigaction action, old_action;
|
||||
|
||||
action.sa_handler = (SigHandler *)handler;
|
||||
action.sa_handler = (SigHandler *) handler;
|
||||
action.sa_mask = block_set;
|
||||
action.sa_flags = 0;
|
||||
sigaction( SIGHUP, &action, &old_action );
|
||||
action.sa_flags = SA_RESTART;
|
||||
sigaction(SIGHUP, &action, &old_action);
|
||||
}
|
||||
|
||||
void zmSetTermHandler( SigHandler *handler )
|
||||
void zmSetTermHandler(SigHandler * handler)
|
||||
{
|
||||
sigset_t block_set;
|
||||
sigemptyset( &block_set );
|
||||
sigemptyset(&block_set);
|
||||
struct sigaction action, old_action;
|
||||
|
||||
action.sa_handler = (SigHandler *)handler;
|
||||
action.sa_handler = (SigHandler *) handler;
|
||||
action.sa_mask = block_set;
|
||||
action.sa_flags = 0;
|
||||
sigaction( SIGTERM, &action, &old_action );
|
||||
action.sa_flags = SA_RESTART;
|
||||
sigaction(SIGTERM, &action, &old_action);
|
||||
sigaction(SIGINT, &action, &old_action);
|
||||
sigaction(SIGQUIT, &action, &old_action);
|
||||
}
|
||||
|
||||
void zmSetDieHandler( SigHandler *handler )
|
||||
void zmSetDieHandler(SigHandler * handler)
|
||||
{
|
||||
sigset_t block_set;
|
||||
sigemptyset( &block_set );
|
||||
sigemptyset(&block_set);
|
||||
struct sigaction action, old_action;
|
||||
|
||||
action.sa_handler = (SigHandler *)handler;
|
||||
action.sa_mask = block_set;
|
||||
#if ( HAVE_SIGINFO_T && HAVE_UCONTEXT_T )
|
||||
action.sa_sigaction = (void (*)(int, siginfo_t *, void *))handler;
|
||||
action.sa_flags = SA_SIGINFO;
|
||||
#else
|
||||
action.sa_handler = (SigHandler *) handler;
|
||||
action.sa_flags = 0;
|
||||
#endif
|
||||
|
||||
sigaction( SIGBUS, &action, &old_action );
|
||||
sigaction( SIGSEGV, &action, &old_action );
|
||||
sigaction( SIGABRT, &action, &old_action );
|
||||
sigaction( SIGILL, &action, &old_action );
|
||||
sigaction( SIGFPE, &action, &old_action );
|
||||
sigaction(SIGBUS, &action, &old_action);
|
||||
sigaction(SIGSEGV, &action, &old_action);
|
||||
sigaction(SIGABRT, &action, &old_action);
|
||||
sigaction(SIGILL, &action, &old_action);
|
||||
sigaction(SIGFPE, &action, &old_action);
|
||||
}
|
||||
|
||||
void zmSetDefaultHupHandler()
|
||||
{
|
||||
zmSetHupHandler( (SigHandler *)zm_hup_handler );
|
||||
zmSetHupHandler((SigHandler *) zm_hup_handler);
|
||||
}
|
||||
|
||||
void zmSetDefaultTermHandler()
|
||||
{
|
||||
zmSetTermHandler( (SigHandler *)zm_term_handler );
|
||||
zmSetTermHandler((SigHandler *) zm_term_handler);
|
||||
}
|
||||
|
||||
void zmSetDefaultDieHandler()
|
||||
{
|
||||
if ( config.dump_cores )
|
||||
{
|
||||
// Do nothing
|
||||
}
|
||||
else
|
||||
{
|
||||
zmSetDieHandler( (SigHandler *)zm_die_handler );
|
||||
}
|
||||
if (config.dump_cores) {
|
||||
// Do nothing
|
||||
} else {
|
||||
zmSetDieHandler((SigHandler *) zm_die_handler);
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -21,7 +21,14 @@
|
|||
#define ZM_SIGNAL_H
|
||||
|
||||
#include <signal.h>
|
||||
|
||||
#if HAVE_EXECINFO_H
|
||||
#include <execinfo.h>
|
||||
#endif
|
||||
#if HAVE_UCONTEXT_H
|
||||
#include <ucontext.h>
|
||||
#endif
|
||||
|
||||
|
||||
#include "zm.h"
|
||||
|
||||
|
@ -32,10 +39,7 @@ extern bool zm_terminate;
|
|||
|
||||
RETSIGTYPE zmc_hup_handler( int signal );
|
||||
RETSIGTYPE zmc_term_handler( int signal );
|
||||
#if HAVE_STRUCT_SIGCONTEXT
|
||||
RETSIGTYPE zmc_die_handler( int signal, struct sigcontext context );
|
||||
#elif ( HAVE_SIGINFO_T && HAVE_UCONTEXT_T )
|
||||
#include <ucontext.h>
|
||||
#if ( HAVE_SIGINFO_T && HAVE_UCONTEXT_T )
|
||||
RETSIGTYPE zmc_die_handler( int signal, siginfo_t *info, void *context );
|
||||
#else
|
||||
RETSIGTYPE zmc_die_handler( int signal );
|
||||
|
|
Some files were not shown because too many files have changed in this diff Show More
Loading…
Reference in New Issue