Merge branch 'master' into BSD_device

This commit is contained in:
Isaac Connor 2014-12-08 16:53:39 -05:00
commit 48f4d7eb93
409 changed files with 4575 additions and 17275 deletions

View File

@ -4,6 +4,10 @@ notifications:
branches:
except:
- modern
addons:
sauce_connect:
username: "zoneminder"
access_key: "046ec7c1-c598-4e7e-949a-f86e725d1722"
env:
global:
- LD_LIBRARY_PATH="/usr/local/lib:/opt/libjpeg-turbo/lib:$LD_LIBRARY_PATH"

View File

@ -44,7 +44,7 @@ include (CheckTypeSize)
include (CheckStructHasMember)
# 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)
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 ZM_CONFIG_DIR)
set(ZM_RUNDIR "/var/run/zm" CACHE PATH "Location of transient process files, default: /var/run/zm")
set(ZM_SOCKDIR "/var/run/zm" CACHE PATH "Location of Unix domain socket files, default /var/run/zm")
set(ZM_TMPDIR "/var/tmp/zm" CACHE PATH "Location of temporary files, default: /tmp/zm")
@ -59,6 +59,7 @@ set(ZM_DB_PASS "zmpass" CACHE STRING "Password of ZoneMinder database user, defa
set(ZM_WEB_USER "" CACHE STRING "The user apache or the local web server runs on. Leave empty for automatic detection. If that fails, you can use this variable to force")
set(ZM_WEB_GROUP "" CACHE STRING "The group apache or the local web server runs on, Leave empty to be the same as the web user")
# Advanced
set(ZM_CONFIG_DIR "/${CMAKE_INSTALL_SYSCONFDIR}" CACHE PATH "Location of ZoneMinder configuration, default system config directory")
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")
@ -490,6 +491,7 @@ endif(NOT POLKIT_FOUND)
# Some variables that zm expects
set(ZM_PID "${ZM_RUNDIR}/zm.pid")
set(ZM_CONFIG "${ZM_CONFIG_DIR}/zm.conf")
set(ZM_CONFIG "/${CMAKE_INSTALL_SYSCONFDIR}/zm.conf")
set(VERSION "${zoneminder_VERSION}")
set(PKGDATADIR "${CMAKE_INSTALL_PREFIX}/${CMAKE_INSTALL_DATADIR}/zoneminder")
@ -539,7 +541,7 @@ else(zmconfgen_result EQUAL 0)
endif(zmconfgen_result EQUAL 0)
# Install zm.conf
install(FILES "${CMAKE_CURRENT_BINARY_DIR}/zm.conf" DESTINATION "/${CMAKE_INSTALL_SYSCONFDIR}")
install(FILES "${CMAKE_CURRENT_BINARY_DIR}/zm.conf" DESTINATION "${ZM_CONFIG_DIR}")
# Uninstall target
configure_file(

View File

@ -3,8 +3,9 @@ AUTOMAKE_OPTIONS = foreign
# And these to the user and group of your webserver
webuser = @WEB_USER@
webgroup = @WEB_GROUP@
zmconfigdir = @ZM_CONFIG_DIR@
sysconf_DATA = \
zmconfig_DATA = \
zm.conf
SUBDIRS = \
@ -20,7 +21,7 @@ EXTRA_DIST = \
# Yes, you are correct. This is a HACK!
install-data-hook:
( cd $(DESTDIR)$(sysconfdir); chown $(webuser):$(webgroup) $(sysconf_DATA); chmod 600 $(sysconf_DATA) )
( cd $(DESTDIR)$(zmconfigdir); chown $(webuser):$(webgroup) $(zmconfig_DATA); chmod 600 $(zmconfig_DATA) )
( if ! test -e $(DESTDIR)$(ZM_RUNDIR); then mkdir -p $(DESTDIR)$(ZM_RUNDIR); fi; if test "$(DESTDIR)$(ZM_RUNDIR)" != "/var/run"; then chown $(webuser):$(webgroup) $(DESTDIR)$(ZM_RUNDIR); chmod u+w $(DESTDIR)$(ZM_RUNDIR); fi )
( if ! test -e $(DESTDIR)$(ZM_SOCKDIR); then mkdir -p $(DESTDIR)$(ZM_SOCKDIR); fi; if test "$(DESTDIR)$(ZM_SOCKDIR)" != "/var/run"; then chown $(webuser):$(webgroup) $(DESTDIR)$(ZM_SOCKDIR); chmod u+w $(DESTDIR)$(ZM_SOCKDIR); fi )
( if ! test -e $(DESTDIR)$(ZM_TMPDIR); then mkdir -m 700 -p $(DESTDIR)$(ZM_TMPDIR); fi; if test "$(DESTDIR)$(ZM_TMPDIR)" != "/tmp" && test "$(DESTDIR)$(ZM_TMPDIR)" != "/var/tmp"; then chown $(webuser):$(webgroup) $(DESTDIR)$(ZM_TMPDIR); chmod u+w $(DESTDIR)$(ZM_TMPDIR); fi )

View File

@ -105,29 +105,39 @@ root@host:~# gdebi /root/zoneminder_1.26.4-1_amd64.deb;
Additional repositories must be added before one can build zoneminder on CentOS or RHEL:
1. RepoForge (formerly RPMForge) http://repoforge.org/use/
1. Zmrepo [ZoneMinder WiKi](http://www.zoneminder.com/wiki/index.php/CentOS#Zmrepo_-_A_ZoneMinder_repository_for_RPM_based_distros)
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:
3. RPMFusion: http://rpmfusion.org/
When adding third party repositories, it is highly recommended that the user also install and configure yum priorities as documented in the [CentOS WiKi](http://wiki.centos.org/PackageManagement/Yum/Priorities)
Prioritize the repositories:
1. Base
2. RPMFusion
3. EPEL
4. RPMForge
For instructions on yum priorities, visit this page:
http://wiki.centos.org/PackageManagement/Yum/Priorities
2. EPEL
3. RPMFusion
4. Zmrepo
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 \
sudo yum install cmake 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 x264 vlc-devel vlc-core libcurl libcurl-devel
perl-TimeDate perl-YAML-Syck perl-X10 perl-URI-Encode php php-cli php-mysql x264 vlc-devel vlc-core \
libcurl libcurl-devel polkit-devel git
```
To build from the master branch:
```bash
git clone https://github.com/ZoneMinder/ZoneMinder.git
cd ZoneMinder
cmake .
make
sudo make install
```
IMPORTANT: Don't forget the trailing "." when calling cmake
#### Docker
Docker is a system to run applications inside isolated containers. ZoneMinder, and the ZM webserver, will run using the
@ -159,4 +169,14 @@ the following steps.
6. Create new Pull Request
7. The team will then review, discuss and hopefully merge your changes.
### Package Maintainters
Many of the ZoneMinder configration variable default values are not configurable at build time through autotools or cmake. A new tool called *zmeditconfigdata.sh* has been added to allow package maintainers to manipulate any variable stored in ConfigData.pm without patching the source.
For example, let's say I have created a new ZoneMinder package that contains the cambolzola javascript file. However, by default cambozola support is turned off. To fix that, add this to the pacakging script:
```bash
./utils/zmeditconfigdata.sh ZM_OPT_CAMBOZOLA yes
```
Note that zmeditconfigdata.sh is intended to be called, from the root build folder, prior to running cmake or configure.
[![Analytics](https://ga-beacon.appspot.com/UA-15147273-6/ZoneMinder/README.md)](https://github.com/igrigorik/ga-beacon)

View File

@ -46,6 +46,7 @@ AC_ARG_VAR(ZM_RUNDIR,[Location of transient process files, default /var/run/zm])
AC_ARG_VAR(ZM_SOCKDIR,[Location of Unix domain socket files, default /var/run/zm])
AC_ARG_VAR(ZM_TMPDIR,[Location of temporary files, default /var/tmp/zm])
AC_ARG_VAR(ZM_LOGDIR,[Location of generated log files, default /var/log/zm])
AC_ARG_VAR(ZM_CONFIG_DIR,[Location of ZoneMinder configuration, default system config directory])
if test "$ZM_DB_TYPE" == ""; then
AC_SUBST(ZM_DB_TYPE,[mysql])
@ -80,6 +81,10 @@ fi
if test "$ZM_LOGDIR" == ""; then
AC_SUBST(ZM_LOGDIR,[/var/log/zm])
fi
AC_DEFINE_DIR([SYSCONFDIR],[sysconfdir],[Expanded configuration directory])
if test "$ZM_CONFIG_DIR" == ""; then
AC_SUBST(ZM_CONFIG_DIR,[$SYSCONFDIR])
fi
LIB_ARCH=lib
AC_ARG_WITH(libarch,
@ -428,8 +433,9 @@ 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")
#AC_DEFINE_DIR([SYSCONFDIR],[sysconfdir],[Expanded configuration directory])
#AC_SUBST(ZM_CONFIG,"$SYSCONFDIR/zm.conf")
AC_SUBST(ZM_CONFIG,"$ZM_CONFIG_DIR/zm.conf")
# Slight hack for non-standard perl install paths
if test "$prefix" != "NONE"; then
@ -446,7 +452,7 @@ 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 misc/com.zoneminder.systemctl.policy misc/com.zoneminder.systemctl.rules 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/zmsystemctl.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])
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 misc/com.zoneminder.systemctl.policy misc/com.zoneminder.systemctl.rules 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/zmsystemctl.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/css/classic/Makefile web/skins/classic/css/classic/views/Makefile web/skins/classic/css/flat/Makefile web/skins/classic/css/flat/views/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/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])
# Create the definitions for compilation and defaults for the database
AC_CONFIG_COMMANDS([src/zm_config_defines.h],[perl ./zmconfgen.pl])

View File

@ -2,12 +2,12 @@ Source: zoneminder
Section: net
Priority: optional
Maintainer: Isaac Connor <iconnor@connortechnology.com>
Build-Depends: debhelper (>= 7.0.50), autoconf, automake, dpatch, libphp-serialization-perl, libgnutls-dev, libmysqlclient-dev | libmariadbclient-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 | libav-tools, libnetpbm10-dev, libavdevice-dev, libdevice-serialport-perl, libpcre3, libarchive-zip-perl, libmime-lite-perl, libjpeg8, dh-autoreconf, libvlccore-dev, libvlc-dev, libcurl4-gnutls-dev | libcurl4-nss-dev | libcurl4-openssl-dev, libgcrypt11-dev, libpolkit-gobject-1-dev
Build-Depends: debhelper (>= 7.0.50), autoconf, automake, dpatch, libphp-serialization-perl, libgnutls-dev|libgnutls28-dev, libmysqlclient-dev | libmariadbclient-dev, libdbd-mysql-perl, libdate-manip-perl, libwww-perl, libjpeg8-dev|libjpeg9-dev|libjpeg62-turbo-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 | libav-tools, libnetpbm10-dev, libavdevice-dev, libdevice-serialport-perl, libarchive-zip-perl, libmime-lite-perl, dh-autoreconf, libvlccore-dev, libvlc-dev, libcurl4-gnutls-dev | libcurl4-nss-dev | libcurl4-openssl-dev, libgcrypt11-dev|libgcrypt20-dev, libpolkit-gobject-1-dev
Standards-Version: 3.9.2
Package: zoneminder
Architecture: any
Depends: ${shlibs:Depends}, ${misc:Depends}, ${perl:Depends}, apache2 | httpd, libapache2-mod-php5 | libapache2-mod-fcgid | php5-fpm, php5, php5-mysql|php5-mysqlnd, libphp-serialization-perl, libdate-manip-perl, libmime-lite-perl, libmime-tools-perl, mariadb-client|mysql-client, libwww-perl, libarchive-tar-perl, libarchive-zip-perl, libdevice-serialport-perl, libpcre3, ffmpeg | libav-tools, rsyslog | system-log-daemon, libmodule-load-perl, libsys-mmap-perl, libjson-any-perl, netpbm, libavdevice53, libjpeg8, zip, libnet-sftp-foreign-perl, libio-pty-perl, libexpect-perl, libvlccore5 | libvlccore7, libvlc5, libcurl4-gnutls-dev | libcurl4-nss-dev | libcurl4-openssl-dev, libpolkit-gobject-1-0
Depends: ${shlibs:Depends}, ${misc:Depends}, ${perl:Depends}, apache2, libapache2-mod-php5 | libapache2-mod-fcgid, php5, php5-mysql|php5-mysqlnd, libphp-serialization-perl, libdate-manip-perl, libmime-lite-perl, libmime-tools-perl, mariadb-client|mysql-client, libwww-perl, libarchive-tar-perl, libarchive-zip-perl, libdevice-serialport-perl, libpcre3, ffmpeg | libav-tools, rsyslog | system-log-daemon, libmodule-load-perl, libsys-mmap-perl, libjson-any-perl, netpbm, libavdevice53 | libavdevice55, libjpeg8|libjpeg9|libjpeg62-turbo, zip, libnet-sftp-foreign-perl, libio-pty-perl, libexpect-perl, libvlccore5 | libvlccore7 | libvlccore8, libvlc5, libcurl4-gnutls-dev | libcurl4-nss-dev | libcurl4-openssl-dev, libpolkit-gobject-1-0, liburi-encode-perl
Recommends: mysql-server|mariadb-server
Description: A video camera security and surveillance solution
ZoneMinder is intended for use in single or multi-camera video security

View File

@ -0,0 +1,51 @@
zoneminder for Debian
---------------------
There is one manual step to get the web interface working.
You need to link /etc/zm/apache.conf to /etc/apache2/conf.d/zoneminder.conf,
then reload the apache config (i.e. /etc/init.d/apache2 reload)
Changing the location for images and events
-------------------------------------------
Zoneminder, in its upstream form, stores data in /usr/share/zoneminder/. This
package modifies that by changing /usr/share/zoneminder/images and
/usr/share/zoneminder/events to symlinks to directories under
/var/cache/zoneminder.
There are numerous places these could be put and ways to do it. But, at the
moment, if you change this, an upgrade will fail with a warning about these
locations having changed (the reason for this was that previously, an upgrade
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.
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 /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 ext4 defaults 0 2
/dev/sdX2 /var/cache/zoneminder/events ext4 defaults 0 2
-- Peter Howard <pjh@northern-ridge.com.au>, Sun, 16 Jan 2010 01:35:51 +1100
Access to /dev/video*
---------------------
For cameras which require access to /dev/video*, zoneminder may need the
www-data user added to the video group in order to see those cameras:
adduser www-data video
Note that all web applications running on the zoneminder server will then have
access to all video devices on the system.
-- Vagrant Cascadian <vagrant@debian.org> Sun, 27 Mar 2011 13:06:56 -0700

View File

@ -0,0 +1,12 @@
This package uses quilt to manage all modifications to the upstream source.
Changes are stored in the source package as diffs in debian/patches and applied
during the build.
See /usr/share/doc/quilt/README.source for a detailed explanation.
This package uses the version 3.0 of the debian source package; An upstream
tarball is required to build it. This tarball can be generated automagically by
downloading the sources from the github repository with the following command:
fakeroot debian/rules get-orig-source

View File

@ -0,0 +1,9 @@
Alias /zm /usr/share/zoneminder
<Directory /usr/share/zoneminder>
php_flag register_globals off
Options Indexes FollowSymLinks
<IfModule mod_dir.c>
DirectoryIndex index.php
</IfModule>
</Directory>

33
distros/debian8/changelog Normal file
View File

@ -0,0 +1,33 @@
zoneminder (1.28.0-0.2) testing; urgency=medium
* Non-maintainer upload.
* Upstream release for debian jessie
* Package dependencies updated
* debhelper version upgraded
* Standards-Version upgraded
* Use debhelper commands instead of standard commands
* Install man pages in /usr/share/man (patch added)
* Switch to quilt
* Switch to systemd
* Some lintian fixes
-- Emmanuel Papin <manupap01@gmail.com> Wed, 26 Nov 2014 00:26:01 +0100
zoneminder (1.28.0-0.1) stable; urgency=medium
* Release
-- Isaac Connor <iconnor@connortechnology.com> Fri, 17 Oct 2014 09:27:22 -0400
zoneminder (1.27.99+1-testing-SNAPSHOT2014072901) testing; urgency=medium
* improve error messages
* Make zmupdate re-run the most recent patch so that people running the daily builds get their db updates
-- Isaac Connor <iconnor@connortechnology.com> Tue, 29 Jul 2014 14:50:20 -0400
zoneminder (1.27.0+1-testing-v4ltomonitor-1) testing; urgency=high
* Snapshot release -
-- Isaac Connor <iconnor@connortechnology.com> Wed, 09 Jul 2014 21:35:29 -0400

1
distros/debian8/compat Normal file
View File

@ -0,0 +1 @@
9

40
distros/debian8/control Normal file
View File

@ -0,0 +1,40 @@
Source: zoneminder
Section: net
Priority: optional
Maintainer: Isaac Connor <iconnor@connortechnology.com>
Build-Depends: debhelper (>= 9), dh-systemd (>= 1.5), autoconf, automake, quilt, libphp-serialization-perl, libgnutls28-dev, libmysqlclient-dev | libmariadbclient-dev, libdbd-mysql-perl, libdate-manip-perl, libwww-perl, libjpeg8-dev|libjpeg9-dev|libjpeg62-turbo-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 | libav-tools, libnetpbm10-dev, libavdevice-dev, libdevice-serialport-perl, libarchive-zip-perl, libmime-lite-perl, dh-autoreconf, libvlccore-dev, libvlc-dev, libcurl4-gnutls-dev | libcurl4-nss-dev | libcurl4-openssl-dev, libgcrypt11-dev|libgcrypt20-dev, libpolkit-gobject-1-dev
Standards-Version: 3.9.6
Package: zoneminder
Architecture: any
Depends: ${shlibs:Depends}, ${misc:Depends}, ${perl:Depends}, apache2, libapache2-mod-php5 | libapache2-mod-fcgid, php5, php5-mysql|php5-mysqlnd, libphp-serialization-perl, libdate-manip-perl, libmime-lite-perl, libmime-tools-perl, mariadb-client|mysql-client, libwww-perl, libarchive-tar-perl, libarchive-zip-perl, libdevice-serialport-perl, libpcre3, ffmpeg | libav-tools, rsyslog | system-log-daemon, libmodule-load-perl, libsys-mmap-perl, libjson-any-perl, netpbm, libavdevice55, libjpeg8|libjpeg9|libjpeg62-turbo, zip, libnet-sftp-foreign-perl, libio-pty-perl, libexpect-perl, libvlccore8, libvlc5, libcurl4-gnutls-dev | libcurl4-nss-dev | libcurl4-openssl-dev, liburi-encode-perl, libgcrypt11|libgcrypt20, libpolkit-gobject-1-0, policykit-1
Recommends: mysql-server|mariadb-server
Description: 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
Priority: extra
Section: debug
Architecture: any
Depends: zoneminder (= ${binary:Version}), ${misc:Depends}
Description: Debugging symbols 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
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.

22
distros/debian8/copyright Normal file
View File

@ -0,0 +1,22 @@
Copyright:
Copyright 2002 Philip Coombes <philip.coombes@zoneminder.com>
License:
This package is free software; you can redistribute it and/or modify it
under the terms of the GNU General Public License as published by the
Free Software Foundation; either version 2 of the License, or (at your
option) any later version.
This package is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
General Public License for more details.
You should have received a copy of the GNU General Public
License along with this package; if not, write to the Free Software
Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
On Debian GNU/Linux systems, the text of the GPL can be found in
/usr/share/common-licenses/GPL.

1
distros/debian8/docs Normal file
View File

@ -0,0 +1 @@
README.md

View File

@ -0,0 +1,15 @@
--- a/configure.ac
+++ b/configure.ac
@@ -437,10 +437,10 @@
PERL_SITE_LIB=`perl -V:installsitelib | sed -e "s/.*='\(.*\)';/\1/"`
PERL_LIB_PATH=`echo $PERL_SITE_LIB | sed -e "s|^$PERL_SITE_PREFIX||"`
EXTRA_PERL_LIB="use lib '$prefix$PERL_LIB_PATH'; # Include custom perl install path"
- PERL_MM_PARMS="PREFIX=$prefix"
+ PERL_MM_PARMS="\"PREFIX=$prefix INSTALLDIRS=vendor\""
else
EXTRA_PERL_LIB="# Include from system perl paths only"
- PERL_MM_PARMS=
+ PERL_MM_PARMS="\"INSTALLDIRS=vendor\""
fi
AC_SUBST(PERL_MM_PARMS)
AC_SUBST(EXTRA_PERL_LIB)

View File

@ -0,0 +1 @@
01_vendor-perl.diff

147
distros/debian8/rules Executable file
View File

@ -0,0 +1,147 @@
#!/usr/bin/make -f
# -*- makefile -*-
# Sample debian/rules that uses debhelper.
# This file was originally written by Joey Hess and Craig Small.
# As a special exception, when this file is copied by dh-make into a
# dh-make output file, you may use that output file without restriction.
# This special exception was added by Craig Small in version 0.37 of dh-make.
# Uncomment this to turn on verbose mode.
#export DH_VERBOSE=1
# 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)
DEB_BUILD_GNU_TYPE ?= $(shell dpkg-architecture -qDEB_BUILD_GNU_TYPE)
CFLAGS = -Wall
CPPFLAGS = -D__STDC_CONSTANT_MACROS
CXXFLAGS = -DHAVE_LIBCRYPTO
ifneq (,$(findstring debug,$(DEB_BUILD_OPTIONS)))
DEBOPT = --enable-debug
CFLAGS += -g
CXXFLAGS += -g
else
DEBOPT =
endif
ifneq (,$(findstring noopt,$(DEB_BUILD_OPTIONS)))
CFLAGS += -O0
else
CFLAGS += -O2
endif
# These are used to get the most recent version of the original sources from github
UURL = $(shell git config --get remote.origin.url)
BRANCH = $(shell git rev-parse --abbrev-ref HEAD)
HEAD = $(shell git rev-parse HEAD)
PKD = $(abspath $(dir $(MAKEFILE_LIST)))
PKG = $(word 2,$(shell dpkg-parsechangelog -l$(PKD)/changelog | grep ^Source))
VER ?= $(shell dpkg-parsechangelog -l$(PKD)/changelog | perl -ne 'print $$1 if m{^Version:\s+(?:\d+:)?(\d.*)(?:\-\d+.*)};')
DTYPE =
TARBALL = ../$(PKG)_$(VER)$(DTYPE).orig.tar.xz
%:
dh $@ --with quilt,autoreconf,systemd
override_dh_auto_configure:
CFLAGS="$(CFLAGS)" CXXFLAGS="$(CXXFLAGS)" dh_auto_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-mariadb=/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 $(DEBOPT)
override_dh_clean:
# Add here commands to clean up after the build process.
[ ! -f Makefile ] || $(MAKE) distclean
dh_clean src/zm_config_defines.h
#
# Delete remaining auto-generated Makefile if Makefile.in exists
find $(CURDIR)/ -type f -name "Makefile" | while read file; do \
[ -f $$file.in ] && rm -f $$file; \
done || true
#
# Delete remaining auto-generated Makefile.in if Makefile.am exists
find $(CURDIR)/ -type f -name "Makefile.in" | while read filein; do \
fileam=`echo $$filein | sed 's/\(.*\)\.in/\1\.am/'`; \
[ -f $$fileam ] && rm -f $$filein; \
done || true
override_dh_install:
#
# NOTE: This is a short-term kludge; hopefully changes in the next
# upstream version will render this unnecessary.
rm -rf debian/zoneminder/usr/share/zoneminder/events
rm -rf debian/zoneminder/usr/share/zoneminder/images
rm -rf debian/zoneminder/usr/share/zoneminder/temp
dh_link var/cache/zoneminder/events usr/share/zoneminder/events
dh_link var/cache/zoneminder/images usr/share/zoneminder/images
dh_link var/cache/zoneminder/temp usr/share/zoneminder/temp
#
# This is a slightly lesser kludge; moving the cgi stuff to
# /usr/share/zoneminder/cgi-bin breaks one set of behavior,
# having it just in /usr/lib/cgi-bin breaks another bit of
# behavior.
#
dh_link usr/lib/cgi-bin usr/share/zoneminder/cgi-bin
dh_install --fail-missing
override_dh_fixperms:
dh_fixperms
chown root:root debian/zoneminder/etc/zm/zm.conf
override_dh_auto_test:
# do not run tests...
override_dh_systemd_start:
dh_systemd_start --restart-after-upgrade
.PHONY: override_dh_strip
override_dh_strip:
dh_strip --dbg-package=zoneminder-dbg
# Inspired by https://wiki.debian.org/onlyjob/get-orig-source
.PHONY: get-orig-source
get-orig-source: $(TARBALL) $(info I: $(PKG)_$(VER)$(DTYPE))
@
$(TARBALL):
$(if $(wildcard $(PKG)-$(VER)),$(error folder '$(PKG)-$(VER)' exists, aborting...))
@echo "# Cloning origin repository..."; \
if ! git clone $(UURL) $(PKG)-$(VER); then \
$(RM) -r $(PKG)-$(VER); \
echo "failed to clone repository, aborting..."; \
false; \
fi
@if [ $(BRANCH) != "master" ]; then \
cd $(PKG)-$(VER); \
echo "# Not on master branch, fetching origin branch '$(BRANCH)'..."; \
git fetch origin $(BRANCH):$(BRANCH) || false; \
echo "# Switching to branch '$(BRANCH)'..."; \
git checkout $(BRANCH) || false; \
fi
@echo "# Checking local source..."
@if [ $$(cd $(PKG)-$(VER) && git rev-parse HEAD) = $(HEAD) ]; then \
echo "even with origin, ok"; \
true; \
else \
echo "not even with origin, aborting..."; \
false; \
fi
@echo "# Setting times..."
@cd $(PKG)-$(VER) \
&& for F in $$(git ls-tree -r --name-only HEAD | sed -e "s/\s/\*/g"); do \
touch --no-dereference -d "$$(git log -1 --format="%ai" -- $$F)" "$$F"; \
done
@echo "# Cleaning-up..."
cd $(PKG)-$(VER) && $(RM) -r .git
@echo "# Packing file '$(TARBALL)'..."
@find -L "$(PKG)-$(VER)" -xdev -type f -print | sort \
| XZ_OPT="-6v" tar -caf "$(TARBALL)" -T- --owner=root --group=root --mode=a+rX \
&& $(RM) -r "$(PKG)-$(VER)"

View File

@ -0,0 +1 @@
3.0 (quilt)

View File

@ -0,0 +1,2 @@
unapply-patches
abort-on-upstream-changes

View File

@ -0,0 +1 @@
extend-diff-ignore = "(^|/)(config\.sub|config\.guess|Makefile|aclocal.m4|compile|config.h.in|configure|depcomp|install-sh|missing)$"

3
distros/debian8/watch Normal file
View File

@ -0,0 +1,3 @@
version=3
http://www.zoneminder.com/downloads.html \
.*/ZoneMinder-(.*).tar.gz

View File

@ -0,0 +1,6 @@
var/log/zm
var/lib/zm
var/cache/zoneminder/events
var/cache/zoneminder/images
var/cache/zoneminder/temp
usr/share/zoneminder/db

View File

@ -0,0 +1,36 @@
#!/bin/sh
#
### BEGIN INIT INFO
# Provides: zoneminder
# Required-Start:
# Required-Stop:
# Default-Start: 2 3 4 5
# Default-Stop: 0 1 6
# Short-Description: Do nothing more than fixing a lintian error
# Description: This script is provided by the Zoneminder package
# Zomeminder init configuration has been switched to systemd
# This dummy script can be safely deleted; It does nothing
# more than fixing a lintian error when testing the package
### END INIT INFO
. /lib/lsb/init-functions
case "$1" in
start)
;;
stop)
;;
status)
;;
restart|reload)
;;
force-reload)
;;
*)
echo "Usage: ${0:-} {start|stop|status|restart|reload|force-reload}" >&2
exit 1
;;
esac
exit 0

View File

@ -0,0 +1,22 @@
usr/bin
usr/lib/cgi-bin
usr/share/man
usr/share/perl5/ZoneMinder
usr/share/perl5/ZoneMinder.pm
usr/share/polkit-1/actions
usr/share/polkit-1/rules.d
usr/share/zoneminder/ajax
usr/share/zoneminder/css
usr/share/zoneminder/db
usr/share/zoneminder/graphics
usr/share/zoneminder/includes
usr/share/zoneminder/index.php
usr/share/zoneminder/js
usr/share/zoneminder/lang
usr/share/zoneminder/skins
usr/share/zoneminder/tools
usr/share/zoneminder/views
etc/zm
db/zm_create.sql usr/share/zoneminder/db
db/zm_update-*.sql usr/share/zoneminder/db
debian/apache.conf etc/zm

View File

@ -0,0 +1,4 @@
var/cache/zoneminder/events usr/share/zoneminder/events
var/cache/zoneminder/images usr/share/zoneminder/images
var/cache/zoneminder/temp usr/share/zoneminder/temp
usr/lib/cgi-bin usr/share/zoneminder/cgi-bin

View File

@ -0,0 +1,68 @@
#! /bin/sh
set -e
apache_install() {
mkdir -p /etc/apache2/conf-available
ln -sf ../../zm/apache.conf /etc/apache2/conf-available/zoneminder.conf
COMMON_STATE=$(dpkg-query -f '${Status}' -W 'apache2.2-common' 2>/dev/null | awk '{print $3}' || true)
if [ -e /usr/share/apache2/apache2-maintscript-helper ] ; then
. /usr/share/apache2/apache2-maintscript-helper
apache2_invoke enconf zoneminder
elif [ "$COMMON_STATE" = "installed" ] || [ "$COMMON_STATE" = "unpacked" ] ; then
[ -d /etc/apache2/conf.d/ ] && [ ! -L /etc/apache2/conf.d/zoneminder.conf ] && ln -s ../conf-available/zoneminder.conf /etc/apache2/conf.d/zoneminder.conf
fi
}
if [ "$1" = "configure" ]; then
if [ -e "/etc/init.d/mysql" ]; then
#
# Get mysql started if it isn't
#
if ! $(/etc/init.d/mysql status >/dev/null 2>&1); then
invoke-rc.d mysql start
fi
if $(/etc/init.d/mysql status >/dev/null 2>&1); then
mysqladmin --defaults-file=/etc/mysql/debian.cnf -f reload
# test if database if already present...
if ! $(echo quit | mysql --defaults-file=/etc/mysql/debian.cnf zm > /dev/null 2> /dev/null) ; then
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
deb-systemd-invoke stop zoneminder.service || true
zmupdate.pl --nointeractive
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...
deb-systemd-invoke stop zoneminder.service || exit $?
if [ "$1" = "configure" ]; then
if [ -z "$2" ]; then
chown www-data:www-data /var/log/zm
chown www-data:www-data /var/lib/zm/
chown www-data:www-data -R /var/cache/zoneminder
else
chown www-data:www-data /var/log/zm
zmupdate.pl
fi
apache_install $1
a2enmod cgi >/dev/null 2>&1
if [ -f /etc/init.d/apache2 ] ; then
invoke-rc.d apache2 reload 3>/dev/null || true
fi
fi
#DEBHELPER#

View File

@ -0,0 +1,32 @@
#! /bin/sh
set -e
apache_remove() {
COMMON_STATE=$(dpkg-query -f '${Status}' -W 'apache2.2-common' 2>/dev/null | awk '{print $3}' || true)
if [ -e /usr/share/apache2/apache2-maintscript-helper ] ; then
. /usr/share/apache2/apache2-maintscript-helper
apache2_invoke disconf zoneminder
elif [ "$COMMON_STATE" = "installed" ] || [ "$COMMON_STATE" = "unpacked" ] ; then
rm -f /etc/apache2/conf.d/zoneminder.conf
fi
rm -f /etc/apache2/conf-available/zoneminder.conf
}
if [ "$1" = "remove" ] || [ "$1" = "purge" ]; then
apache_remove $1
if [ -f /etc/init.d/apache2 ] ; then
invoke-rc.d apache2 reload 3>/dev/null || true
fi
fi
if [ "$1" = "purge" ]; then
if [ -e "/etc/init.d/mysql" ]; then
echo 'delete from user where User="zmuser";' | mysql --defaults-file=/etc/mysql/debian.cnf mysql
echo 'delete from db where User="zmuser";' | mysql --defaults-file=/etc/mysql/debian.cnf mysql
mysqladmin --defaults-file=/etc/mysql/debian.cnf -f drop zm
else
echo 'mysql not found, assuming remote server.'
fi
fi
#DEBHELPER#

View File

@ -0,0 +1,32 @@
#!/bin/sh
set -e
abort=false
if [ -L /usr/share/zoneminder/events ]; then
l=$(readlink /usr/share/zoneminder/events)
if [ "$l" != "/var/cache/zoneminder/events" ]; then
abort=true
fi
fi
if [ -L /usr/share/zoneminder/images ]; then
l=$(readlink /usr/share/zoneminder/images )
if [ "$l" != "/var/cache/zoneminder/images" ]; then
abort=true
fi
fi
if [ "$abort" = "true" ]; then
cat >&2 << EOF
Aborting installation of zoneminder due to non-default symlinks in
/usr/share/zoneminder for the images and/or events directory, which could
result in loss of data. Please move your data in each of these directories to
/var/cache/zoneminder before installing zoneminder from the package.
EOF
exit 1
fi
#DEBHELPER#
exit 0

View File

@ -0,0 +1,18 @@
# ZoneMinder systemd unit file
# This file is intended to work with debian distributions
[Unit]
Description=ZoneMinder CCTV recording and security system
After=network.target mysql.service apache2.service
Requires=mysql.service apache2.service
[Service]
User=www-data
Type=forking
ExecStart=/usr/bin/zmpkg.pl start
ExecReload=/usr/bin/zmpkg.pl restart
ExecStop=/bin/bash -c '[[ "$(/usr/bin/pgrep zmdc.pl)" > 0 ]] && /usr/bin/zmpkg.pl stop'
PIDFile=/var/run/zm/zm.pid
[Install]
WantedBy=multi-user.target

View File

@ -0,0 +1 @@
d /var/run/zm 0755 www-data www-data

View File

@ -22,8 +22,6 @@ URL: http://www.zoneminder.com/
#Source: https://github.com/ZoneMinder/ZoneMinder/archive/v%{version}.tar.gz
Source: ZoneMinder-%{version}.tar.gz
Patch1: zoneminder-1.28.0-defaults.patch
BuildRequires: cmake gnutls-devel systemd-units bzip2-devel
BuildRequires: community-mysql-devel pcre-devel libjpeg-turbo-devel
BuildRequires: perl(Archive::Tar) perl(Archive::Zip)
@ -66,7 +64,14 @@ too much degradation of performance.
%prep
%setup -q -n ZoneMinder-%{version}
%patch1 -p0 -b .defaults
# Change the following default values
./utils/zmeditconfigdata.sh ZM_PATH_ZMS /cgi-bin/zm/nph-zms
./utils/zmeditconfigdata.sh ZM_OPT_CAMBOZOLA yes
./utils/zmeditconfigdata.sh ZM_PATH_SWAP /dev/shm
./utils/zmeditconfigdata.sh ZM_UPLOAD_FTP_LOC_DIR /var/spool/zoneminder-upload
./utils/zmeditconfigdata.sh ZM_OPT_CONTROL yes
./utils/zmeditconfigdata.sh ZM_CHECK_FOR_UPDATES no
./utils/zmeditconfigdata.sh ZM_DYN_SHOW_DONATE_REMINDER no
%build
%cmake \

View File

@ -1,11 +1,12 @@
module local_zoneminder 1.1;
module local_zoneminder 1.2;
require {
type afs_ka_port_t;
type netsupport_port_t;
type port_t;
type presence_port_t;
type postfix_master_t;
type postfix_qmgr_t;
type postfix_pickup_t;
type httpd_t;
type var_lib_t;
@ -28,74 +29,75 @@ require {
type git_port_t;
type ipp_port_t;
type aol_port_t;
type unconfined_t;
type kernel_t;
type init_t;
type auditd_t;
type mysqld_t;
type httpd_log_t;
type syslogd_t;
type httpd_t;
type initrc_state_t;
type initrc_t;
type var_lib_t;
type udev_t;
type mysqld_safe_t;
type sshd_t;
type crond_t;
type getty_t;
type httpd_var_lib_t;
type initrc_var_run_t;
type tmpfs_t;
type dhcpc_t;
type v4l_device_t;
type file_t;
class sock_file { write create unlink };
class unix_stream_socket { read connectto };
class lnk_file { write create getattr read lock unlink };
class dir search;
type unconfined_t;
type kernel_t;
type init_t;
type auditd_t;
type mysqld_t;
type httpd_log_t;
type syslogd_t;
type httpd_t;
type initrc_state_t;
type initrc_t;
type var_lib_t;
type udev_t;
type mysqld_safe_t;
type sshd_t;
type crond_t;
type getty_t;
type httpd_var_lib_t;
type initrc_var_run_t;
type tmpfs_t;
type dhcpc_t;
type v4l_device_t;
type file_t;
class sock_file { write create unlink };
class unix_stream_socket { read connectto };
class lnk_file { write create getattr read lock unlink };
class dir {search getattr };
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;
class file { write getattr read lock unlink open };
class shm { unix_read unix_write associate read write getattr };
class chr_file getattr;
}
#============= httpd_t ==============
allow httpd_t auditd_t:dir search;
allow httpd_t auditd_t:dir { search getattr };
allow httpd_t auditd_t:file { read getattr open };
allow httpd_t crond_t:dir search;
allow httpd_t crond_t:dir { search getattr };
allow httpd_t crond_t:file { read getattr open };
allow httpd_t dhcpc_t:dir search;
allow httpd_t dhcpc_t:dir { search getattr };
allow httpd_t dhcpc_t:file { read getattr open };
allow httpd_t getty_t:dir search;
allow httpd_t getty_t:dir { search getattr };
allow httpd_t getty_t:file { read getattr open };
allow httpd_t httpd_log_t:file write;
allow httpd_t httpd_var_lib_t:lnk_file { write getattr read lock unlink };
allow httpd_t init_t:dir search;
allow httpd_t init_t:dir { search getattr };
allow httpd_t init_t:file { read getattr open };
#!!!! The source type 'httpd_t' can write to a 'file' of the following types:
# squirrelmail_spool_t, dirsrvadmin_config_t, httpd_lock_t, dirsrv_config_t, httpd_tmp_t, dirsrvadmin_tmp_t, httpd_cache_t, httpd_tmpfs_t, httpd_squirrelmail_t, dirsrv_var_log_t, zarafa_var_lib_t, dirsrv_var_run_t, httpd_var_lib_t, httpd_var_run_t, passenger_tmp_t, httpd_nutups_cgi_rw_content_t, httpd_apcupsd_cgi_rw_content_t, httpd_dspam_rw_content_t, httpd_mediawiki_rw_content_t, httpd_squid_rw_content_t, httpd_prewikka_rw_content_t, httpd_smokeping_cgi_rw_content_t, passenger_var_run_t, httpd_openshift_rw_content_t, httpd_dirsrvadmin_rw_content_t, httpd_w3c_validator_rw_content_t, httpd_user_rw_content_t, httpd_awstats_rw_content_t, httpdcontent, httpd_cobbler_rw_content_t, root_t, httpd_munin_rw_content_t, httpd_bugzilla_rw_content_t, httpd_cvs_rw_content_t, httpd_git_rw_content_t, httpd_sys_rw_content_t, httpd_sys_rw_content_t, httpd_nagios_rw_content_t
#squirrelmail_spool_t, mirrormanager_var_run_t, dirsrvadmin_config_t, httpd_lock_t, httpd_tmp_t, dirsrv_config_t, dirsrvadmin_tmp_t, httpd_cache_t, httpd_tmpfs_t, httpd_squirrelmail_t, dirsrv_var_run_t, dirsrv_var_log_t, httpd_var_lib_t, httpd_var_run_t, zarafa_var_lib_t, httpd_prewikka_rw_content_t, httpd_mediawiki_rw_content_t, httpd_squid_rw_content_t, passenger_var_run_t, httpd_smokeping_cgi_rw_content_t, httpd_openshift_rw_content_t, httpd_dirsrvadmin_rw_content_t, httpd_w3c_validator_rw_content_t, httpd_collectd_rw_content_t, cluster_var_lib_t, cluster_var_run_t, httpd_user_rw_content_t, httpd_awstats_rw_content_t, httpdcontent, root_t, httpd_cobbler_rw_content_t, httpd_munin_rw_content_t, cluster_conf_t, httpd_bugzilla_rw_content_t, passenger_tmp_t, httpd_cvs_rw_content_t, httpd_git_rw_content_t, httpd_sys_rw_content_t, httpd_sys_rw_content_t, httpd_nagios_rw_content_t, httpd_apcupsd_cgi_rw_content_t, httpd_nutups_cgi_rw_content_t, httpd_dspam_rw_content_t
allow httpd_t initrc_state_t:file { read write getattr unlink open };
allow httpd_t initrc_t:unix_stream_socket connectto;
allow httpd_t initrc_t:shm { unix_read unix_write associate read write getattr };
allow httpd_t initrc_var_run_t:file { read lock open };
allow httpd_t kernel_t:dir search;
allow httpd_t initrc_var_run_t:file { write read lock open };
allow httpd_t kernel_t:dir { search getattr };
allow httpd_t kernel_t:file { read getattr open };
allow httpd_t mysqld_safe_t:dir search;
allow httpd_t mysqld_safe_t:dir { search getattr };
allow httpd_t mysqld_safe_t:file { read getattr open };
allow httpd_t mysqld_t:dir search;
allow httpd_t mysqld_t:dir { search getattr };
allow httpd_t mysqld_t:file { read getattr open };
allow httpd_t sshd_t:dir search;
allow httpd_t sshd_t:dir { search getattr };
allow httpd_t sshd_t:file { read getattr open };
allow httpd_t syslogd_t:dir search;
allow httpd_t syslogd_t:dir { search getattr };
allow httpd_t syslogd_t:file { read getattr open };
allow httpd_t tmpfs_t:sock_file write;
allow httpd_t udev_t:dir search;
allow httpd_t udev_t:dir { search getattr };
allow httpd_t udev_t:file { read getattr open };
allow httpd_t unconfined_t:dir search;
allow httpd_t unconfined_t:dir { search getattr };
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 var_lib_t:sock_file { write 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;
@ -114,10 +116,10 @@ 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:dir { search getattr };
allow httpd_t postfix_master_t:file { read getattr open };
allow httpd_t postfix_pickup_t:dir search;
allow httpd_t postfix_pickup_t:dir { search getattr };
allow httpd_t postfix_pickup_t:file { read getattr open };
allow httpd_t postfix_qmgr_t:dir search;
allow httpd_t postfix_qmgr_t:dir { search getattr };
allow httpd_t postfix_qmgr_t:file { read getattr open };
allow httpd_t presence_port_t:udp_socket name_bind;

View File

@ -17,8 +17,6 @@ URL: http://www.zoneminder.com/
#Source0: https://github.com/ZoneMinder/ZoneMinder/archive/v%{version}.tar.gz
Source0: ZoneMinder-%{version}.tar.gz
Patch1: zoneminder-1.28.0-defaults.patch
BuildRequires: cmake gnutls-devel bzip2-devel
BuildRequires: mysql-devel pcre-devel libjpeg-turbo-devel
BuildRequires: perl(Archive::Tar) perl(Archive::Zip)
@ -63,7 +61,14 @@ too much degradation of performance.
%prep
%setup -q -n ZoneMinder-%{version}
%patch1 -p0 -b .defaults
# Change the following default values
./utils/zmeditconfigdata.sh ZM_PATH_ZMS /cgi-bin/zm/nph-zms
./utils/zmeditconfigdata.sh ZM_OPT_CAMBOZOLA yes
./utils/zmeditconfigdata.sh ZM_PATH_SWAP /dev/shm
./utils/zmeditconfigdata.sh ZM_UPLOAD_FTP_LOC_DIR /var/spool/zoneminder-upload
./utils/zmeditconfigdata.sh ZM_OPT_CONTROL yes
./utils/zmeditconfigdata.sh ZM_CHECK_FOR_UPDATES no
./utils/zmeditconfigdata.sh ZM_DYN_SHOW_DONATE_REMINDER no
%build
# Have to override CMAKE_INSTALL_LIBDIR for cmake < 2.8.7 due to this bug:

View File

@ -1,3 +1,9 @@
zoneminder (1.28.0+1-utopic-SNAPSHOT2014112001) utopic; urgency=medium
* Various fixes and developments since 1.28.0. Includes Digest-Auth for HTTP and better for RTSP
-- Isaac Connor <iconnor@connortechnology.com> Thu, 20 Nov 2014 10:57:57 -0500
zoneminder (1.28.0-trusty) trusty; urgency=medium
* Release

View File

@ -51,9 +51,9 @@ copyright = u'2014, https://github.com/ZoneMinder/ZoneMinder/graphs/contributors
# built documents.
#
# The short X.Y version.
version = '1.27.0'
version = '1.28.0'
# The full version, including alpha/beta/rc tags.
release = '1.27.0'
release = '1.28.0'
# The language for content autogenerated by Sphinx. Refer to documentation
# for a list of supported languages.

Binary file not shown.

After

Width:  |  Height:  |  Size: 22 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 15 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 20 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 25 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 12 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 18 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 11 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 18 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 17 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 20 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 20 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 8.8 KiB

View File

@ -1,17 +1,24 @@
Options
=======
The final area covered by the tutorial is the options and user section. If you are running in authenticated mode and dont have system privileges then you will not see this section at all and if you are running in un-authenticated mode then no user section will be displayed.
The various options you can specify are displayed in a tabbed dialog with each group of options displayed under a different heading. Each option is displayed with its name, a short description and the current value. You can also click on the ? link following each description to get a fuller explanation about each option. This is the same as you would get from zmconfig.pl. A number of option groups have a master option near the top which enables or disables the whole group so you should be aware of the state of this before modifying options and expecting them to make any difference.
If you have changed the value of an option you should then save it. A number of the option groups will then prompt you to let you know that the option(s) you have changed will require a system restart. This is not done automatically in case you will be changing many values in the same session, however once you have made all of your changes you should restart ZoneMinder as soon as possible. The reason for this is that web and some scripts will pick up the new changes immediately but some of the daemons will still be using the old values and this can lead to data inconsistency or loss.
One of the options you may notice in the System tab allows you to specify the default language for your installation of ZoneMinder. Versions 1.17.0 and later support multiple languages but rely on users to assist in creating language files for specific languages. To specify a language you will have to give the applicable code, thus for UK English this is en_gb, and for US English it would be en_us, if no language is given then UK English is assumed. Most languages will be specified in this nn_mm format and to check which languages are available look for files named zm_lang_*.php in the ZoneMinder build directory where the parts represented by the * would be what you would enter as a language. This is slightly unwieldy and will probably be improved in future to make it easier to determine language availability. On checking which languages are available it may be that your preferred language is not currently included and if this is the case please consider doing a translation and sending it back to it may be included in future releases. All the language elements are given in the zm_lang_en_gb.php file along with a few notes to help you understand the format.
.. toctree::
As mentioned above, you may also see a users tab in the Options area. In this section you will see a list of the current users defined on the system. You can also add or delete users from here. It is recommended you do not delete the admin user unless you have created another fully privileged user to take over the same role. Each user is defined with a name and password (which is hidden) as well as an enabled setting which you can use to temporarily enable or disable users, for example a guest user for limited time access. As well as that there is a language setting that allows you to define user specific languages. Setting a language here that is different than the system language will mean that when that user logs in they will have the web interface presented in their own language rather than the system default, if it is available. Specifying a language here is done in the same way as for the system default language described above.
There are also five values that define the user permissions, these are Stream, Events, Control, Monitors and System Each can have values of None, View or Edit apart from Stream which has no Edit setting. These values cover access to the following areas; Stream defines whether a user is allowed to view the live video feeds coming from the cameras. You may wish to allow a user to view historical events only in which case this setting should be none. The Events setting determines whether a user can view and modify or delete any retained historical events. The Control setting allows you to indicate whether the user is able to control any Pan/Tilt/Zoom type cameras you may have on your system. The Monitors setting specifies whether a user can see the current monitor settings and change them. Finally the System setting determines whether a user can view or modify the system settings as a whole, such as options and users or controlling the running of the system as a whole.
As well as these settings there is also a Bandwidth setting which can be used to limit the maximum bandwidth that a user can view at and a Monitor Ids setting that can be used for non-System users to restrict them to only being able to access streams, events or monitors for the given monitors ids as a comma separated list with no spaces. If a user with Monitors edit privileges is limited to specific monitors here they will not be able to add or delete monitors but only change the details of those they have access to. If a user has System privileges then the Monitors Ids setting is ignored and has no effect.
Thats pretty much is it for the tour, though there is a lot more to ZoneMinder as you will discover. You should experiment with the various settings to get the results you think are right for your requirements.
options/options_display
options/options_system
options/options_config
options/options_paths
options/options_web
options/options_images
options/options_logging
options/options_network
options/options_email
options/options_upload
options/options_x10
options/options_bw
options/options_phonebw
options/options_eyezm
options/options_users

Binary file not shown.

After

Width:  |  Height:  |  Size: 78 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 49 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 82 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 14 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 84 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 30 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 49 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 96 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 15 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 25 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 67 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 52 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 79 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 61 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 65 KiB

View File

@ -0,0 +1,42 @@
Options - High, Medium and Low B/W
----------------------------------
.. image:: images/Options_BW.png
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. The following options are available in H, M and L options. These 3 groups control what happens when the client is running in 'high', 'medium' and 'low' bandwidth mode respectively. In most cases the default values will be suitable as a starting point.
High - You should set these options for when accessing the ZoneMinder client over a local network or high speed link.
Medium - You should set these options for when accessing the ZoneMinder client over a slower cable or DSL link.
Slow - You should set these options for when accessing Zoneminder client over a slow network link.
WEB_H_REFRESH_MAIN, WEB_M_REFRESH_MAIN, WEB_L_REFRESH_MAIN - How often (in seconds) the main console window should refresh itself. 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.
WEB_H_REFRESH_CYCLE, WEB_M_REFRESH_CYCLE, WEB_L_REFRESH_CYCLE - How often (in seconds) the cycle watch window swaps to the next monitor. The cycle watch window is a method of continuously cycling between images from all of your monitors. This option determines how often to refresh with a new image.
WEB_H_REFRESH_IMAGE, WEB_M_REFRESH_IMAGE, WEB_L_REFRESH_IMAGE - How often (in seconds) the watched image is refreshed (if not streaming). 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.
WEB_H_REFRESH_STATUS, WEB_M_REFRESH_STATUS, WEB_L_REFRESH_STATUS - How often (in seconds) the status refreshes itself in the watch window. 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.
WEB_H_REFRESH_EVENTS, WEB_M_REFRESH_EVENTS, WEB_L_REFRESH_EVENTS - How often (in seconds) the event listing is refreshed in the watch window. 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.
WEB_H_CAN_STREAM, WEB_M_CAN_STREAM, WEB_L_CAN_STREAM - If you know that your browser can handle image streams of the type 'multipart/x-mixed-replace' but ZoneMinder does not detect this correctly you can set this option to ensure that the stream is delivered with or without the use of the Cambozola plugin. Selecting 'yes' will tell ZoneMinder that your browser can handle the streams nativ
WEB_H_STREAM_METHOD, WEB_M_STREAM_METHOD, WEB_H_STREAM_METHOD - ZoneMinder can be configured to use either mpeg encoded video or a series or still jpeg images when sending video streams. This option defines which is used. If you choose mpeg you should ensure that you have the appropriate plugins available on your browser whereas choosing jpeg will work natively on Mozilla and related browsers and with a Java applet on Internet Explorer
WEB_H_DEFAULT_SCALE, WEB_M_DEFAULT_SCALE, WEB_L_DEFAULT_SCALE - Normally ZoneMinder will display 'live' or 'event' streams in their native size. However if you have monitors with large dimensions or a slow link you may prefer to reduce this size, alternatively for small monitors you can enlarge it. This options lets you specify what the default scaling factor will be. It is expressed as a percentage so 100 is normal size, 200 is double size etc.
WEB_H_DEFAULT_RATE, WEB_M_DEFAULT_RATE, WEB_L_DEFAULT_RATE - Normally ZoneMinder will display 'event' streams at their native rate, i.e. as close to real-time as possible. However if you have long events it is often convenient to replay them at a faster rate for review. This option lets you specify what the default replay rate will be. It is expressed as a percentage so 100 is normal rate, 200 is double speed etc.
WEB_H_VIDEO_BITRATE, WEB_M_VIDEO_BITRATE, WEB_L_VIDEO_BITRATE - When encoding real video via the ffmpeg library a bit rate can be specified which roughly corresponds to the available bandwidth used for the stream. This setting effectively corresponds to a 'quality' setting for the video. A low value will result in a blocky image whereas a high value will produce a clearer view. Note that this setting does not control the frame rate of the video however the quality of the video produced is affected both by this setting and the frame rate that the video is produced at. A higher frame rate at a particular bit rate result in individual frames being at a lower quality.
WEB_H_VIDEO_MAXFPS, WEB_M_VIDEO_MAXFPS, WEB_L_VIDEO_MAXFPS - 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.
WEB_H_SCALE_THUMBS, WEB_M_SCALE_THUMBS, WEB_L_SCALE_THUMBS - If unset, this option sends the whole image to the browser which resizes it in the window. If set the image is scaled down on the server before sending a reduced size image to the browser to conserve bandwidth at the cost of cpu on the server. Note that ZM can only perform the resizing if the appropriate PHP graphics functionality is installed. This is usually available in the php-gd package.
WEB_H_EVENTS_VIEW, WEB_M_EVENTS_VIEW, WEB_L_EVENTS_VIEW - Stored events can be viewed in either an events list format or in a timeline based one. This option sets the default view that will be used. Choosing one view here does not prevent the other view being used as it will always be selectable from whichever view is currently being used.
WEB_H_SHOW_PROGRESS, WEB_M_SHOW_PROGRESS, WEB_L_SHOW_PROGRESS - When viewing events an event navigation panel and progress bar is shown below the event itself. This allows you to jump to specific points in the event, but can can also dynamically update to display the current progress of the event replay itself. This progress is calculated from the actual event duration and is not directly linked to the replay itself, so on limited bandwidth connections may be out of step with the replay. This option allows you to turn off the progress display, whilst still keeping the navigation aspect, where bandwidth prevents it functioning effectively.
WEB_H_AJAX_TIMEOUT, WEB_M_AJAX_TIMEOUT, WEB_L_AJAX_TIMEOUT - The newer versions of the live feed and event views use Ajax to request information from the server and populate the views dynamically. This option allows you to specify a timeout if required after which requests are abandoned. A timeout may be necessary if requests would overwise hang such as on a slow connection. This would tend to consume a lot of browser memory and make the interface unresponsive. Ordinarily no requests should timeout so this setting should be set to a value greater than the slowest expected response. This value is in milliseconds but if set to zero then no timeout will be used.

View File

@ -0,0 +1,38 @@
Options - Config
----------------
.. image:: images/Options_Config.png
TIMESTAMP_ON_CAPTURE - ZoneMinder can add a timestamp to images in two ways. The default method, when this option is set, is that each image is timestamped immediately when captured and so the image held in memory is marked right away. The second method does not timestamp the images until they are either saved as part of an event or accessed over the web. The timestamp used in both methods will contain the same time as this is preserved along with the image. The first method ensures that an image is timestamped regardless of any other circumstances but will result in all images being timestamped even those never saved or viewed. The second method necessitates that saved images are copied before being saved otherwise two timestamps perhaps at different scales may be applied. This has the (perhaps) desirable side effect that the timestamp is always applied at the same resolution so an image that has scaling applied will still have a legible and correctly scaled timestamp.
CPU_EXTENSIONS - When advanced processor extensions such as SSE2 or SSSE3 are available, ZoneMinder can use them, which should increase performance and reduce system load. Enabling this option on processors that do not support the advanced processors extensions used by ZoneMinder is harmless and will have no effect.
FAST_IMAGE_BLENDS - To detect alarms ZoneMinder needs to blend the captured image with the stored reference image to update it for comparison with the next image. The reference blend percentage specified for the monitor controls how much the new image affects the reference image. There are two methods that are available for this. If this option is set then fast calculation which does not use any multiplication or division is used. This calculation is extremely fast, however it limits the possible blend percentages to 50%, 25%, 12.5%, 6.25%, 3.25% and 1.5%. Any other blend percentage will be rounded to the nearest possible one. The alternative is to switch this option off and use standard blending instead, which is slower.
OPT_ADAPTIVE_SKIP - In previous versions of ZoneMinder the analysis daemon would attempt to keep up with the capture daemon by processing the last captured frame on each pass. This would sometimes have the undesirable side-effect of missing a chunk of the initial activity that caused the alarm because the pre-alarm frames would all have to be written to disk and the database before processing the next frame, leading to some delay between the first and second event frames. Setting this option enables a newer adaptive algorithm where the analysis daemon attempts to process as many captured frames as possible, only skipping frames when in danger of the capture daemon overwriting yet to be processed frames. This skip is variable depending on the size of the ring buffer and the amount of space left in it. Enabling this option will give you much better coverage of the beginning of alarms whilst biasing out any skipped frames towards the middle or end of the event. However you should be aware that this will have the effect of making the analysis daemon run somewhat behind the capture daemon during events and for particularly fast rates of capture it is possible for the adaptive algorithm to be overwhelmed and not have time to react to a rapid build up of pending frames and thus for a buffer overrun condition to occur.
MAX_SUSPEND_TIME - ZoneMinder allows monitors to have motion detection to be suspended, for instance while panning a camera. Ordinarily this relies on the operator resuming motion detection afterwards as failure to do so can leave a monitor in a permanently suspended state. This setting allows you to set a maximum time which a camera may be suspended for before it automatically resumes motion detection. This time can be extended by subsequent suspend indications after the first so continuous camera movement will also occur while the monitor is suspended.
STRICT_VIDEO_CONFIG - With some video devices errors can be reported in setting the various video attributes when in fact the operation was successful. Switching this option off will still allow these errors to be reported but will not cause them to kill the video capture daemon. Note however that doing this will cause all errors to be ignored including those which are genuine and which may cause the video capture to not function correctly. Use this option with caution.
SIGNAL_CHECK_POINTS - For locally attached video cameras ZoneMinder can check for signal loss by looking at a number of random points on each captured image. If all of these points are set to the same fixed colour then the camera is assumed to have lost signal. When this happens any open events are closed and a short one frame signal loss event is generated, as is another when the signal returns. This option defines how many points on each image to check. Note that this is a maximum, any points found to not have the check colour will abort any further checks so in most cases on a couple of points will actually be checked. Network and file based cameras are never checked.
V4L_MULTI_BUFFER - Performance when using Video 4 Linux devices is usually best if multiple buffers are used allowing the next image to be captured while the previous one is being processed. If you have multiple devices on a card sharing one input that requires switching then this approach can sometimes cause frames from one source to be mixed up with frames from another. Switching this option off prevents multi buffering resulting in slower but more stable image capture. This option is ignored for non-local cameras or if only one input is present on a capture chip. This option addresses a similar problem to the ZM_CAPTURES_PER_FRAME option and you should normally change the value of only one of the options at a time. If you have different capture cards that need different values you can ovveride them in each individual monitor on the source page.
CAPTURES_PER_FRAME - If you are using cameras attached to a video capture card which forces multiple inputs to share one capture chip, it can sometimes produce images with interlaced frames reversed resulting in poor image quality and a distinctive comb edge appearance. Increasing this setting allows you to force additional image captures before one is selected as the captured frame. This allows the capture hardware to 'settle down' and produce better quality images at the price of lesser capture rates. This option has no effect on (a) network cameras, or (b) where multiple inputs do not share a capture chip. This option addresses a similar problem to the ZM_V4L_MULTI_BUFFER option and you should normally change the value of only one of the options at a time. If you have different capture cards that need different values you can ovveride them in each individual monitor on the source page.
FORCED_ALARM_SCORE - The 'zmu' utility can be used to force an alarm on a monitor rather than rely on the motion detection algorithms. This option determines what score to give these alarms to distinguish them from regular ones. It must be 255 or less.
BULK_FRAME_INTERVAL - Traditionally ZoneMinder writes an entry into the Frames database table for each frame that is captured and saved. This works well in motion detection scenarios but when in a DVR situation ('Record' or 'Mocord' mode) this results in a huge number of frame writes and a lot of database and disk bandwidth for very little additional information. Setting this to a non-zero value will enabled ZoneMinder to group these non-alarm frames into one 'bulk' frame entry which saves a lot of bandwidth and space. The only disadvantage of this is that timing information for individual frames is lost but in constant frame rate situations this is usually not significant. This setting is ignored in Modect mode and individual frames are still written if an alarm occurs in Mocord mode also.
EVENT_CLOSE_MODE - When a monitor is running in a continuous recording mode (Record or Mocord) events are usually closed after a fixed period of time (the section length). However in Mocord mode it is possible that motion detection may occur near the end of a section. This option controls what happens when an alarm occurs in Mocord mode. The 'time' setting means that the event will be closed at the end of the section regardless of alarm activity. The 'idle' setting means that the event will be closed at the end of the section if there is no alarm activity occuring at the time otherwise it will be closed once the alarm is over meaning the event may end up being longer than the normal section length. The 'alarm' setting means that if an alarm occurs during the event, the event will be closed once the alarm is over regardless of when this occurs. This has the effect of limiting the number of alarms to one per event and the events will be shorter than the section length if an alarm has occurred.
CREATE_ANALYSIS_IMAGES - By default during an alarm ZoneMinder records both the raw captured image and one that has been analysed and had areas where motion was detected outlined. This can be very useful during zone configuration or in analysing why events occured. However it also incurs some overhead and in a stable system may no longer be necessary. This parameter allows you to switch the generation of these images off.
WEIGHTED_ALARM_CENTRES - ZoneMinder will always calculate the centre point of an alarm in a zone to give some indication of where on the screen it is. This can be used by the experimental motion tracking feature or your own custom extensions. In the alarmed or filtered pixels mode this is a simple midpoint between the extents of the detected pxiesl. However in the blob method this can instead be calculated using weighted pixel locations to give more accurate positioning for irregularly shaped blobs. This method, while more precise is also slower and so is turned off by default.
EVENT_IMAGE_DIGITS - 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.
DEFAULT_ASPECT_RATIO - When specifying the dimensions of monitors you can click a checkbox to ensure that the width stays in the correct ratio to the height, or vice versa. This setting allows you to indicate what the ratio of these settings should be. This should be specified in the format <width value>:<height value> and the default of 4:3 normally be acceptable but 11:9 is another common setting. If the checkbox is not clicked when specifying monitor dimensions this setting has no effect.
USER_SELF_EDIT - Ordinarily only users with system edit privilege are able to change users details. Switching this option on allows ordinary users to change their passwords and their language settings

View File

@ -0,0 +1,13 @@
Options - Display
-----------------
.. image:: images/Options_Display.png
This option screen allows user to select the skin for ZoneMinder. Currently available skins are:
* Classic
* Flat
* XML (Deprecated in favour of web/API)
* Mobile (Deprecated)

View File

@ -0,0 +1,96 @@
Options - Email
---------------
.. image:: images/Options_email.png
OPT_EMAIL - In ZoneMinder you can create event filters that specify whether events that match certain criteria should have their details emailed to you at a designated email address. This will allow you to be notified of events as soon as they occur and also to quickly view the events directly. This option specifies whether this functionality should be available. The email created with this option can be any size and is intended to be sent to a regular email reader rather than a mobile device.
EMAIL_ADDRESS - This option is used to define the email address that any events that match the appropriate filters will be sent to.
EMAIL_SUBJECT - This option is used to define the subject of the email that is sent for any events that match the appropriate filters.
EMAIL_BODY - This option is used to define the content of the email that is sent for any events that match the appropriate filters.
+--------+--------------------------------------------------------+
| Token | Description |
+========+========================================================+
| %EI% | Id of the event |
+--------+--------------------------------------------------------+
| %EN% | Name of the event |
+--------+--------------------------------------------------------+
| %EC% | Cause of the event |
+--------+--------------------------------------------------------+
| %ED% | Event description |
+--------+--------------------------------------------------------+
| %ET% | Time of the event |
+--------+--------------------------------------------------------+
| %EL% | Length of the event |
+--------+--------------------------------------------------------+
| %EF% | Number of frames in the event |
+--------+--------------------------------------------------------+
| %EFA% | Number of alarm frames in the event |
+--------+--------------------------------------------------------+
| %EST% | Total score of the event |
+--------+--------------------------------------------------------+
| %ESA% | Average score of the event |
+--------+--------------------------------------------------------+
| %ESM% | Maximum score of the event |
+--------+--------------------------------------------------------+
| %EP% | Path to the event |
+--------+--------------------------------------------------------+
| %EPS% | Path to the event stream |
+--------+--------------------------------------------------------+
| %EPI% | Path to the event images |
+--------+--------------------------------------------------------+
| %EPI1% | Path to the first alarmed event image |
+--------+--------------------------------------------------------+
| %EPIM% | Path to the (first) event image with the highest score |
+--------+--------------------------------------------------------+
| %EI1% | Attach first alarmed event image |
+--------+--------------------------------------------------------+
| %EIM% | Attach (first) event image with the highest score |
+--------+--------------------------------------------------------+
| %EV% | Attach event mpeg video |
+--------+--------------------------------------------------------+
| %MN% | Name of the monitor |
+--------+--------------------------------------------------------+
| %MET% | Total number of events for the monitor |
+--------+--------------------------------------------------------+
| %MEH% | Number of events for the monitor in the last hour |
+--------+--------------------------------------------------------+
| %MED% | Number of events for the monitor in the last day |
+--------+--------------------------------------------------------+
| %MEW% | Number of events for the monitor in the last week |
+--------+--------------------------------------------------------+
| %MEM% | Number of events for the monitor in the last month |
+--------+--------------------------------------------------------+
| %MEA% | Number of archived events for the monitor |
+--------+--------------------------------------------------------+
| %MP% | Path to the monitor window |
+--------+--------------------------------------------------------+
| %MPS% | Path to the monitor stream |
+--------+--------------------------------------------------------+
| %MPI% | Path to the monitor recent image |
+--------+--------------------------------------------------------+
| %FN% | Name of the current filter that matched |
+--------+--------------------------------------------------------+
| %FP% | Path to the current filter that matched |
+--------+--------------------------------------------------------+
| %ZP% | Path to your ZoneMinder console |
+--------+--------------------------------------------------------+
OPT_MESSAGE - In ZoneMinder you can create event filters that specify whether events that match certain criteria should have their details sent to you at a designated short message email address. This will allow you to be notified of events as soon as they occur. This option specifies whether this functionality should be available. The email created by this option will be brief and is intended to be sent to an SMS gateway or a minimal mail reader such as a mobile device or phone rather than a regular email reader.
MESSAGE_ADDRESS - This option is used to define the short message email address that any events that match the appropriate filters will be sent to.
MESSAGE_SUBJECT - This option is used to define the subject of the message that is sent for any events that match the appropriate filters.
MESSAGE_BODY - This option is used to define the content of the message that is sent for any events that match the appropriate filters.
NEW_MAIL_MODULES - Traditionally ZoneMinder has used the MIME::Entity perl module to construct and send notification emails and messages. Some people have reported problems with this module not being present at all or flexible enough for their needs. If you are one of those people this option allows you to select a new mailing method using MIME::Lite and Net::SMTP instead. This method was contributed by Ross Melin and should work for everyone but has not been extensively tested so currently is not selected by default.
EMAIL_HOST - If you have chosen SMTP as the method by which to send notification emails or messages then this option allows you to choose which SMTP server to use to send them. The default of localhost may work if you have the sendmail, exim or a similar daemon running however you may wish to enter your ISP's SMTP mail server here.
FROM_EMAIL - The emails or messages that will be sent to you informing you of events can appear to come from a designated email address to help you with mail filtering etc. An address of something like ZoneMinder\@your.domain is recommended.
URL - The emails or messages that will be sent to you informing you of events can include a link to the events themselves for easy viewing. If you intend to use this feature then set this option to the url of your installation as it would appear from where you read your email, e.g. http://host.your.domain/zm.php.

View File

@ -0,0 +1,22 @@
Options - eyeZM
---------------
.. image:: images/Options_eyezm.png
EYEZM_DEBUG - Enable or Disable extra debugging from the eyeZm Plugin. Extra debugging information will be displayed in it's own file (EYEZM_LOG_TO_FILE is set), or your Apache error log
EYEZM_LOG_TO_FILE - When EYEZM_DEBUG is on and EYEZM_LOG_TO_FILE is on, output generated from the eyeZm Plugin will go to it's own file. Otherwise it will go to the apache error log.
EYEZM_LOG_FILE - Default filename to use when logging eyeZm Output and EYEZM_LOG_TO_FILE is enabled. This file will contain it's own output from the eyeZm Plugin when EYEZM_LOG_TO_FILE and EYEZM_DEBUG are both enabled.
EYEZM_EVENT_VCODEC - The eyeZm Plugin calls FFMPEG externally to encode the captured images. If your FFMPEG is not built with support for H264, change this to MPEG-4. If using H264, please check http://www.eyezm.com for H264 requirements and that your eyeZm version supports H264 (v1.2+).
EYEZM_FEED_VCODEC - Determines whether the live stream is generated using native MJPEG streaming with ZoneMinder, or H264 using FFMPEG and HTML-5 streaming. If using H264, please check http://www.eyezm.com for H264 requirements and that your eyeZm version supports H264 (v1.2+). This is just a default parameter, and can be overridden with eyeZm.
EYEZM_H264_DEFAULT_BR - Default bit-rate to use with FFMPEG for H264 streaming. When using the eyeZm Plugin to stream H264 data, FFMPEG requires a bitrate to control the quality and bandwidth of the video. This should be specified in a format acceptable to FFMPEG. The default value is sufficient for most installations. This is just a default parameter, and can be overridden with eyeZm.
EYEZM_H264_DEFAULT_EVBR - Default bit-rate to use with FFMPEG for H264 event viewing. When using the eyeZm Plugin to view events in H264, FFMPEG requires a bitrate to control the quality and bandwidth of the video. This should be specified in a format acceptable to FFMPEG. The default value is sufficient for most installations. This is just a default parameter, and can be overridden with eyeZm.
EYEZM_H264_TIMEOUT - Timeout (sec) to wait for H264 stream to start before terminating. The eyeZm Plugin will attempt to spawn an H264 stream when requested, and require that it complete within the timeout specified. If you have a slow system or find through the logs that the H264 stream is not starting because the timeout is expiring, even though FFMPEG is running, try increasing this value. If you have a fast system, decreasing this value can improve the responsiveness when there are issues starting H264 streams.
EYEZM_SEG_DURATION - Segment duration used for streaming using HTTP-5 Streaming protocol. The HTTP-5 Live Streaming Protocol segments the input video stream into small chunks of a duration specified by this parameter. Increasing the segment duration will help with choppy connections on the other end, but will increase the latency in starting a stream.

View File

@ -0,0 +1,44 @@
Options - Images
----------------
.. image:: images/Options_images.png
OPT_FFMPEG - ZoneMinder can optionally encode a series of video images into an MPEG encoded movie file for viewing, downloading or storage. This option allows you to specify whether you have the ffmpeg tools installed. Note that creating MPEG files can be fairly CPU and disk intensive and is not a required option as events can still be reviewed as video streams without it.
PATH_FFMPEG - This path should point to where ffmpeg has been installed.
FFMPEG_INPUT_OPTIONS - Ffmpeg can take many options on the command line to control the quality of video produced. This option allows you to specify your own set that apply to the input to ffmpeg (options that are given before the -i option). Check the ffmpeg documentation for a full list of options which may be used here.
FFMPEG_OUTPUT_OPTIONS - Ffmpeg can take many options on the command line to control the quality of video produced. This option allows you to specify your own set that apply to the output from ffmpeg (options that are given after the -i option). Check the ffmpeg documentation for a full list of options which may be used here. The most common one will often be to force an output frame rate supported by the video encoder.
FFMPEG_FORMATS - Ffmpeg can generate video in many different formats. This option allows you to list the ones you want to be able to select. As new formats are supported by ffmpeg you can add them here and be able to use them immediately. Adding a '*' after a format indicates that this will be the default format used for web video, adding '**' defines the default format for phone video.
FFMPEG_OPEN_TIMEOUT - When Ffmpeg is opening a stream, it can take a long time before failing; certain circumstances even seem to be able to lock indefinitely. This option allows you to set a maximum time in seconds to pass before closing the stream and trying to reopen it again.
JPEG_STREAM_QUALITY - When viewing a 'live' stream for a monitor ZoneMinder will grab an image from the buffer and encode it into JPEG format before sending it. This option specifies what image quality should be used to encode these images. A higher number means better quality but less compression so will take longer to view over a slow connection. By contrast a low number means quicker to view images but at the price of lower quality images. This option does not apply when viewing events or still images as these are usually just read from disk and so will be encoded at the quality specified by the previous options.
MPEG_TIMED_FRAMES - When using streamed MPEG based video, either for live monitor streams or events, ZoneMinder can send the streams in two ways. If this option is selected then the timestamp for each frame, taken from it's capture time, is included in the stream. This means that where the frame rate varies, for instance around an alarm, the stream will still maintain it's 'real' timing. If this option is not selected then an approximate frame rate is calculated and that is used to schedule frames instead. This option should be selected unless you encounter problems with your preferred streaming method.
MPEG_LIVE_FORMAT - When using MPEG mode ZoneMinder can output live video. However what formats are handled by the browser varies greatly between machines. This option allows you to specify a video format using a file extension format, so you would just enter the extension of the file type you would like and the rest is determined from that. The default of 'asf' works well under Windows with Windows Media Player but I'm currently not sure what, if anything, works on a Linux platform. If you find out please let me know! If this option is left blank then live streams will revert to being in motion jpeg format
MPEG_REPLAY_FORMAT - When using MPEG mode ZoneMinder can replay events in encoded video format. However what formats are handled by the browser varies greatly between machines. This option allows you to specify a video format using a file extension format, so you would just enter the extension of the file type you would like and the rest is determined from that. The default of 'asf' works well under Windows with Windows Media Player and 'mpg', or 'avi' etc should work under Linux. If you know any more then please let me know! If this option is left blank then live streams will revert to being in motion jpeg format
RAND_STREAM - Some browsers can cache the streams used by ZoneMinder. In order to prevent his a harmless random string can be appended to the url to make each invocation of the stream appear unique.
OPT_CAMBOZOLA - Cambozola is a handy low fat cheese flavoured Java applet that ZoneMinder uses to view image streams on browsers such as Internet Explorer that don't natively support this format. If you use this browser it is highly recommended to install this from http://www.charliemouse.com/code/cambozola/ however if it is not installed still images at a lower refresh rate can still be viewed.
PATH_CAMBOZOLA - Cambozola is a handy low fat cheese flavoured Java applet that ZoneMinder uses to view image streams on browsers such as Internet Explorer that don't natively support this format. If you use this browser it is highly recommended to install this from http://www.charliemouse.com/code/cambozola/ however if it is not installed still images at a lower refresh rate can still be viewed. Leave this as 'cambozola.jar' if cambozola is installed in the same directory as the ZoneMinder web client files.
RELOAD_CAMBOZOLA - Cambozola allows for the viewing of streaming MJPEG however it caches the entire stream into cache space on the computer, setting this to a number > 0 will cause it to automatically reload after that many seconds to avoid filling up a hard drive.
OPT_FFMPEG - ZoneMinder can optionally encode a series of video images into an MPEG encoded movie file for viewing, downloading or storage. This option allows you to specify whether you have the ffmpeg tools installed. Note that creating MPEG files can be fairly CPU and disk intensive and is not a required option as events can still be reviewed as video streams without it.
PATH_FFMPEG - This path should point to where ffmpeg has been installed.
FFMPEG_INPUT_OPTIONS - Ffmpeg can take many options on the command line to control the quality of video produced. This option allows you to specify your own set that apply to the input to ffmpeg (options that are given before the -i option). Check the ffmpeg documentation for a full list of options which may be used here.
FFMPEG_OUTPUT_OPTIONS - Ffmpeg can take many options on the command line to control the quality of video produced. This option allows you to specify your own set that apply to the output from ffmpeg (options that are given after the -i option). Check the ffmpeg documentation for a full list of options which may be used here. The most common one will often be to force an output frame rate supported by the video encoder.
FFMPEG_FORMATS - Ffmpeg can generate video in many different formats. This option allows you to list the ones you want to be able to select. As new formats are supported by ffmpeg you can add them here and be able to use them immediately. Adding a '*' after a format indicates that this will be the default format used for web video, adding '**' defines the default format for phone video.
FFMPEG_OPEN_TIMEOUT - When Ffmpeg is opening a stream, it can take a long time before failing; certain circumstances even seem to be able to lock indefinitely. This option allows you to set a maximum time in seconds to pass before closing the stream and trying to reopen it again.

View File

@ -0,0 +1,42 @@
Options - Logging
-----------------
.. image:: images/Options_Logging.png
LOG_LEVEL_SYSLOG - ZoneMinder logging is now more more integrated between components and allows you to specify the destination for logging output and the individual levels for each. This option lets you control the level of logging output that goes to the system log. ZoneMinder binaries have always logged to the system log but now scripts and web logging is also included. To preserve the previous behaviour you should ensure this value is set to Info or Warning. This option controls the maximum level of logging that will be written, so Info includes Warnings and Errors etc. To disable entirely, set this option to None. You should use caution when setting this option to Debug as it can affect severely affect system performance. If you want debug you will also need to set a level and component below
LOG_LEVEL_FILE - ZoneMinder logging is now more more integrated between components and allows you to specify the destination for logging output and the individual levels for each. This option lets you control the level of logging output that goes to individual log files written by specific components. This is how logging worked previously and although useful for tracking down issues in specific components it also resulted in many disparate log files. To preserve this behaviour you should ensure this value is set to Info or Warning. This option controls the maximum level of logging that will be written, so Info includes Warnings and Errors etc. To disable entirely, set this option to None. You should use caution when setting this option to Debug as it can affect severely affect system performance though file output has less impact than the other options. If you want debug you will also need to set a level and component below
LOG_LEVEL_WEBLOG - ZoneMinder logging is now more more integrated between components and allows you to specify the destination for logging output and the individual levels for each. This option lets you control the level of logging output from the web interface that goes to the httpd error log. Note that only web logging from PHP and JavaScript files is included and so this option is really only useful for investigating specific issues with those components. This option controls the maximum level of logging that will be written, so Info includes Warnings and Errors etc. To disable entirely, set this option to None. You should use caution when setting this option to Debug as it can affect severely affect system performance. If you want debug you will also need to set a level and component below
LOG_LEVEL_DATABASE - ZoneMinder logging is now more more integrated between components and allows you to specify the destination for logging output and the individual levels for each. This option lets you control the level of logging output that is written to the database. This is a new option which can make viewing logging output easier and more intuitive and also makes it easier to get an overall impression of how the system is performing. If you have a large or very busy system then it is possible that use of this option may slow your system down if the table becomes very large. Ensure you use the LOG_DATABASE_LIMIT option to keep the table to a manageable size. This option controls the maximum level of logging that will be written, so Info includes Warnings and Errors etc. To disable entirely, set this option to None. You should use caution when setting this option to Debug as it can affect severely affect system performance. If you want debug you will also need to set a level and component below
LOG_DATABASE_LIMIT - If you are using database logging then it is possible to quickly build up a large number of entries in the Logs table. This option allows you to specify how many of these entries are kept. If you set this option to a number greater than zero then that number is used to determine the maximum number of rows, less than or equal to zero indicates no limit and is not recommended. You can also set this value to time values such as '<n> day' which will limit the log entries to those newer than that time. You can specify 'hour', 'day', 'week', 'month' and 'year', note that the values should be singular (no 's' at the end). The Logs table is pruned periodically so it is possible for more than the expected number of rows to be present briefly in the meantime.
LOG_DEBUG" - ZoneMinder components usually support debug logging available to help with diagnosing problems. Binary components have several levels of debug whereas more other components have only one. Normally this is disabled to minimise performance penalties and avoid filling logs too quickly. This option lets you switch on other options that allow you to configure additional debug information to be output. Components will pick up this instruction when they are restarted.
LOG_DEBUG_TARGET - There are three scopes of debug available. Leaving this option blank means that all components will use extra debug (not recommended). Setting this option to '_<component>', e.g. _zmc, will limit extra debug to that component only. Setting this option to '_<component>_<identity>', e.g. '_zmc_m1' will limit extra debug to that instance of the component only. This is ordinarily what you probably want to do. To debug scripts use their names without the .pl extension, e.g. '_zmvideo' and to debug issues with the web interface use '_web'. You can specify multiple targets by separating them with '|' characters.
LOG_DEBUG_LEVEL - There are 9 levels of debug available, with higher numbers being more debug and level 0 being no debug. However not all levels are used by all components. Also if there is debug at a high level it is usually likely to be output at such a volume that it may obstruct normal operation. For this reason you should set the level carefully and cautiously until the degree of debug you wish to see is present. Scripts and the web interface only have one level so this is an on/off type option for them.
LOG_DEBUG_FILE - This option allows you to specify a different target for debug output. All components have a default log file which will norally be in /tmp or /var/log and this is where debug will be written to if this value is empty. Adding a path here will temporarily redirect debug, and other logging output, to this file. This option is a simple filename and you are debugging several components then they will all try and write to the same file with undesirable consequences. Appending a '+' to the filename will cause the file to be created with a '.<pid>' suffix containing your process id. In this way debug from each run of a component is kept separate. This is the recommended setting as it will also prevent subsequent runs from overwriting the same log. You should ensure that permissions are set up to allow writing to the file and directory specified here.
LOG_CHECK_PERIOD - When ZoneMinder is logging events to the database it can retrospectively examine the number of warnings and errors that have occurred to calculate an overall state of system health. This option allows you to indicate what period of historical events are used in this calculation. This value is expressed in seconds and is ignored if LOG_LEVEL_DATABASE is set to None.
LOG_ALERT_WAR_COUNT - When ZoneMinder is logging events to the database it can retrospectively examine the number of warnings and errors that have occurred to calculate an overall state of system health. This option allows you to specify how many warnings must have occurred within the defined time period to generate an overall system alert state. A value of zero means warnings are not considered. This value is ignored if LOG_LEVEL_DATABASE is set to None.
LOG_ALERT_ERR_COUNT - When ZoneMinder is logging events to the database it can retrospectively examine the number of warnings and errors that have occurred to calculate an overall state of system health. This option allows you to specify how many errors must have occurred within the defined time period to generate an overall system alert state. A value of zero means errors are not considered. This value is ignored if LOG_LEVEL_DATABASE is set to None.
LOG_ALERT_FAT_COUNT - When ZoneMinder is logging events to the database it can retrospectively examine the number of warnings and errors that have occurred to calculate an overall state of system health. This option allows you to specify how many fatal errors (including panics) must have occurred within the defined time period to generate an overall system alert state. A value of zero means fatal errors are not considered. This value is ignored if LOG_LEVEL_DATABASE is set to None.
LOG_ALARM_WAR_COUNT - When ZoneMinder is logging events to the database it can retrospectively examine the number of warnings and errors that have occurred to calculate an overall state of system health. This option allows you to specify how many warnings must have occurred within the defined time period to generate an overall system alarm state. A value of zero means warnings are not considered. This value is ignored if LOG_LEVEL_DATABASE is set to None.
LOG_ALARM_ERR_COUNT - When ZoneMinder is logging events to the database it can retrospectively examine the number of warnings and errors that have occurred to calculate an overall state of system health. This option allows you to specify how many errors must have occurred within the defined time period to generate an overall system alarm state. A value of zero means errors are not considered. This value is ignored if LOG_LEVEL_DATABASE is set to None.
LOG_ALARM_FAT_COUNT - When ZoneMinder is logging events to the database it can retrospectively examine the number of warnings and errors that have occurred to calculate an overall state of system health. This option allows you to specify how many fatal errors (including panics) must have occurred within the defined time period to generate an overall system alarm state. A value of zero means fatal errors are not considered. This value is ignored if LOG_LEVEL_DATABASE is set to None.
RECORD_EVENT_STATS - This version of ZoneMinder records detailed information about events in the Stats table. This can help in profiling what the optimum settings are for Zones though this is tricky at present. However in future releases this will be done more easily and intuitively, especially with a large sample of events. The default option of 'yes' allows this information to be collected now in readiness for this but if you are concerned about performance you can switch this off in which case no Stats information will be saved.
RECORD_DIAG_IMAGES - In addition to recording event statistics you can also record the intermediate diagnostic images that display the results of the various checks and processing that occur when trying to determine if an alarm event has taken place. There are several of these images generated for each frame and zone for each alarm or alert frame so this can have a massive impact on performance. Only switch this setting on for debug or analysis purposes and remember to switch it off again once no longer required.
DUMP_CORES - When an unrecoverable error occurs in a ZoneMinder binary process is has traditionally been trapped and the details written to logs to aid in remote analysis. However in some cases it is easier to diagnose the error if a core file, which is a memory dump of the process at the time of the error, is created. This can be interactively analysed in the debugger and may reveal more or better information than that available from the logs. This option is recommended for advanced users only otherwise leave at the default. Note using this option to trigger core files will mean that there will be no indication in the binary logs that a process has died, they will just stop, however the zmdc log will still contain an entry. Also note that you may have to explicitly enable core file creation on your system via the 'ulimit -c' command or other means otherwise no file will be created regardless of the value of this option.

View File

@ -0,0 +1,14 @@
Options - Network
-----------------
.. image:: images/Options_Network.png
HTTP_VERSION - 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.
HTTP_UA - When ZoneMinder communicates with remote cameras it will identify itself using this string and it's version number. This is normally sufficient, however if a particular cameras expects only to communicate with certain browsers then this can be changed to a different string identifying ZoneMinder as Internet Explorer or Netscape etc.
HTTP_TIMEOUT - When retrieving remote images ZoneMinder will wait for this length of time before deciding that an image is not going to arrive and taking steps to retry. This timeout is in milliseconds (1000 per second) and will apply to each part of an image if it is not sent in one whole chunk.
MIN_RTP_PORT - When ZoneMinder communicates with MPEG4 capable cameras using RTP with the unicast method it must open ports for the camera to connect back to for control and streaming purposes. This setting specifies the minimum port number that ZoneMinder will use. Ordinarily two adjacent ports are used for each camera, one for control packets and one for data packets. This port should be set to an even number, you may also need to open up a hole in your firewall to allow cameras to connect back if you wish to use unicasting.
MAX_RTP_PORT - When ZoneMinder communicates with MPEG4 capable cameras using RTP with the unicast method it must open ports for the camera to connect back to for control and streaming purposes. This setting specifies the maximum port number that ZoneMinder will use. Ordinarily two adjacent ports are used for each camera, one for control packets and one for data packets. This port should be set to an even number, you may also need to open up a hole in your firewall to allow cameras to connect back if you wish to use unicasting. You should also ensure that you have opened up at least two ports for each monitor that will be connecting to unicasting network cameras.

View File

@ -0,0 +1,22 @@
Options - Paths
---------------
.. image:: images/Options_Paths.png
ZM_DIR_EVENTS - This is the path to the events directory where all the event images and other miscellaneous files are stored. CAUTION: The directory you specify here cannot be outside the web root. This is a common mistake. Most users should never change this value. If you intend to record events to a second disk or network share, then you should mount the drive or share directly to the ZoneMinder events folder or follow the instructions in the ZoneMinder Wiki titled Using a dedicated Hard Drive.
USE_DEEP_STORAGE - Traditionally ZoneMinder stores all events for a monitor in one directory for that monitor. This is simple and efficient except when you have very large amounts of events. Some filesystems are unable to store more than 32k files in one directory and even without this limitation, large numbers of files in a directory can slow creation and deletion of files. This option allows you to select an alternate method of storing events by year/month/day/hour/min/second which has the effect of separating events out into more directories, resulting in less per directory, and also making it easier to manually navigate to any events that may have happened at a particular time or date.
DIR_IMAGES - ZoneMinder generates a myriad of images, mostly of which are associated with events. For those that aren't this is where they go. CAUTION: The directory you specify here cannot be outside the web root. This is a common mistake. Most users should never change this value. If you intend to save images to a second disk or network share, then you should mount the drive or share directly to the ZoneMinder images folder or follow the instructions in the ZoneMinder Wiki titled Using a dedicated Hard Drive.
DIR_SOUNDS - ZoneMinder can optionally play a sound file when an alarm is detected. This indicates where to look for this file. CAUTION: The directory you specify here cannot be outside the web root. Most users should never change this value.
PATH_ZMS - The ZoneMinder streaming server is required to send streamed images to your browser. It will be installed into the cgi-bin path given at configuration time. This option determines what the web path to the server is rather than the local path on your machine. Ordinarily the streaming server runs in parser-header mode however if you experience problems with streaming you can change this to non-parsed-header (nph) mode by changing 'zms' to 'nph-zms'.
PATH_MAP - ZoneMinder has historically used IPC shared memory for shared data between processes. This has it's advantages and limitations. This version of ZoneMinder can use an alternate method, mapped memory, instead with can be enabled with the --enable--mmap directive to configure. This requires less system configuration and is generally more flexible. However it requires each shared data segment to map onto a filesystem file. This option indicates where those mapped files go. You should ensure that this location has sufficient space for these files and for the best performance it should be a tmpfs file system or ramdisk otherwise disk access may render this method slower than the regular shared memory one.
PATH_SOCKS - ZoneMinder generally uses Unix domain sockets where possible. This reduces the need for port assignments and prevents external applications from possibly compromising the daemons. However each Unix socket requires a .sock file to be created. This option indicates where those socket files go.
PATH_LOGS - There are various daemons that are used by ZoneMinder to perform various tasks. Most generate helpful log files and this is where they go. They can be deleted if not required for debugging.
PATH_SWAP - Buffered playback requires temporary swap images to be stored for each instance of the streaming daemons. This option determines where these images will be stored. The images will actually be stored in sub directories beneath this location and will be automatically cleaned up after a period of time.

View File

@ -0,0 +1,20 @@
Options - Phone Bandwidth
-------------------------
.. image:: images/Options_BW_Phone.png
WEB_P_CAN_STREAM - Override the automatic detection of browser streaming capability. If you know that your browser can handle image streams of the type 'multipart/x-mixed-replace' but ZoneMinder does not detect this correctly you can set this option to ensure that the stream is delivered with or without the use of the Cambozola plugin. Selecting 'yes' will tell ZoneMinder that your browser can handle the streams natively, 'no' means that it can't and so the plugin will be used while 'auto' lets ZoneMinder decide.
WEB_P_STREAM_METHOD - ZoneMinder can be configured to use either mpeg encoded video or a series or still jpeg images when sending video streams. This option defines which is used. If you choose mpeg you should ensure that you have the appropriate plugins available on your browser whereas choosing jpeg will work natively on Mozilla and related browsers and with a Java applet on Internet Explorer"
WEB_P_DEFAULT_SCALE - Normally ZoneMinder will display 'live' or 'event' streams in their native size. However if you have monitors with large dimensions or a slow link you may prefer to reduce this size, alternatively for small monitors you can enlarge it. This options lets you specify what the default scaling factor will be. It is expressed as a percentage so 100 is normal size, 200 is double size etc.
WEB_P_DEFAULT_RATE - Normally ZoneMinder will display 'event' streams at their native rate, i.e. as close to real-time as possible. However if you have long events it is often convenient to replay them at a faster rate for review. This option lets you specify what the default replay rate will be. It is expressed as a percentage so 100 is normal rate, 200 is double speed etc.
WEB_P_VIDEO_BITRATE - When encoding real video via the ffmpeg library a bit rate can be specified which roughly corresponds to the available bandwidth used for the stream. This setting effectively corresponds to a 'quality' setting for the video. A low value will result in a blocky image whereas a high value will produce a clearer view. Note that this setting does not control the frame rate of the video however the quality of the video produced is affected both by this setting and the frame rate that the video is produced at. A higher frame rate at a particular bit rate result in individual frames being at a lower quality.
WEB_P_VIDEO_MAXFPS - 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.
WEB_P_SCALE_THUMBS - If unset, this option sends the whole image to the browser which resizes it in the window. If set the image is scaled down on the server before sending a reduced size image to the browser to conserve bandwidth at the cost of cpu on the server. Note that ZM can only perform the resizing if the appropriate PHP graphics functionality is installed. This is usually available in the php-gd package.
WEB_P_AJAX_TIMEOUT - The newer versions of the live feed and event views use Ajax to request information from the server and populate the views dynamically. This option allows you to specify a timeout if required after which requests are abandoned. A timeout may be necessary if requests would overwise hang such as on a slow connection. This would tend to consume a lot of browser memory and make the interface unresponsive. Ordinarily no requests should timeout so this setting should be set to a value greater than the slowest expected response. This value is in milliseconds but if set to zero then no timeout will be used.

View File

@ -0,0 +1,48 @@
Options - System
----------------
.. image:: images/Options_System.png
LANG_DEFAULT - ZoneMinder allows the web interface to use languages other than English if the appropriate language file has been created and is present. This option allows you to change the default language that is used from the shipped language, British English, to another language.
OPT_USE_AUTH - ZoneMinder can run in two modes. The simplest is an entirely unauthenticated mode where anyone can access ZoneMinder and perform all tasks. This is most suitable for installations where the web server access is limited in other ways. The other mode enables user accounts with varying sets of permissions. Users must login or authenticate to access ZoneMinder and are limited by their defined permissions. Authenticated mode alone should not be relied up for securing Internet connected ZoneMinder.
AUTH_TYPE - ZoneMinder can use two methods to authenticate users when running in authenticated mode. The first is a builtin method where ZoneMinder provides facilities for users to log in and maintains track of their identity. The second method allows interworking with other methods such as http basic authentication which passes an independently authentication 'remote' user via http. In this case ZoneMinder would use the supplied user without additional authentication provided such a user is configured ion ZoneMinder.
AUTH_RELAY - When ZoneMinder is running in authenticated mode it can pass user details between the web pages and the back end processes. There are two methods for doing this. This first is to use a time limited hashed string which contains no direct username or password details, the second method is to pass the username and passwords around in plaintext. This method is not recommend except where you do not have the md5 libraries available on your system or you have a completely isolated system with no external access. You can also switch off authentication relaying if your system is isolated in other ways.
AUTH_HASH_SECRET - When ZoneMinder is running in hashed authenticated mode it is necessary to generate hashed strings containing encrypted sensitive information such as usernames and password. Although these string are reasonably secure the addition of a random secret increases security substantially.
AUTH_HASH_IPS - When ZoneMinder is running in hashed authenticated mode it can optionally include the requesting IP address in the resultant hash. This adds an extra level of security as only requests from that address may use that authentication key. However in some circumstances, such as access over mobile networks, the requesting address can change for each request which will cause most requests to fail. This option allows you to control whether IP addresses are included in the authentication hash on your system. If you experience intermitent problems with authentication, switching this option off may help.
AUTH_HASH_LOGINS - The normal process for logging into ZoneMinder is via the login screen with username and password. In some circumstances it may be desirable to allow access directly to one or more pages, for instance from a third party application. If this option is enabled then adding an 'auth' parameter to any request will include a shortcut login bypassing the login screen, if not already logged in. As authentication hashes are time and, optionally, IP limited this can allow short-term access to ZoneMinder screens from other web pages etc. In order to use this the calling application will hae to generate the authentication hash itself and ensure it is valid. If you use this option you should ensure that you have modified the ZM_AUTH_HASH_SECRET to somethign unique to your system.
OPT_FAST_DELETE - Normally an event created as the result of an alarm consists of entries in one or more database tables plus the various files associated with it. When deleting events in the browser it can take a long time to remove all of this if your are trying to do a lot of events at once. It is recommended that you set this option which means that the browser client only deletes the key entries in the events table, which means the events will no longer appear in the listing, and leaves the zmaudit daemon to clear up the rest later.
FILTER_RELOAD_DELAY - ZoneMinder allows you to save filters to the database which allow events that match certain criteria to be emailed, deleted or uploaded to a remote machine etc. The zmfilter daemon loads these and does the actual operation. This option determines how often in seconds the filters are reloaded from the database to get the latest versions or new filters. If you don't change filters very often this value can be set to a large value.
FILTER_EXECUTE_INTERVAL - ZoneMinder allows you to save filters to the database which allow events that match certain criteria to be emailed, deleted or uploaded to a remote machine etc. The zmfilter daemon loads these and does the actual operation. This option determines how often the filters are executed on the saved event in the database. If you want a rapid response to new events this should be a smaller value, however this may increase the overall load on the system and affect performance of other elements.
MAX_RESTART_DELAY - The zmdc (zm daemon control) process controls when processeses are started or stopped and will attempt to restart any that fail. If a daemon fails frequently then a delay is introduced between each restart attempt. If the daemon stills fails then this delay is increased to prevent extra load being placed on the system by continual restarts. This option controls what this maximum delay is.
WATCH_CHECK_INTERVAL - The zmwatch daemon checks the image capture performance of the capture daemons to ensure that they have not locked up (rarely a sync error may occur which blocks indefinately). This option determines how often the daemons are checked.
WATCH_MAX_DELAY - The zmwatch daemon checks the image capture performance of the capture daemons to ensure that they have not locked up (rarely a sync error may occur which blocks indefinately). This option determines the maximum delay to allow since the last captured frame. The daemon will be restarted if it has not captured any images after this period though the actual restart may take slightly longer in conjunction with the check interval value above.
RUN_AUDIT - The zmaudit daemon exists to check that the saved information in the database and on the filesystem match and are consistent with each other. If an error occurs or if you are using 'fast deletes' it may be that database records are deleted but files remain. In this case, and similar, zmaudit will remove redundant information to synchronise the two data stores. This option controls whether zmaudit is run in the background and performs these checks and fixes continuously. This is recommended for most systems however if you have a very large number of events the process of scanning the database and filesystem may take a long time and impact performance. In this case you may prefer to not have zmaudit running unconditionally and schedule occasional checks at other, more convenient, times.
AUDIT_CHECK_INTERVAL - The zmaudit daemon exists to check that the saved information in the database and on the filesystem match and are consistent with each other. If an error occurs or if you are using 'fast deletes' it may be that database records are deleted but files remain. In this case, and similar, zmaudit will remove redundant information to synchronise the two data stores. The default check interval of 900 seconds (15 minutes) is fine for most systems however if you have a very large number of events the process of scanning the database and filesystem may take a long time and impact performance. In this case you may prefer to make this interval much larger to reduce the impact on your system. This option determines how often these checks are performed.
OPT_FRAME_SERVER - In some circumstances it is possible for a slow disk to take so long writing images to disk that it causes the analysis daemon to fall behind especially during high frame rate events. Setting this option to yes enables a frame server daemon (zmf) which will be sent the images from the analysis daemon and will do the actual writing of images itself freeing up the analysis daemon to get on with other things. Should this transmission fail or other permanent or transient error occur, this function will fall back to the analysis daemon.
FRAME_SOCKET_SIZE - For large captured images it is possible for the writes from the analysis daemon to the frame server to fail as the amount to be written exceeds the default buffer size. While the images are then written by the analysis daemon so no data is lost, it defeats the object of the frame server daemon in the first place. You can use this option to indicate that a larger buffer size should be used. Note that you may have to change the existing maximum socket buffer size on your system via sysctl (or in /proc/sys/net/core/wmem_max) to allow this new size to be set. Alternatively you can change the default buffer size on your system in the same way in which case that will be used with no change necessary in this option
OPT_CONTROL - ZoneMinder includes limited support for controllable cameras. A number of sample protocols are included and others can easily be added. If you wish to control your cameras via ZoneMinder then select this option otherwise if you only have static cameras or use other control methods then leave this option off.
OPT_TRIGGERS - ZoneMinder can interact with external systems which prompt or cancel alarms. This is done via the zmtrigger.pl script. This option indicates whether you want to use these external triggers. Most people will say no here.
CHECK_FOR_UPDATES - From ZoneMinder version 1.17.0 onwards new versions are expected to be more frequent. To save checking manually for each new version ZoneMinder can check with the zoneminder.com website to determine the most recent release. These checks are infrequent, about once per week, and no personal or system information is transmitted other than your current version number. If you do not wish these checks to take place or your ZoneMinder system has no internet access you can switch these check off with this configuration variable
UPDATE_CHECK_PROXY - If you use a proxy to access the internet then ZoneMinder needs to know so it can access zoneminder.com to check for updates. If you do use a proxy enter the full proxy url here in the form of http://<proxy host>:<proxy port>/
SHM_KEY - ZoneMinder uses shared memory to speed up communication between modules. To identify the right area to use shared memory keys are used. This option controls what the base key is, each monitor will have it's Id or'ed with this to get the actual key used. You will not normally need to change this value unless it clashes with another instance of ZoneMinder on the same machine. Only the first four hex digits are used, the lower four will be masked out and ignored.

View File

@ -0,0 +1,32 @@
Options - Upload
----------------
.. image:: images/Options_upload.png
OPT_UPLOAD - In ZoneMinder you can create event filters that specify whether events that match certain criteria should be uploaded to a remote server for archiving. This option specifies whether this functionality should be available
UPLOAD_ARCH_FORMAT - Uploaded events may be stored in either .tar or .zip format, this option specifies which. Note that to use this you will need to have the Archive::Tar and/or Archive::Zip perl modules installed.
UPLOAD_ARCH_COMPRESS - When the archive files are created they can be compressed. However in general since the images are compressed already this saves only a minimal amount of space versus utilising more CPU in their creation. Only enable if you have CPU to waste and are limited in disk space on your remote server or bandwidth.
UPLOAD_ARCH_ANALYSE - When the archive files are created they can contain either just the captured frames or both the captured frames and, for frames that caused an alarm, the analysed image with the changed area highlighted. This option controls files are included. Only include analysed frames if you have a high bandwidth connection to the remote server or if you need help in figuring out what caused an alarm in the first place as archives with these files in can be considerably larger.
UPLOAD_PROTOCOL - ZoneMinder can upload events to a remote server using either FTP or SFTP. Regular FTP is widely supported but not necessarily very secure whereas SFTP (Secure FTP) runs over an ssh connection and so is encrypted and uses regular ssh ports. Note that to use this you will need to have the appropriate perl module, either Net::FTP or Net::SFTP installed depending on your choice.
UPLOAD_HOST - You can use filters to instruct ZoneMinder to upload events to a remote server. This option indicates the name, or ip address, of the server to use.
UPLOAD_PORT - You can use filters to instruct ZoneMinder to upload events to a remote server. If you are using the SFTP protocol then this option allows you to specify a particular port to use for connection. If this option is left blank then the default, port 22, is used. This option is ignored for FTP uploads.
UPLOAD_USER - You can use filters to instruct ZoneMinder to upload events to a remote server. This option indicates the username that ZoneMinder should use to log in for transfer.
UPLOAD_PASS - You can use filters to instruct ZoneMinder to upload events to a remote server. This option indicates the password that ZoneMinder should use to log in for transfer. If you are using certicate based logins for SFTP servers you can leave this option blank.
UPLOAD_LOC_DIR - You can use filters to instruct ZoneMinder to upload events to a remote server. This option indicates the local directory that ZoneMinder should use for temporary upload files. These are files that are created from events, uploaded and then deleted.
UPLOAD_REM_DIR - You can use filters to instruct ZoneMinder to upload events to a remote server. This option indicates the remote directory that ZoneMinder should use to upload event files to.
UPLOAD_TIMEOUT - You can use filters to instruct ZoneMinder to upload events to a remote server. This option indicates the maximum inactivity timeout (in seconds) that should be tolerated before ZoneMinder determines that the transfer has failed and closes down the connection.
UPLOAD_FTP_PASSIVE - You can use filters to instruct ZoneMinder to upload events to a remote ftp server. This option indicates that ftp transfers should be done in passive mode. This uses a single connection for all ftp activity and, whilst slower than active transfers, is more robust and likely to work from behind filewalls. This option is ignored for SFTP transfers.
UPLOAD_DEBUG - You can use filters to instruct ZoneMinder to upload events to a remote server. If you are having (or expecting) troubles with uploading events then setting this to 'yes' permits additional information to be generated by the underlying transfer modules and included in the logs.

View File

@ -0,0 +1,10 @@
Options - Users
---------------
.. image:: images/Options_Users.png
In this section you will see a list of the current users defined on the system. You can also add or delete users from here. It is recommended you do not delete the admin user unless you have created another fully privileged user to take over the same role. Each user is defined with a name and password (which is hidden) as well as an enabled setting which you can use to temporarily enable or disable users, for example a guest user for limited time access. As well as that there is a language setting that allows you to define user specific languages. Setting a language here that is different than the system language will mean that when that user logs in they will have the web interface presented in their own language rather than the system default, if it is available.
There are also five values that define the user permissions, these are Stream, Events, Control, Monitors and System Each can have values of None, View or Edit apart from Stream which has no Edit setting. These values cover access to the following areas; Stream defines whether a user is allowed to view the live video feeds coming from the cameras. You may wish to allow a user to view historical events only in which case this setting should be none. The Events setting determines whether a user can view and modify or delete any retained historical events. The Control setting allows you to indicate whether the user is able to control any Pan/Tilt/Zoom type cameras you may have on your system. The Monitors setting specifies whether a user can see the current monitor settings and change them. Finally the System setting determines whether a user can view or modify the system settings as a whole, such as options and users or controlling the running of the system as a whole.
As well as these settings there is also a Bandwidth setting which can be used to limit the maximum bandwidth that a user can view at and a Monitor Ids setting that can be used for non-System users to restrict them to only being able to access streams, events or monitors for the given monitors ids as a comma separated list with no spaces. If a user with Monitors edit privileges is limited to specific monitors here they will not be able to add or delete monitors but only change the details of those they have access to. If a user has System privileges then the Monitors Ids setting is ignored and has no effect.

View File

@ -0,0 +1,30 @@
Options - Web
-------------
.. image:: images/Options_web.png
WEB_TITLE_PREFIX - If you have more than one installation of ZoneMinder it can be helpful to display different titles for each one. Changing this option allows you to customise the window titles to include further information to aid identification.
WEB_RESIZE_CONSOLE - Traditionally the main ZoneMinder web console window has resized itself to shrink to a size small enough to list only the monitors that are actually present. This is intended to make the window more unobtrusize but may not be to everyones tastes, especially if opened in a tab in browsers which support this kind if layout. Switch this option off to have the console window size left to the users preference
WEB_POPUP_ON_ALARM - When viewing a live monitor stream you can specify whether you want the window to pop to the front if an alarm occurs when the window is minimised or behind another window. This is most useful if your monitors are over doors for example when they can pop up if someone comes to the doorway.
WEB_SOUND_ON_ALARM - When viewing a live monitor stream you can specify whether you want the window to play a sound to alert you if an alarm occurs.
WEB_ALARM_SOUND - You can specify a sound file to play if an alarm occurs whilst you are watching a live monitor stream. So long as your browser understands the format it does not need to be any particular type. This file should be placed in the sounds directory defined earlier.
WEB_COMPACT_MONTAGE - The montage view shows the output of all of your active monitors in one window. This include a small menu and status information for each one. This can increase the web traffic and make the window larger than may be desired. Setting this option on removes all this extraneous information and just displays the images.
WEB_EVENT_SORT_FIELD - Events in lists can be initially ordered in any way you want. This option controls what field is used to sort them. You can modify this ordering from filters or by clicking on headings in the lists themselves. Bear in mind however that the 'Prev' and 'Next' links, when scrolling through events, relate to the ordering in the lists and so not always to time based ordering.
WEB_EVENT_SORT_ORDER - Events in lists can be initially ordered in any way you want. This option controls what order (ascending or descending) is used to sort them. You can modify this ordering from filters or by clicking on headings in the lists themselves. Bear in mind however that the 'Prev' and 'Next' links, when scrolling through events, relate to the ordering in the lists and so not always to time based ordering.
WEB_EVENTS_PER_PAGE - In the event list view you can either list all events or just a page at a time. This option controls how many events are listed per page in paged mode and how often to repeat the column headers in non-paged mode.
WEB_LIST_THUMBS - Ordinarily the event lists just display text details of the events to save space and time. By switching this option on you can also display small thumbnails to help you identify events of interest. The size of these thumbnails is controlled by the following two options.
WEB_LIST_THUMB_WIDTH - This options controls the width of the thumbnail images that appear in the event lists. It should be fairly small to fit in with the rest of the table. If you prefer you can specify a height instead in the next option but you should only use one of the width or height and the other option should be set to zero. If both width and height are specified then width will be used and height ignored.
WEB_LIST_THUMB_HEIGHT - This options controls the height of the thumbnail images that appear in the event lists. It should be fairly small to fit in with the rest of the table. If you prefer you can specify a width instead in the previous option but you should only use one of the width or height and the other option should be set to zero. If both width and height are specified then width will be used and height ignored.
WEB_USE_OBJECT_TAGS - There are two methods of including media content in web pages. The most common way is use the EMBED tag which is able to give some indication of the type of content. However this is not a standard part of HTML. The official method is to use OBJECT tags which are able to give more information allowing the correct media viewers etc to be loaded. However these are less widely supported and content may be specifically tailored to a particular platform or player. This option controls whether media content is enclosed in EMBED tags only or whether, where appropriate, it is additionally wrapped in OBJECT tags. Currently OBJECT tags are only used in a limited number of circumstances but they may become more widespread in the future. It is suggested that you leave this option on unless you encounter problems playing some content.

View File

@ -0,0 +1,12 @@
Options - X10
-------------
.. image:: images/Options_X10.png
OPT_X10 - If you have an X10 Home Automation setup in your home you can use ZoneMinder to initiate or react to X10 signals if your computer has the appropriate interface controller. This option indicates whether X10 options will be available in the browser client.
X10_DEVICE - If you have an X10 controller device (e.g. XM10U) connected to your computer this option details which port it is conected on, the default of /dev/ttyS0 maps to serial or com port 1.
X10_HOUSE_CODE - X10 devices are grouped together by identifying them as all belonging to one House Code. This option details what that is. It should be a single letter between A and P.
X10_DB_RELOAD_INTERVAL - The zmx10 daemon periodically checks the database to find out what X10 events trigger, or result from, alarms. This option determines how frequently this check occurs, unless you change this area frequently this can be a fairly large value.

View File

@ -442,6 +442,15 @@ our @options =
type => $types{string},
category => "images",
},
{
name => "ZM_FFMPEG_OPEN_TIMEOUT",
default => "10",
description => "Timeout in seconds when opening a stream.",
help => "When Ffmpeg is opening a stream, it can take a long time before failing; certain circumstances even seem to be able to lock indefinitely. This option allows you to set a maximum time in seconds to pass before closing the stream and trying to reopen it again.",
requires => [ { name=>"ZM_OPT_FFMPEG", value=>"yes" } ],
type => $types{integer},
category => "images",
},
{
name => "ZM_LOG_LEVEL_SYSLOG",
default => "0",

View File

@ -33,8 +33,6 @@ require ZoneMinder::Control;
our @ISA = qw(ZoneMinder::Control);
our $VERSION = $ZoneMinder::Base::VERSION;
# ==========================================================================
#
# Axis V2 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';
}

View File

@ -20,8 +20,6 @@
# This module contains the implementation of the Trendnet TV-IP672PI IP camera control
# protocol. Also works or TV-IP862IC
#
#
#
# For Zoneminder 1.26+
#
# Under control capability:
@ -69,9 +67,10 @@ our @ISA = qw(ZoneMinder::Control);
#
# Finally, the username is the username you'd like to authenticate as.
#
our $REALM = "TV-IP862IC";
our $USERNAME = "admin";
our $REALM = 'TV-IP862IC';
our $USERNAME = 'admin';
our $PASSWORD = '';
our $ADDRESS = '';
# ==========================================================================
#
@ -82,8 +81,6 @@ our $USERNAME = "admin";
use ZoneMinder::Logger qw(:all);
use ZoneMinder::Config qw(:all);
use Time::HiRes qw( usleep );
sub new
{
my $class = shift;
@ -112,13 +109,29 @@ sub AUTOLOAD
sub open
{
my $self = shift;
$self->loadMonitor();
my ( $protocol, $username, $password, $address ) = $self->{Monitor}->{ControlAddress} =~ /^(https?:\/\/)?([^:]+):([^\/@]+)@(.*)$/;
if ( $username ) {
$USERNAME = $username;
$PASSWORD = $password;
$ADDRESS = $address;
} else {
Error( "Failed to parse auth from address");
$ADDRESS = $self->{Monitor}->{ControlAddress};
}
if ( ! $ADDRESS =~ /:/ ) {
Error( "You generally need to also specify the port. I will append :80" );
$ADDRESS .= ':80';
}
use LWP::UserAgent;
$self->{ua} = LWP::UserAgent->new;
$self->{ua}->agent( "ZoneMinder Control Agent/".$ZoneMinder::Base::ZM_VERSION );
$self->{state} = 'open';
# credentials: ("ip:port" (no prefix!), realm (string), username (string), password (string)
Debug ( "sendCmd credentials control address:'".$ADDRESS."' realm:'" . $REALM . "' username:'" . $USERNAME . "' password:'".$PASSWORD."'");
$self->{ua}->credentials($ADDRESS,$REALM,$USERNAME,$PASSWORD);
}
sub close
@ -146,18 +159,10 @@ sub sendCmd
my $result = undef;
Debug ( $cmd, "Tx" );
my $url = "http://".$ADDRESS."/cgi/ptdc.cgi?command=".$cmd;
my $req = HTTP::Request->new( GET=>$url );
my $ua = LWP::UserAgent->new();
my $req = HTTP::Request->new( GET=>"http://".$self->{Monitor}->{ControlAddress}."/cgi/ptdc.cgi?command=".$cmd );
# credentials: ("ip:port" (no prefix!), realm (string), username (string), password (string)
$self->{ua}->credentials($self->{Monitor}->{ControlAddress},$REALM,$USERNAME,$self->{Monitor}->{ControlDevice});
Debug ( "sendCmd credentials control address:'".$self->{Monitor}->{ControlAddress}."' realm:'" . $REALM . "' username:'" . $USERNAME . "' password:'".$self->{Monitor}->{ControlDevice}."'");
Debug ("sendCmd command: " . $cmd);
Debug ("sendCmd command: " . $url );
my $res = $self->{ua}->request($req);
@ -165,10 +170,13 @@ sub sendCmd
$result = !undef;
} else {
if ( $res->status_line() eq '401 Unauthorized' ) {
Error( "Error check failed, trying again: USERNAME: $USERNAME realm: $REALM password: " . $self->{Monitor}->{ControlDevice} );
Error( "Error check failed, trying again: USERNAME: $USERNAME realm: $REALM password: " . $PASSWORD );
Error("Content was " . $res->content() );
my $res = $self->{ua}->request($req);
if ( $res->is_success ) {
$result = !undef;
} else {
Error("Content was " . $res->content() );
}
}
if ( ! $result ) {
@ -194,7 +202,6 @@ sub sendCmdPost
my $result = undef;
if ($url eq undef)
{
Error ("url passed to sendCmdPost is undefined.");
@ -203,16 +210,11 @@ sub sendCmdPost
Debug ("sendCmdPost url: " . $url . " cmd: " . $cmd);
my $ua = LWP::UserAgent->new();
my $req = HTTP::Request->new(POST => "http://".$self->{Monitor}->{ControlAddress}.$url);
my $req = HTTP::Request->new(POST => "http://".$ADDRESS.$url);
$req->content_type('application/x-www-form-urlencoded');
$req->content($cmd);
$self->{ua}->credentials($self->{Monitor}->{ControlAddress},$REALM,$USERNAME,$self->{Monitor}->{ControlDevice});
Debug ( "sendCmdPost credentials control address:'".$self->{Monitor}->{ControlAddress}."' realm:'" . $REALM . "' username:'" . $USERNAME . "'
password:'".$self->{Monitor}->{ControlDevice}."'");
Debug ( "sendCmdPost credentials control address:'".$ADDRESS."' realm:'" . $REALM . "' username:'" . $USERNAME . "' password:'".$PASSWORD."'");
my $res = $self->{ua}->request($req);
@ -222,12 +224,11 @@ password:'".$self->{Monitor}->{ControlDevice}."'");
}
else
{
Error( "Error check failed: USERNAME: $USERNAME realm: $REALM password: " . $self->{Monitor}->{ControlDevice} );
Error( "Error check failed: '".$res->status_line()."' cmd:'".$cmd."'" );
Error( "sendCmdPost Error check failed: '".$res->status_line()."' cmd:'".$cmd."'" );
if ( $res->status_line() eq '401 Unauthorized' ) {
Error( "Error check failed: USERNAME: $USERNAME realm: $REALM password: " . $self->{Monitor}->{ControlDevice} );
Error( "sendCmdPost Error check failed: USERNAME: $USERNAME realm: $REALM password: " . $PASSWORD );
} else {
Error( "Error check failed: USERNAME: $USERNAME realm: $REALM password: " . $self->{Monitor}->{ControlDevice} );
Error( "sendCmdPost Error check failed: USERNAME: $USERNAME realm: $REALM password: " . $PASSWORD );
} # endif
}

View File

@ -3,6 +3,9 @@
# chkconfig: 2345 99 00
# processname: zmpkg.pl
# This script is intended for use with legacy SysV init environments ONLY
# For systemd environments, use the ZoneMinder systemd unit file instead
# Source function library.
. /etc/rc.d/init.d/functions

View File

@ -49,7 +49,7 @@ use ZoneMinder;
use POSIX;
use Socket;
use IO::Handle;
use Data::Dumper;
#use Data::Dumper;
use constant SOCK_FILE => $Config{ZM_PATH_SOCKS}.'/zmdc.sock';
@ -214,7 +214,7 @@ use ZoneMinder;
use POSIX;
use Socket;
use IO::Handle;
use Data::Dumper;
#use Data::Dumper;
our %cmd_hash;
our %pid_hash;

View File

@ -89,6 +89,8 @@ Parameters are :-
-u<dbuser>, --user=<dbuser> - Alternate DB user with privileges to alter DB
-p<dbpass>, --pass=<dbpass> - Password of alternate DB user with privileges to alter DB
-d<dir>,--dir=<dir> - Directory containing update files if not in default build location
-interactive - interact with the user
-nointeractive - do not interact with the user
");
exit( -1 );
}
@ -319,34 +321,37 @@ if ( $freshen )
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() );
# Don't do innoDB upgrade if not interactive
if ( $interactive ) {
# 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();
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) {
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]$/ ) {
$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();
print "\nConverting MyISAM tables to InnoDB. Please wait.\n";
foreach (@MyISAM_Tables) {
my $sql = "ALTER TABLE $_ ENGINE = InnoDB";
my $sth = $dbh->prepare_cached( $sql ) or die( "Can't prepare '$sql': ".$dbh->errstr() );
my $res = $sth->execute() or die( "Can't execute: ".$sth->errstr() );
$sth->finish();
}
$dbh->do(q|SET sql_mode=''|); # Set mode back to default
}
}
}
} # end if interactive
if ( $version )
{

View File

@ -151,7 +151,7 @@ public:
{
if ( mSize == 0 )
mHead = mTail = mStorage;
else if ( level >= 1 )
else if ( level )
{
if ( (mHead-mStorage) > mSize )
{
@ -159,12 +159,6 @@ public:
mHead = mStorage;
mTail = mHead + mSize;
}
else if ( level >= 2 )
{
memmove( mStorage, mHead, mSize );
mHead = mStorage;
mTail = mHead + mSize;
}
}
}
}

View File

@ -29,7 +29,6 @@ void zmLoadConfig()
{
FILE *cfg;
char line[512];
char *val;
if ( (cfg = fopen( ZM_CONFIG, "r")) == NULL )
{
Fatal( "Can't open %s: %s", ZM_CONFIG, strerror(errno) );
@ -82,19 +81,16 @@ void zmLoadConfig()
white_len = strspn( val_ptr, " \t" );
val_ptr += white_len;
val = (char *)malloc( strlen(val_ptr)+1 );
strncpy( val, val_ptr, strlen(val_ptr)+1 );
if ( strcasecmp( name_ptr, "ZM_DB_HOST" ) == 0 )
staticConfig.DB_HOST = val;
staticConfig.DB_HOST = std::string(val_ptr);
else if ( strcasecmp( name_ptr, "ZM_DB_NAME" ) == 0 )
staticConfig.DB_NAME = val;
staticConfig.DB_NAME = std::string(val_ptr);
else if ( strcasecmp( name_ptr, "ZM_DB_USER" ) == 0 )
staticConfig.DB_USER = val;
staticConfig.DB_USER = std::string(val_ptr);
else if ( strcasecmp( name_ptr, "ZM_DB_PASS" ) == 0 )
staticConfig.DB_PASS = val;
staticConfig.DB_PASS = std::string(val_ptr);
else if ( strcasecmp( name_ptr, "ZM_PATH_WEB" ) == 0 )
staticConfig.PATH_WEB = val;
staticConfig.PATH_WEB = std::string(val_ptr);
else
{
// We ignore this now as there may be more parameters than the

View File

@ -64,3 +64,14 @@ void zmDbConnect()
zmDbConnected = true;
}
void zmDbClose()
{
if ( zmDbConnected )
{
mysql_close( &dbconn );
// mysql_init() call implicitly mysql_library_init() but
// mysql_close() does not call mysql_library_end()
mysql_library_end();
zmDbConnected = false;
}
}

View File

@ -30,6 +30,8 @@ extern MYSQL dbconn;
extern int zmDbConnected;
void zmDbConnect();
void zmDbClose();
#ifdef __cplusplus
} /* extern "C" */
#endif

View File

@ -23,6 +23,10 @@
#include "zm_ffmpeg_camera.h"
#ifndef AV_ERROR_MAX_STRING_SIZE
#define AV_ERROR_MAX_STRING_SIZE 64
#endif
FfmpegCamera::FfmpegCamera( int p_id, const std::string &p_path, const std::string &p_method, const std::string &p_options, int p_width, int p_height, int p_colours, int p_brightness, int p_contrast, int p_hue, int p_colour, bool p_capture ) :
Camera( p_id, FFMPEG_SRC, p_width, p_height, p_colours, ZM_SUBPIX_ORDER_DEFAULT_FOR_COLOUR(p_colours), p_brightness, p_contrast, p_hue, p_colour, p_capture ),
mPath( p_path ),
@ -41,6 +45,10 @@ FfmpegCamera::FfmpegCamera( int p_id, const std::string &p_path, const std::stri
mRawFrame = NULL;
mFrame = NULL;
frameCount = 0;
mIsOpening = false;
mCanCapture = false;
mOpenStart = 0;
mReopenThread = 0;
#if HAVE_LIBSWSCALE
mConvertContext = NULL;
@ -63,31 +71,7 @@ FfmpegCamera::FfmpegCamera( int p_id, const std::string &p_path, const std::stri
FfmpegCamera::~FfmpegCamera()
{
av_freep( &mFrame );
av_freep( &mRawFrame );
#if HAVE_LIBSWSCALE
if ( mConvertContext )
{
sws_freeContext( mConvertContext );
mConvertContext = NULL;
}
#endif
if ( mCodecContext )
{
avcodec_close( mCodecContext );
mCodecContext = NULL; // Freed by av_close_input_file
}
if ( mFormatContext )
{
#if LIBAVFORMAT_VERSION_INT >= AV_VERSION_INT(53, 17, 0)
avformat_close_input( &mFormatContext );
#else
av_close_input_file( mFormatContext );
#endif
mFormatContext = NULL;
}
CloseFfmpeg();
if ( capture )
{
@ -112,116 +96,11 @@ void FfmpegCamera::Terminate()
int FfmpegCamera::PrimeCapture()
{
Info( "Priming capture from %s", mPath.c_str() );
// Open the input, not necessarily a file
#if LIBAVFORMAT_VERSION_INT < AV_VERSION_INT(53, 4, 0)
if ( av_open_input_file( &mFormatContext, mPath.c_str(), NULL, 0, NULL ) !=0 )
#else
// Handle options
AVDictionary *opts = 0;
StringVector opVect = split(Options(), ",");
// Set transport method as specified by method field, rtpUni is default
if ( Method() == "rtpMulti" )
opVect.push_back("rtsp_transport=udp_multicast");
else if ( Method() == "rtpRtsp" )
opVect.push_back("rtsp_transport=tcp");
else if ( Method() == "rtpRtspHttp" )
opVect.push_back("rtsp_transport=http");
Debug(2, "Number of Options: %d",opVect.size());
for (size_t i=0; i<opVect.size(); i++)
{
StringVector parts = split(opVect[i],"=");
if (parts.size() > 1) {
parts[0] = trimSpaces(parts[0]);
parts[1] = trimSpaces(parts[1]);
if ( av_dict_set(&opts, parts[0].c_str(), parts[1].c_str(), 0) == 0 ) {
Debug(2, "set option %d '%s' to '%s'", i, parts[0].c_str(), parts[1].c_str());
}
else
{
Warning( "Error trying to set option %d '%s' to '%s'", i, parts[0].c_str(), parts[1].c_str() );
}
}
if (OpenFfmpeg() != 0){
ReopenFfmpeg();
}
if ( avformat_open_input( &mFormatContext, mPath.c_str(), NULL, &opts ) !=0 )
#endif
Fatal( "Unable to open input %s due to: %s", mPath.c_str(), strerror(errno) );
// Locate stream info from input
#if LIBAVFORMAT_VERSION_INT < AV_VERSION_INT(53, 4, 0)
if ( av_find_stream_info( mFormatContext ) < 0 )
#else
if ( avformat_find_stream_info( mFormatContext, 0 ) < 0 )
#endif
Fatal( "Unable to find stream info from %s due to: %s", mPath.c_str(), strerror(errno) );
// Find first video stream present
mVideoStreamId = -1;
for (unsigned int i=0; i < mFormatContext->nb_streams; i++ )
{
#if LIBAVUTIL_VERSION_INT >= AV_VERSION_INT(51,2,1)
if ( mFormatContext->streams[i]->codec->codec_type == AVMEDIA_TYPE_VIDEO )
#else
if ( mFormatContext->streams[i]->codec->codec_type == CODEC_TYPE_VIDEO )
#endif
{
mVideoStreamId = i;
break;
}
}
if ( mVideoStreamId == -1 )
Fatal( "Unable to locate video stream in %s", mPath.c_str() );
mCodecContext = mFormatContext->streams[mVideoStreamId]->codec;
// Try and get the codec from the codec context
if ( (mCodec = avcodec_find_decoder( mCodecContext->codec_id )) == NULL )
Fatal( "Can't find codec for video stream from %s", mPath.c_str() );
// Open the codec
#if LIBAVFORMAT_VERSION_INT < AV_VERSION_INT(53, 7, 0)
if ( avcodec_open( mCodecContext, mCodec ) < 0 )
#else
if ( avcodec_open2( mCodecContext, mCodec, 0 ) < 0 )
#endif
Fatal( "Unable to open codec for video stream from %s", mPath.c_str() );
// Allocate space for the native video frame
mRawFrame = avcodec_alloc_frame();
// Allocate space for the converted video frame
mFrame = avcodec_alloc_frame();
if(mRawFrame == NULL || mFrame == NULL)
Fatal( "Unable to allocate frame for %s", mPath.c_str() );
int pSize = avpicture_get_size( imagePixFormat, width, height );
if( (unsigned int)pSize != imagesize) {
Fatal("Image size mismatch. Required: %d Available: %d",pSize,imagesize);
}
#if HAVE_LIBSWSCALE
#if LIBSWSCALE_VERSION_INT >= AV_VERSION_INT(0, 8, 0)
if(!sws_isSupportedInput(mCodecContext->pix_fmt)) {
Fatal("swscale does not support the codec format: %c%c%c%c",(mCodecContext->pix_fmt)&0xff,((mCodecContext->pix_fmt>>8)&0xff),((mCodecContext->pix_fmt>>16)&0xff),((mCodecContext->pix_fmt>>24)&0xff));
}
if(!sws_isSupportedOutput(imagePixFormat)) {
Fatal("swscale does not support the target format: %c%c%c%c",(imagePixFormat)&0xff,((imagePixFormat>>8)&0xff),((imagePixFormat>>16)&0xff),((imagePixFormat>>24)&0xff));
}
#endif
#else // HAVE_LIBSWSCALE
Fatal( "You must compile ffmpeg with the --enable-swscale option to use ffmpeg cameras" );
#endif // HAVE_LIBSWSCALE
return( 0 );
return 0;
}
int FfmpegCamera::PreCapture()
@ -232,6 +111,24 @@ int FfmpegCamera::PreCapture()
int FfmpegCamera::Capture( Image &image )
{
if (!mCanCapture){
return -1;
}
// If the reopen thread has a value, but mCanCapture != 0, then we have just reopened the connection to the ffmpeg device, and we can clean up the thread.
if (mReopenThread != 0) {
void *retval = 0;
int ret;
ret = pthread_tryjoin_np(mReopenThread, &retval);
if (ret != 0){
Error("Could not join reopen thread.");
}
Info( "Successfully reopened stream." );
mReopenThread = 0;
}
AVPacket packet;
uint8_t* directbuffer;
@ -248,7 +145,20 @@ int FfmpegCamera::Capture( Image &image )
int avResult = av_read_frame( mFormatContext, &packet );
if ( avResult < 0 )
{
Error( "Unable to read packet from stream %d: error %d", packet.stream_index, avResult );
char errbuf[AV_ERROR_MAX_STRING_SIZE];
av_strerror(avResult, errbuf, AV_ERROR_MAX_STRING_SIZE);
if (
// Check if EOF.
(avResult == AVERROR_EOF || (mFormatContext->pb && mFormatContext->pb->eof_reached)) ||
// Check for Connection failure.
(avResult == -110)
)
{
Info( "av_read_frame returned \"%s\". Reopening stream.", errbuf);
ReopenFfmpeg();
}
Error( "Unable to read packet from stream %d: error %d \"%s\".", packet.stream_index, avResult, errbuf );
return( -1 );
}
Debug( 5, "Got packet from stream %d", packet.stream_index );
@ -300,4 +210,235 @@ int FfmpegCamera::PostCapture()
return( 0 );
}
int FfmpegCamera::OpenFfmpeg() {
Debug ( 2, "OpenFfmpeg called." );
mOpenStart = time(NULL);
mIsOpening = true;
// Open the input, not necessarily a file
#if LIBAVFORMAT_VERSION_INT < AV_VERSION_INT(53, 4, 0)
Debug ( 1, "Calling av_open_input_file" );
if ( av_open_input_file( &mFormatContext, mPath.c_str(), NULL, 0, NULL ) !=0 )
#else
// Handle options
AVDictionary *opts = 0;
StringVector opVect = split(Options(), ",");
// Set transport method as specified by method field, rtpUni is default
if ( Method() == "rtpMulti" )
opVect.push_back("rtsp_transport=udp_multicast");
else if ( Method() == "rtpRtsp" )
opVect.push_back("rtsp_transport=tcp");
else if ( Method() == "rtpRtspHttp" )
opVect.push_back("rtsp_transport=http");
Debug(2, "Number of Options: %d",opVect.size());
for (size_t i=0; i<opVect.size(); i++)
{
StringVector parts = split(opVect[i],"=");
if (parts.size() > 1) {
parts[0] = trimSpaces(parts[0]);
parts[1] = trimSpaces(parts[1]);
if ( av_dict_set(&opts, parts[0].c_str(), parts[1].c_str(), 0) == 0 ) {
Debug(2, "set option %d '%s' to '%s'", i, parts[0].c_str(), parts[1].c_str());
}
else
{
Warning( "Error trying to set option %d '%s' to '%s'", i, parts[0].c_str(), parts[1].c_str() );
}
}
}
Debug ( 1, "Calling avformat_open_input" );
mFormatContext = avformat_alloc_context( );
mFormatContext->interrupt_callback.callback = FfmpegInterruptCallback;
mFormatContext->interrupt_callback.opaque = this;
if ( avformat_open_input( &mFormatContext, mPath.c_str(), NULL, &opts ) !=0 )
#endif
{
mIsOpening = false;
Error( "Unable to open input %s due to: %s", mPath.c_str(), strerror(errno) );
return -1;
}
mIsOpening = false;
Debug ( 1, "Opened input" );
// Locate stream info from avformat_open_input
#if LIBAVFORMAT_VERSION_INT < AV_VERSION_INT(53, 4, 0)
Debug ( 1, "Calling av_find_stream_info" );
if ( av_find_stream_info( mFormatContext ) < 0 )
#else
Debug ( 1, "Calling avformat_find_stream_info" );
if ( avformat_find_stream_info( mFormatContext, 0 ) < 0 )
#endif
Fatal( "Unable to find stream info from %s due to: %s", mPath.c_str(), strerror(errno) );
Debug ( 1, "Got stream info" );
// Find first video stream present
mVideoStreamId = -1;
for (unsigned int i=0; i < mFormatContext->nb_streams; i++ )
{
#if LIBAVUTIL_VERSION_INT >= AV_VERSION_INT(51,2,1)
if ( mFormatContext->streams[i]->codec->codec_type == AVMEDIA_TYPE_VIDEO )
#else
if ( mFormatContext->streams[i]->codec->codec_type == CODEC_TYPE_VIDEO )
#endif
{
mVideoStreamId = i;
break;
}
}
if ( mVideoStreamId == -1 )
Fatal( "Unable to locate video stream in %s", mPath.c_str() );
Debug ( 1, "Found video stream" );
mCodecContext = mFormatContext->streams[mVideoStreamId]->codec;
// Try and get the codec from the codec context
if ( (mCodec = avcodec_find_decoder( mCodecContext->codec_id )) == NULL )
Fatal( "Can't find codec for video stream from %s", mPath.c_str() );
Debug ( 1, "Found decoder" );
// Open the codec
#if LIBAVFORMAT_VERSION_INT < AV_VERSION_INT(53, 7, 0)
Debug ( 1, "Calling avcodec_open" );
if ( avcodec_open( mCodecContext, mCodec ) < 0 )
#else
Debug ( 1, "Calling avcodec_open2" );
if ( avcodec_open2( mCodecContext, mCodec, 0 ) < 0 )
#endif
Fatal( "Unable to open codec for video stream from %s", mPath.c_str() );
Debug ( 1, "Opened codec" );
// Allocate space for the native video frame
mRawFrame = avcodec_alloc_frame();
// Allocate space for the converted video frame
mFrame = avcodec_alloc_frame();
if(mRawFrame == NULL || mFrame == NULL)
Fatal( "Unable to allocate frame for %s", mPath.c_str() );
Debug ( 1, "Allocated frames" );
int pSize = avpicture_get_size( imagePixFormat, width, height );
if( (unsigned int)pSize != imagesize) {
Fatal("Image size mismatch. Required: %d Available: %d",pSize,imagesize);
}
Debug ( 1, "Validated imagesize" );
#if HAVE_LIBSWSCALE
Debug ( 1, "Calling sws_isSupportedInput" );
if(!sws_isSupportedInput(mCodecContext->pix_fmt)) {
Fatal("swscale does not support the codec format: %c%c%c%c",(mCodecContext->pix_fmt)&0xff,((mCodecContext->pix_fmt>>8)&0xff),((mCodecContext->pix_fmt>>16)&0xff),((mCodecContext->pix_fmt>>24)&0xff));
}
if(!sws_isSupportedOutput(imagePixFormat)) {
Fatal("swscale does not support the target format: %c%c%c%c",(imagePixFormat)&0xff,((imagePixFormat>>8)&0xff),((imagePixFormat>>16)&0xff),((imagePixFormat>>24)&0xff));
}
#else // HAVE_LIBSWSCALE
Fatal( "You must compile ffmpeg with the --enable-swscale option to use ffmpeg cameras" );
#endif // HAVE_LIBSWSCALE
mCanCapture = true;
return 0;
}
int FfmpegCamera::ReopenFfmpeg() {
Debug(2, "ReopenFfmpeg called.");
mCanCapture = false;
if (pthread_create( &mReopenThread, NULL, ReopenFfmpegThreadCallback, (void*) this) != 0){
// Log a fatal error and exit the process.
Fatal( "ReopenFfmpeg failed to create worker thread." );
}
return 0;
}
int FfmpegCamera::CloseFfmpeg(){
Debug(2, "CloseFfmpeg called.");
mCanCapture = false;
av_freep( &mFrame );
av_freep( &mRawFrame );
#if HAVE_LIBSWSCALE
if ( mConvertContext )
{
sws_freeContext( mConvertContext );
mConvertContext = NULL;
}
#endif
if ( mCodecContext )
{
avcodec_close( mCodecContext );
mCodecContext = NULL; // Freed by av_close_input_file
}
if ( mFormatContext )
{
#if LIBAVFORMAT_VERSION_INT < AV_VERSION_INT(53, 4, 0)
av_close_input_file( mFormatContext );
#else
avformat_close_input( &mFormatContext );
#endif
mFormatContext = NULL;
}
return 0;
}
int FfmpegCamera::FfmpegInterruptCallback(void *ctx)
{
FfmpegCamera* camera = reinterpret_cast<FfmpegCamera*>(ctx);
if (camera->mIsOpening){
int now = time(NULL);
if ((now - camera->mOpenStart) > config.ffmpeg_open_timeout) {
Error ( "Open video took more than %d seconds.", config.ffmpeg_open_timeout );
return 1;
}
}
return 0;
}
void *FfmpegCamera::ReopenFfmpegThreadCallback(void *ctx){
if (ctx == NULL) return NULL;
FfmpegCamera* camera = reinterpret_cast<FfmpegCamera*>(ctx);
while (1){
// Close current stream.
camera->CloseFfmpeg();
// Sleep if neccessary to not reconnect too fast.
int wait = config.ffmpeg_open_timeout - (time(NULL) - camera->mOpenStart);
wait = wait < 0 ? 0 : wait;
if (wait > 0){
Debug( 1, "Sleeping %d seconds before reopening stream.", wait );
sleep(wait);
}
if (camera->OpenFfmpeg() == 0){
return NULL;
}
}
}
#endif // HAVE_LIBAVFORMAT

View File

@ -47,6 +47,16 @@ protected:
AVFrame *mRawFrame;
AVFrame *mFrame;
PixelFormat imagePixFormat;
int OpenFfmpeg();
int ReopenFfmpeg();
int CloseFfmpeg();
static int FfmpegInterruptCallback(void *ctx);
static void* ReopenFfmpegThreadCallback(void *ctx);
bool mIsOpening;
bool mCanCapture;
int mOpenStart;
pthread_t mReopenThread;
#endif // HAVE_LIBAVFORMAT
#if HAVE_LIBSWSCALE

View File

@ -140,6 +140,22 @@ Image::Image( const Image &p_image )
Image::~Image()
{
DumpImgBuffer();
if ( initialised )
{
delete[] y_table;
delete[] uv_table;
delete[] r_v_table;
delete[] g_v_table;
delete[] g_u_table;
delete[] b_u_table;
initialised = false;
}
if ( jpg_dcinfo )
{
jpeg_destroy_decompress( jpg_dcinfo );
delete jpg_dcinfo;
jpg_dcinfo = 0;
}
}
void Image::Initialise()
@ -339,21 +355,23 @@ void Image::AssignDirect( const unsigned int p_width, const unsigned int p_heigh
Error("Attempt to directly assign buffer from a NULL pointer");
return;
}
if(buffer_size < (unsigned int)((p_width*p_height)*p_colours)) {
Error("Attempt to directly assign buffer from an undersized buffer of size: %zu",buffer_size);
return;
}
if(!p_height || !p_width) {
Error("Attempt to directly assign buffer with invalid width or height: %d %d",p_width,p_height);
return;
}
if(p_colours != ZM_COLOUR_GRAY8 && p_colours != ZM_COLOUR_RGB24 && p_colours != ZM_COLOUR_RGB32) {
Error("Attempt to directly assign buffer with unexpected colours per pixel: %d",p_colours);
return;
}
unsigned int new_buffer_size = ((p_width*p_height)*p_colours);
if(buffer_size < new_buffer_size) {
Error("Attempt to directly assign buffer from an undersized buffer of size: %zu, needed %dx%d*%d colours = %zu",buffer_size, p_width, p_height, p_colours );
return;
}
if(holdbuffer && buffer) {
if((unsigned int)((p_height*p_width)*p_colours) > allocation) {
@ -365,7 +383,7 @@ void Image::AssignDirect( const unsigned int p_width, const unsigned int p_heigh
colours = p_colours;
subpixelorder = p_subpixelorder;
pixels = height*width;
size = pixels*colours;
size = new_buffer_size; // was pixels*colours, but we already calculated it above as new_buffer_size
/* Copy into the held buffer */
if(new_buffer != buffer)
@ -383,7 +401,7 @@ void Image::AssignDirect( const unsigned int p_width, const unsigned int p_heigh
colours = p_colours;
subpixelorder = p_subpixelorder;
pixels = height*width;
size = pixels*colours;
size = new_buffer_size; // was pixels*colours, but we already calculated it above as new_buffer_size
allocation = buffer_size;
buffertype = p_buffertype;

View File

@ -239,6 +239,9 @@ void Logger::terminate()
if ( mSyslogLevel > NOLOG )
closeSyslog();
if ( mDatabaseLevel > NOLOG )
closeDatabase();
}
bool Logger::boolEnv( const std::string &name, bool defaultValue )
@ -468,6 +471,15 @@ void Logger::closeFile()
}
}
void Logger::closeDatabase()
{
if ( mDbConnected )
{
mysql_close( &mDbConnection );
mDbConnected = false;
}
}
void Logger::openSyslog()
{
(void) openlog( mId.c_str(), LOG_PID|LOG_NDELAY, LOG_LOCAL1 );
@ -604,5 +616,6 @@ void logInit( const char *name, const Logger::Options &options )
void logTerm()
{
Logger::fetch()->terminate();
if ( Logger::smInstance )
delete Logger::smInstance;
}

View File

@ -115,6 +115,7 @@ private:
public:
friend void logInit( const char *name, const Options &options );
friend void logTerm();
static Logger *fetch()
{
@ -182,6 +183,7 @@ private:
void closeFile();
void openSyslog();
void closeSyslog();
void closeDatabase();
public:
void logPrint( bool hex, const char * const file, const int line, const int level, const char *fstring, ... );

View File

@ -317,7 +317,9 @@ Monitor::Monitor(
last_motion_score(0),
camera( p_camera ),
n_zones( p_n_zones ),
zones( p_zones )
zones( p_zones ),
timestamps( 0 ),
images( 0 )
{
strncpy( name, p_name, sizeof(name) );
@ -416,12 +418,12 @@ Monitor::Monitor(
{
if ( purpose != QUERY )
{
Error( "Shared data not initialised by capture daemon" );
Error( "Shared data not initialised by capture daemon for monitor %s", name );
exit( -1 );
}
else
{
Warning( "Shared data not initialised by capture daemon, some query functions may not be available or produce invalid results" );
Warning( "Shared data not initialised by capture daemon, some query functions may not be available or produce invalid results for monitor %s", name );
}
}
@ -567,6 +569,14 @@ bool Monitor::connect() {
Monitor::~Monitor()
{
if ( timestamps ) {
delete[] timestamps;
timestamps = 0;
}
if ( images ) {
delete[] images;
images = 0;
}
if ( mem_ptr ) {
if ( event )
Info( "%s: %03d - Closing event %d, shutting down", name, image_count, event->Id() );
@ -1234,8 +1244,6 @@ bool Monitor::Analyse()
}
static bool static_undef = true;
static struct timeval **timestamps;
static Image **images;
static int last_section_mod = 0;
static bool last_signal;

View File

@ -282,12 +282,15 @@ protected:
Event *event;
int n_zones;
int n_zones;
Zone **zones;
int iDoNativeMotDet;
struct timeval **timestamps;
Image **images;
int n_linked_monitors;
int iDoNativeMotDet;
int n_linked_monitors;
MonitorLink **linked_monitors;
public:

View File

@ -63,8 +63,16 @@ void RemoteCamera::Initialise()
auth = host.substr( 0, authIndex );
host.erase( 0, authIndex+1 );
auth64 = base64Encode( auth );
authIndex = auth.rfind( ':' );
username = auth.substr(0,authIndex);
password = auth.substr( authIndex+1, auth.length() );
}
mNeedAuth = false;
mAuthenticator = new Authenticator(username,password);
struct addrinfo hints;
memset(&hints, 0, sizeof(hints));
hints.ai_family = AF_UNSPEC;

View File

@ -21,6 +21,7 @@
#define ZM_REMOTE_CAMERA_H
#include "zm_camera.h"
#include "zm_rtsp_auth.h"
#include <string>
#include <sys/types.h>
@ -39,8 +40,17 @@ protected:
std::string port;
std::string path;
std::string auth;
std::string username;
std::string password;
std::string auth64;
// Reworked authentication system
// First try without authentication, even if we have a username and password
// on receiving a 401 response, select authentication method (basic or digest)
// fill required fields and set needAuth
// subsequent requests can set the required authentication header.
bool mNeedAuth;
Authenticator* mAuthenticator;
protected:
struct addrinfo *hp;
@ -53,6 +63,8 @@ public:
const std::string &Port() const { return( port ); }
const std::string &Path() const { return( path ); }
const std::string &Auth() const { return( auth ); }
const std::string &Username() const { return( username ); }
const std::string &Password() const { return( password ); }
virtual void Initialise();
virtual void Terminate() = 0;

View File

@ -62,7 +62,7 @@ void RemoteCameraHttp::Initialise()
{
request = stringtf( "GET %s HTTP/%s\r\n", path.c_str(), config.http_version );
request += stringtf( "User-Agent: %s/%s\r\n", config.http_ua, ZM_VERSION );
request += stringtf( "Host: %s\r\n", host .c_str());
request += stringtf( "Host: %s\r\n", host.c_str());
if ( strcmp( config.http_version, "1.0" ) == 0 )
request += stringtf( "Connection: Keep-Alive\r\n" );
if ( !auth.empty() )
@ -130,6 +130,7 @@ int RemoteCameraHttp::Disconnect()
int RemoteCameraHttp::SendRequest()
{
Debug( 2, "Sending request: %s", request.c_str() );
if ( write( sd, request.data(), request.length() ) < 0 )
{
Error( "Can't write: %s", strerror(errno) );
@ -216,6 +217,8 @@ int RemoteCameraHttp::ReadData( Buffer &buffer, int bytes_expected )
}
while ( total_bytes_to_read );
Debug( 3, buffer );
return( total_bytes_read );
}
@ -280,9 +283,31 @@ int RemoteCameraHttp::GetResponse()
status_code = atoi( status_expr->MatchString( 2 ) );
status_mesg = status_expr->MatchString( 3 );
if ( status_code < 200 || status_code > 299 )
{
Error( "Invalid response status %d: %s", status_code, status_mesg );
if ( status_code == 401 ) {
if ( mNeedAuth ) {
Error( "Failed authentication: " );
return( -1 );
}
mNeedAuth = true;
std::string Header = header;
mAuthenticator->checkAuthResponse(Header);
if ( mAuthenticator->auth_method() == AUTH_DIGEST ) {
Debug( 2, "Need Digest Authentication" );
request = stringtf( "GET %s HTTP/%s\r\n", path.c_str(), config.http_version );
request += stringtf( "User-Agent: %s/%s\r\n", config.http_ua, ZM_VERSION );
request += stringtf( "Host: %s\r\n", host.c_str());
if ( strcmp( config.http_version, "1.0" ) == 0 )
request += stringtf( "Connection: Keep-Alive\r\n" );
request += mAuthenticator->getAuthHeader( "GET", path.c_str() );
request += "\r\n";
Debug( 2, "New request header: %s", request.c_str() );
return( 0 );
}
} else if ( status_code < 200 || status_code > 299 ) {
Error( "Invalid response status %d: %s\n%s", status_code, status_mesg, (char *)buffer );
return( -1 );
}
Debug( 3, "Got status '%d' (%s), http version %s", status_code, status_mesg, http_version );
@ -545,11 +570,13 @@ int RemoteCameraHttp::GetResponse()
static const char *content_length_match = "Content-length:";
static const char *content_type_match = "Content-type:";
static const char *boundary_match = "boundary=";
static const char *authenticate_match = "WWW-Authenticate:";
static int http_match_len = 0;
static int connection_match_len = 0;
static int content_length_match_len = 0;
static int content_type_match_len = 0;
static int boundary_match_len = 0;
static int authenticate_match_len = 0;
if ( !http_match_len )
http_match_len = strlen( http_match );
@ -561,6 +588,8 @@ int RemoteCameraHttp::GetResponse()
content_type_match_len = strlen( content_type_match );
if ( !boundary_match_len )
boundary_match_len = strlen( boundary_match );
if ( !authenticate_match_len )
authenticate_match_len = strlen( authenticate_match );
static int n_headers;
//static char *headers[32];
@ -573,6 +602,7 @@ int RemoteCameraHttp::GetResponse()
static char *content_length_header;
static char *content_type_header;
static char *boundary_header;
static char *authenticate_header;
static char subcontent_length_header[32];
static char subcontent_type_header[64];
@ -596,6 +626,7 @@ int RemoteCameraHttp::GetResponse()
connection_header = 0;
content_length_header = 0;
content_type_header = 0;
authenticate_header = 0;
http_version[0] = '\0';
status_code [0]= '\0';
@ -674,6 +705,12 @@ int RemoteCameraHttp::GetResponse()
content_length_header = header_ptr+content_length_match_len;
Debug( 6, "Got content length header '%s'", header_ptr );
}
else if ( !authenticate_header && (strncasecmp( header_ptr, authenticate_match, authenticate_match_len) == 0) )
{
authenticate_header = header_ptr;
Debug( 6, "Got authenticate header '%s'", header_ptr );
}
else if ( !content_type_header && (strncasecmp( header_ptr, content_type_match, content_type_match_len) == 0) )
{
content_type_header = header_ptr+content_type_match_len;
@ -721,7 +758,36 @@ int RemoteCameraHttp::GetResponse()
start_ptr += strspn( start_ptr, " " );
strcpy( status_mesg, start_ptr );
if ( status < 200 || status > 299 )
if ( status == 401 ) {
if ( mNeedAuth ) {
Error( "Failed authentication: " );
return( -1 );
}
if ( ! authenticate_header ) {
Error( "Failed authentication, but don't have an authentication header: " );
return( -1 );
}
mNeedAuth = true;
std::string Header = authenticate_header;
Debug(2, "Checking for digest auth in %s", authenticate_header );
mAuthenticator->checkAuthResponse(Header);
if ( mAuthenticator->auth_method() == AUTH_DIGEST ) {
Debug( 2, "Need Digest Authentication" );
request = stringtf( "GET %s HTTP/%s\r\n", path.c_str(), config.http_version );
request += stringtf( "User-Agent: %s/%s\r\n", config.http_ua, ZM_VERSION );
request += stringtf( "Host: %s\r\n", host.c_str());
if ( strcmp( config.http_version, "1.0" ) == 0 )
request += stringtf( "Connection: Keep-Alive\r\n" );
request += mAuthenticator->getAuthHeader( "GET", path.c_str() );
request += "\r\n";
Debug( 2, "New request header: %s", request.c_str() );
return( 0 );
} else {
Debug( 2, "Need some other kind of Authentication" );
}
} else if ( status < 200 || status > 299 )
{
Error( "Invalid response status %s: %s", status_code, status_mesg );
return( -1 );

View File

@ -91,7 +91,7 @@ RemoteCameraRtsp::~RemoteCameraRtsp()
if ( mCodecContext )
{
avcodec_close( mCodecContext );
mCodecContext = NULL; // Freed by av_close_input_file
mCodecContext = NULL; // Freed by avformat_free_context in the destructor of RtspThread class
}
if ( capture )

View File

@ -26,7 +26,6 @@
#include "zm_rtp_data.h"
#include "zm_rtp_ctrl.h"
#include "zm_db.h"
#include "zm_sdp.h"
#include <sys/time.h>
#include <signal.h>
@ -68,34 +67,6 @@ bool RtspThread::sendCommand( std::string message )
return( true );
}
// find WWW-Authenticate header, send to Authenticator to extract required subfields
void RtspThread::checkAuthResponse(std::string &response)
{
std::string authLine;
StringVector lines = split( response, "\r\n" );
const char* authenticate_match = "WWW-Authenticate:";
size_t authenticate_match_len = strlen(authenticate_match);
for ( size_t i = 0; i < lines.size(); i++ )
{
// stop at end of headers
if (lines[i].length()==0)
break;
if (strncasecmp(lines[i].c_str(),authenticate_match,authenticate_match_len) == 0)
{
authLine = lines[i];
Debug( 2, "Found auth line at %d", i);
break;
}
}
if (!authLine.empty())
{
Debug( 2, "Analyze auth line %s", authLine.c_str());
mAuthenticator->authHandleHeader( trimSpaces(authLine.substr(authenticate_match_len,authLine.length()-authenticate_match_len)) );
}
}
bool RtspThread::recvResponse( std::string &response )
{
if ( mRtspSocket.recv( response ) < 0 )
@ -121,7 +92,7 @@ bool RtspThread::recvResponse( std::string &response )
if ( respCode == 401)
{
Debug( 2, "Got 401 access denied response code, check WWW-Authenticate header and retry");
checkAuthResponse(response);
mAuthenticator->checkAuthResponse(response);
mNeedAuth = true;
return( false );
}
@ -171,6 +142,7 @@ int RtspThread::requestPorts()
nMonitors = 1;
position = 0;
}
mysql_free_result(result);
int portRange = int(((config.max_rtp_port-config.min_rtp_port)+1)/nMonitors);
smMinDataPort = config.min_rtp_port + (position * portRange);
smMaxDataPort = smMinDataPort + portRange - 1;
@ -202,6 +174,7 @@ RtspThread::RtspThread( int id, RtspMethod method, const std::string &protocol,
mHost( host ),
mPort( port ),
mPath( path ),
mSessDesc( 0 ),
mFormatContext( 0 ),
mSeq( 0 ),
mSession( 0 ),
@ -236,6 +209,17 @@ RtspThread::RtspThread( int id, RtspMethod method, const std::string &protocol,
RtspThread::~RtspThread()
{
if ( mFormatContext )
{
avformat_free_context( mFormatContext );
mFormatContext = NULL;
}
if ( mSessDesc )
{
delete mSessDesc;
mSessDesc = NULL;
}
delete mAuthenticator;
}
int RtspThread::run()
@ -314,7 +298,7 @@ int RtspThread::run()
// for requested authentication method
if (respCode == 401 && !authTried) {
mNeedAuth = true;
checkAuthResponse(response);
mAuthenticator->checkAuthResponse(response);
Debug(2, "Processed 401 response");
mRtspSocket.close();
if ( !mRtspSocket.connect( mHost.c_str(), strtol( mPort.c_str(), NULL, 10 ) ) )
@ -349,7 +333,7 @@ int RtspThread::run()
int localPorts[2] = { 0, 0 };
// Request supported RTSP commands by the server
message = "OPTIONS * RTSP/1.0\r\n";
message = "OPTIONS "+mUrl+" RTSP/1.0\r\n";
if ( !sendCommand( message ) )
return( -1 );
if ( !recvResponse( response ) )
@ -387,11 +371,10 @@ int RtspThread::run()
std::string sdp = response.substr( sdpStart );
Debug( 1, "Processing SDP '%s'", sdp.c_str() );
SessionDescriptor *sessDesc = 0;
try
{
sessDesc = new SessionDescriptor( mUrl, sdp );
mFormatContext = sessDesc->generateFormatContext();
mSessDesc = new SessionDescriptor( mUrl, sdp );
mFormatContext = mSessDesc->generateFormatContext();
}
catch( const Exception &e )
{
@ -414,6 +397,7 @@ int RtspThread::run()
uint32_t rtpClock = 0;
std::string trackUrl = mUrl;
std::string controlUrl;
_AVCODECID codecId;
@ -421,7 +405,7 @@ int RtspThread::run()
{
for ( unsigned int i = 0; i < mFormatContext->nb_streams; i++ )
{
SessionDescriptor::MediaDescriptor *mediaDesc = sessDesc->getStream( i );
SessionDescriptor::MediaDescriptor *mediaDesc = mSessDesc->getStream( i );
#if LIBAVUTIL_VERSION_INT >= AV_VERSION_INT(51,2,1)
if ( mFormatContext->streams[i]->codec->codec_type == AVMEDIA_TYPE_VIDEO )
#else
@ -429,7 +413,7 @@ int RtspThread::run()
#endif
{
// Check if control Url is absolute or relative
std::string controlUrl = mediaDesc->getControlUrl();
controlUrl = mediaDesc->getControlUrl();
if (std::equal(trackUrl.begin(), trackUrl.end(), controlUrl.begin()))
{
trackUrl = controlUrl;
@ -481,20 +465,26 @@ int RtspThread::run()
return( -1 );
lines = split( response, "\r\n" );
char *session = 0;
std::string session;
int timeout = 0;
char transport[256] = "";
for ( size_t i = 0; i < lines.size(); i++ )
{
sscanf( lines[i].c_str(), "Session: %a[0-9a-fA-F]; timeout=%d", &session, &timeout );
if ( ( lines[i].size() > 8 ) && ( lines[i].substr( 0, 8 ) == "Session:" ) )
{
StringVector sessionLine = split( lines[i].substr(9), ";" );
session = trimSpaces( sessionLine[0] );
if ( sessionLine.size() == 2 )
sscanf( trimSpaces( sessionLine[1] ).c_str(), "timeout=%d", &timeout );
}
sscanf( lines[i].c_str(), "Transport: %s", transport );
}
if ( !session )
if ( session.empty() )
Fatal( "Unable to get session identifier from response '%s'", response.c_str() );
Debug( 2, "Got RTSP session %s, timeout %d secs", session, timeout );
Debug( 2, "Got RTSP session %s, timeout %d secs", session.c_str(), timeout );
if ( !transport[0] )
Fatal( "Unable to get transport details from response '%s'", response.c_str() );
@ -562,31 +552,56 @@ int RtspThread::run()
return( -1 );
lines = split( response, "\r\n" );
char *rtpInfo = 0;
std::string rtpInfo;
for ( size_t i = 0; i < lines.size(); i++ )
{
sscanf( lines[i].c_str(), "RTP-Info: %as", &rtpInfo );
if ( ( lines[i].size() > 9 ) && ( lines[i].substr( 0, 9 ) == "RTP-Info:" ) )
rtpInfo = trimSpaces( lines[i].substr( 9 ) );
// Check for a timeout again. Some rtsp devices don't send a timeout until after the PLAY command is sent
if ( ( lines[i].size() > 8 ) && ( lines[i].substr( 0, 8 ) == "Session:" ) && ( timeout == 0 ) )
{
StringVector sessionLine = split( lines[i].substr(9), ";" );
if ( sessionLine.size() == 2 )
sscanf( trimSpaces( sessionLine[1] ).c_str(), "timeout=%d", &timeout );
if ( timeout > 0 )
Debug( 2, "Got timeout %d secs from PLAY command response", timeout );
}
}
if ( !rtpInfo )
Fatal( "Unable to get RTP Info identifier from response '%s'", response.c_str() );
Debug( 2, "Got RTP Info %s", rtpInfo );
int seq = 0;
unsigned long rtpTime = 0;
parts = split( rtpInfo, ";" );
for ( size_t i = 0; i < parts.size(); i++ )
StringVector streams;
if ( rtpInfo.empty() )
{
if ( startsWith( parts[i], "seq=" ) )
Debug( 1, "RTP Info Empty. Starting values for Sequence and Rtptime shall be zero.");
}
else
{
Debug( 2, "Got RTP Info %s", rtpInfo.c_str() );
// More than one stream can be included in the RTP Info
streams = split( rtpInfo.c_str(), "," );
for ( size_t i = 0; i < streams.size(); i++ )
{
StringVector subparts = split( parts[i], "=" );
seq = strtol( subparts[1].c_str(), NULL, 10 );
}
else if ( startsWith( parts[i], "rtptime=" ) )
{
StringVector subparts = split( parts[i], "=" );
rtpTime = strtol( subparts[1].c_str(), NULL, 10 );
// We want the stream that matches the trackUrl we are using
if ( streams[i].find(controlUrl.c_str()) != std::string::npos )
{
// Parse the sequence and rtptime values
parts = split( streams[i].c_str(), ";" );
for ( size_t j = 0; j < parts.size(); j++ )
{
if ( startsWith( parts[j], "seq=" ) )
{
StringVector subparts = split( parts[j], "=" );
seq = strtol( subparts[1].c_str(), NULL, 10 );
}
else if ( startsWith( parts[j], "rtptime=" ) )
{
StringVector subparts = split( parts[j], "=" );
rtpTime = strtol( subparts[1].c_str(), NULL, 10 );
}
}
break;
}
}
}
@ -662,7 +677,7 @@ int RtspThread::run()
select.addReader( &mRtspSocket );
Buffer buffer( ZM_NETWORK_BUFSIZ );
std::string keepaliveMessage = "OPTIONS * RTSP/1.0\r\n";
std::string keepaliveMessage = "OPTIONS "+mUrl+" RTSP/1.0\r\n";
std::string keepaliveResponse = "RTSP/1.0 200 OK\r\n";
while ( !mStop && select.wait() >= 0 )
{
@ -768,11 +783,10 @@ int RtspThread::run()
if ( !recvResponse( response ) )
return( -1 );
#endif
// Send a teardown message but don't expect a response as this may not be implemented on the server when using TCP
message = "TEARDOWN "+mUrl+" RTSP/1.0\r\nSession: "+session+"\r\n";
if ( !sendCommand( message ) )
return( -1 );
if ( !recvResponse( response ) )
return( -1 );
delete mSources[ssrc];
mSources.clear();

Some files were not shown because too many files have changed in this diff Show More