Репозиторий Sisyphus
Последнее обновление: 1 октября 2023 | Пакетов: 18631 | Посещений: 37550014
en ru br
Репозитории ALT
S:1.36.33-alt2
4.1: 1.23.3-alt2
www.altlinux.org/Changes

Группа :: Система/Серверы
Пакет: zoneminder

 Главная   Изменения   Спек   Патчи   Sources   Загрузить   Gear   Bugs and FR  Repocop 

Патч: zm1244.diff
Скачать


diff -Nrau ZoneMinder-1.24.4/Makefile.am ZoneMinder-1.24.4.new/Makefile.am
--- ZoneMinder-1.24.4/Makefile.am	2011-05-20 12:39:37.000000000 +0300
+++ ZoneMinder-1.24.4.new/Makefile.am	2011-08-10 04:09:00.952468090 +0300
@@ -21,9 +21,9 @@
 # Yes, you are correct. This is a HACK!
 install-data-hook:
 	( cd $(DESTDIR)$(sysconfdir); chown $(webuser):$(webgroup) $(sysconf_DATA); chmod 600 $(sysconf_DATA) )
-	( if ! test -e $(ZM_RUNDIR); then mkdir -p $(ZM_RUNDIR); fi; if test "$(ZM_RUNDIR)" != "/var/run"; then chown $(webuser):$(webgroup) $(ZM_RUNDIR); chmod u+w $(ZM_RUNDIR); fi )
-	( if ! test -e $(ZM_TMPDIR); then mkdir -m 700 -p $(ZM_TMPDIR); fi; if test "$(ZM_TMPDIR)" != "/tmp"; then chown $(webuser):$(webgroup) $(ZM_TMPDIR); chmod u+w $(ZM_TMPDIR); fi )
-	( if ! test -e $(ZM_LOGDIR); then mkdir -p $(ZM_LOGDIR); fi; if test "$(ZM_LOGDIR)" != "/var/log"; then chown $(webuser):$(webgroup) $(ZM_LOGDIR); chmod u+w $(ZM_LOGDIR); fi )
+	( if ! test -e $(DESTDIR)$(ZM_RUNDIR); then mkdir -p $(DESTDIR)$(ZM_RUNDIR); fi; if test "$(DESTDIR)$(ZM_RUNDIR)" != "/var/run"; then chown $(webuser):$(webgroup) $(DESTDIR)$(ZM_RUNDIR); chmod u+w $(DESTDIR)$(ZM_RUNDIR); fi )
+	( if ! test -e $(DESTDIR)$(ZM_TMPDIR); then mkdir -m 700 -p $(DESTDIR)$(ZM_TMPDIR); fi; if test "$(DESTDIR)$(ZM_TMPDIR)" != "/tmp"; then chown $(webuser):$(webgroup) $(DESTDIR)$(ZM_TMPDIR); chmod u+w $(DESTDIR)$(ZM_TMPDIR); fi )
+	( if ! test -e $(DESTDIR)$(ZM_LOGDIR); then mkdir -p $(DESTDIR)$(ZM_LOGDIR); fi; if test "$(DESTDIR)$(ZM_LOGDIR)" != "/var/log"; then chown $(webuser):$(webgroup) $(DESTDIR)$(ZM_LOGDIR); chmod u+w $(DESTDIR)$(ZM_LOGDIR); fi )
 
 uninstall-hook:
 	@-( cd $(DESTDIR)$(webdir); rm -rf events graphics images sounds temp )
diff -Nrau ZoneMinder-1.24.4/scripts/zm.in ZoneMinder-1.24.4.new/scripts/zm.in
--- ZoneMinder-1.24.4/scripts/zm.in	2010-11-28 23:22:05.000000000 +0200
+++ ZoneMinder-1.24.4.new/scripts/zm.in	2011-08-10 04:13:59.215274689 +0300
@@ -1,120 +1,138 @@
-#!/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
-# processname: zmpkg.pl
-
-# Source function library.
-. /etc/rc.d/init.d/functions
-
-prog=ZoneMinder
-ZM_CONFIG="@ZM_CONFIG@"
-pidfile="@ZM_RUNDIR@"
-LOCKFILE=/var/lock/subsys/zm
-
-loadconf()
-{
-	if [ -f $ZM_CONFIG ]; then
-		. $ZM_CONFIG
-	else
-		echo "ERROR: $ZM_CONFIG not found."
-		return 1
-	fi
-}
-
-loadconf
-command="$ZM_PATH_BIN/zmpkg.pl"
-
-start()
-{
-	zmupdate || return $?
-	loadconf || return $?
-	#Make sure the directory for our PID folder exists or create one.
-	[ ! -d $pidfile ] \
-		&& mkdir -m 774 $pidfile \
-		&& chown $ZM_WEB_USER:$ZM_WEB_GROUP $pidfile
-	#Make sure the folder for the socks file exists or create one
-	GetPath="select Value from Config where Name='ZM_PATH_SOCKS'"
-    dbHost=`echo $ZM_DB_HOST | cut -d: -f1`
-    dbPort=`echo $ZM_DB_HOST | cut -d: -s -f2`
-    if [ "$dbPort" = "" ]
-    then
-	    ZM_PATH_SOCK=`echo $GetPath | mysql -B -h$ZM_DB_HOST -u$ZM_DB_USER -p$ZM_DB_PASS $ZM_DB_NAME | grep -v '^Value'`
-    else
-	    ZM_PATH_SOCK=`echo $GetPath | mysql -B -h$dbHost -P$dbPort -u$ZM_DB_USER -p$ZM_DB_PASS $ZM_DB_NAME | grep -v '^Value'`
-    fi 
-	[ ! -d $ZM_PATH_SOCK ] \
-		&& mkdir -m 774 $ZM_PATH_SOCK \
-		&& chown $ZM_WEB_USER:$ZM_WEB_GROUP $ZM_PATH_SOCK
-	echo -n $"Starting $prog: "
-	$command start
-	RETVAL=$?
-	[ $RETVAL = 0 ] && success || failure
-	echo
-	[ $RETVAL = 0 ] && touch $LOCKFILE
-	return $RETVAL
-}
-
-stop()
-{
-	loadconf
-	echo -n $"Stopping $prog: "
-	$command stop
-	RETVAL=$?
-	[ $RETVAL = 0 ] && success || failure
-	echo
-	[ $RETVAL = 0 ] && rm -f $LOCKFILE
-}
-
-zmstatus()
-{
-	loadconf
-	result=`$command status`
-	if [ "$result" = "running" ]; then
-		echo "ZoneMinder is running"
-		$ZM_PATH_BIN/zmu -l
-		RETVAL=0
-	else
-		echo "ZoneMinder is stopped"
-		RETVAL=1
-	fi
-}
-
-zmupdate()
-{
-	if [ -x $ZM_PATH_BIN/zm_update ]; then
-		$ZM_PATH_BIN/zm_update -f
-	fi
-}
-
-
-case "$1" in
-	'start')
-		start
-		;;
-	'stop')
-		stop
-		;;
-	'restart')
-		stop
-		start
-		;;
-	'condrestart')
-		loadconf
-		result=`$ZM_PATH_BIN/zmdc.pl check`
-		if [ "$result" = "running" ]; then
-			$ZM_PATH_BIN/zmdc.pl shutdown > /dev/null
-			rm -f $LOCKFILE
-			start
-		fi
-		;;
-	'status')
-		status httpd
-		status mysqld
-		zmstatus
-		;;
-	*)
-		echo "Usage: $0 { start | stop | restart | condrestart | status }"
-		RETVAL=1
-		;;
-esac
-exit $RETVAL
+#!/bin/sh
+### BEGIN INIT INFO
+# Provides: zoneminder
+# Required-Start: $network
+# Required-Stop: $network
+# Default-Start: 3 4 5
+# Default-Stop: 0 1 6
+# Description: Startup script for ZoneMinder under ALTLinux
+# Short-Description: start and stop zoneminder
+### END INIT INFO
+#
+# chkconfig: 345 99 50
+# processname: zmpkg.pl
+# config: /etc/zm.conf
+#
+# Source function library.
+. /etc/rc.d/init.d/functions
+
+prog=ZoneMinder
+ZM_CONFIG="@ZM_CONFIG@"
+pidfile="@ZM_RUNDIR@"
+LOCKFILE=/var/lock/subsys/zm
+
+loadconf()
+{
+	if [ -f $ZM_CONFIG ]; then
+		. $ZM_CONFIG
+	else
+		echo "ERROR: $ZM_CONFIG not found."
+		return 1
+	fi
+}
+
+loadconf
+command="$ZM_PATH_BIN/zmpkg.pl"
+
+start()
+{
+	zmupdate || return $?
+	loadconf || return $?
+	#Make sure the directory for our PID folder exists or create one.
+	[ ! -d $pidfile ] \
+		&& mkdir -m 774 $pidfile \
+		&& chown $ZM_WEB_USER:$ZM_WEB_GROUP $pidfile
+	#Make sure the folder for the socks file exists or create one
+	GetPath="select Value from Config where Name='ZM_PATH_SOCKS'"
+    dbHost=`echo $ZM_DB_HOST | cut -d: -f1`
+    dbPort=`echo $ZM_DB_HOST | cut -d: -s -f2`
+    if [ "$dbPort" = "" ]
+    then
+	    ZM_PATH_SOCK=`echo $GetPath | mysql -B -h$ZM_DB_HOST -u$ZM_DB_USER -p$ZM_DB_PASS $ZM_DB_NAME | grep -v '^Value'`
+    else
+	    ZM_PATH_SOCK=`echo $GetPath | mysql -B -h$dbHost -P$dbPort -u$ZM_DB_USER -p$ZM_DB_PASS $ZM_DB_NAME | grep -v '^Value'`
+    fi 
+	[ ! -d $ZM_PATH_SOCK ] \
+		&& mkdir -m 774 $ZM_PATH_SOCK \
+		&& chown $ZM_WEB_USER:$ZM_WEB_GROUP $ZM_PATH_SOCK
+	echo -n $"Starting $prog: "
+	$command start
+	RETVAL=$?
+	[ $RETVAL = 0 ] && success || failure
+	echo
+	[ $RETVAL = 0 ] && touch $LOCKFILE
+	return $RETVAL
+}
+
+stop()
+{
+	loadconf
+	echo -n $"Stopping $prog: "
+	$command stop
+	RETVAL=$?
+	[ $RETVAL = 0 ] && success || failure
+	echo
+	[ $RETVAL = 0 ] && rm -f $LOCKFILE
+}
+
+zmstatus()
+{
+	loadconf
+	result=`$command status`
+	if [ "$result" = "running" ]; then
+		echo "ZoneMinder is running"
+		$ZM_PATH_BIN/zmu -l
+		RETVAL=0
+	else
+		echo "ZoneMinder is stopped"
+		RETVAL=1
+	fi
+}
+
+zmupdate()
+{
+	if [ -x $ZM_PATH_BIN/zm_update ]; then
+		$ZM_PATH_BIN/zm_update -f
+	fi
+}
+
+
+case "$1" in
+	'start')
+		start
+		;;
+	'stop')
+		stop
+		;;
+	'restart|reload')
+		stop
+		start
+		;;
+	'condrestart')
+		loadconf
+		result=`$ZM_PATH_BIN/zmdc.pl check`
+		if [ "$result" = "running" ]; then
+			$ZM_PATH_BIN/zmdc.pl shutdown > /dev/null
+			rm -f $LOCKFILE
+			start
+		fi
+		;;
+	'condstop')
+		loadconf
+		result=`$ZM_PATH_BIN/zmdc.pl check`
+		if [ "$result" = "running" ]; then
+			$ZM_PATH_BIN/zmdc.pl shutdown > /dev/null
+			rm -f $LOCKFILE
+		fi
+		;;
+	'status')
+		status httpd
+		status mysqld
+		zmstatus
+		;;
+	*)
+		echo "Usage: $0 { start | stop | restart | condrestart | condstop | status }"
+		RETVAL=1
+		;;
+esac
+exit $RETVAL
diff -Nrau ZoneMinder-1.24.4/src/zmf.cpp ZoneMinder-1.24.4.new/src/zmf.cpp
--- ZoneMinder-1.24.4/src/zmf.cpp	2009-04-14 23:18:57.000000000 +0300
+++ ZoneMinder-1.24.4.new/src/zmf.cpp	2011-08-10 04:09:00.952468090 +0300
@@ -231,16 +231,39 @@
 		}
 		Debug( 1, "Read frame header, expecting %ld bytes of image", frame_header.image_length );
 		static unsigned char image_data[ZM_MAX_IMAGE_SIZE];
-		n_bytes = read( sd, image_data, frame_header.image_length );
-		if ( n_bytes != (ssize_t)frame_header.image_length )
+
+                // Read for pipe and loop until bytes expected have been read or an error occures
+                int bytes_read = 0;
+                do
 		{
-			if ( n_bytes < 0 )
+                        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)
 			{
-				Error( "Can't read frame image data: %s", strerror(errno) );
+                                // 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)
+                                {
+                                        Warning("Image read : Read rest of short read: %d bytes read total of %d bytes",n_bytes,frame_header.image_length);
+                                }
+                                else
+                                {
+                                        Warning("Image read : continuing, read %d bytes (%d so far)", n_bytes, bytes_read+n_bytes);
+                                }
 			}
-			else if ( n_bytes > 0 )
+                        bytes_read+= n_bytes;
+                } while (n_bytes>0 && (bytes_read < (ssize_t)frame_header.image_length) );
+
+                // Print errors if there was a problem
+                if ( n_bytes < 1 )
+                {
+                        Error( "Only read %d bytes of %d\n", bytes_read, frame_header.image_length);
+                        if ( n_bytes < 0 )
 			{
-				Error( "Incomplete read of frame image data, %d bytes only", n_bytes );
+                                Error( "Can't read frame image data: %s", strerror(errno) );
 			}
 			else
 			{
@@ -249,16 +272,18 @@
 			ReopenSocket( sd, monitor->Id() );
 			continue;
 		}
+
 		static char subpath[PATH_MAX] = "";
-        if ( config.use_deep_storage )
-        {
-            struct tm *time = localtime( &frame_header.event_time );
-            snprintf( subpath, sizeof(subpath), "%02d/%02d/%02d/%02d/%02d/%02d", time->tm_year-100, time->tm_mon+1, time->tm_mday, time->tm_hour, time->tm_min, time->tm_sec );
-        }
-        else
-        {
-            snprintf( subpath, sizeof(subpath), "%ld", frame_header.event_id );
-        }
+                if ( config.use_deep_storage )
+                {
+                    struct tm *time = localtime( &frame_header.event_time );
+                    snprintf( subpath, sizeof(subpath), "%02d/%02d/%02d/%02d/%02d/%02d", time->tm_year-100, time->tm_mon+1, time->tm_mday, time->tm_hour, time->tm_min, time->tm_sec );
+                }
+                else
+                {
+                    snprintf( subpath, sizeof(subpath), "%ld", frame_header.event_id );
+                }
+
 		static char path[PATH_MAX] = "";
 		snprintf( path, sizeof(path), frame_header.alarm_frame?anal_path:capt_path, subpath, frame_header.frame_id );
 		Debug( 1, "Got image, writing to %s", path );
diff -Nrau ZoneMinder-1.24.4/src/zm_ffmpeg_camera.cpp ZoneMinder-1.24.4.new/src/zm_ffmpeg_camera.cpp
--- ZoneMinder-1.24.4/src/zm_ffmpeg_camera.cpp	2011-05-17 01:36:02.000000000 +0300
+++ ZoneMinder-1.24.4.new/src/zm_ffmpeg_camera.cpp	2011-08-10 04:09:00.952468090 +0300
@@ -19,6 +19,10 @@
 
 #include "zm.h"
 
+#ifndef errno
+#include <errno.h>
+#endif // errno
+
 #if HAVE_LIBAVFORMAT
 
 #include "zm_ffmpeg_camera.h"
diff -Nrau ZoneMinder-1.24.4/src/zm_local_camera.cpp ZoneMinder-1.24.4.new/src/zm_local_camera.cpp
--- ZoneMinder-1.24.4/src/zm_local_camera.cpp	2011-02-17 11:31:33.000000000 +0200
+++ ZoneMinder-1.24.4.new/src/zm_local_camera.cpp	2011-08-10 04:09:00.952468090 +0300
@@ -116,7 +116,9 @@
             case V4L2_PIX_FMT_NV21 :
             case V4L2_PIX_FMT_YYUV :
             case V4L2_PIX_FMT_HI240 :
+#ifdef V4L2_PIX_FMT_HM12
             case V4L2_PIX_FMT_HM12 :
+#endif // V4L2_PIX_FMT_HM12
             //case V4L2_PIX_FMT_SBGGR8 :
             //case V4L2_PIX_FMT_SGBRG8 :
             //case V4L2_PIX_FMT_SBGGR16 :
@@ -125,9 +127,15 @@
             case V4L2_PIX_FMT_MPEG :
             case V4L2_PIX_FMT_WNVA :
             case V4L2_PIX_FMT_SN9C10X :
+#ifdef V4L2_PIX_FMT_PWC1
             case V4L2_PIX_FMT_PWC1 :
+#endif // V4L2_PIX_FMT_PWC1
+#ifdef V4L2_PIX_FMT_PWC2
             case V4L2_PIX_FMT_PWC2 :
+#endif // V4L2_PIX_FMT_PWC2
+#ifdef V4L2_PIX_FMT_ET61X251
             case V4L2_PIX_FMT_ET61X251 :
+#endif // V4L2_PIX_FMT_ET61X251
             //case V4L2_PIX_FMT_SPCA501 :
             //case V4L2_PIX_FMT_SPCA505 :
             //case V4L2_PIX_FMT_SPCA508 :
@@ -827,8 +835,16 @@
                     capString( vid_cap.capabilities&V4L2_CAP_VIDEO_OVERLAY,         "    ", "Supports", "Does not support", "frame buffer overlay" ),
                     capString( vid_cap.capabilities&V4L2_CAP_VBI_CAPTURE,           "    ", "Supports", "Does not support", "VBI capture" ),
                     capString( vid_cap.capabilities&V4L2_CAP_VBI_OUTPUT,            "    ", "Supports", "Does not support", "VBI output" ),
+#ifdef V4L2_CAP_SLICED_VBI_CAPTURE
                     capString( vid_cap.capabilities&V4L2_CAP_SLICED_VBI_CAPTURE,    "    ", "Supports", "Does not support", "sliced VBI capture" ),
+#else // V4L2_CAP_SLICED_VBI_CAPTURE
+                    "",
+#endif // V4L2_CAP_SLICED_VBI_CAPTURE
+#ifdef V4L2_CAP_SLICED_VBI_OUTPUT
                     capString( vid_cap.capabilities&V4L2_CAP_SLICED_VBI_OUTPUT,     "    ", "Supports", "Does not support", "sliced VBI output" ),
+#else // V4L2_CAP_SLICED_VBI_OUTPUT
+                    "",
+#endif // V4L2_CAP_SLICED_VBI_OUTPUT
 #ifdef V4L2_CAP_VIDEO_OUTPUT_OVERLAY
                     capString( vid_cap.capabilities&V4L2_CAP_VIDEO_OUTPUT_OVERLAY,  "    ", "Supports", "Does not support", "video output overlay" ),
 #else // V4L2_CAP_VIDEO_OUTPUT_OVERLAY
diff -Nrau ZoneMinder-1.24.4/src/zm_mpeg.cpp ZoneMinder-1.24.4.new/src/zm_mpeg.cpp
--- ZoneMinder-1.24.4/src/zm_mpeg.cpp	2011-05-15 23:39:06.000000000 +0300
+++ ZoneMinder-1.24.4.new/src/zm_mpeg.cpp	2011-08-10 04:09:00.952468090 +0300
@@ -23,6 +23,10 @@
 #include "zm.h"
 #include "zm_mpeg.h"
 
+#ifndef errno
+#include <errno.h>
+#endif // errno
+
 #if HAVE_LIBAVCODEC
 
 bool VideoStream::initialised = false;
diff -Nrau ZoneMinder-1.24.4/src/zm_utils.cpp ZoneMinder-1.24.4.new/src/zm_utils.cpp
--- ZoneMinder-1.24.4/src/zm_utils.cpp	2009-11-24 13:41:16.000000000 +0200
+++ ZoneMinder-1.24.4.new/src/zm_utils.cpp	2011-08-10 04:09:00.952468090 +0300
@@ -22,6 +22,12 @@
 
 #include <stdio.h>
 #include <stdarg.h>
+#include <cstdio>
+#include <cstdarg>
+
+namespace std {
+   using namespace __gnu_cxx;
+}
 
 const std::string stringtf( const char *format, ... )
 {
diff -Nrau ZoneMinder-1.24.4/web/includes/database.php ZoneMinder-1.24.4.new/web/includes/database.php
--- ZoneMinder-1.24.4/web/includes/database.php	2010-05-27 15:18:06.000000000 +0300
+++ ZoneMinder-1.24.4.new/web/includes/database.php	2011-08-10 04:09:00.952468090 +0300
@@ -207,7 +207,7 @@
 
 function getTableAutoInc( $table )
 {
-    $sql = "show table status where Name = '".dbEscape($table)."'";
+    $sql = "show table status like '".dbEscape($table)."'";
     $row = dbFetchOne( $sql );
     return( $row['Auto_increment'] );
 }
diff -Nrau ZoneMinder-1.24.4/web/index.php ZoneMinder-1.24.4.new/web/index.php
--- ZoneMinder-1.24.4/web/index.php	2009-11-19 10:13:07.000000000 +0200
+++ ZoneMinder-1.24.4.new/web/index.php	2011-08-10 04:09:00.952468090 +0300
@@ -18,14 +18,18 @@
 // Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA  02111-1307, USA.
 // 
 
-error_reporting( E_ALL );
+error_reporting(E_ALL ^ (E_NOTICE | E_DEPRECATED));
 
 $debug = false;
 if ( $debug )
 {
     // Use these for debugging, though not both at once!
     phpinfo( INFO_VARIABLES );
-    //error_reporting( E_ALL );
+    //error_reporting(E_ALL ^ (E_NOTICE | E_DEPRECATED));
+}
+
+if ( version_compare( phpversion(), "5.1", ">=") ) { 
+   date_default_timezone_set('UTC'); 
 }
 
 // Use new style autoglobals where possible
diff -Nrau ZoneMinder-1.24.4/web/skins/classic/views/js/event.js ZoneMinder-1.24.4.new/web/skins/classic/views/js/event.js
--- ZoneMinder-1.24.4/web/skins/classic/views/js/event.js	2011-02-06 20:57:05.000000000 +0200
+++ ZoneMinder-1.24.4.new/web/skins/classic/views/js/event.js	2011-08-10 04:09:00.952468090 +0300
@@ -12,7 +12,8 @@
     var newWidth = ( baseWidth * scale ) / SCALE_BASE;
     var newHeight = ( baseHeight * scale ) / SCALE_BASE;
 
-    streamScale( scale );
+    // This is command being sent to the streamer (zms) to change the resolution, which should save bandwidth when decreasing the size, but can kill streams with certain browsers. This line is already commented out for live streams, but not for events, and thats why we are commenting it out.
+	//    streamScale( scale );
 
     /*Stream could be an applet so can't use moo tools*/ 
     var streamImg = document.getElementById('evtStream');
@@ -243,6 +244,7 @@
             $('unarchiveEvent').addClass( 'hidden' );
         }
     }
+    }
     //var eventImg = $('eventImage');
     //eventImg.setStyles( { 'width': eventData.width, 'height': eventData.height } );
     drawProgressBar();
 
дизайн и разработка: Vladimir Lettiev aka crux © 2004-2005, Andrew Avramenko aka liks © 2007-2008
текущий майнтейнер: Michael Shigorin