diff --git a/.travis.yml b/.travis.yml index 5071b7cc9..b9a528876 100644 --- a/.travis.yml +++ b/.travis.yml @@ -33,16 +33,16 @@ before_script: - if [ "$ZM_BUILDMETHOD" = "autotools" ]; then autoheader; fi - if [ "$ZM_BUILDMETHOD" = "autotools" ]; then automake --force-missing --add-missing; fi - if [ "$ZM_BUILDMETHOD" = "autotools" ]; then autoconf; fi + - mysql -uroot -e "CREATE DATABASE IF NOT EXISTS zm" + - mysql -uroot -e "GRANT ALL ON zm.* TO 'zmuser'@'localhost' IDENTIFIED BY 'zmpass'"; + - mysql -uroot -e "FLUSH PRIVILEGES" script: - if [ "$ZM_BUILDMETHOD" = "autotools" ]; then ./configure --prefix=/usr --with-libarch=lib/$DEB_HOST_GNU_TYPE --host=$DEB_HOST_GNU_TYPE --build=$DEB_BUILD_GNU_TYPE --with-mysql=/usr --with-ffmpeg=/usr --with-webdir=/usr/share/zoneminder/www --with-cgidir=/usr/libexec/zoneminder/cgi-bin --with-webuser=www-data --with-webgroup=www-data --enable-crashtrace=yes --disable-debug --enable-mmap=yes ZM_SSL_LIB=openssl; fi - if [ "$ZM_BUILDMETHOD" = "cmake" ]; then cmake -DCMAKE_INSTALL_PREFIX="/usr"; fi - make - sudo make install -after_success: - if [ "$ZM_BUILDMETHOD" = "cmake" ]; then sudo ./zmlinkcontent.sh; fi - - mysql -uroot -e "CREATE DATABASE IF NOT EXISTS zm" - - mysql -uroot -e "GRANT ALL ON zm.* TO 'zmuser'@'localhost' IDENTIFIED BY 'zmpass'"; - - mysql -uroot -e "FLUSH PRIVILEGES" - mysql -uzmuser -pzmpass < db/zm_create.sql - mysql -uzmuser -pzmpass zm < db/test.monitor.sql - sudo zmpkg.pl start + - sudo zmfilter.pl -f purgewhenfull diff --git a/db/test.monitor.sql b/db/test.monitor.sql index 084a6ebcb..030577f33 100644 --- a/db/test.monitor.sql +++ b/db/test.monitor.sql @@ -1 +1,2 @@ -INSERT INTO Monitors (Name, Type, Function, Enabled, Format, Protocol, Method, Host, Port, Path, Width, Height, Colours, Palette, Orientation, Deinterlacing, Brightness, Contrast, Hue, Colour, RefBlendPerc) VALUES ('travis_test','Remote','Modect',1,255,'http','simple','50.79.143.149','21146','/mjpg/video.mjpg',1280,800,3,0,'0',0,-1,-1,-1,-1,12); +INSERT INTO Monitors (Name, Type, Function, Enabled, Format, Protocol, Method, Host, Port, Path, Width, Height, Colours, Palette, Orientation, Deinterlacing, Brightness, Contrast, Hue, Colour, RefBlendPerc) VALUES ('travis_test1','Remote','Modect',1,255,'http','simple','50.79.143.149','21146','/mjpg/video.mjpg',1280,800,3,0,'0',0,-1,-1,-1,-1,12); +INSERT INTO Monitors (Name, Type, Function, Enabled, Format, Protocol, Method, Host, Port, Path, Width, Height, Colours, Palette, Orientation, Deinterlacing, Brightness, Contrast, Hue, Colour, RefBlendPerc) VALUES ('travis_test2','Remote','Modect',1,255,'http','simple','50.79.143.149','21146','/mjpg/video.mjpg',1280,800,3,0,'0',0,-1,-1,-1,-1,12); diff --git a/db/zm_create.sql.in b/db/zm_create.sql.in index b6e0b8223..05353cb7f 100644 --- a/db/zm_create.sql.in +++ b/db/zm_create.sql.in @@ -353,7 +353,7 @@ CREATE TABLE `Monitors` ( `AlarmMaxFPS` decimal(5,2) default NULL, `FPSReportInterval` smallint(5) unsigned NOT NULL default '250', `RefBlendPerc` tinyint(3) unsigned NOT NULL default '6', - `AlarmRefBlendPerc` tinyint(3) unsigned NOT NULL default '3', + `AlarmRefBlendPerc` tinyint(3) unsigned NOT NULL default '6', `Controllable` tinyint(3) unsigned NOT NULL default '0', `ControlId` int(10) unsigned NOT NULL default '0', `ControlDevice` varchar(255) default NULL, @@ -542,8 +542,9 @@ insert into Controls values (8,'Pelco-D','Ffmpeg','PelcoD',1,1,0,1,1,0,0,1,NULL, insert into Controls values (9,'Pelco-P','Ffmpeg','PelcoP',1,1,0,1,1,0,0,1,NULL,NULL,NULL,NULL,1,0,3,1,1,0,0,1,NULL,NULL,NULL,NULL,0,NULL,NULL,1,1,0,1,0,NULL,NULL,NULL,NULL,0,NULL,NULL,0,0,0,0,0,NULL,NULL,NULL,NULL,0,NULL,NULL,1,1,0,1,0,NULL,NULL,NULL,NULL,0,NULL,NULL,1,20,1,1,1,1,0,0,0,1,1,NULL,NULL,NULL,NULL,1,0,63,1,254,1,NULL,NULL,NULL,NULL,1,0,63,1,254,0,0); INSERT INTO Controls VALUES (10,'Foscam FI8620','Ffmpeg','FI8620_Y2k',0,0,0,1,0,0,0,1,1,10,1,10,1,1,63,1,1,0,0,1,1,63,1,63,1,1,63,1,1,0,0,1,0,0,0,0,1,0,255,0,0,0,0,0,0,0,0,0,0,0,0,1,1,0,0,1,0,0,0,0,1,0,255,1,8,0,1,1,1,0,0,0,1,1,1,360,1,360,1,1,63,0,0,1,1,90,1,90,1,1,63,0,0,0,0); INSERT INTO Controls VALUES (11,'Foscam FI8608W','Ffmpeg','FI8608W_Y2k',1,0,1,1,0,0,0,1,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,1,1,0,0,1,0,0,0,0,1,0,255,0,0,0,0,0,0,0,0,0,0,0,0,1,1,0,0,1,0,0,0,0,1,0,255,1,8,0,1,1,1,0,0,0,1,1,0,0,0,0,1,1,128,0,0,1,0,0,0,0,1,1,128,0,0,0,0); -INSERT INTO Controls VALUES (12,'Foscam FI9821W','Ffmpeg','FI9821W_Y2k',1,0,1,1,0,0,0,1,0,0,0,0,0,0,0,1,1,0,0,1,0,0,0,0,1,0,100,1,1,0,0,1,0,100,0,100,1,0,100,0,0,0,0,0,0,0,0,0,0,0,0,1,1,0,0,1,0,100,0,100,1,0,100,1,16,0,1,1,1,0,0,0,1,1,0,360,0,360,1,0,4,0,0,1,0,90,0,90,1,0,4,0,0,0,0); -INSERT INTO Controls VALUES (13,'Loftek Sentinel','Remote','LoftekSentinel',0,0,1,1,0,0,0,1,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,1,0,1,0,0,0,255,16,16,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,1,0,1,0,0,0,6,1,1,0,0,0,1,10,0,1,1,1,0,0,0,1,1,0,0,0,0,0,0,0,0,0,1,0,0,0,0,0,0,0,0,0,0,0); +INSERT INTO Controls VALUES (12,'Foscam FI8908W','Remote','FI8908W',0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,1,0,1,0,1,1,0,0,0,1,1,0,0,0,0,0,0,0,0,0,1,0,0,0,0,0,0,0,0,0,0,0); +INSERT INTO Controls VALUES (13,'Foscam FI9821W','Ffmpeg','FI9821W_Y2k',1,0,1,1,0,0,0,1,0,0,0,0,0,0,0,1,1,0,0,1,0,0,0,0,1,0,100,1,1,0,0,1,0,100,0,100,1,0,100,0,0,0,0,0,0,0,0,0,0,0,0,1,1,0,0,1,0,100,0,100,1,0,100,1,16,0,1,1,1,0,0,0,1,1,0,360,0,360,1,0,4,0,0,1,0,90,0,90,1,0,4,0,0,0,0); +INSERT INTO Controls VALUES (14,'Loftek Sentinel','Remote','LoftekSentinel',0,0,1,1,0,0,0,1,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,1,0,1,0,0,0,255,16,16,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,1,0,1,0,0,0,6,1,1,0,0,0,1,10,0,1,1,1,0,0,0,1,1,0,0,0,0,0,0,0,0,0,1,0,0,0,0,0,0,0,0,0,0,0); -- -- Add some monitor preset values diff --git a/db/zm_update-1.26.5.sql b/db/zm_update-1.26.5.sql index 01308aae4..bffa09129 100644 --- a/db/zm_update-1.26.5.sql +++ b/db/zm_update-1.26.5.sql @@ -5,5 +5,21 @@ -- -- Add AlarmRefBlendPerc field for controlling the reference image blend percent during alarm (see pull request #241) -- -ALTER TABLE `Monitors` ADD `AlarmRefBlendPerc` TINYINT(3) UNSIGNED NOT NULL DEFAULT '3' AFTER `RefBlendPerc`; + +SET @s = (SELECT IF( + (SELECT COUNT(*) + FROM INFORMATION_SCHEMA.COLUMNS + WHERE table_name = 'Monitors' + AND table_schema = DATABASE() + AND column_name = 'AlarmRefBlendPerc' + ) > 0, +"SELECT 1", +"ALTER TABLE `Monitors` ADD `AlarmRefBlendPerc` TINYINT(3) UNSIGNED NOT NULL DEFAULT '6' AFTER `RefBlendPerc`" +)); + +PREPARE stmt FROM @s; +EXECUTE stmt; + +UPDATE `Monitors` SET `AlarmRefBlendPerc` = `RefBlendPerc`; + diff --git a/distros/debian/README.Debian b/distros/debian/README.Debian index b8ea413e3..a49b6be72 100644 --- a/distros/debian/README.Debian +++ b/distros/debian/README.Debian @@ -20,18 +20,18 @@ would silently revert the changes and cause event loss - refer bug #608793). If you do want to change the location, here are a couple of suggestions. -(thanks to vagrant@freegeek.org): -These lines in fstab could allow you to bind-mount an alternate location +These lines would mount /dev/sdX1 to /video_storage, and then 'link' /video_storage +to the locations that ZoneMinder expects them to be at. - /dev/sdX1 /otherdrive ext3 defaults 0 2 - /otherdrive/zoneminder/images /var/cache/zoneminder/images bind defaults 0 2 - /otherdrive/zoneminder/events /var/cache/zoneminder/events bind defaults 0 2 + /dev/sdX1 /video_storage ext4 defaults 0 2 + /video_storage/zoneminder/images /var/cache/zoneminder/images none bind 0 2 + /video_storage/zoneminder/events /var/cache/zoneminder/events none bind 0 2 or if you have a separate partition for each: - /dev/sdX1 /var/cache/zoneminder/images ext3 defaults 0 2 - /dev/sdX2 /var/cache/zoneminder/events ext3 defaults 0 2 + /dev/sdX1 /var/cache/zoneminder/images ext4 defaults 0 2 + /dev/sdX2 /var/cache/zoneminder/events ext4 defaults 0 2 diff --git a/distros/debian/postinst b/distros/debian/postinst index 716c475e6..32e8d7a96 100644 --- a/distros/debian/postinst +++ b/distros/debian/postinst @@ -2,7 +2,7 @@ set -e -VERSION=1.26.4 +VERSION=1.26.5 if [ "$1" = "configure" ]; then # diff --git a/distros/debian/rules b/distros/debian/rules index 3dea63174..3a6840e7f 100755 --- a/distros/debian/rules +++ b/distros/debian/rules @@ -43,7 +43,7 @@ override_dh_clean: override_dh_install: # Add here commands to install the package into debian/zm. - $(MAKE) install DESTDIR=$(CURDIR)/debian/zoneminder RUNDIR=$(CURDIR)/debian/zoneminder/var/run ZM_RUNDIR=$(CURDIR)/debian/zoneminder/var/run + $(MAKE) install DESTDIR=$(CURDIR)/debian/zoneminder install -D -m 0644 db/zm_create.sql $(CURDIR)/debian/zoneminder/usr/share/zoneminder/db install -D -m 0644 db/zm_update-*.sql $(CURDIR)/debian/zoneminder/usr/share/zoneminder/db install -D -m 0644 debian/apache.conf $(CURDIR)/debian/zoneminder/etc/zm diff --git a/distros/fedora/zoneminder.cmake.f19.spec b/distros/fedora/zoneminder.cmake.f19.spec index 2b8a6756f..d41d7233c 100644 --- a/distros/fedora/zoneminder.cmake.f19.spec +++ b/distros/fedora/zoneminder.cmake.f19.spec @@ -3,6 +3,10 @@ %define zmuid_final apache %define zmgid_final apache +### Delete the lines below to build with ffmpeg and/or x10 +%define _without_ffmpeg 1 +%define _without_x10 1 + Name: zoneminder Version: 1.26.5 Release: 1%{?dist} @@ -17,8 +21,6 @@ URL: http://www.zoneminder.com/ Source: ZoneMinder-%{version}.tar.gz Patch1: zoneminder-1.26.0-defaults.patch -# Enable this patch to disable ffmpeg support -#Patch2: zoneminder-1.26.3-noffmpeg.patch BuildRequires: cmake gnutls-devel systemd-units bzip2-devel BuildRequires: community-mysql-devel pcre-devel libjpeg-turbo-devel @@ -28,19 +30,18 @@ BuildRequires: perl(ExtUtils::MakeMaker) perl(LWP::UserAgent) BuildRequires: perl(MIME::Entity) perl(MIME::Lite) BuildRequires: perl(PHP::Serialization) perl(Sys::Mmap) BuildRequires: perl(Time::HiRes) perl(Net::SFTP::Foreign) -BuildRequires: perl(Expect) +BuildRequires: perl(Expect) perl(Sys::Syslog) BuildRequires: gcc gcc-c++ -# Comment out for no ffmpeg -BuildRequires: ffmpeg-devel -# Uncomment for X10 support -#BuildRequires: perl(X10::ActiveHome) perl(Astro::SunTime) +%{!?_without_ffmpeg:BuildRequires: ffmpeg-devel} +%{!?_without_x10:BuildRequires: perl(X10::ActiveHome) perl(Astro::SunTime)} Requires: httpd php php-mysql cambozola -Requires: libjpeg-turbo ffmpeg +Requires: libjpeg-turbo Requires: perl(:MODULE_COMPAT_%(eval "`%{__perl} -V:version`"; echo $version)) Requires: perl(DBD::mysql) perl(Archive::Tar) perl(Archive::Zip) Requires: perl(MIME::Entity) perl(MIME::Lite) perl(Net::SMTP) perl(Net::FTP) Requires: perl(LWP::Protocol::https) +%{!?_without_ffmpeg:Requires: ffmpeg} Requires(post): systemd-units systemd-sysv Requires(post): /usr/bin/gpasswd @@ -64,7 +65,12 @@ too much degradation of performance. #%patch2 -p0 -b .noffmpeg %build -%cmake -DZM_TARGET_DISTRO="f19" -DZM_NO_X10=ON -DZM_NO_FFMPEG=ON -DZM_PERL_SUBPREFIX=`x="%{perl_vendorlib}" ; echo ${x#"%{_prefix}"}` . +%cmake \ + -DZM_TARGET_DISTRO="f19" \ + -DZM_PERL_SUBPREFIX=`x="%{perl_vendorlib}" ; echo ${x#"%{_prefix}"}` \ +%{?_without_ffmpeg:-DZM_NO_FFMPEG=ON} \ +%{?_without_x10:-DZM_NO_X10=ON} \ + . make %{?_smp_mflags} @@ -78,8 +84,9 @@ if [ $1 -eq 1 ] ; then /bin/systemctl daemon-reload >/dev/null 2>&1 || : fi -# Allow zoneminder access to local video sources -/usr/bin/gpasswd -a %zmuid_final video +# Allow zoneminder access to local video sources, serial ports, and x10 +/usr/bin/gpasswd -a %{zmuid_final} video +/usr/bin/gpasswd -a %{zmuid_final} dialout # Display the README for post installation instructions /usr/bin/less %{_docdir}/%{name}-%{version}/README.Fedora @@ -126,6 +133,8 @@ fi %{_bindir}/zmdc.pl %{_bindir}/zmf %{_bindir}/zmfilter.pl +# zmfix removed from zoneminder 1.26.6 +#%attr(4755,root,root) %{_bindir}/zmfix %{_bindir}/zmpkg.pl %{_bindir}/zmstreamer %{_bindir}/zmtrack.pl @@ -134,8 +143,7 @@ fi %{_bindir}/zmupdate.pl %{_bindir}/zmvideo.pl %{_bindir}/zmwatch.pl -# Uncomment this for x10 support -#%{_bindir}/zmx10.pl +%{!?_without_x10:%{_bindir}/zmx10.pl} %{perl_vendorlib}/ZoneMinder* %{perl_vendorlib}/%{_arch}-linux-thread-multi/auto/ZoneMinder* diff --git a/distros/fedora/zoneminder.f19.spec b/distros/fedora/zoneminder.f19.spec index 1f0eac54b..b0733eb43 100644 --- a/distros/fedora/zoneminder.f19.spec +++ b/distros/fedora/zoneminder.f19.spec @@ -7,6 +7,10 @@ %define zmuid_final apache %define zmgid_final apache +### Delete the lines below to build with ffmpeg and/or x10 +%define _without_ffmpeg 1 +%define _without_x10 1 + Name: zoneminder Version: 1.26.5 Release: 1%{?dist} @@ -28,11 +32,9 @@ Source2: jscalendar-%{jscrev}.zip # here. #Source3: http://mootools.net/download/get/mootools-core-%{moorev}-full-compat-yc.js -#Patch1: zoneminder-1.26.4-dbinstall.patch -Patch2: zoneminder-1.24.3-runlevel.patch -Patch3: zoneminder-1.26.0-defaults.patch -# Enable this patch to disable ffmpeg support -#Patch4: zoneminder-1.26.3-noffmpeg.patch +Patch1: zoneminder-1.24.3-runlevel.patch +Patch2: zoneminder-1.26.0-defaults.patch +%{?_without_ffmpeg:Patch3: zoneminder-1.26.3-noffmpeg.patch} BuildRequires: automake gnutls-devel systemd-units BuildRequires: libtool bzip2-devel @@ -46,10 +48,8 @@ BuildRequires: perl(Time::HiRes) perl(Net::SFTP::Foreign) BuildRequires: perl(Expect) perl(Sys::Syslog) BuildRequires: gcc gcc-c++ BuildRequires: autoconf autoconf-archive -# Comment out for no ffmpeg -BuildRequires: ffmpeg-devel -# Uncomment for X10 support -#BuildRequires: perl(X10::ActiveHome) perl(Astro::SunTime) +%{!?_without_ffmpeg:BuildRequires: ffmpeg-devel} +%{!?_without_x10:BuildRequires: perl(X10::ActiveHome) perl(Astro::SunTime)} Requires: httpd php php-mysql cambozola Requires: libjpeg-turbo ffmpeg @@ -84,10 +84,9 @@ mv *html *php doc/* README ../jscalendar-doc rmdir doc popd -#%patch1 -p0 -b .dbinstall -%patch2 -p0 -b .runlevel -%patch3 -p0 -b .defaults -#%patch4 -p0 -b .noffmpeg +%patch1 -p0 -b .runlevel +%patch2 -p0 -b .defaults +%{?_without_ffmpeg:%patch3 -p0 -b .noffmpeg} chmod -x src/zm_event.cpp src/zm_user.h @@ -132,8 +131,7 @@ install -d %{buildroot}/%{_localstatedir}/run make install DESTDIR=%{buildroot} \ INSTALLDIRS=vendor rm -rf %{buildroot}/%{perl_vendorarch} %{buildroot}/%{perl_archlib} -# Comment out for x10 support -rm -f %{buildroot}/%{_bindir}/zmx10.pl +%{?_without_x10:%{__rm} -f %{buildroot}/%{_bindir}/zmx10.pl} install -m 755 -d %{buildroot}/var/log/zoneminder for dir in events images temp @@ -159,7 +157,7 @@ cp -rp jscalendar-1.0/* %{buildroot}/%{_datadir}/zoneminder/www/jscalendar # Set up cambozola pushd %{buildroot}/%{_datadir}/zoneminder/www -ln -s ../../java/cambozola.jar +%{__ln_s} ../../java/cambozola.jar popd # Set up mootools @@ -180,8 +178,9 @@ if [ $1 -eq 1 ] ; then /bin/systemctl daemon-reload >/dev/null 2>&1 || : fi -# Allow zoneminder access to local video sources -/usr/bin/gpasswd -a %zmuid_final video +# Allow zoneminder access to local video sources, serial ports, and x10 +/usr/bin/gpasswd -a %{zmuid_final} video +/usr/bin/gpasswd -a %{zmuid_final} dialout # Display the README for post installation instructions /usr/bin/less %{_docdir}/%{name}-%{version}/README.Fedora @@ -228,6 +227,8 @@ fi %{_bindir}/zmdc.pl %{_bindir}/zmf %{_bindir}/zmfilter.pl +# zmfix removed from zoneminder 1.26.6 +#%attr(4755,root,root) %{_bindir}/zmfix %{_bindir}/zmpkg.pl %{_bindir}/zmstreamer %{_bindir}/zmtrack.pl @@ -236,7 +237,7 @@ fi %{_bindir}/zmupdate.pl %{_bindir}/zmvideo.pl %{_bindir}/zmwatch.pl -#%{_bindir}/zmx10.pl +%{!?_without_x10:%{_bindir}/zmx10.pl} %{perl_vendorlib}/ZoneMinder* %{_mandir}/man*/* diff --git a/distros/redhat/zoneminder.cmake.el6.spec b/distros/redhat/zoneminder.cmake.el6.spec index d732c6af5..6c26c6598 100644 --- a/distros/redhat/zoneminder.cmake.el6.spec +++ b/distros/redhat/zoneminder.cmake.el6.spec @@ -78,9 +78,10 @@ make install /sbin/chkconfig --add zoneminder /sbin/chkconfig zoneminder on -# Allow zoneminder access to local video sources +# Allow zoneminder access to local video sources, serial ports, and x10 echo -/usr/bin/gpasswd -a apache video +/usr/bin/gpasswd -a %{zmuid_final} video +/usr/bin/gpasswd -a %{zmuid_final} dialout # Create and load zoneminder selinux policy module echo -e "\nCreating and installing a ZoneMinder SELinux policy module. Please wait.\n" @@ -124,6 +125,8 @@ rm -rf %{_docdir}/%{name}-%{version} %{_bindir}/zmdc.pl %{_bindir}/zmf %{_bindir}/zmfilter.pl +# zmfix removed from zoneminder 1.26.6 +#%attr(4755,root,root) %{_bindir}/zmfix %{_bindir}/zmpkg.pl %{_bindir}/zmstreamer %{_bindir}/zmtrack.pl diff --git a/distros/redhat/zoneminder.el6.spec b/distros/redhat/zoneminder.el6.spec index d47d66f65..63419b4d3 100644 --- a/distros/redhat/zoneminder.el6.spec +++ b/distros/redhat/zoneminder.el6.spec @@ -190,9 +190,10 @@ popd /sbin/chkconfig --add zoneminder /sbin/chkconfig zoneminder on -# Allow zoneminder access to local video sources +# Allow zoneminder access to local video sources, serial ports, and x10 echo -/usr/bin/gpasswd -a apache video +/usr/bin/gpasswd -a %{zmuid_final} video +/usr/bin/gpasswd -a %{zmuid_final} dialout # Create and load zoneminder selinux policy module echo -e "\nCreating and installing a ZoneMinder SELinux policy module. Please wait.\n" @@ -233,6 +234,8 @@ fi %{_bindir}/zmdc.pl %{_bindir}/zmf %{_bindir}/zmfilter.pl +# zmfix removed from zoneminder 1.26.6 +#%attr(4755,root,root) %{_bindir}/zmfix %{_bindir}/zmpkg.pl %{_bindir}/zmstreamer %{_bindir}/zmtrack.pl diff --git a/scripts/Makefile.am b/scripts/Makefile.am index c56dd3de7..613278498 100644 --- a/scripts/Makefile.am +++ b/scripts/Makefile.am @@ -62,6 +62,7 @@ EXTRA_DIST = \ ZoneMinder/lib/ZoneMinder/Control/SkyIPCam7xx.pm \ ZoneMinder/lib/ZoneMinder/Control/FI8608W_Y2k.pm \ ZoneMinder/lib/ZoneMinder/Control/FI8620_Y2k.pm \ + ZoneMinder/lib/ZoneMinder/Control/FI8908W.pm \ ZoneMinder/lib/ZoneMinder/Control/FI9821W_Y2k.pm \ ZoneMinder/lib/ZoneMinder/Control/LoftekSentinel.pm \ ZoneMinder/lib/ZoneMinder/Trigger/Channel.pm \ diff --git a/scripts/ZoneMinder/Makefile.PL b/scripts/ZoneMinder/Makefile.PL index a1bf572e2..ad9d9e12e 100644 --- a/scripts/ZoneMinder/Makefile.PL +++ b/scripts/ZoneMinder/Makefile.PL @@ -28,6 +28,7 @@ WriteMakefile( 'lib/ZoneMinder/Control/SkyIPCam7xx.pm' => '$(INST_LIBDIR)/ZoneMinder/Control/SkyIPCam7xx.pm', 'lib/ZoneMinder/Control/FI8608W_Y2k.pm' => '$(INST_LIBDIR)/ZoneMinder/Control/FI8608W_Y2k.pm', 'lib/ZoneMinder/Control/FI8620_Y2k.pm' => '$(INST_LIBDIR)/ZoneMinder/Control/FI8620_Y2k.pm', + 'lib/ZoneMinder/Control/FI8908W.pm' => '$(INST_LIBDIR)/ZoneMinder/Control/FI8908W.pm', 'lib/ZoneMinder/Control/FI9821W_Y2k.pm' => '$(INST_LIBDIR)/ZoneMinder/Control/FI9821W_Y2k.pm', 'lib/ZoneMinder/Control/LoftekSentinel.pm' => '$(INST_LIBDIR)/ZoneMinder/Control/LoftekSentinel.pm', 'lib/ZoneMinder/Trigger/Channel.pm' => '$(INST_LIBDIR)/ZoneMinder/Trigger/Channel.pm', diff --git a/scripts/ZoneMinder/lib/ZoneMinder/Control/FI8908W.pm b/scripts/ZoneMinder/lib/ZoneMinder/Control/FI8908W.pm new file mode 100644 index 000000000..ab877c609 --- /dev/null +++ b/scripts/ZoneMinder/lib/ZoneMinder/Control/FI8908W.pm @@ -0,0 +1,231 @@ +# ========================================================================== +# +# ZoneMinder Foscam FI8908W / FI8918W IP Control Protocol Module, $Date$, $Revision$ +# Copyright (C) 2001-2008 Philip Coombes +# Modified for use with Foscam FI8908W IP Camera by Dave Harris +# +# This program is free software; you can redistribute it and/or +# modify it under the terms of the GNU General Public License +# as published by the Free Software Foundation; either version 2 +# of the License, or (at your option) any later version. +# +# This program is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +# GNU General Public License for more details. +# +# You should have received a copy of the GNU General Public License +# along with this program; if not, write to the Free Software +# Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. +# +# ========================================================================== +# +package ZoneMinder::Control::FI8908W; + +use 5.006; +use strict; +use warnings; + +require ZoneMinder::Base; +require ZoneMinder::Control; + +our @ISA = qw(ZoneMinder::Control); + +# ========================================================================== +# +# Foscam FI8908W IP Control Protocol +# +# ========================================================================== + +use ZoneMinder::Logger qw(:all); +use ZoneMinder::Config qw(:all); + +use Time::HiRes qw( usleep ); + +sub new +{ + my $class = shift; + my $id = shift; + my $self = ZoneMinder::Control->new( $id ); + bless( $self, $class ); + srand( time() ); + return $self; +} + +our $AUTOLOAD; + +sub AUTOLOAD +{ + my $self = shift; + my $class = ref($self) || croak( "$self not object" ); + my $name = $AUTOLOAD; + $name =~ s/.*://; + if ( exists($self->{$name}) ) + { + return( $self->{$name} ); + } + Fatal( "Can't access $name member of object of class $class" ); +} + +sub open +{ + my $self = shift; + + $self->loadMonitor(); + + use LWP::UserAgent; + $self->{ua} = LWP::UserAgent->new; + $self->{ua}->agent( "ZoneMinder Control Agent/".ZoneMinder::Base::ZM_VERSION ); + + $self->{state} = 'open'; +} + +sub close +{ + my $self = shift; + $self->{state} = 'closed'; +} + +sub printMsg +{ + my $self = shift; + my $msg = shift; + my $msg_len = length($msg); + + Debug( $msg."[".$msg_len."]" ); +} + +sub sendCmd +{ + my $self = shift; + my $cmd = shift; + my $result = undef; + + my ($user, $password) = split /:/, $self->{Monitor}->{ControlDevice}; + + if ( !defined $password ) { + # If value of "Control device" does not consist of two parts, then only password is given and we fallback to default user: + $password = $user; + $user = 'admin'; + } + + $cmd .= "user=$user&pwd=$password"; + + printMsg( $cmd, "Tx" ); + + my $req = HTTP::Request->new( GET=>"http://".$self->{Monitor}->{ControlAddress}."/$cmd" ); + my $res = $self->{ua}->request($req); + + if ( $res->is_success ) + { + $result = !undef; + } + else + { + Error( "Error check failed: '".$res->status_line()."' for URL ".$req->uri() ); + } + + return( $result ); +} + +sub reset +{ + my $self = shift; + Debug( "Camera Reset" ); + $self->sendCmd( 'reboot.cgi?' ); +} + +#Up Arrow +sub moveConUp +{ + my $self = shift; + Debug( "Move Up" ); + $self->sendCmd( 'decoder_control.cgi?command=0&' ); +} + +#Down Arrow +sub moveConDown +{ + my $self = shift; + Debug( "Move Down" ); + $self->sendCmd( 'decoder_control.cgi?command=2&' ); +} + +#Left Arrow +sub moveConLeft +{ + my $self = shift; + Debug( "Move Left" ); + $self->sendCmd( 'decoder_control.cgi?command=6&' ); +} + +#Right Arrow +sub moveConRight +{ + my $self = shift; + Debug( "Move Right" ); + $self->sendCmd( 'decoder_control.cgi?command=4&' ); +} + +#Diagonally Up Right Arrow +sub moveConUpRight +{ + my $self = shift; + Debug( "Move Diagonally Up Right" ); + $self->sendCmd( 'decoder_control.cgi?command=90&' ); +} + +#Diagonally Down Right Arrow +sub moveConDownRight +{ + my $self = shift; + Debug( "Move Diagonally Down Right" ); + $self->sendCmd( 'decoder_control.cgi?command=92&' ); +} + +#Diagonally Up Left Arrow +sub moveConUpLeft +{ + my $self = shift; + Debug( "Move Diagonally Up Left" ); + $self->sendCmd( 'decoder_control.cgi?command=91&' ); +} + +#Diagonally Down Left Arrow +sub moveConDownLeft +{ + my $self = shift; + Debug( "Move Diagonally Down Left" ); + $self->sendCmd( 'decoder_control.cgi?command=93&' ); +} + +#Stop +sub moveStop +{ + my $self = shift; + Debug( "Move Stop" ); + $self->sendCmd( 'decoder_control.cgi?command=1&' ); +} + +#Move Camera to Home Position +sub presetHome +{ + my $self = shift; + Debug( "Home Preset" ); + $self->sendCmd( 'decoder_control.cgi?command=25&' ); +} + +1; + +__END__ +=pod + +=head1 DESCRIPTION + +This module contains the implementation of the Foscam FI8908W / FI8918W IP camera control +protocol. + +The module uses "Control Device" value to retrieve user and password. User and password should +be separated by colon, e.g. user:password. If colon is not provided, then "admin" is used +as a fallback value for the user. +=cut diff --git a/scripts/ZoneMinder/lib/ZoneMinder/Memory/Mapped.pm b/scripts/ZoneMinder/lib/ZoneMinder/Memory/Mapped.pm index 7c472591d..6af97122c 100644 --- a/scripts/ZoneMinder/lib/ZoneMinder/Memory/Mapped.pm +++ b/scripts/ZoneMinder/lib/ZoneMinder/Memory/Mapped.pm @@ -76,8 +76,11 @@ sub zmMemKey( $ ) sub zmMemAttach( $$ ) { - my $monitor = shift; - my $size = shift; + my ( $monitor, $size ) = @_; + if ( ! $size ) { + Error( "No size passed to zmMemAttach for monitor $$monitor{Id}\n" ); + return( undef ); + } if ( !defined($monitor->{MMapAddr}) ) { my $mmap_file = $Config{ZM_PATH_MAP}."/zm.mmap.".$monitor->{Id}; @@ -95,6 +98,7 @@ sub zmMemAttach( $$ ) if ( !$mmap_addr || !$mmap ) { Error( sprintf( "Can't mmap to file '%s': $!\n", $mmap_file ) ); + close( MMAP ); return( undef ); } $monitor->{MMapHandle} = \*MMAP; @@ -110,7 +114,9 @@ sub zmMemDetach( $ ) if ( $monitor->{MMap} ) { - munmap( ${$monitor->{MMap}} ); + if ( ! munmap( ${$monitor->{MMap}} ) ) { + Warn( "Unable to munmap for monitor $$monitor{Id}\n"); + } delete $monitor->{MMap}; } if ( $monitor->{MMapAddr} ) diff --git a/scripts/zmcontrol.pl.in b/scripts/zmcontrol.pl.in index 77283acc9..e8c78ae84 100644 --- a/scripts/zmcontrol.pl.in +++ b/scripts/zmcontrol.pl.in @@ -49,7 +49,7 @@ sub Usage print( " Usage: zmcontrol.pl --id --command= "); - exit( -1 ); + exit(); } logInit(); diff --git a/scripts/zmtrigger.pl.in b/scripts/zmtrigger.pl.in index 11c5c9a29..d8929fab3 100644 --- a/scripts/zmtrigger.pl.in +++ b/scripts/zmtrigger.pl.in @@ -53,7 +53,7 @@ use ZoneMinder::Trigger::Connection; my @connections; push( @connections, ZoneMinder::Trigger::Connection->new( name=>"Chan1", channel=>ZoneMinder::Trigger::Channel::Inet->new( port=>6802 ), mode=>"rw" ) ); -push( @connections, ZoneMinder::Trigger::Connection->new( name=>"Chan2", channel=>ZoneMinder::Trigger::Channel::Unix->new( path=>ZM_PATH_SOCKS.'/zmtrigger.sock' ), mode=>"rw" ) ); +push( @connections, ZoneMinder::Trigger::Connection->new( name=>"Chan2", channel=>ZoneMinder::Trigger::Channel::Unix->new( path=>$Config{ZM_PATH_SOCKS}.'/zmtrigger.sock' ), mode=>"rw" ) ); #push( @connections, ZoneMinder::Trigger::Connection->new( name=>"Chan3", channel=>ZoneMinder::Trigger::Channel::File->new( path=>'/tmp/zmtrigger.out' ), mode=>"w" ) ); push( @connections, ZoneMinder::Trigger::Connection->new( name=>"Chan4", channel=>ZoneMinder::Trigger::Channel::Serial->new( path=>'/dev/ttyS0' ), mode=>"rw" ) ); @@ -437,4 +437,7 @@ sub handleMessage { Error( "Unrecognised action '$action' in message '$message'\n" ); } -} +} # end sub handleMessage + +1; +__END__ diff --git a/scripts/zmx10.pl.in b/scripts/zmx10.pl.in index 14eff5a01..f661e656f 100644 --- a/scripts/zmx10.pl.in +++ b/scripts/zmx10.pl.in @@ -48,7 +48,7 @@ use Socket; use Getopt::Long; use Data::Dumper; -use constant SOCK_FILE => ZM_PATH_SOCKS.'/zmx10.sock'; +use constant SOCK_FILE => $Config{ZM_PATH_SOCKS}.'/zmx10.sock'; $| = 1; diff --git a/src/zm_rtp_source.cpp b/src/zm_rtp_source.cpp index 0aecd0332..608e529d5 100644 --- a/src/zm_rtp_source.cpp +++ b/src/zm_rtp_source.cpp @@ -24,6 +24,8 @@ #include +#if HAVE_LIBAVCODEC + #if LIBAVCODEC_VERSION_INT >= AV_VERSION_INT(54,25,0) #define _AVCODECID AVCodecID #else @@ -385,4 +387,6 @@ bool RtpSource::getFrame( Buffer &buffer ) return( true ); } -#undef _AVCODECID \ No newline at end of file +#undef _AVCODECID + +#endif // HAVE_LIBAVCODEC diff --git a/src/zm_rtp_source.h b/src/zm_rtp_source.h index 8d1f7da4f..b8a879565 100644 --- a/src/zm_rtp_source.h +++ b/src/zm_rtp_source.h @@ -28,6 +28,8 @@ #include #include +#if HAVE_LIBAVCODEC + #if LIBAVCODEC_VERSION_INT >= AV_VERSION_INT(54,25,0) #define _AVCODECID AVCodecID #else @@ -189,4 +191,6 @@ public: #undef _AVCODECID +#endif // HAVE_LIBAVCODEC + #endif // ZM_RTP_SOURCE_H diff --git a/utils/travis.pl b/utils/travis.pl new file mode 100755 index 000000000..f9c74bbc6 --- /dev/null +++ b/utils/travis.pl @@ -0,0 +1,21 @@ +#!/usr/bin/env perl + +use strict; +use warnings; + +my @tests = ( + 'zmpkg.pl start', + 'zmfilter.pl -f purgewhenfull', +); + +sub run_test { + my $test = $_[0]; + print "Running test: '$test'"; + + my @args = ('sudo', $test); + system(@args) == 0 or die "'$test' failed to run!"; +} + +foreach my $test (@tests) { + run_test($test); +} diff --git a/web/index.php b/web/index.php index 530e7f2c8..46c173421 100644 --- a/web/index.php +++ b/web/index.php @@ -105,11 +105,11 @@ if ( isset($_REQUEST['request']) ) if ( isset($_REQUEST['action']) ) $action = detaintPath($_REQUEST['action']); -require_once( 'includes/actions.php' ); - foreach ( getSkinIncludes( 'skin.php' ) as $includeFile ) require_once $includeFile; +require_once( 'includes/actions.php' ); + if ( isset( $_REQUEST['request'] ) ) { foreach ( getSkinIncludes( 'ajax/'.$request.'.php', true, true ) as $includeFile ) diff --git a/web/skins/classic/includes/timeline_functions.php b/web/skins/classic/includes/timeline_functions.php index 74a58c06c..cf92f8689 100644 --- a/web/skins/classic/includes/timeline_functions.php +++ b/web/skins/classic/includes/timeline_functions.php @@ -228,6 +228,7 @@ function parseFilterToTree( $filter ) case 'MonitorName': case 'Name': case 'Cause': + case 'Notes': $value = "'$value'"; break; case 'DateTime': diff --git a/web/skins/classic/views/js/montage.js b/web/skins/classic/views/js/montage.js index cc49d5776..b8ea83aa6 100644 --- a/web/skins/classic/views/js/montage.js +++ b/web/skins/classic/views/js/montage.js @@ -134,6 +134,7 @@ function changeScale() streamImg.style.width = newWidth + "px"; streamImg.style.height = newHeight + "px"; } + Cookie.write( 'zmMontageScale', scale, { duration: 10*365 } ); } var monitors = new Array(); diff --git a/web/skins/classic/views/monitor.php b/web/skins/classic/views/monitor.php index cfc24d8c6..e80816d55 100644 --- a/web/skins/classic/views/monitor.php +++ b/web/skins/classic/views/monitor.php @@ -100,7 +100,7 @@ else 'AlarmMaxFPS' => "", 'FPSReportInterval' => 1000, 'RefBlendPerc' => 6, - 'AlarmRefBlendPerc' => 3, + 'AlarmRefBlendPerc' => 6, 'DefaultView' => 'Events', 'DefaultRate' => '100', 'DefaultScale' => '100', diff --git a/web/skins/classic/views/montage.php b/web/skins/classic/views/montage.php index 6a93ee727..2362a7fad 100644 --- a/web/skins/classic/views/montage.php +++ b/web/skins/classic/views/montage.php @@ -44,8 +44,11 @@ foreach( dbFetchAll( $sql ) as $row ) { continue; } + if ( isset( $_REQUEST['scale'] ) ) $scale = validInt($_REQUEST['scale']); + else if ( isset( $_COOKIE['zmMontageScale'] ) ) + $scale = $_COOKIE['zmMontageScale']; else $scale = reScale( SCALE_BASE, $row['DefaultScale'], ZM_WEB_DEFAULT_SCALE );