Merge branch 'master' into feature-h264-videostorage

This commit is contained in:
Chris Wiggins 2013-09-22 10:44:38 +12:00
commit 3dfff0b3ac
34 changed files with 1050 additions and 158 deletions

1
ZoneMinder Submodule

@ -0,0 +1 @@
Subproject commit 4d508d8be232a4f84aefe37327b0e737196f58d1

View File

@ -0,0 +1,62 @@
================================================================================
NEW INSTALLS
================================================================================
1. Unless you are already using MySQL server, you need to ensure that
the server is confired to start during boot and properly secured
by running:
sudo service mysqld start
/usr/bin/mysql_secure_installation
sudo chkconfig mysqld on
2. Using the password for the root account set during the previous step, you
will need to create the ZoneMinder database:
mysql -uroot -p
mysql> create database zm;
mysql> grant select,insert,update,delete on zm.* to
'zmuser'@localhost identified by 'zmpass';
mysql> exit;
mysql -uroot -p < /usr/share/zoneminder/db/zm_create.sql
mysqladmin -uroot -p reload
3. IMPORTANT: Edit /etc/php.ini and put in the appropriate timezone for
date.timezone!
4. The ZoneMinder web interface is disabled by default, you will need
to edit this file to enable it:
/etc/httpd/conf.d/zoneminder.conf
HINT: Most users will want to simply delete the line that says
"Deny from all".
5. Configure the web server to start automatically:
sudo chkconfig httpd on
sudo service httpd start
6. This package has automatically configured and installed an SELinux policy
called local_zoneminder. A copy of this policy is in the documentation
folder.
7. Finally, you may start the ZoneMinder service:
sudo service zoneminder start
Then point your web browser to http://<machine name or ip>/zm
================================================================================
UPGRADES
================================================================================
1. You will need to upgrade the ZoneMinder database as described in the
manual. This command should be sufficient:
sudo zmupdate.pl --user=root --pass=<mysql root pwd> --version=<from version>
It is recommended to backup your database and then upgrade your tables
to InnoDB when prompted.

View File

@ -0,0 +1,86 @@
New installs
============
1. Unless you are already using the MySQL server or you are running it
remotely you will need to ensure that the server is installed and secured:
yum install mysql-community or
yum install mysql (Mariadb)
sudo systemctl mysqld enable
sudo system mysqld start
mysql_secure_installation
2. You will need to create the ZoneMinder database. These commands should do
the trick, assuming your database server is local:
mysql -u root -p < /usr/share/zoneminder/db/zm_create.sql
mysqladmin reload
3. The database needs a user. One is not created by default because this would
introduce an obvious security issue. The following should set this up:
mysql -u root -p
grant select,insert,update,delete on zm.* to 'zmuser'@localhost identified by 'zmpass';
Obviously, change at least zmpass to an actual, secure password or
passphrase. You can change zmuser as well if you like.
4. Edit /etc/zm.conf and, at the bottom, change ZM_DB_PASS and perhaps
ZM_DB_USER to match.
5. Edit /etc/php.ini, uncomment the date.timezone line, and add your local
timezone. For whatever reason, PHP will complain loudly if this is not set,
or if it is set incorrectly, and these complaints will show up in the
zoneminder logging system as errors.
If you are not sure of the proper timezone specification to use, look at
http://php.net/date.timezone
6. This package probably does not work with SELinux enabled at the moment. It
may be necessary to disable SELinux for httpd, or even completely for
ZoneMinder to function. This will be addressed in a later release. Run
setenforce 0
for testing, and edit /etc/sysconfig/selinux to disable it at boot time.
7. The zoneminder.service file fails at present but the zmpkg.pl script
can be run as root to start zoneminder.
sudo zmpkg.pl start
8. The ZoneMinder web interface is disabled by default (which makes it rather
useless but also secure by default), you will need to edit
/etc/httpd/conf.d/zoneminder.conf to enable it. Afterwards, you can start
the web server:
sudo systemctl enable httpd.service
sudo systemctl start httpd.service
9. You should immediately visit http://localhost/zm and secure the system if
it is network facing. To do this:
a) click Options, then System.
b) check OPT_USE_AUTH.
c) set AUTH_HASH_SECRET to a random string.
d) click Save and refresh the main browser window.
e) You should be prompted to log in; the default username/password is admin/admin.
f) Open Options again, choose the newly visible Users tab.
g) click the admin user and set a password.
Upgrades
========
1. Update /etc/zm.conf. Check for any new settings and update the version
information. Comparing /etc/zm.conf and /etc/zm.conf.rpmnew should help to
do this.
2. You will need to upgrade the ZoneMinder database as described in the
manual. This command should be sufficient when run as root:
zmupdate.pl --user=root --pass={mysql_root_pwd} --version=<from version>

View File

@ -0,0 +1,17 @@
After install run "zm_database_init" to create
the database and the zm database user (zm_admin).
The config file is automaticly adjusted with the
entered password for zm_admin.
If you want to use X10 thwn install the the required
perl module with cpan.
information:
during the run of zm_database_init a .my.cnf will
be created/updated (in the home directory of root)
so that root can access the database without password.
It Does not delete the .my.cnf when it exists, but checks
whether it has an entry for the mysql client [client] which
contains as username root. When the entry not exist or
the username is not root the .my.cnf will be modified
to fit the above requirements.

View File

@ -0,0 +1,72 @@
module local_zoneminder 1.0;
require {
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;
class unix_stream_socket { read connectto };
class lnk_file { write getattr read lock unlink };
class dir search;
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:file { read getattr open };
allow httpd_t crond_t:dir search;
allow httpd_t crond_t:file { read getattr open };
allow httpd_t dhcpc_t:dir search;
allow httpd_t dhcpc_t:file { read getattr open };
allow httpd_t getty_t:dir search;
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: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
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 kernel_t:file { read getattr open };
allow httpd_t mysqld_safe_t:dir search;
allow httpd_t mysqld_safe_t:file { read getattr open };
allow httpd_t mysqld_t:dir search;
allow httpd_t mysqld_t:file { read getattr open };
allow httpd_t sshd_t:dir search;
allow httpd_t sshd_t:file { read getattr open };
allow httpd_t syslogd_t:dir search;
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:file { read getattr open };
allow httpd_t unconfined_t:dir search;
allow httpd_t unconfined_t:file { read getattr open };
allow httpd_t var_lib_t:lnk_file { write getattr read lock unlink };
allow httpd_t v4l_device_t:chr_file getattr;

BIN
distros/redhat/redalert.wav Executable file

Binary file not shown.

48
distros/redhat/zm-init Normal file
View File

@ -0,0 +1,48 @@
#!/bin/sh
#$Id: zm-init,v 1.1 2005/04/19 00:49:53 hunter Exp $
#
# Copyright (C) 2005 Serg Oskin
#
ZM_VERSION=
ZM_CONFIG=/etc/zm.conf
ZM_PATH=/usr/lib/zm
if [ -f $ZM_CONFIG ]; then
. $ZM_CONFIG
else
echo "ERROR: $ZM_CONFIG not found."
exit 1
fi
for n in ZM_DB_SERVER ZM_DB_NAME ZM_DB_USER ZM_DB_PASS; do
eval "val=\$$n"
if [ "$val" = "" ]; then
echo "ERROR($ZM_CONFIG): $n should exist and be not empty."
exit 1
fi
done
if [ "$ZM_DB_SERVER" = "localhost" ]; then
ClientHost=localhost
else
ClientHost=`hostname`
fi
sql=/tmp/zm.crdb.sql
echo "" >$sql
chmod 600 $sql
echo "CREATE DATABASE /*!32312 IF NOT EXISTS*/ $ZM_DB_NAME;" >>$sql
echo "USE $ZM_DB_NAME;" >>$sql
echo "GRANT all on $ZM_DB_NAME.* TO '$ZM_DB_USER'@'$ClientHost' IDENTIFIED BY '$ZM_DB_PASS';" >>$sql
echo -n "Enter MySQL Administrator username: "
read admin
cat $sql | mysql -B -h $ZM_DB_SERVER -u $admin -p
rm -f $sql
cat /usr/lib/zm/init/zmschema.sql | mysql -h $ZM_DB_SERVER -u $ZM_DB_USER -p$ZM_DB_PASS $ZM_DB_NAME
( cd $ZM_PATH/init; perl $ZM_PATH/init/zmoptions -f $ZM_PATH/init/zmconfig.txt )

View File

@ -0,0 +1,7 @@
/var/log/zoneminder/*log
{
weekly
notifempty
missingok
create 660 http http
}

View File

@ -0,0 +1,72 @@
--- configure.ac 2013-09-05 10:33:08.000000000 -0500
+++ configure.ac.dbinstall 2013-09-05 17:23:28.555553447 -0500
@@ -1,13 +1,11 @@
AC_PREREQ(2.59)
-AC_INIT(zm,1.26.0,[http://www.zoneminder.com/forums/ - Please check FAQ first],ZoneMinder,http://www.zoneminder.com/downloads.html)
+AC_INIT(zm,1.26.0,[http://www.zoneminder.com/forums/ - Please check FAQ first],zoneminder,http://www.zoneminder.com/downloads.html)
AM_INIT_AUTOMAKE
AC_CONFIG_SRCDIR(src/zm.h)
AC_CONFIG_HEADERS(config.h)
AC_SUBST([AM_CXXFLAGS], [-D__STDC_CONSTANT_MACROS])
-PATH_BUILD=`pwd`
-AC_SUBST(PATH_BUILD)
TIME_BUILD=`date +'%s'`
AC_SUBST(TIME_BUILD)
@@ -354,6 +352,8 @@ AC_PROG_PERL_MODULES(X10::ActiveHome,,AC
AC_DEFINE_DIR([BINDIR],[bindir],[Expanded binary directory])
AC_DEFINE_DIR([LIBDIR],[libdir],[Expanded library directory])
+AC_DEFINE_DIR([DATADIR],[datadir],[Expanded data directory])
+AC_SUBST(PKGDATADIR,"$DATADIR/$PACKAGE")
AC_SUBST(ZM_PID,"$ZM_RUNDIR/zm.pid")
AC_DEFINE_DIR([SYSCONFDIR],[sysconfdir],[Expanded configuration directory])
AC_SUBST(ZM_CONFIG,"$SYSCONFDIR/zm.conf")
diff -up ./db/Makefile.am.dbinstall ./db/Makefile.am
--- ./db/Makefile.am.dbinstall 2009-10-14 04:42:46.000000000 -0500
+++ ./db/Makefile.am 2011-03-24 22:50:14.173912137 -0500
@@ -1,7 +1,16 @@
AUTOMAKE_OPTIONS = gnu
+zmdbdatadir = $(pkgdatadir)/db
+
EXTRA_DIST = \
zm_create.sql.in \
+ $(dbupgrade_scripts)
+
+dist_zmdbdata_DATA = \
+ zm_create.sql \
+ $(dbupgrade_scripts)
+
+dbupgrade_scripts = \
zm_update-0.0.1.sql \
zm_update-0.9.7.sql \
zm_update-0.9.8.sql \
diff -up ./scripts/zmupdate.pl.in.dbinstall ./scripts/zmupdate.pl.in
--- ./scripts/zmupdate.pl.in.dbinstall 2011-08-27 15:44:05.335602405 -0500
+++ ./scripts/zmupdate.pl.in 2011-08-26 02:51:37.000000000 -0500
@@ -424,7 +424,7 @@ if ( $version )
}
else
{
- $command .= ZM_PATH_BUILD."/db";
+ $command .= ZM_PATH_DATA."/db";
}
$command .= "/zm_update-".$version.".sql";
diff -up ./zm.conf.in.dbinstall ./zm.conf.in
--- ./zm.conf.in.dbinstall 2008-07-25 04:48:16.000000000 -0500
+++ ./zm.conf.in 2011-03-24 22:50:14.175912077 -0500
@@ -12,8 +12,8 @@
# Current version of ZoneMinder
ZM_VERSION=@VERSION@
-# Path to build directory, used mostly for finding DB upgrade scripts
-ZM_PATH_BUILD=@PATH_BUILD@
+# Path to installed data directory, used mostly for finding DB upgrade scripts
+ZM_PATH_DATA=@PKGDATADIR@
# Build time, used to record when to trigger various checks
ZM_TIME_BUILD=@TIME_BUILD@

View File

@ -0,0 +1,76 @@
--- configure.ac 2013-08-15 11:44:10.000000000 -0500
+++ configure.ac.logdir 2013-08-17 09:20:07.326053328 -0500
@@ -46,7 +46,7 @@
AC_SUBST(ZM_TMPDIR,[/tmp/zm])
fi
if test "$ZM_LOGDIR" == ""; then
- AC_SUBST(ZM_LOGDIR,[/var/log/zm])
+ AC_SUBST(ZM_LOGDIR,[/var/log/zoneminder])
fi
LIB_ARCH=lib
--- scripts/ZoneMinder/lib/ZoneMinder/ConfigData.pm.in 2013-08-01 18:14:45.175241378 -0500
+++ scripts/ZoneMinder/lib/ZoneMinder/ConfigData.pm.in.defaults 2013-08-07 18:57:42.525006149 -0500
@@ -187,7 +187,7 @@
},
{
name => "ZM_PATH_ZMS",
- default => "/cgi-bin/nph-zms",
+ default => "/cgi-bin/zm/nph-zms",
description => "Web path to zms streaming server",
help => "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'.",
type => $types{rel_path},
@@ -276,7 +276,7 @@
},
{
name => "ZM_OPT_CAMBOZOLA",
- default => "no",
+ default => "yes",
description => "Is the (optional) cambozola java streaming client installed",
help => "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.",
type => $types{boolean},
@@ -526,7 +526,7 @@
},
{
name => "ZM_LOG_DEBUG_FILE",
- default => "@ZM_TMPDIR@/zm_debug.log+",
+ default => "/var/log/zoneminder/zm_debug_log+",
description => "Where extra debug is output to",
help => "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.",
requires => [ { name => "ZM_LOG_DEBUG", value => "yes" } ],
@@ -623,7 +623,7 @@
},
{
name => "ZM_PATH_SOCKS",
- default => "@ZM_TMPDIR@",
+ default => "/var/lib/zoneminder/sock",
description => "Path to the various Unix domain socket files that ZoneMinder uses",
help => "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.",
type => $types{abs_path},
@@ -639,7 +639,7 @@
},
{
name => "ZM_PATH_SWAP",
- default => "@ZM_TMPDIR@",
+ default => "/dev/shm",
description => "Path to location for temporary swap images used in streaming",
help => "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.",
type => $types{abs_path},
@@ -902,7 +902,7 @@
},
{
name => "ZM_UPLOAD_FTP_LOC_DIR",
- default => "@ZM_TMPDIR@",
+ default => "/var/spool/zoneminder-upload",
description => "The local directory in which to create upload files",
help => "You can use filters to instruct ZoneMinder to upload events to a remote ftp 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.",
requires => [ { name => "ZM_OPT_UPLOAD", value => "yes" } ],
@@ -1258,7 +1258,7 @@
},
{
name => "ZM_OPT_CONTROL",
- default => "no",
+ default => "yes",
description => "Support controllable (e.g. PTZ) cameras",
help => "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.",
type => $types{boolean},

View File

@ -0,0 +1,11 @@
diff -up ./scripts/zm.in.runlevel ./scripts/zm.in
--- ./scripts/zm.in.runlevel 2010-11-28 15:22:05.000000000 -0600
+++ ./scripts/zm.in 2011-03-24 21:39:01.973010160 -0500
@@ -1,6 +1,6 @@
#!/bin/sh
# description: ZoneMinder is the top Linux video camera security and surveillance solution. ZoneMinder is intended for use in single or multi-camera video security applications.Copyright: Philip Coombes, Corey DeLasaux 2003-2008
-# chkconfig: 2345 99 00
+# chkconfig: - 99 00
# processname: zmpkg.pl
# Source function library.

View File

@ -0,0 +1,407 @@
%define cambrev 0.931
%define moorev 1.3.2
%define jscrev 1.0
%define zmuid $(id -un)
%define zmgid $(id -gn)
%define zmuid_final apache
%define zmgid_final apache
Name: zoneminder
Version: 1.26.0
Release: 1%{?dist}
Summary: A camera monitoring and analysis tool
Group: System Environment/Daemons
# jscalendar is LGPL (any version): http://www.dynarch.com/projects/calendar/
# Mootools is inder the MIT license: http://mootools.net/
# Cambozola is GPL: http://www.charliemouse.com/code/cambozola/
License: GPLv2+ and LGPLv2+ and MIT
URL: http://www.zoneminder.com/
# Some of these sources to be added upstream. Will edit once that happens.
Source0: zoneminder-%{version}.tar.gz
Source2: zoneminder.conf
Source3: redalert.wav
Source4: README.CentOS
Source5: jscalendar-%{jscrev}.zip
#Source5: http://downloads.sourceforge.net/jscalendar/jscalendar-%{jscrev}.zip
Source6: mootools-core-%{moorev}-full-compat-yc.js
#Source6: http://mootools.net/download/get/mootools-core-%{moorev}-full-compat-yc.js
Source7: zm-init
Source8: zm-logrotate_d
Source9: local_zoneminder.te
Source10: cambozola-%{cambrev}.tar.gz
#Source10: http://www.andywilcock.com/code/cambozola/cambozola-%{cambrev}.tar.gz
Patch1: zoneminder-1.26.0-dbinstall.patch
Patch2: zoneminder-runlevel.patch
Patch3: zoneminder-1.26.0-defaults.patch
BuildRoot: %{_tmppath}/%{name}-%{version}-%{release}-root-%(%{__id_u} -n)
BuildRequires: automake gnutls-devel bzip2-devel libtool
BuildRequires: mysql-devel pcre-devel libjpeg-turbo-devel
BuildRequires: perl(Archive::Tar) perl(Archive::Zip)
BuildRequires: perl(Date::Manip) perl(DBD::mysql)
BuildRequires: perl(ExtUtils::MakeMaker) perl(LWP::UserAgent)
BuildRequires: perl(MIME::Entity) perl(MIME::Lite)
BuildRequires: perl(PHP::Serialization) perl(Sys::Mmap)
BuildRequires: perl(Time::HiRes) perl(Net::SFTP::Foreign)
BuildRequires: perl(Expect) perl(X10::ActiveHome) perl(Astro::SunTime)
# Change this for distros compatible newer ffmpeg & gcc
BuildRequires: ffmpeg-devel >= 0.4.9
BuildRequires: ffmpeg-devel <= 0.6.5
BuildRequires: gcc < 4.7
Requires: httpd php php-mysql mysql-server libjpeg-turbo
Requires: perl(:MODULE_COMPAT_%(eval "`%{__perl} -V:version`"; echo $version))
Requires: perl(DBD::mysql) perl(Archive::Tar) perl(Archive::Zip)
Requires: perl(MIME::Entity) perl(MIME::Lite) perl(Net::SMTP) perl(Net::FTP)
# Change this for distros compatible newer ffmpeg
Requires: ffmpeg >= 0.4.9
Requires: ffmpeg <= 0.6.5
Requires(post): /sbin/chkconfig
Requires(post): /usr/bin/checkmodule
Requires(post): /usr/bin/semodule_package
Requires(post): /usr/sbin/semodule
Requires(post): /usr/bin/gpasswd
Requires(post): /usr/bin/less
Requires(preun): /sbin/chkconfig
Requires(preun): /sbin/service
Requires(preun): /usr/sbin/semodule
Requires(postun): /sbin/service
%description
ZoneMinder is a set of applications which is intended to provide a complete
solution allowing you to capture, analyse, record and monitor any cameras you
have attached to a Linux based machine. It is designed to run on kernels which
support the Video For Linux (V4L) interface and has been tested with cameras
attached to BTTV cards, various USB cameras and IP network cameras. It is
designed to support as many cameras as you can attach to your computer without
too much degradation of performance.
%prep
%setup -q -n zoneminder-%{version}
# Unpack jscalendar and move some files around
%setup -q -D -T -a 5 -n zoneminder-%{version}
mkdir jscalendar-doc
pushd jscalendar-%{jscrev}
mv *html *php doc/* README ../jscalendar-doc
rmdir doc
popd
# Unpack Cambozola and move some files around
%setup -q -D -T -a 10 -n zoneminder-%{version}
mkdir cambozola-doc
pushd cambozola-%{cambrev}
mv application.properties build.xml dist.sh *html LICENSE testPages/* ../cambozola-doc
rmdir testPages
popd
%patch1 -p0 -b .dbinstall
%patch2 -p0 -b .runlevel
%patch3 -p0
cp %{SOURCE4} README.CentOS
cp %{SOURCE9} local_zoneminder.te
%build
libtoolize --force
aclocal
autoheader
automake --force-missing --add-missing
autoconf
#autoreconf
OPTS=""
%ifnarch %{ix86} x86_64
OPTS="$OPTS --disable-crashtrace"
%endif
%configure \
--with-libarch=%{_lib} \
%ifarch %{ix86} %{x8664}
--enable-crashtrace \
%else
--disable-crashtrace \
%endif
--with-mysql=%{_prefix} \
--with-ffmpeg=%{_prefix} \
--with-webdir=%{_datadir}/%{name}/www \
--with-cgidir=%{_libexecdir}/%{name}/cgi-bin \
--with-webuser=%{zmuid} \
--with-webgroup=%{zmgid} \
--enable-mmap=yes \
--disable-debug \
--with-webhost=zm.local \
ZM_SSL_LIB="gnutls" \
ZM_RUNDIR=/var/run/zoneminder \
ZM_TMPDIR=/var/lib/zoneminder/temp \
CXXFLAGS="-D__STDC_CONSTANT_MACROS -msse2" \
--with-extralibs=""
make %{?_smp_mflags}
%{__perl} -pi -e 's/(ZM_WEB_USER=).*$/${1}%{zmuid_final}/;' \
-e 's/(ZM_WEB_GROUP=).*$/${1}%{zmgid_final}/;' zm.conf
%install
install -d %{buildroot}/%{_localstatedir}/run
install -d %{buildroot}/etc/logrotate.d
make install DESTDIR=%{buildroot} \
INSTALLDIRS=vendor
rm -rf %{buildroot}/%{perl_vendorarch} %{buildroot}/%{perl_archlib}
install -m 755 -d %{buildroot}/%{_localstatedir}/log/zoneminder
for dir in events images temp
do
install -m 755 -d %{buildroot}/%{_localstatedir}/lib/zoneminder/$dir
rmdir %{buildroot}/%{_datadir}/%{name}/www/$dir
ln -sf ../../../..%{_localstatedir}/lib/zoneminder/$dir %{buildroot}/%{_datadir}/%{name}/www/$dir
done
install -m 755 -d %{buildroot}/%{_localstatedir}/lib/zoneminder/sock
install -m 755 -d %{buildroot}/%{_localstatedir}/lib/zoneminder/swap
install -m 755 -d %{buildroot}/%{_localstatedir}/spool/zoneminder-upload
install -D -m 755 scripts/zm %{buildroot}/%{_initrddir}/zoneminder
install -D -m 644 %{SOURCE2} %{buildroot}/%{_sysconfdir}/httpd/conf.d/zoneminder.conf
install -D -m 755 %{SOURCE3} %{buildroot}/%{_datadir}/%{name}/www/sounds/redalert.wav
install %{SOURCE8} $RPM_BUILD_ROOT%{_sysconfdir}/logrotate.d/%{name}
# Install jscalendar
install -d -m 755 %{buildroot}/%{_datadir}/%{name}/www/jscalendar
cp -rp jscalendar-%{jscrev}/* %{buildroot}/%{_datadir}/%{name}/www/jscalendar
# Install Cambozola
cp -rp cambozola-%{cambrev}/dist/cambozola.jar %{buildroot}/%{_datadir}/%{name}/www/
rm -rf cambozola-%{cambrev}
# Install mootools
pushd %{buildroot}/%{_datadir}/%{name}/www
install -m 644 %{SOURCE6} mootools-core-%{moorev}-full-compat-yc.js
ln -s mootools-core-%{moorev}-full-compat-yc.js mootools.js
popd
%post
/sbin/chkconfig --add zoneminder
/sbin/chkconfig zoneminder on
# Allow zoneminder access to local video sources
echo
/usr/bin/gpasswd -a apache video
# Create and load zoneminder selinux policy module
echo -e "\nCreating and installing a ZoneMinder SELinux policy module. Please wait.\n"
/usr/bin/checkmodule -M -m -o %{_docdir}/%{name}-%{version}/local_zoneminder.mod %{_docdir}/%{name}-%{version}/local_zoneminder.te > /dev/null
/usr/bin/semodule_package -o %{_docdir}/%{name}-%{version}/local_zoneminder.pp -m %{_docdir}/%{name}-%{version}/local_zoneminder.mod > /dev/null
/usr/sbin/semodule -i %{_docdir}/%{name}-%{version}/local_zoneminder.pp > /dev/null
# Display the README for post installation instructions
/usr/bin/less %{_docdir}/%{name}-%{version}/README.CentOS
%preun
if [ $1 -eq 0 ]; then
/sbin/service zoneminder stop > /dev/null 2>&1 || :
/sbin/chkconfig --del zoneminder
echo -e "\nRemoving ZoneMinder SELinux policy module. Please wait.\n"
/usr/sbin/semodule -r local_zoneminder.pp
fi
%postun
if [ $1 -ge 1 ]; then
/sbin/service zoneminder condrestart > /dev/null 2>&1 || :
fi
%files
%defattr(-,root,root,-)
%doc AUTHORS BUGS ChangeLog COPYING LICENSE NEWS README.md README.CentOS jscalendar-doc cambozola-doc local_zoneminder.te
%config(noreplace) %attr(640,root,%{zmgid_final}) %{_sysconfdir}/zm.conf
%config(noreplace) %attr(644,root,root) %{_sysconfdir}/httpd/conf.d/zoneminder.conf
%config(noreplace) /etc/logrotate.d/%{name}
%attr(755,root,root) %{_initrddir}/zoneminder
%{_bindir}/zma
%{_bindir}/zmaudit.pl
%{_bindir}/zmc
%{_bindir}/zmcontrol.pl
%{_bindir}/zmdc.pl
%{_bindir}/zmf
%{_bindir}/zmfilter.pl
%attr(4755,root,root) %{_bindir}/zmfix
%{_bindir}/zmpkg.pl
%{_bindir}/zmstreamer
%{_bindir}/zmtrack.pl
%{_bindir}/zmtrigger.pl
%{_bindir}/zmu
%{_bindir}/zmupdate.pl
%{_bindir}/zmvideo.pl
%{_bindir}/zmwatch.pl
%{_bindir}/zmx10.pl
%{perl_vendorlib}/ZoneMinder*
%{_mandir}/man*/*
%dir %{_libexecdir}/%{name}
%{_libexecdir}/%{name}/cgi-bin
%dir %{_datadir}/%{name}
%{_datadir}/%{name}/db
%{_datadir}/%{name}/www
%dir %attr(755,%{zmuid_final},%{zmgid_final}) %{_localstatedir}/lib/zoneminder
%dir %attr(755,%{zmuid_final},%{zmgid_final}) %{_localstatedir}/lib/zoneminder/events
%dir %attr(755,%{zmuid_final},%{zmgid_final}) %{_localstatedir}/lib/zoneminder/images
%dir %attr(755,%{zmuid_final},%{zmgid_final}) %{_localstatedir}/lib/zoneminder/sock
%dir %attr(755,%{zmuid_final},%{zmgid_final}) %{_localstatedir}/lib/zoneminder/swap
%dir %attr(755,%{zmuid_final},%{zmgid_final}) %{_localstatedir}/lib/zoneminder/temp
%dir %attr(755,%{zmuid_final},%{zmgid_final}) %{_localstatedir}/log/zoneminder
%dir %attr(755,%{zmuid_final},%{zmgid_final}) %{_localstatedir}/spool/zoneminder-upload
%changelog
* Thu Sep 05 2013 Andrew Bauer <knnniggett@users.sourceforge.net> - 1.26.0
- 1.26.0 Release
- https://github.com/ZoneMinder/ZoneMinder/archive/v1.26.0.tar.gz
* Sun Sep 01 2013 Andrew Bauer <knnniggett@users.sourceforge.net> - 1.26.0-beta
- Update SELinux policy module
* Thu Aug 29 2013 Andrew Bauer <knnniggett@users.sourceforge.net> - 1.26.0-beta
- Third Beta release
- https://github.com/ZoneMinder/ZoneMinder/tree/release-1.26
- Reduce number of uneeded dependencies by integrating cambozola into spec file
* Thu Aug 15 2013 Andrew Bauer <knnniggett@users.sourceforge.net> - 1.26.0-beta
- Initial Beta release
- https://github.com/ZoneMinder/ZoneMinder/tree/release-1.26
* Sun Aug 11 2013 Andrew Bauer <knnniggett@users.sourceforge.net> - 1.25.0-kfirproper
- Modified specfile to work with kfir-proper branch
- https://github.com/ZoneMinder/ZoneMinder/tree/kfir-proper
* Wed Aug 07 2013 Andrew Bauer <knnniggett@users.sourceforge.net> - 1.25.0-2svn3827
- Move RHEL/CentOS specific defaults to a patch file
- Add bzip2-devel as a build dependency
- Default ZM_SSL_LIB back to gnutls. AUTH_RELAY = hashed didn't work with openssl.
* Fri Aug 02 2013 Andrew Bauer <knnniggett@users.sourceforge.net> - 1.25.0-1svn3827
- Update to latest 1.25.0 subversion.
- Does not compile with modern versions of ffmpeg. Configure to work only with older versions.
- Does not compile with gcc 4.7. Configure to build with gcc less than 4.7.
* Thu Mar 24 2011 Jason L Tibbitts III <tibbs@math.uh.edu> - 1.24.3-4.20110324svn3310
- Update to latest 1.24.3 subversion. Turns out that what upstream was calling
1.24.3 is really just an occasionally updated devel snapshot.
- Rebase various patches.
* Wed Mar 23 2011 Dan Horák <dan@danny.cz> - 1.24.3-3
- rebuilt for mysql 5.5.10 (soname bump in libmysqlclient)
* Tue Feb 08 2011 Fedora Release Engineering <rel-eng@lists.fedoraproject.org> - 1.24.3-2
- Rebuilt for https://fedoraproject.org/wiki/Fedora_15_Mass_Rebuild
* Tue Jan 25 2011 Jason L Tibbitts III <tibbs@math.uh.edu> - 1.24.3-1
- Update to latest upstream version.
- Rebase patches.
- Initial incomplete attempt to disable v4l1 support.
* Fri Jan 21 2011 Jason L Tibbitts III <tibbs@math.uh.edu> - 1.24.2-6
- Unbundle cambozola; instead link to the separately pacakged copy.
- Remove BuildRoot:, %%clean and buildroot cleaning in %%install.
- Git rid of mixed space/tab usage by removing all tabs.
- Remove unnecessary Conflicts: line.
- Attempt to force short_open_tag on for the code directories.
- Move default location of sockets, swaps, logfiles and some temporary files to
make more sense and allow things to work better with a future selinux policy.
- Fix errors in README.CentOS.
* Wed Jun 02 2010 Marcela Maslanova <mmaslano@redhat.com> - 1.24.2-5
- Mass rebuild with perl-5.12.0
* Fri Dec 4 2009 Stepan Kasal <skasal@redhat.com> - 1.24.2-4
- rebuild against perl 5.10.1
- use Perl vendorarch and archlib variables correctly
* Mon Jul 27 2009 Fedora Release Engineering <rel-eng@lists.fedoraproject.org> - 1.24.2-3
- Rebuilt for https://fedoraproject.org/wiki/Fedora_12_Mass_Rebuild
* Wed Jul 22 2009 Jason L Tibbitts III <tibbs@math.uh.edu> - 1.24.2-2
- Bump release since 1.24.2-1 was mistakenly tagged a few months ago.
* Wed Jul 22 2009 Jason L Tibbitts III <tibbs@math.uh.edu> - 1.24.2-1
- Initial update to 1.24.2.
- Rebase patches.
- Update mootools download location.
- Update to mootools 1.2.3.
- Add additional dependencies for some optional features.
* Sat Apr 11 2009 Martin Ebourne <martin@zepler.org> - 1.24.1-3
- Remove unused Sys::Mmap perl dependency RPM is finding
* Sat Apr 11 2009 Martin Ebourne <martin@zepler.org> - 1.24.1-2
- Update gcc44 patch to disable -frepo, seems to be broken with gcc44
- Added noffmpeg patch to make building outside mock easier
* Sat Mar 21 2009 Martin Ebourne <martin@zepler.org> - 1.24.1-1
- Patch for gcc 4.4 compilation errors
- Upgrade to 1.24.1
* Wed Feb 25 2009 Fedora Release Engineering <rel-eng@lists.fedoraproject.org> - 1.23.3-4
- Rebuilt for https://fedoraproject.org/wiki/Fedora_11_Mass_Rebuild
* Sat Jan 24 2009 Caolán McNamara <caolanm@redhat.com> - 1.23.3-3
- rebuild for dependencies
* Mon Dec 15 2008 Martin Ebourne <martin@zepler.org> - 1.23.3-2
- Fix permissions on zm.conf
* Fri Jul 11 2008 Jason L Tibbitts III <tibbs@math.uh.edu> - 1.23.3-1
- Initial attempt at packaging 1.23.
* Tue Jul 1 2008 Martin Ebourne <martin@zepler.org> - 1.22.3-15
- Add perl module compat dependency, bz #453590
* Tue May 6 2008 Martin Ebourne <martin@zepler.org> - 1.22.3-14
- Remove default runlevel, bz #441315
* Mon Apr 28 2008 Jason L Tibbitts III <tibbs@math.uh.edu> - 1.22.3-13
- Backport patch for CVE-2008-1381 from 1.23.3 to 1.22.3.
* Tue Feb 19 2008 Fedora Release Engineering <rel-eng@fedoraproject.org> - 1.22.3-12
- Autorebuild for GCC 4.3
* Thu Jan 3 2008 Martin Ebourne <martin@zepler.org> - 1.22.3-11
- Fix compilation on gcc 4.3
* Thu Dec 6 2007 Martin Ebourne <martin@zepler.org> - 1.22.3-10
- Rebuild for new openssl
* Thu Aug 2 2007 Martin Ebourne <martin@zepler.org> - 1.22.3-8
- Fix licence tag
* Thu Jul 12 2007 Martin Ebourne <martin@zepler.org> - 1.22.3-7
- Fixes from testing by Jitz including missing dependencies and database creation
* Sat Jun 30 2007 Martin Ebourne <martin@zepler.org> - 1.22.3-6
- Disable crashtrace on ppc
* Sat Jun 30 2007 Martin Ebourne <martin@zepler.org> - 1.22.3-5
- Fix uid for directories in /var/lib/zoneminder
* Tue Jun 26 2007 Martin Ebourne <martin@zepler.org> - 1.22.3-4
- Added perl Archive::Tar dependency
- Disabled web interface due to lack of access control on the event images
* Sun Jun 10 2007 Martin Ebourne <martin@zepler.org> - 1.22.3-3
- Changes recommended in review by Jason Tibbitts
* Mon Apr 2 2007 Martin Ebourne <martin@zepler.org> - 1.22.3-2
- Standardised on package name of zoneminder
* Thu Dec 28 2006 Martin Ebourne <martin@zepler.org> - 1.22.3-1
- First version. Uses some parts from zm-1.20.1 by Corey DeLasaux and Serg Oskin

View File

@ -0,0 +1,33 @@
# The Zoneminder web interface has been disabled by default due to a small
# security issue in the default install.
#
# When using Zoneminder's own authentication, recorded CCTV images are
# accessible from the web directly without passing the authentication. This
# means any attacker could see your CCTV images without a password. In order
# to avoid this you can disable Zoneminder's authentication and configure
# standard Apache authentication (see the Apache documentation for details on
# this).
#
# If you still wish to use Zoneminder's own authentication, or have an
# internal site which needs no authentication, you need to delete the line
# marked below and restart Apache.
Alias /zm "/usr/share/zoneminder/www"
<Directory "/usr/share/zoneminder/www">
Options -Indexes MultiViews FollowSymLinks
AllowOverride All
Order allow,deny
Allow from all
# The code unfortunately uses short tags in many places
php_value short_open_tag 1
Deny from all # DELETE THIS LINE
</Directory>
ScriptAlias /cgi-bin/zm "/usr/libexec/zoneminder/cgi-bin"
<Directory "/usr/libexec/zoneminder/cgi-bin">
AllowOverride All
Options ExecCGI
Order allow,deny
Allow from all
</Directory>

View File

@ -1025,21 +1025,21 @@ if ( $version )
$cascade = !undef;
}
if ( $cascade || $version eq "1.26.1" )
if ( $cascade || $version le "1.26.1" )
{
# Patch the database
patchDB( $dbh, "1.26.1" );
$cascade = !undef;
}
if ( $cascade || $version eq "1.26.2" )
if ( $cascade || $version le "1.26.2" )
{
# Patch the database
patchDB( $dbh, "1.26.2" );
$cascade = !undef;
}
if ( $cascade || $version eq "1.26.3" )
if ( $cascade || $version le "1.26.3" )
{
# Patch the database
patchDB( $dbh, "1.26.3" );

View File

@ -290,7 +290,7 @@ void Image::Initialise()
}
/* Requests a writeable buffer to the image. This is safer than buffer() because this way we can gurantee that a buffer of required size exists */
uint8_t* Image::WriteBuffer(const int p_width, const int p_height, const int p_colours, const int p_subpixelorder) {
uint8_t* Image::WriteBuffer(const unsigned int p_width, const unsigned int p_height, const unsigned int p_colours, const unsigned int p_subpixelorder) {
unsigned int newsize;
if(p_colours != ZM_COLOUR_GRAY8 && p_colours != ZM_COLOUR_RGB24 && p_colours != ZM_COLOUR_RGB32) {
@ -334,7 +334,7 @@ uint8_t* Image::WriteBuffer(const int p_width, const int p_height, const int p_c
}
/* Assign an existing buffer to the image instead of copying from a source buffer. The goal is to reduce the amount of memory copying and increase efficiency and buffer reusing. */
void Image::AssignDirect( const int p_width, const int p_height, const int p_colours, const int p_subpixelorder, uint8_t *new_buffer, const size_t buffer_size, const int p_buffertype) {
void Image::AssignDirect( const unsigned int p_width, const unsigned int p_height, const unsigned int p_colours, const unsigned int p_subpixelorder, uint8_t *new_buffer, const size_t buffer_size, const int p_buffertype) {
if(new_buffer == NULL) {
Error("Attempt to directly assign buffer from a NULL pointer");
return;
@ -392,7 +392,7 @@ void Image::AssignDirect( const int p_width, const int p_height, const int p_col
}
void Image::Assign(const int p_width, const int p_height, const int p_colours, const int p_subpixelorder, const uint8_t* new_buffer, const size_t buffer_size) {
void Image::Assign(const unsigned int p_width, const unsigned int p_height, const unsigned int p_colours, const unsigned int p_subpixelorder, const uint8_t* new_buffer, const size_t buffer_size) {
unsigned int new_size = (p_width * p_height) * p_colours;
if(new_buffer == NULL) {
@ -481,7 +481,7 @@ void Image::Assign( const Image &image ) {
(*fptr_imgbufcpy)(buffer, image.buffer, size);
}
Image *Image::HighlightEdges( Rgb colour, int p_colours, int p_subpixelorder, const Box *limits )
Image *Image::HighlightEdges( Rgb colour, unsigned int p_colours, unsigned int p_subpixelorder, const Box *limits )
{
if ( colours != ZM_COLOUR_GRAY8 )
{
@ -498,18 +498,18 @@ Image *Image::HighlightEdges( Rgb colour, int p_colours, int p_subpixelorder, co
/* Set image to all black */
high_image->Clear();
int lo_x = limits?limits->Lo().X():0;
int lo_y = limits?limits->Lo().Y():0;
int hi_x = limits?limits->Hi().X():width-1;
int hi_y = limits?limits->Hi().Y():height-1;
unsigned int lo_x = limits?limits->Lo().X():0;
unsigned int lo_y = limits?limits->Lo().Y():0;
unsigned int hi_x = limits?limits->Hi().X():width-1;
unsigned int hi_y = limits?limits->Hi().Y():height-1;
if ( p_colours == ZM_COLOUR_GRAY8 )
{
for ( int y = lo_y; y <= hi_y; y++ )
for ( unsigned int y = lo_y; y <= hi_y; y++ )
{
const uint8_t* p = buffer + (y * width) + lo_x;
uint8_t* phigh = high_buff + (y * width) + lo_x;
for ( int x = lo_x; x <= hi_x; x++, p++, phigh++ )
for ( unsigned int x = lo_x; x <= hi_x; x++, p++, phigh++ )
{
bool edge = false;
if ( *p )
@ -528,11 +528,11 @@ Image *Image::HighlightEdges( Rgb colour, int p_colours, int p_subpixelorder, co
}
else if ( p_colours == ZM_COLOUR_RGB24 )
{
for ( int y = lo_y; y <= hi_y; y++ )
for ( unsigned int y = lo_y; y <= hi_y; y++ )
{
const uint8_t* p = buffer + (y * width) + lo_x;
uint8_t* phigh = high_buff + (((y * width) + lo_x) * 3);
for ( int x = lo_x; x <= hi_x; x++, p++, phigh += 3 )
for ( unsigned int x = lo_x; x <= hi_x; x++, p++, phigh += 3 )
{
bool edge = false;
if ( *p )
@ -553,11 +553,11 @@ Image *Image::HighlightEdges( Rgb colour, int p_colours, int p_subpixelorder, co
}
else if ( p_colours == ZM_COLOUR_RGB32 )
{
for ( int y = lo_y; y <= hi_y; y++ )
for ( unsigned int y = lo_y; y <= hi_y; y++ )
{
const uint8_t* p = buffer + (y * width) + lo_x;
Rgb* phigh = (Rgb*)(high_buff + (((y * width) + lo_x) * 4));
for ( int x = lo_x; x <= hi_x; x++, p++, phigh++ )
for ( unsigned int x = lo_x; x <= hi_x; x++, p++, phigh++ )
{
bool edge = false;
if ( *p )
@ -631,7 +631,7 @@ bool Image::WriteRaw( const char *filename ) const
return( true );
}
bool Image::ReadJpeg( const char *filename, int p_colours, int p_subpixelorder)
bool Image::ReadJpeg( const char *filename, unsigned int p_colours, unsigned int p_subpixelorder)
{
unsigned int new_width, new_height, new_colours, new_subpixelorder;
struct jpeg_decompress_struct *cinfo = jpg_dcinfo;
@ -884,7 +884,7 @@ bool Image::WriteJpeg( const char *filename, int quality_override ) const
return( true );
}
bool Image::DecodeJpeg( const JOCTET *inbuffer, int inbuffer_size, int p_colours, int p_subpixelorder)
bool Image::DecodeJpeg( const JOCTET *inbuffer, int inbuffer_size, unsigned int p_colours, unsigned int p_subpixelorder)
{
unsigned int new_width, new_height, new_colours, new_subpixelorder;
struct jpeg_decompress_struct *cinfo = jpg_dcinfo;
@ -1141,10 +1141,10 @@ bool Image::Zip( Bytef *outbuffer, unsigned long *outbuffer_size, int compressio
}
#endif // HAVE_ZLIB_H
bool Image::Crop( int lo_x, int lo_y, int hi_x, int hi_y )
bool Image::Crop( unsigned int lo_x, unsigned int lo_y, unsigned int hi_x, unsigned int hi_y )
{
int new_width = (hi_x-lo_x)+1;
int new_height = (hi_y-lo_y)+1;
unsigned int new_width = (hi_x-lo_x)+1;
unsigned int new_height = (hi_y-lo_y)+1;
if ( lo_x > hi_x || lo_y > hi_y )
{
@ -1162,11 +1162,11 @@ bool Image::Crop( int lo_x, int lo_y, int hi_x, int hi_y )
return( true );
}
int new_size = new_width*new_height*colours;
unsigned int new_size = new_width*new_height*colours;
uint8_t *new_buffer = AllocBuffer(new_size);
int new_stride = new_width*colours;
for ( int y = lo_y, ny = 0; y <= hi_y; y++, ny++ )
unsigned int new_stride = new_width*colours;
for ( unsigned int y = lo_y, ny = 0; y <= hi_y; y++, ny++ )
{
unsigned char *pbuf = &buffer[((y*width)+lo_x)*colours];
unsigned char *pnbuf = &new_buffer[(ny*new_width)*colours];
@ -1364,7 +1364,7 @@ void Image::Overlay( const Image &image )
}
/* RGB32 compatible: complete */
void Image::Overlay( const Image &image, int x, int y )
void Image::Overlay( const Image &image, unsigned int x, unsigned int y )
{
if ( !(width < image.width || height < image.height) )
{
@ -1381,17 +1381,17 @@ void Image::Overlay( const Image &image, int x, int y )
Panic( "Attempt to partial overlay differently coloured images, expected %d, got %d", colours, image.colours );
}
int lo_x = x;
int lo_y = y;
int hi_x = (x+image.width)-1;
int hi_y = (y+image.height-1);
unsigned int lo_x = x;
unsigned int lo_y = y;
unsigned int hi_x = (x+image.width)-1;
unsigned int hi_y = (y+image.height-1);
if ( colours == ZM_COLOUR_GRAY8 )
{
const uint8_t *psrc = image.buffer;
for ( int y = lo_y; y <= hi_y; y++ )
for ( unsigned int y = lo_y; y <= hi_y; y++ )
{
uint8_t *pdest = &buffer[(y*width)+lo_x];
for ( int x = lo_x; x <= hi_x; x++ )
for ( unsigned int x = lo_x; x <= hi_x; x++ )
{
*pdest++ = *psrc++;
}
@ -1400,10 +1400,10 @@ void Image::Overlay( const Image &image, int x, int y )
else if ( colours == ZM_COLOUR_RGB24 )
{
const uint8_t *psrc = image.buffer;
for ( int y = lo_y; y <= hi_y; y++ )
for ( unsigned int y = lo_y; y <= hi_y; y++ )
{
uint8_t *pdest = &buffer[colours*((y*width)+lo_x)];
for ( int x = lo_x; x <= hi_x; x++ )
for ( unsigned int x = lo_x; x <= hi_x; x++ )
{
*pdest++ = *psrc++;
*pdest++ = *psrc++;
@ -1414,10 +1414,10 @@ void Image::Overlay( const Image &image, int x, int y )
else if ( colours == ZM_COLOUR_RGB32 )
{
const Rgb *psrc = (Rgb*)(image.buffer);
for ( int y = lo_y; y <= hi_y; y++ )
for ( unsigned int y = lo_y; y <= hi_y; y++ )
{
Rgb *pdest = (Rgb*)&buffer[((y*width)+lo_x)<<2];
for ( int x = lo_x; x <= hi_x; x++ )
for ( unsigned int x = lo_x; x <= hi_x; x++ )
{
*pdest++ = *psrc++;
}
@ -1466,15 +1466,15 @@ void Image::Blend( const Image &image, int transparency )
AssignDirect( width, height, colours, subpixelorder, new_buffer, size, ZM_BUFTYPE_ZM);
}
Image *Image::Merge( int n_images, Image *images[] )
Image *Image::Merge( unsigned int n_images, Image *images[] )
{
if ( n_images <= 0 ) return( 0 );
if ( n_images == 1 ) return( new Image( *images[0] ) );
int width = images[0]->width;
int height = images[0]->height;
int colours = images[0]->colours;
for ( int i = 1; i < n_images; i++ )
unsigned int width = images[0]->width;
unsigned int height = images[0]->height;
unsigned int colours = images[0]->colours;
for ( unsigned int i = 1; i < n_images; i++ )
{
if ( !(width == images[i]->width && height == images[i]->height && colours == images[i]->colours) )
{
@ -1483,12 +1483,12 @@ Image *Image::Merge( int n_images, Image *images[] )
}
Image *result = new Image( width, height, images[0]->colours, images[0]->subpixelorder);
int size = result->size;
for ( int i = 0; i < size; i++ )
unsigned int size = result->size;
for ( unsigned int i = 0; i < size; i++ )
{
int total = 0;
unsigned int total = 0;
uint8_t *pdest = result->buffer;
for ( int j = 0; j < n_images; j++ )
for ( unsigned int j = 0; j < n_images; j++ )
{
uint8_t *psrc = images[j]->buffer;
total += *psrc;
@ -1500,15 +1500,15 @@ Image *Image::Merge( int n_images, Image *images[] )
return( result );
}
Image *Image::Merge( int n_images, Image *images[], double weight )
Image *Image::Merge( unsigned int n_images, Image *images[], double weight )
{
if ( n_images <= 0 ) return( 0 );
if ( n_images == 1 ) return( new Image( *images[0] ) );
int width = images[0]->width;
int height = images[0]->height;
int colours = images[0]->colours;
for ( int i = 1; i < n_images; i++ )
unsigned int width = images[0]->width;
unsigned int height = images[0]->height;
unsigned int colours = images[0]->colours;
for ( unsigned int i = 1; i < n_images; i++ )
{
if ( !(width == images[i]->width && height == images[i]->height && colours == images[i]->colours) )
{
@ -1517,13 +1517,13 @@ Image *Image::Merge( int n_images, Image *images[], double weight )
}
Image *result = new Image( *images[0] );
int size = result->size;
unsigned int size = result->size;
double factor = 1.0*weight;
for ( int i = 1; i < n_images; i++ )
for ( unsigned int i = 1; i < n_images; i++ )
{
uint8_t *pdest = result->buffer;
uint8_t *psrc = images[i]->buffer;
for ( int j = 0; j < size; j++ )
for ( unsigned int j = 0; j < size; j++ )
{
*pdest = (uint8_t)(((*pdest)*(1.0-factor))+((*psrc)*factor));
pdest++;
@ -1534,15 +1534,15 @@ Image *Image::Merge( int n_images, Image *images[], double weight )
return( result );
}
Image *Image::Highlight( int n_images, Image *images[], const Rgb threshold, const Rgb ref_colour )
Image *Image::Highlight( unsigned int n_images, Image *images[], const Rgb threshold, const Rgb ref_colour )
{
if ( n_images <= 0 ) return( 0 );
if ( n_images == 1 ) return( new Image( *images[0] ) );
int width = images[0]->width;
int height = images[0]->height;
int colours = images[0]->colours;
for ( int i = 1; i < n_images; i++ )
unsigned int width = images[0]->width;
unsigned int height = images[0]->height;
unsigned int colours = images[0]->colours;
for ( unsigned int i = 1; i < n_images; i++ )
{
if ( !(width == images[i]->width && height == images[i]->height && colours == images[i]->colours) )
{
@ -1551,14 +1551,14 @@ Image *Image::Highlight( int n_images, Image *images[], const Rgb threshold, con
}
Image *result = new Image( width, height, images[0]->colours, images[0]->subpixelorder );
int size = result->size;
for ( int c = 0; c < colours; c++ )
unsigned int size = result->size;
for ( unsigned int c = 0; c < colours; c++ )
{
for ( int i = 0; i < size; i++ )
for ( unsigned int i = 0; i < size; i++ )
{
int count = 0;
unsigned int count = 0;
uint8_t *pdest = result->buffer+c;
for ( int j = 0; j < n_images; j++ )
for ( unsigned int j = 0; j < n_images; j++ )
{
uint8_t *psrc = images[j]->buffer+c;
@ -1678,10 +1678,10 @@ void Image::Annotate( const char *p_text, const Coord &coord, const Rgb fg_colou
{
strncpy( text, p_text, sizeof(text) );
int index = 0;
int line_no = 0;
int text_len = strlen( text );
int line_len = 0;
unsigned int index = 0;
unsigned int line_no = 0;
unsigned int text_len = strlen( text );
unsigned int line_len = 0;
const char *line = text;
const uint8_t fg_r_col = RED_VAL_RGBA(fg_colour);
@ -1701,15 +1701,15 @@ void Image::Annotate( const char *p_text, const Coord &coord, const Rgb fg_colou
while ( (index < text_len) && (line_len = strcspn( line, "\n" )) )
{
int line_width = line_len * CHAR_WIDTH;
unsigned int line_width = line_len * CHAR_WIDTH;
int lo_line_x = coord.X();
int lo_line_y = coord.Y() + (line_no * LINE_HEIGHT);
unsigned int lo_line_x = coord.X();
unsigned int lo_line_y = coord.Y() + (line_no * LINE_HEIGHT);
int min_line_x = 0;
int max_line_x = width - line_width;
int min_line_y = 0;
int max_line_y = height - LINE_HEIGHT;
unsigned int min_line_x = 0;
unsigned int max_line_x = width - line_width;
unsigned int min_line_y = 0;
unsigned int max_line_y = height - LINE_HEIGHT;
if ( lo_line_x > max_line_x )
lo_line_x = max_line_x;
@ -1720,8 +1720,8 @@ void Image::Annotate( const char *p_text, const Coord &coord, const Rgb fg_colou
if ( lo_line_y < min_line_y )
lo_line_y = min_line_y;
int hi_line_x = lo_line_x + line_width;
int hi_line_y = lo_line_y + LINE_HEIGHT;
unsigned int hi_line_x = lo_line_x + line_width;
unsigned int hi_line_y = lo_line_y + LINE_HEIGHT;
// Clip anything that runs off the right of the screen
if ( hi_line_x > width )
@ -1732,13 +1732,13 @@ void Image::Annotate( const char *p_text, const Coord &coord, const Rgb fg_colou
if ( colours == ZM_COLOUR_GRAY8 )
{
unsigned char *ptr = &buffer[(lo_line_y*width)+lo_line_x];
for ( int y = lo_line_y, r = 0; y < hi_line_y && r < CHAR_HEIGHT; y++, r++, ptr += width )
for ( unsigned int y = lo_line_y, r = 0; y < hi_line_y && r < CHAR_HEIGHT; y++, r++, ptr += width )
{
unsigned char *temp_ptr = ptr;
for ( int x = lo_line_x, c = 0; x < hi_line_x && c < line_len; c++ )
for ( unsigned int x = lo_line_x, c = 0; x < hi_line_x && c < line_len; c++ )
{
int f = fontdata[(line[c] * CHAR_HEIGHT) + r];
for ( int i = 0; i < CHAR_WIDTH && x < hi_line_x; i++, x++, temp_ptr++ )
for ( unsigned int i = 0; i < CHAR_WIDTH && x < hi_line_x; i++, x++, temp_ptr++ )
{
if ( f & (0x80 >> i) )
{
@ -1755,16 +1755,16 @@ void Image::Annotate( const char *p_text, const Coord &coord, const Rgb fg_colou
}
else if ( colours == ZM_COLOUR_RGB24 )
{
int wc = width * colours;
unsigned int wc = width * colours;
unsigned char *ptr = &buffer[((lo_line_y*width)+lo_line_x)*colours];
for ( int y = lo_line_y, r = 0; y < hi_line_y && r < CHAR_HEIGHT; y++, r++, ptr += wc )
for ( unsigned int y = lo_line_y, r = 0; y < hi_line_y && r < CHAR_HEIGHT; y++, r++, ptr += wc )
{
unsigned char *temp_ptr = ptr;
for ( int x = lo_line_x, c = 0; x < hi_line_x && c < line_len; c++ )
for ( unsigned int x = lo_line_x, c = 0; x < hi_line_x && c < line_len; c++ )
{
int f = fontdata[(line[c] * CHAR_HEIGHT) + r];
for ( int i = 0; i < CHAR_WIDTH && x < hi_line_x; i++, x++, temp_ptr += colours )
for ( unsigned int i = 0; i < CHAR_WIDTH && x < hi_line_x; i++, x++, temp_ptr += colours )
{
if ( f & (0x80 >> i) )
{
@ -1787,16 +1787,16 @@ void Image::Annotate( const char *p_text, const Coord &coord, const Rgb fg_colou
}
else if ( colours == ZM_COLOUR_RGB32 )
{
int wc = width * colours;
unsigned int wc = width * colours;
uint8_t *ptr = &buffer[((lo_line_y*width)+lo_line_x)<<2];
for ( int y = lo_line_y, r = 0; y < hi_line_y && r < CHAR_HEIGHT; y++, r++, ptr += wc )
for ( unsigned int y = lo_line_y, r = 0; y < hi_line_y && r < CHAR_HEIGHT; y++, r++, ptr += wc )
{
Rgb* temp_ptr = (Rgb*)ptr;
for ( int x = lo_line_x, c = 0; x < hi_line_x && c < line_len; c++ )
for ( unsigned int x = lo_line_x, c = 0; x < hi_line_x && c < line_len; c++ )
{
int f = fontdata[(line[c] * CHAR_HEIGHT) + r];
for ( int i = 0; i < CHAR_WIDTH && x < hi_line_x; i++, x++, temp_ptr++ )
for ( unsigned int i = 0; i < CHAR_WIDTH && x < hi_line_x; i++, x++, temp_ptr++ )
{
if ( f & (0x80 >> i) )
{
@ -1845,7 +1845,7 @@ void Image::Timestamp( const char *label, const time_t when, const Coord &coord
}
/* RGB32 compatible: complete */
void Image::Colourise(const int p_reqcolours, const int p_reqsubpixelorder)
void Image::Colourise(const unsigned int p_reqcolours, const unsigned int p_reqsubpixelorder)
{
Debug(9, "Colourise: Req colours: %u Req subpixel order: %u Current colours: %u Current subpixel order: %u",p_reqcolours,p_reqsubpixelorder,colours,subpixelorder);
@ -1865,7 +1865,7 @@ void Image::Colourise(const int p_reqcolours, const int p_reqsubpixelorder)
if ( p_reqsubpixelorder == ZM_SUBPIX_ORDER_ABGR || p_reqsubpixelorder == ZM_SUBPIX_ORDER_ARGB) {
/* ARGB\ABGR subpixel order. alpha byte is first (mem+0), so we need to shift the pixel left in the end */
for(int i=0;i<pixels;i++) {
for(unsigned int i=0;i<pixels;i++) {
newpixel = subpixel = psrc[i];
newpixel = (newpixel<<8) | subpixel;
newpixel = (newpixel<<8) | subpixel;
@ -1873,7 +1873,7 @@ void Image::Colourise(const int p_reqcolours, const int p_reqsubpixelorder)
}
} else {
/* RGBA\BGRA subpixel order, alpha byte is last (mem+3) */
for(int i=0;i<pixels;i++) {
for(unsigned int i=0;i<pixels;i++) {
newpixel = subpixel = psrc[i];
newpixel = (newpixel<<8) | subpixel;
newpixel = (newpixel<<8) | subpixel;
@ -1955,16 +1955,16 @@ void Image::Fill( Rgb colour, const Box *limits )
/* Convert the colour's RGBA subpixel order into the image's subpixel order */
colour = rgb_convert(colour,subpixelorder);
int lo_x = limits?limits->Lo().X():0;
int lo_y = limits?limits->Lo().Y():0;
int hi_x = limits?limits->Hi().X():width-1;
int hi_y = limits?limits->Hi().Y():height-1;
unsigned int lo_x = limits?limits->Lo().X():0;
unsigned int lo_y = limits?limits->Lo().Y():0;
unsigned int hi_x = limits?limits->Hi().X():width-1;
unsigned int hi_y = limits?limits->Hi().Y():height-1;
if ( colours == ZM_COLOUR_GRAY8 )
{
for ( int y = lo_y; y <= hi_y; y++ )
for ( unsigned int y = lo_y; y <= hi_y; y++ )
{
unsigned char *p = &buffer[(y*width)+lo_x];
for ( int x = lo_x; x <= hi_x; x++, p++)
for ( unsigned int x = lo_x; x <= hi_x; x++, p++)
{
*p = colour;
}
@ -1972,10 +1972,10 @@ void Image::Fill( Rgb colour, const Box *limits )
}
else if ( colours == ZM_COLOUR_RGB24 )
{
for ( int y = lo_y; y <= hi_y; y++ )
for ( unsigned int y = lo_y; y <= hi_y; y++ )
{
unsigned char *p = &buffer[colours*((y*width)+lo_x)];
for ( int x = lo_x; x <= hi_x; x++, p += 3)
for ( unsigned int x = lo_x; x <= hi_x; x++, p += 3)
{
RED_PTR_RGBA(p) = RED_VAL_RGBA(colour);
GREEN_PTR_RGBA(p) = GREEN_VAL_RGBA(colour);
@ -2013,16 +2013,16 @@ void Image::Fill( Rgb colour, int density, const Box *limits )
/* Convert the colour's RGBA subpixel order into the image's subpixel order */
colour = rgb_convert(colour,subpixelorder);
int lo_x = limits?limits->Lo().X():0;
int lo_y = limits?limits->Lo().Y():0;
int hi_x = limits?limits->Hi().X():width-1;
int hi_y = limits?limits->Hi().Y():height-1;
unsigned int lo_x = limits?limits->Lo().X():0;
unsigned int lo_y = limits?limits->Lo().Y():0;
unsigned int hi_x = limits?limits->Hi().X():width-1;
unsigned int hi_y = limits?limits->Hi().Y():height-1;
if ( colours == ZM_COLOUR_GRAY8 )
{
for ( int y = lo_y; y <= hi_y; y++ )
for ( unsigned int y = lo_y; y <= hi_y; y++ )
{
unsigned char *p = &buffer[(y*width)+lo_x];
for ( int x = lo_x; x <= hi_x; x++, p++)
for ( unsigned int x = lo_x; x <= hi_x; x++, p++)
{
if ( ( x == lo_x || x == hi_x || y == lo_y || y == hi_y ) || (!(x%density) && !(y%density) ) )
*p = colour;
@ -2031,10 +2031,10 @@ void Image::Fill( Rgb colour, int density, const Box *limits )
}
else if ( colours == ZM_COLOUR_RGB24 )
{
for ( int y = lo_y; y <= hi_y; y++ )
for ( unsigned int y = lo_y; y <= hi_y; y++ )
{
unsigned char *p = &buffer[colours*((y*width)+lo_x)];
for ( int x = lo_x; x <= hi_x; x++, p += 3)
for ( unsigned int x = lo_x; x <= hi_x; x++, p += 3)
{
if ( ( x == lo_x || x == hi_x || y == lo_y || y == hi_y ) || (!(x%density) && !(y%density) ) ) {
RED_PTR_RGBA(p) = RED_VAL_RGBA(colour);
@ -2046,11 +2046,11 @@ void Image::Fill( Rgb colour, int density, const Box *limits )
}
else if ( colours == ZM_COLOUR_RGB32 ) /* RGB32 */
{
for ( int y = lo_y; y <= hi_y; y++ )
for ( unsigned int y = lo_y; y <= hi_y; y++ )
{
Rgb* p = (Rgb*)&buffer[((y*width)+lo_x)<<2];
for ( int x = lo_x; x <= hi_x; x++, p++)
for ( unsigned int x = lo_x; x <= hi_x; x++, p++)
{
if ( ( x == lo_x || x == hi_x || y == lo_y || y == hi_y ) || (!(x%density) && !(y%density) ) )
/* Fast, copies the entire pixel in a single pass */
@ -2346,16 +2346,16 @@ void Image::Rotate( int angle )
new_height = width;
new_width = height;
int line_bytes = new_width*colours;
unsigned int line_bytes = new_width*colours;
unsigned char *s_ptr = buffer;
if ( colours == ZM_COLOUR_GRAY8 )
{
unsigned char *d_ptr;
for ( int i = new_width-1; i >= 0; i-- )
for ( unsigned int i = new_width-1; i >= 0; i-- )
{
d_ptr = rotate_buffer+i;
for ( int j = new_height-1; j >= 0; j-- )
for ( unsigned int j = new_height-1; j >= 0; j-- )
{
*d_ptr = *s_ptr++;
d_ptr += line_bytes;
@ -2366,10 +2366,10 @@ void Image::Rotate( int angle )
{
Rgb* s_rptr = (Rgb*)s_ptr;
Rgb* d_rptr;
for ( int i = new_width-1; i >= 0; i-- )
for ( unsigned int i = new_width-1; i >= 0; i-- )
{
d_rptr = (Rgb*)(rotate_buffer+(i<<2));
for ( int j = new_height-1; j >= 0; j-- )
for ( unsigned int j = new_height-1; j >= 0; j-- )
{
*d_rptr = *s_rptr++;
d_rptr += new_width;
@ -2379,10 +2379,10 @@ void Image::Rotate( int angle )
else /* Assume RGB24 */
{
unsigned char *d_ptr;
for ( int i = new_width-1; i >= 0; i-- )
for ( unsigned int i = new_width-1; i >= 0; i-- )
{
d_ptr = rotate_buffer+(3*i);
for ( int j = new_height-1; j >= 0; j-- )
for ( unsigned int j = new_height-1; j >= 0; j-- )
{
*d_ptr = *s_ptr++;
*(d_ptr+1) = *s_ptr++;
@ -2433,16 +2433,16 @@ void Image::Rotate( int angle )
new_height = width;
new_width = height;
int line_bytes = new_width*colours;
unsigned int line_bytes = new_width*colours;
unsigned char *s_ptr = buffer+size;
if ( colours == ZM_COLOUR_GRAY8 )
{
unsigned char *d_ptr;
for ( int i = new_width-1; i >= 0; i-- )
for ( unsigned int i = new_width-1; i >= 0; i-- )
{
d_ptr = rotate_buffer+i;
for ( int j = new_height-1; j >= 0; j-- )
for ( unsigned int j = new_height-1; j >= 0; j-- )
{
s_ptr--;
*d_ptr = *s_ptr;
@ -2468,10 +2468,10 @@ void Image::Rotate( int angle )
else /* Assume RGB24 */
{
unsigned char *d_ptr;
for ( int i = new_width-1; i >= 0; i-- )
for ( unsigned int i = new_width-1; i >= 0; i-- )
{
d_ptr = rotate_buffer+(3*i);
for ( int j = new_height-1; j >= 0; j-- )
for ( unsigned int j = new_height-1; j >= 0; j-- )
{
*(d_ptr+2) = *(--s_ptr);
*(d_ptr+1) = *(--s_ptr);
@ -2493,8 +2493,8 @@ void Image::Flip( bool leftright )
{
uint8_t* flip_buffer = AllocBuffer(size);
int line_bytes = width*colours;
int line_bytes2 = 2*line_bytes;
unsigned int line_bytes = width*colours;
unsigned int line_bytes2 = 2*line_bytes;
if ( leftright )
{
// Horizontal flip, left to right
@ -2506,7 +2506,7 @@ void Image::Flip( bool leftright )
{
while( d_ptr < max_d_ptr )
{
for ( int j = 0; j < width; j++ )
for ( unsigned int j = 0; j < width; j++ )
{
s_ptr--;
*d_ptr++ = *s_ptr;
@ -2521,7 +2521,7 @@ void Image::Flip( bool leftright )
Rgb* max_d_rptr = (Rgb*)max_d_ptr;
while( d_rptr < max_d_rptr )
{
for ( int j = 0; j < width; j++ )
for ( unsigned int j = 0; j < width; j++ )
{
s_rptr--;
*d_rptr++ = *s_rptr;
@ -2533,7 +2533,7 @@ void Image::Flip( bool leftright )
{
while( d_ptr < max_d_ptr )
{
for ( int j = 0; j < width; j++ )
for ( unsigned int j = 0; j < width; j++ )
{
s_ptr -= 3;
*d_ptr++ = *s_ptr;
@ -2590,19 +2590,19 @@ void Image::Scale( unsigned int factor )
unsigned int last_h_index = 0;
unsigned int last_w_index = 0;
unsigned int h_index;
for ( int y = 0; y < height; y++ )
for ( unsigned int y = 0; y < height; y++ )
{
unsigned char *ps = &buffer[y*wc];
unsigned int w_count = ZM_SCALE_BASE/2;
unsigned int w_index;
last_w_index = 0;
for ( int x = 0; x < width; x++ )
for ( unsigned int x = 0; x < width; x++ )
{
w_count += factor;
w_index = w_count/ZM_SCALE_BASE;
for (unsigned int f = last_w_index; f < w_index; f++ )
{
for ( int c = 0; c < colours; c++ )
for ( unsigned int c = 0; c < colours; c++ )
{
*pd++ = *(ps+c);
}
@ -2650,7 +2650,7 @@ void Image::Scale( unsigned int factor )
if ( w_index > last_w_index )
{
for ( int c = 0; c < colours; c++ )
for ( unsigned int c = 0; c < colours; c++ )
{
*pd++ = *ps++;
}

View File

@ -136,12 +136,12 @@ protected:
static struct zm_error_mgr jpg_err;
protected:
int width;
int height;
int pixels;
int colours;
int size;
int subpixelorder;
unsigned int width;
unsigned int height;
unsigned int pixels;
unsigned int colours;
unsigned int size;
unsigned int subpixelorder;
unsigned long allocation;
uint8_t *buffer;
int buffertype; /* 0=not ours, no need to call free(), 1=malloc() buffer, 2=new buffer */
@ -158,18 +158,18 @@ public:
Image( const Image &p_image );
~Image();
inline int Width() const { return( width ); }
inline int Height() const { return( height ); }
inline int Pixels() const { return( pixels ); }
inline int Colours() const { return( colours ); }
inline int SubpixelOrder() const { return( subpixelorder ); }
inline int Size() const { return( size ); }
inline unsigned int Width() const { return( width ); }
inline unsigned int Height() const { return( height ); }
inline unsigned int Pixels() const { return( pixels ); }
inline unsigned int Colours() const { return( colours ); }
inline unsigned int SubpixelOrder() const { return( subpixelorder ); }
inline unsigned int Size() const { return( size ); }
/* Internal buffer should not be modified from functions outside of this class */
inline const uint8_t* Buffer() const { return( buffer ); }
inline const uint8_t* Buffer( unsigned int x, unsigned int y= 0 ) const { return( &buffer[colours*((y*width)+x)] ); }
/* Request writeable buffer */
uint8_t* WriteBuffer(const int p_width, const int p_height, const int p_colours, const int p_subpixelorder);
uint8_t* WriteBuffer(const unsigned int p_width, const unsigned int p_height, const unsigned int p_colours, const unsigned int p_subpixelorder);
inline int IsBufferHeld() const { return holdbuffer; }
inline void HoldBuffer(int tohold) { holdbuffer = tohold; }
@ -181,9 +181,9 @@ public:
width = height = colours = size = pixels = subpixelorder = 0;
}
void Assign( int p_width, int p_height, int p_colours, int p_subpixelorder, const uint8_t* new_buffer, const size_t buffer_size);
void Assign( unsigned int p_width, unsigned int p_height, unsigned int p_colours, unsigned int p_subpixelorder, const uint8_t* new_buffer, const size_t buffer_size);
void Assign( const Image &image );
void AssignDirect( const int p_width, const int p_height, const int p_colours, const int p_subpixelorder, uint8_t *new_buffer, const size_t buffer_size, const int p_buffertype);
void AssignDirect( const unsigned int p_width, const unsigned int p_height, const unsigned int p_colours, const unsigned int p_subpixelorder, uint8_t *new_buffer, const size_t buffer_size, const int p_buffertype);
inline void CopyBuffer( const Image &image )
{
@ -202,9 +202,9 @@ public:
bool ReadRaw( const char *filename );
bool WriteRaw( const char *filename ) const;
bool ReadJpeg( const char *filename, int p_colours, int p_subpixelorder);
bool ReadJpeg( const char *filename, unsigned int p_colours, unsigned int p_subpixelorder);
bool WriteJpeg( const char *filename, int quality_override=0 ) const;
bool DecodeJpeg( const JOCTET *inbuffer, int inbuffer_size, int p_colours, int p_subpixelorder);
bool DecodeJpeg( const JOCTET *inbuffer, int inbuffer_size, unsigned int p_colours, unsigned int p_subpixelorder);
bool EncodeJpeg( JOCTET *outbuffer, int *outbuffer_size, int quality_override=0 ) const;
#if HAVE_ZLIB_H
@ -212,24 +212,24 @@ public:
bool Zip( Bytef *outbuffer, unsigned long *outbuffer_size, int compression_level=Z_BEST_SPEED ) const;
#endif // HAVE_ZLIB_H
bool Crop( int lo_x, int lo_y, int hi_x, int hi_y );
bool Crop( unsigned int lo_x, unsigned int lo_y, unsigned int hi_x, unsigned int hi_y );
bool Crop( const Box &limits );
void Overlay( const Image &image );
void Overlay( const Image &image, int x, int y );
void Overlay( const Image &image, unsigned int x, unsigned int y );
void Blend( const Image &image, int transparency=12 );
static Image *Merge( int n_images, Image *images[] );
static Image *Merge( int n_images, Image *images[], double weight );
static Image *Highlight( int n_images, Image *images[], const Rgb threshold=RGB_BLACK, const Rgb ref_colour=RGB_RED );
static Image *Merge( unsigned int n_images, Image *images[] );
static Image *Merge( unsigned int n_images, Image *images[], double weight );
static Image *Highlight( unsigned int n_images, Image *images[], const Rgb threshold=RGB_BLACK, const Rgb ref_colour=RGB_RED );
//Image *Delta( const Image &image ) const;
void Delta( const Image &image, Image* targetimage) const;
const Coord centreCoord( const char *text ) const;
void Annotate( const char *p_text, const Coord &coord, const Rgb fg_colour=RGB_WHITE, const Rgb bg_colour=RGB_BLACK );
Image *HighlightEdges( Rgb colour, int p_colours, int p_subpixelorder, const Box *limits=0 );
Image *HighlightEdges( Rgb colour, unsigned int p_colours, unsigned int p_subpixelorder, const Box *limits=0 );
//Image *HighlightEdges( Rgb colour, const Polygon &polygon );
void Timestamp( const char *label, const time_t when, const Coord &coord );
void Colourise(const int p_reqcolours, const int p_reqsubpixelorder);
void Colourise(const unsigned int p_reqcolours, const unsigned int p_reqsubpixelorder);
void DeColourise();
void Clear() { memset( buffer, 0, size ); }

View File

@ -1073,7 +1073,7 @@ void LocalCamera::Terminate()
if ( v4l_version == 1 )
{
#if HAVE_LIBSWSCALE
for(unsigned int i=0; i < v4l1_data.frames.frames; i++) {
for(int i=0; i < v4l1_data.frames.frames; i++) {
/* Free capture pictures */
av_free(capturePictures[i]);
capturePictures[i] = NULL;

View File

@ -1086,7 +1086,7 @@ int RemoteCameraHttp::PreCapture()
int RemoteCameraHttp::Capture( Image &image )
{
int content_length = GetResponse();
unsigned int content_length = GetResponse();
if ( content_length == 0 )
{
Warning( "Unable to capture image, retrying" );

View File

@ -240,14 +240,14 @@ int main( int argc, char *argv[] )
{
n_bytes = read( sd, image_data+bytes_read, frame_header.image_length-bytes_read );
if (n_bytes < 0) break; // break on error
if (n_bytes < frame_header.image_length)
if (n_bytes < (int)frame_header.image_length)
{
// print some informational messages
if (bytes_read == 0)
{
// Warning("Image read : Short read %d bytes of %d expected bytes",n_bytes,frame_header.image_length);
}
else if (bytes_read+n_bytes == frame_header.image_length)
else if (bytes_read+n_bytes == (int)frame_header.image_length)
{
// Warning("Image read : Read rest of short read: %d bytes read total of %d bytes",n_bytes,frame_header.image_length);
}

View File

@ -2167,7 +2167,7 @@ function logState()
Logger::WARNING => array( ZM_LOG_ALERT_WAR_COUNT, ZM_LOG_ALARM_WAR_COUNT ),
);
$sql = "select Level, count(Level) as LevelCount from Logs where Level < ".Logger::INFO." and from_unixtime(TimeKey) + interval ".ZM_LOG_CHECK_PERIOD." second > now() group by Level order by Level asc";
$sql = "select Level, count(Level) as LevelCount from Logs where Level < ".Logger::INFO." and TimeKey > unix_timestamp(now() - interval ".ZM_LOG_CHECK_PERIOD." second) group by Level order by Level asc";
$counts = dbFetchAll( $sql );
foreach ( $counts as $count )