From c5288a172dc9ac7fe665523243b62cfde82f1c99 Mon Sep 17 00:00:00 2001 From: Isaac Connor Date: Tue, 30 May 2017 11:57:20 -0400 Subject: [PATCH 01/60] fix merge problem --- web/includes/functions.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/web/includes/functions.php b/web/includes/functions.php index 37dd33d91..dd248f4c4 100644 --- a/web/includes/functions.php +++ b/web/includes/functions.php @@ -2196,7 +2196,7 @@ function getStreamHTML( $monitor, $options = array() ) { //FIXME, the width and height of the image need to be scaled. if ( ZM_WEB_STREAM_METHOD == 'mpeg' && ZM_MPEG_LIVE_FORMAT ) { - $streamSrc = $monitor->getStreamSrc( array( 'mode'=>'mpeg', 'scale'=>$scale, 'bitrate'=>ZM_WEB_VIDEO_BITRATE, 'maxfps'=>ZM_WEB_VIDEO_MAXFPS, 'format'=>ZM_MPEG_LIVE_FORMAT ) ); + $streamSrc = $monitor->getStreamSrc( array( 'mode'=>'mpeg', 'scale'=>$options['scale'], 'bitrate'=>ZM_WEB_VIDEO_BITRATE, 'maxfps'=>ZM_WEB_VIDEO_MAXFPS, 'format'=>ZM_MPEG_LIVE_FORMAT ) ); return getVideoStream( 'liveStream'.$monitor->Id(), $streamSrc, $options, ZM_MPEG_LIVE_FORMAT, $monitor->Name() ); } else if ( $options['mode'] == 'stream' and canStream() ) { $options['mode'] = 'jpeg'; From e9a0474cf7e58e9b9f648008ea38743db2aa0584 Mon Sep 17 00:00:00 2001 From: Isaac Connor Date: Tue, 30 May 2017 12:04:12 -0400 Subject: [PATCH 02/60] add back required lines with a comment --- web/includes/functions.php | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/web/includes/functions.php b/web/includes/functions.php index dd248f4c4..0457b3667 100644 --- a/web/includes/functions.php +++ b/web/includes/functions.php @@ -27,6 +27,10 @@ if ( version_compare( phpversion(), '4.3.0', '<') ) { } } +# We are requiring these because this file is getting included from the api, which hasn't already included them. +require_once( 'logger.php' ); +require_once( 'database.php' ); + function userLogin( $username, $password='', $passwordHashed=false ) { global $user, $cookies; From c7b52bd9980c1fd9cdad0199b5242979497d5a46 Mon Sep 17 00:00:00 2001 From: Isaac Connor Date: Tue, 30 May 2017 13:14:43 -0400 Subject: [PATCH 03/60] fix logging dirs --- web/api/app/Config/bootstrap.php.in | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/web/api/app/Config/bootstrap.php.in b/web/api/app/Config/bootstrap.php.in index ac3bcb62c..a2bfe9c26 100644 --- a/web/api/app/Config/bootstrap.php.in +++ b/web/api/app/Config/bootstrap.php.in @@ -100,12 +100,12 @@ App::uses('CakeLog', 'Log'); CakeLog::config('debug', array( 'engine' => 'File', 'types' => array('notice', 'info', 'debug'), - 'file' => 'cake_debug', + 'file' => '@ZM_LOGDIR@/cake_debug', )); CakeLog::config('error', array( 'engine' => 'File', 'types' => array('warning', 'error', 'critical', 'alert', 'emergency'), - 'file' => 'cake_error', + 'file' => '@ZM_LOGDIR@/cake_error', )); CakeLog::config('custom_path', array( 'engine' => 'File', From 1a4333411381d7622c8e82845c110fa78e88c345 Mon Sep 17 00:00:00 2001 From: Isaac Connor Date: Tue, 30 May 2017 13:38:57 -0400 Subject: [PATCH 04/60] Use NULLs instead of '' when saving things --- web/includes/functions.php | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/web/includes/functions.php b/web/includes/functions.php index 0457b3667..023f9fe10 100644 --- a/web/includes/functions.php +++ b/web/includes/functions.php @@ -705,7 +705,11 @@ function getFormChanges( $values, $newValues, $types=false, $columns=false ) { default : { if ( !isset($values[$key]) || ($values[$key] != $value) ) { - $changes[$key] = $key . ' = '.dbEscape(trim($value)); + if ( ! isset($value) || $value == '' ) { + $changes[$key] = "$key = NULL"; + } else { + $changes[$key] = $key . ' = '.dbEscape(trim($value)); + } } break; } From 8b3b9eb30e4c54f56f250a79e1382da0f5f508f1 Mon Sep 17 00:00:00 2001 From: Isaac Connor Date: Tue, 30 May 2017 13:47:30 -0400 Subject: [PATCH 05/60] more merges/fixes from SA --- web/includes/Frame.php | 6 +- web/skins/classic/views/events.php | 170 ++- web/skins/classic/views/frame.php | 53 +- web/skins/classic/views/js/timeline.js | 14 +- web/skins/classic/views/monitor.php | 1343 ++++++++++++------------ web/views/image.php | 247 +++-- 6 files changed, 944 insertions(+), 889 deletions(-) diff --git a/web/includes/Frame.php b/web/includes/Frame.php index eaec94c58..5a31b3dc3 100644 --- a/web/includes/Frame.php +++ b/web/includes/Frame.php @@ -27,9 +27,11 @@ class Frame { Error("No row for Frame " . $IdOrRow ); } } // end function __construct + public function Storage() { return $this->Event()->Storage(); } + public function Event() { return new Event( $this->{'EventId'} ); } @@ -70,7 +72,9 @@ class Frame { } public function getImageSrc( $show='capture' ) { - return $_SERVER['PHP_SELF'].'?view=image&fid='.$this->{'Id'}.'&show='.$show.'&filename='.$this->Event()->MonitorId().'_'.$this->{'EventId'}.'_'.$this->{'FrameId'}.'.jpg'; + + return $_SERVER['PHP_SELF'].'?view=image&fid='.$this->{'FrameId'}.'&eid='.$this->{'EventId'}.'&show='.$show; + #return $_SERVER['PHP_SELF'].'?view=image&fid='.$this->{'Id'}.'&show='.$show.'&filename='.$this->Event()->MonitorId().'_'.$this->{'EventId'}.'_'.$this->{'FrameId'}.'.jpg'; } // end function getImageSrc public static function find( $parameters = array(), $limit = NULL ) { diff --git a/web/skins/classic/views/events.php b/web/skins/classic/views/events.php index defc75272..e1747c5b9 100644 --- a/web/skins/classic/views/events.php +++ b/web/skins/classic/views/events.php @@ -18,76 +18,70 @@ // Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. // -if ( !canView( 'Events' ) || (!empty($_REQUEST['execute']) && !canEdit('Events')) ) -{ - $view = "error"; - return; +if ( !canView( 'Events' ) || (!empty($_REQUEST['execute']) && !canEdit('Events')) ) { + $view = 'error'; + return; } require_once( 'includes/Event.php' ); -if ( !empty($_REQUEST['execute']) ) -{ - executeFilter( $tempFilterName ); +if ( !empty($_REQUEST['execute']) ) { + executeFilter( $tempFilterName ); } $countSql = 'SELECT count(E.Id) AS EventCount FROM Monitors AS M INNER JOIN Events AS E ON (M.Id = E.MonitorId) WHERE'; -$eventsSql = 'SELECT E.*,M.Name AS MonitorName FROM Monitors AS M INNER JOIN Events AS E on (M.Id = E.MonitorId) WHERE'; +$eventsSql = 'SELECT E.*,M.Name AS MonitorName,M.DefaultScale FROM Monitors AS M INNER JOIN Events AS E on (M.Id = E.MonitorId) WHERE'; if ( $user['MonitorIds'] ) { $user_monitor_ids = ' M.Id in ('.$user['MonitorIds'].')'; $countSql .= $user_monitor_ids; $eventsSql .= $user_monitor_ids; } else { - $countSql .= " 1"; - $eventsSql .= " 1"; + $countSql .= " 1"; + $eventsSql .= " 1"; } parseSort(); parseFilter( $_REQUEST['filter'] ); $filterQuery = $_REQUEST['filter']['query']; -if ( $_REQUEST['filter']['sql'] ) -{ - $countSql .= $_REQUEST['filter']['sql']; - $eventsSql .= $_REQUEST['filter']['sql']; +if ( $_REQUEST['filter']['sql'] ) { + $countSql .= $_REQUEST['filter']['sql']; + $eventsSql .= $_REQUEST['filter']['sql']; } $eventsSql .= " ORDER BY $sortColumn $sortOrder"; if ( isset($_REQUEST['page']) ) - $page = validInt($_REQUEST['page']); + $page = validInt($_REQUEST['page']); else - $page = 0; + $page = 0; if ( isset($_REQUEST['limit']) ) - $limit = validInt($_REQUEST['limit']); + $limit = validInt($_REQUEST['limit']); else - $limit = 0; + $limit = 0; $nEvents = dbFetchOne( $countSql, 'EventCount' ); -if ( !empty($limit) && $nEvents > $limit ) -{ - $nEvents = $limit; +if ( !empty($limit) && $nEvents > $limit ) { + $nEvents = $limit; } $pages = (int)ceil($nEvents/ZM_WEB_EVENTS_PER_PAGE); if ( !empty($page) ) { - if ( $page < 0 ) - $page = 1; - if ( $page > $pages ) - $page = $pages; + if ( $page < 0 ) + $page = 1; + else if ( $page > $pages ) + $page = $pages; } + if ( !empty($page) ) { - $limitStart = (($page-1)*ZM_WEB_EVENTS_PER_PAGE); - if ( empty( $limit ) ) - { - $limitAmount = ZM_WEB_EVENTS_PER_PAGE; - } - else - { - $limitLeft = $limit - $limitStart; - $limitAmount = ($limitLeft>ZM_WEB_EVENTS_PER_PAGE)?ZM_WEB_EVENTS_PER_PAGE:$limitLeft; - } - $eventsSql .= " limit $limitStart, $limitAmount"; + $limitStart = (($page-1)*ZM_WEB_EVENTS_PER_PAGE); + if ( empty( $limit ) ) { + $limitAmount = ZM_WEB_EVENTS_PER_PAGE; + } else { + $limitLeft = $limit - $limitStart; + $limitAmount = ($limitLeft>ZM_WEB_EVENTS_PER_PAGE)?ZM_WEB_EVENTS_PER_PAGE:$limitLeft; + } + $eventsSql .= " limit $limitStart, $limitAmount"; } elseif ( !empty( $limit ) ) { - $eventsSql .= " limit 0, ".$limit; + $eventsSql .= ' limit 0, '.$limit; } $maxWidth = 0; @@ -95,20 +89,19 @@ $maxHeight = 0; $archived = false; $unarchived = false; $events = array(); -foreach ( dbFetchAll( $eventsSql ) as $event_row ) -{ - $events[] = $event = new Event( $event_row ); +foreach ( dbFetchAll( $eventsSql ) as $event_row ) { + $events[] = $event = new Event( $event_row ); - # Doesn this code do anything? - $scale = max( reScale( SCALE_BASE, $event->DefaultScale(), ZM_WEB_DEFAULT_SCALE ), SCALE_BASE ); - $eventWidth = reScale( $event_row['Width'], $scale ); - $eventHeight = reScale( $event_row['Height'], $scale ); - if ( $maxWidth < $eventWidth ) $maxWidth = $eventWidth; - if ( $maxHeight < $eventHeight ) $maxHeight = $eventHeight; - if ( $event_row['Archived'] ) - $archived = true; - else - $unarchived = true; +# Doesn this code do anything? + $scale = max( reScale( SCALE_BASE, $event->DefaultScale(), ZM_WEB_DEFAULT_SCALE ), SCALE_BASE ); + $eventWidth = reScale( $event_row['Width'], $scale ); + $eventHeight = reScale( $event_row['Height'], $scale ); + if ( $maxWidth < $eventWidth ) $maxWidth = $eventWidth; + if ( $maxHeight < $eventHeight ) $maxHeight = $eventHeight; + if ( $event_row['Archived'] ) + $archived = true; + else + $unarchived = true; } $maxShortcuts = 5; @@ -124,20 +117,16 @@ xhtmlHeaders(__FILE__, translate('Events') ); From 555a6670357f9e627575023de591def6f5f3bcd6 Mon Sep 17 00:00:00 2001 From: Isaac Connor Date: Fri, 2 Jun 2017 12:12:59 -0400 Subject: [PATCH 45/60] fix filter button --- web/skins/classic/views/console.php | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/web/skins/classic/views/console.php b/web/skins/classic/views/console.php index 8de087281..ede536295 100644 --- a/web/skins/classic/views/console.php +++ b/web/skins/classic/views/console.php @@ -331,7 +331,7 @@ echo $Server->Name(); - + - + + + + From a9268d10e33400ba55e14f6b6cf956e2b223785e Mon Sep 17 00:00:00 2001 From: Isaac Connor Date: Fri, 2 Jun 2017 12:21:12 -0400 Subject: [PATCH 46/60] fix the use of ZM_OPT constants in javascript. Instead, check for existence of the element in the form. --- web/skins/classic/views/js/filter.js | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/web/skins/classic/views/js/filter.js b/web/skins/classic/views/js/filter.js index 599a3c589..385ef3c7e 100644 --- a/web/skins/classic/views/js/filter.js +++ b/web/skins/classic/views/js/filter.js @@ -7,13 +7,13 @@ function updateButtons( element ) { var canExecute = false; if ( form.elements['AutoArchive'].checked ) canExecute = true; - else if ( typeof ZM_OPT_FFMPEG !== "undefined" && form.elements['AutoVideo'].checked ) + else if ( form.elements['AutoVideo'] && form.elements['AutoVideo'].checked ) canExecute = true; - else if ( typeof ZM_OPT_UPLOAD !== "undefined" && form.elements['AutoUpload'].checked ) + else if ( form.elements['AutoUpload'] && form.elements['AutoUpload'].checked ) canExecute = true; - else if ( typeof ZM_OPT_EMAIL !== "undefined" && form.elements['AutoEmail'].checked ) + else if ( form.elements['AutoEmail'] && form.elements['AutoEmail'].checked ) canExecute = true; - else if ( typeof ZM_OPT_MESSAGE !== "undefined" && form.elements['AutoMessage'].checked ) + else if ( form.elements['AutoMessage'] && form.elements['AutoMessage'].checked ) canExecute = true; else if ( form.elements['AutoExecute'].checked && form.elements['AutoExecuteCmd'].value != '' ) canExecute = true; From 71b9ca97c61988bd95bfc870fd9d5997881b8a93 Mon Sep 17 00:00:00 2001 From: Isaac Connor Date: Fri, 2 Jun 2017 12:25:26 -0400 Subject: [PATCH 47/60] no need to store filters as an array ref --- scripts/zmfilter.pl.in | 32 ++++++++++++++++---------------- 1 file changed, 16 insertions(+), 16 deletions(-) diff --git a/scripts/zmfilter.pl.in b/scripts/zmfilter.pl.in index 4538c099c..a508473bf 100644 --- a/scripts/zmfilter.pl.in +++ b/scripts/zmfilter.pl.in @@ -153,7 +153,7 @@ if ( !$filter_parm ) { sleep( START_DELAY ); } -my $filters; +my @filters; my $last_action = 0; while( 1 ) { @@ -161,14 +161,14 @@ while( 1 ) { if ( ($now - $last_action) > $Config{ZM_FILTER_RELOAD_DELAY} ) { Debug( "Reloading filters\n" ); $last_action = $now; - $filters = getFilters( $filter_parm ); + @filters = getFilters( $filter_parm ); } - foreach my $filter ( @$filters ) { + foreach my $filter ( @filters ) { checkFilter( $filter ); } - last if ( $filter_parm ); + last if $filter_parm; Debug( "Sleeping for $delay seconds\n" ); sleep( $delay ); @@ -203,19 +203,19 @@ sub getFilters { or Fatal( "Can't execute '$sql': ".$sth->errstr() ); } FILTER: while( my $db_filter = $sth->fetchrow_hashref() ) { - my $filter = new ZoneMinder::Filter( $$db_filter{Id}, $db_filter ); - Debug( "Found filter '$db_filter->{Name}'\n" ); - my $sql = $filter->Sql(); + my $filter = new ZoneMinder::Filter( $$db_filter{Id}, $db_filter ); + Debug( "Found filter '$db_filter->{Name}'\n" ); + my $sql = $filter->Sql(); - if ( ! $sql ) { - Error( "Error parsing Sql. skipping filter '$db_filter->{Name}'\n" ); - next FILTER; - } - push( @filters, $filter ); - } - $sth->finish(); - Debug( 'Got ' . @filters . ' filters' ); - return( \@filters ); + if ( ! $sql ) { + Error( "Error parsing Sql. skipping filter '$db_filter->{Name}'\n" ); + next FILTER; + } + push( @filters, $filter ); + } + $sth->finish(); + Debug( 'Got ' . @filters . ' filters' ); + return( @filters ); } sub checkFilter { From b6b4738b9fb945189f605db82355d7f84769bd99 Mon Sep 17 00:00:00 2001 From: Isaac Connor Date: Fri, 2 Jun 2017 12:31:54 -0400 Subject: [PATCH 48/60] fix quotes --- scripts/zmfilter.pl.in | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/scripts/zmfilter.pl.in b/scripts/zmfilter.pl.in index a508473bf..aeb11b509 100644 --- a/scripts/zmfilter.pl.in +++ b/scripts/zmfilter.pl.in @@ -794,7 +794,7 @@ sub sendMessage { my $event = shift; if ( ! $Config{ZM_FROM_EMAIL} ) { - Error( 'No 'from' email address defined, not sending message' ); + Error( "No 'from' email address defined, not sending message" ); return( 0 ); } if ( ! $Config{ZM_MESSAGE_ADDRESS} ) { From 8b91403c256955ea90233d7a4454eb25069e519b Mon Sep 17 00:00:00 2001 From: Isaac Connor Date: Fri, 2 Jun 2017 12:32:02 -0400 Subject: [PATCH 49/60] remove references to Storage object --- scripts/zmaudit.pl.in | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/scripts/zmaudit.pl.in b/scripts/zmaudit.pl.in index c671e9989..58b4a2739 100644 --- a/scripts/zmaudit.pl.in +++ b/scripts/zmaudit.pl.in @@ -185,11 +185,11 @@ MAIN: while( $loop ) { Debug( "Checking day dir $day_dir" ); ( $day_dir ) = ( $day_dir =~ /^(.*)$/ ); # De-taint if ( ! chdir( $day_dir ) ) { - Error( "Can't chdir to '$$Storage{Path}/$day_dir': $!" ); + Error( "Can't chdir to '$day_dir': $!" ); next; } if ( ! opendir( DIR, '.' ) ) { - Error( "Can't open directory '$$Storage{Path}/$day_dir': $!" ); + Error( "Can't open directory '$day_dir': $!" ); next; } From 9c9eaa6851fbdc2470202d6fdfe979cbe4f10068 Mon Sep 17 00:00:00 2001 From: Isaac Connor Date: Fri, 2 Jun 2017 12:35:01 -0400 Subject: [PATCH 50/60] move test for MIN_AGE up. Don't need to constantly check for it because it won't change. --- scripts/zmaudit.pl.in | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/scripts/zmaudit.pl.in b/scripts/zmaudit.pl.in index 58b4a2739..6cf2af2e3 100644 --- a/scripts/zmaudit.pl.in +++ b/scripts/zmaudit.pl.in @@ -111,6 +111,10 @@ if ( ($report + $interactive + $continuous) > 1 ) { pod2usage(-exitstatus => -1); } +if ( ! exists $Config{ZM_AUDIT_MIN_AGE} ) { + Fatal('ZM_AUDIT_MIN_AGE is not set in config.'); +} + my $dbh = zmDbConnect(); chdir( EVENT_PATH ); @@ -145,12 +149,8 @@ MAIN: while( $loop ) { sleep 1; } # end if - if ( ! exists $Config{ZM_AUDIT_MIN_AGE} ) { - Fatal('ZM_AUDIT_MIN_AGE is not set in config.'); - } - my $db_monitors; - my $monitorSelectSql = "select Id from Monitors order by Id"; + my $monitorSelectSql = 'select Id from Monitors order by Id'; my $monitorSelectSth = $dbh->prepare_cached( $monitorSelectSql ) or Fatal( "Can't prepare '$monitorSelectSql': ".$dbh->errstr() ); my $eventSelectSql = 'SELECT Id, (unix_timestamp() - unix_timestamp(StartTime)) as Age From b5c0a0eae2930fd60478995ea8188a627741dca5 Mon Sep 17 00:00:00 2001 From: Isaac Connor Date: Fri, 2 Jun 2017 12:40:32 -0400 Subject: [PATCH 51/60] the contents of these are not being maintained and should be generated by scripts --- distros/ubuntu1204/NEWS | 10 - distros/ubuntu1204/changelog | 573 ----------------------------------- 2 files changed, 583 deletions(-) delete mode 100644 distros/ubuntu1204/NEWS delete mode 100644 distros/ubuntu1204/changelog diff --git a/distros/ubuntu1204/NEWS b/distros/ubuntu1204/NEWS deleted file mode 100644 index 6200726cf..000000000 --- a/distros/ubuntu1204/NEWS +++ /dev/null @@ -1,10 +0,0 @@ -zoneminder (1.28.1-1) unstable; urgency=low - - This version is no longer automatically initialize or upgrade database. - See README.Debian for details. - - Changed installation paths (please correct your web server configuration): - /usr/share/zoneminder --> /usr/share/zoneminder/www - /usr/lib/cgi-bin --> /usr/lib/zoneminder/cgi-bin - - -- Dmitry Smirnov Tue, 31 Mar 2015 15:12:17 +1100 diff --git a/distros/ubuntu1204/changelog b/distros/ubuntu1204/changelog deleted file mode 100644 index c7e86f69d..000000000 --- a/distros/ubuntu1204/changelog +++ /dev/null @@ -1,573 +0,0 @@ -zoneminder (1.28.1+1-vivid-SNAPSHOT2015081701) vivid; urgency=medium - - * include api, switch to cmake build - - -- Isaac Connor Mon, 17 Aug 2015 10:29:23 -0400 - - -zoneminder (1.28.1-8) unstable; urgency=medium - - * Patchworks: - + New upstream "980-fix-image-size.patch". - + New "default_cgi-path.patch" to correct default ZM_PATH_ZMS. - * postinst: set "root" as group owner for "/var/log/zm" to silence - logrotate warnings. - * Minor correction to README.Debian. - - -- Dmitry Smirnov Sun, 16 Aug 2015 19:19:50 +1000 - -zoneminder (1.28.1-7) unstable; urgency=medium - - * Build-Depends += "cakephp (<< 3.0.0~)"; - Zoneminder is not compatible with latest CakePHP. - * Handle conffile removal from maintscript. - * rules: build man pages reproducibly. - * gbp.conf: renamed old style config section [git-dch] to [dch]. - * README - + added instructions to update owner of the "/etc/zm/zm.conf" - (Closes: #789327). - + zmupdate.pl needs CREATE rights. - + added note about required number of "fcgiwrap" workers. - * New upstream patch: "zmtrigger-plus.patch". - - -- Dmitry Smirnov Mon, 20 Jul 2015 16:30:15 +1000 - -zoneminder (1.28.1-6) unstable; urgency=low - - * New "zoneminder-doc" and "zoneminder-dbg" packages. - - -- Dmitry Smirnov Sun, 19 Apr 2015 14:50:41 +1000 - -zoneminder (1.28.1-5) unstable; urgency=low - - * Move handling of "/var/run/zm" and "/tmp/zm" from .service into .tmpfile. - Let dh_installinit do the job. Thanks, Andrew Bauer. - * Use dh_apache2 to install Apache conf file; remove old conf and symlink. - * Promote "libapache2-mod-php5 | php5-fpm" to Recommends. - * Build-Depends: - + dh-linktree - + cakephp (>= 2.6.3) - + libjs-jquery - + libjs-mootools - * Depends: - - libjs-jquery - - libjs-mootools - * Build-time replace bundled CakePHP with system one using "dh-linktree". - * Use "dh-linktree" to handle mootools and jquery symlinks. - - -- Dmitry Smirnov Sun, 19 Apr 2015 11:45:01 +1000 - -zoneminder (1.28.1-4) unstable; urgency=low - - * New patch to fix HTML export with USE_DEEP_STORAGE (closes: #723706). - * New "783.patch" to describe potential data loss in ZM_USE_DEEP_STORAGE. - * New patch to change default date format to region-neutral ISO notation - with time zone. - * Build sphinx documentation: - + Install "zoneminder.1" man page. - + Build-Depends += "python-sphinx | python3-sphinx" - + Added commented "zoneminder-doc" package. - + Added "docs.patch" to unlink distro-specific installation docs. - * rules: - + set ZM_CONTENTDIR, ZM_SOCKDIR and ZM_TMPDIR. - + remove mistakengly installed Perl module templates. - * Updated startup scripts to create ZM_TMPDIR. - * Hurd improvements: - + New patch to add PATH_MAX definitions. - + Build without MMAP support on Hurd. - + libsys-mmap-perl [!hurd-any]. - - -- Dmitry Smirnov Mon, 06 Apr 2015 18:18:55 +1000 - -zoneminder (1.28.1-3) unstable; urgency=low - - * Updated Apache2 and nginx configuration templates to support CGI. - * Updated README.Debian to document cgi-bin setup. - * Removed "/usr/share/zoneminder/www/cgi-bin" symlink. - * Added "apache2.patch" to correct Apache2 site configuration example. - * control: Suggests += "fcgiwrap". - * rules: added dh_systemd overrides to prevent automatic service - activation and start. - * Added note about manual service activation to README.Debian - (Closes: #781733). - - -- Dmitry Smirnov Thu, 02 Apr 2015 23:20:20 +1100 - -zoneminder (1.28.1-2) unstable; urgency=low - - * Removed word "Linux" from short package description. - * Build-Depends: do not require "libv4l-dev" on Hurd i.e. [!hurd-any]. - * Added run-time Perl Depends: - + libdbd-mysql-perl - + libimage-info-perl - + libmodule-load-conditional-perl - + libnet-sftp-foreign-perl - + liburi-encode-perl - * Prepare for package split: added commented "libzoneminder-perl" - and "zoneminder-dbg" packages to "debian/control". - * rules: do not install worthless ".packlist" file. - * Updated "libv4l1-videodev.h.patch" to fix v4lv1 detection in CMake. - - -- Dmitry Smirnov Thu, 02 Apr 2015 13:25:19 +1100 - -zoneminder (1.28.1-1) unstable; urgency=low - - [ Dmitry Smirnov ] - * New upstream release [February 2015]. - * Upload to unstable. - * Disabled automatic database upgrades: post(inst|rm) scripts no longer - touch database or do unexpected stuff (Closes: #779254). - See README.Debian for details. - * Updated installation paths: - + /usr/share/zoneminder --> /usr/share/zoneminder/www - + /usr/lib/cgi-bin --> /usr/lib/zoneminder/cgi-bin - * Added logrotate config (Closes: #544826). - Thanks, Alberto Reyes. - * Native systemd service; "--with systemd" added to dh. - * Build with CMake instead of autoconf; rules clean-up. - * Build with all hardening. - * Build and install "zmupdate.pl.1" man page. - * Added nginx/php5-fpm configuration example. - * Install upstream "apache.conf" example. - * Described setup of Zoneminer web site and database in README.Debian. - * Install "/etc/zm/zm.conf" with tighter permissions. - * Added TODO.Debian. - * Added "debian/clean"; "debian/gbp.conf"; bug-presubj. - * Remove bundled Cake tests to take ~5 MB off big-usr-share. - * Standards-Version: 3.9.6; compat/debhelper to version 9. - * Vcs links to new git repository at collab-maint. - * Build-Depends: - + dh-systemd - + libgcrypt11-dev --> libgcrypt-dev - + libcurl4-gnutls-dev - + libvlc-dev - + policykit-1 (required by "zmsystemctl.pl") - - dh-autoreconf, autoconf, automake - * Depends: - - apache2 - - libapache2-mod-php5 (moved to Suggests) - - libpcre3 (invalid) - - libmodule-load-perl (obsolete; replaced with perl-modules) - - libarchive-tar-perl (obsolete; replaced with perl-modules) - - mysql-server (moved to Recommends, Closes: #759504). - - php5 - + libav-tools - + libjs-jquery (replaces bundled component) - + libjs-mootool (replaces bundled component) - + libjson-any-perl (Closes: #690803). - + perl-modules (Closes: #745819). - * Recommends: - + apache2 | httpd - + mysql-server | virtual-mysql-server (Closes: #732874). - * Suggests: - + libapache2-mod-php5 | php5-fpm - + logrotate - * Refreshed, renamed and re-ordered patches; added DEP-3 headers. - * Removed "vendor_perl" patch (applied-upstream). - * New patches: - + cmake-fix-confpath.patch - + cmake-gnutls.patch - + cmake-nossl.patch - + cmake.patch - + format-hardening.patch - + pod_man_fixes.patch - + pod_name_fixes.patch - + pod_zmupdate-to-pod2usage.patch - * Lintianisation (incomplete): - - extra-license-file - - init.d-script-missing-lsb-description - - init.d-script-does-not-source-init-functions - - privacy-breach-generic - - package-contains-empty-directory - - manpage-has-errors-from-pod2man - - manpage-has-bad-whatis-entry - - quilt-patch-missing-description - - no-dep5-copyright - * Lintian-overrides: - + unusual-interpreter usr/bin/zmsystemctl.pl #!/usr/bin/pkexec - + script-not-executable usr/share/zoneminder/www/api/* - + script-with-language-extension usr/bin/*.pl - + source-is-missing web/tools/mootools/mootools-*-yc.js - + source-is-missing web/skins/*/js/jquery-1.4.2.min.js - + source-contains-prebuilt-javascript-object - * Renamed files in "debian". - * watch: dfsg repacksuffix and dversionmangle. - * "debian/copyright" to Copyright-Format-1.0. - * Set myself as new Maintainer (Closes: #760314). - - [ Vagrant Cascadian ] - * Removed obsolete DM-Upload-Allowed flag. - * Update debian/watch to use tarballs from github. - * Add Build-Depends on libgcrypt11-dev (Closes: #745819). - * Use canonical alioth Vcs-Hg URL. - * debian/control: Add Build-Depends: libpolkit-gobject-1-dev. - * Removed configure flag "--enable-crashtrace=no", which is no longer - present upstream. - - -- Dmitry Smirnov Tue, 31 Mar 2015 15:11:13 +1100 - -zoneminder (1.26.5-3.1) experimental; urgency=low - - * Non-maintainer upload. - * Add libav10.patch and compile against libav10 (Closes: #739461) - - -- Reinhard Tartler Wed, 19 Mar 2014 00:31:22 +0000 - -zoneminder (1.26.5-3) unstable; urgency=low - - - * Previous release still didn't build on PPC - this has been corrected. - (Closes: #736516) - - -- Peter Howard Tue, 4 Feb 2014 02:02:10 +1000 - -zoneminder (1.26.5-2) unstable; urgency=low - - * Remove dependency on ffmpeg - (Closes: #721161) - - * Builds again on non-x86 target architectures. - - -- Peter Howard Thu, 23 Jan 2014 01:02:10 +1000 - -zoneminder (1.26.5-1) unstable; urgency=low - - * New upstream version - (Closes: #694131) - * Change Build-Depends on libgnutls-dev to libgnutls-openssl-dev - (Closes: #731560) - -- Peter Howard Tue, 17 Dec 2013 01:02:10 +1000 - -zoneminder (1.25.0-4) unstable; urgency=high - - * Add CVE-2013-0232 patch - [SECURITY] CVE-2013-0232: Shell escape commands with untrusted content. - Thanks to James McCoy (Closes: #698910) - Thanks also to Salvatore Bonaccorso - - -- Peter Howard Tue, 12 Jun 2013 12:02:10 +1000 - -zoneminder (1.25.0-3) unstable; urgency=low - - * debian/rules: Export CFLAGS, CPPFLAGS, CXXFLAGS and LDFLAGS, to ensure - hardening build flags are enabled. - - -- Vagrant Cascadian Tue, 28 Aug 2012 12:10:03 -0700 - -zoneminder (1.25.0-2) unstable; urgency=low - - [ Vagrant Cascadian ] - * Add a patch to disable checking for updated versions by default, as - upgrades should happen through package management. - * Use dpkg-buildflags in debian/rules to set default compiler flags. - * Ensure zoneminder is stopped before starting (Closes: #657407). - - [ Peter Howard ] - * Fix postinst to add permission for table creation during upgrade - (Closes: #657407). - - -- Vagrant Cascadian Thu, 23 Aug 2012 12:40:34 -0700 - -zoneminder (1.25.0-1.1) unstable; urgency=low - - * Non-maintainer upload. - * Fix "ftbfs with GCC-4.7": add patch Fix-FTBFS-with-gcc-4.7 from Cyril - Brulebois: fix missing includes. - (Closes: #667428) - - -- gregor herrmann Sun, 13 May 2012 17:02:21 +0200 - -zoneminder (1.25.0-1) unstable; urgency=low - - * Fix typo in libv4l1-videodev.h patch that caused v4l1 support to be - dropped. - * Fail to build if version in postinst doesn't match upstream version. - * Add Build-Depends: libavdevice-dev to fix MPEG streaming (Closes: #515558). - * debian/rules: Convert to using debhelper overrides. - * Set debian/compat to 7. - * Simplify debian/watch file. - * Refresh debian/patches/use_libjs-mootools. - * Refresh debian/patches/libv4l1-videodev.h. - * Remove dependencies on php4 and related packages. - * Remove build-dependencies on libmysqlclient14-dev and - libmysqlclient15-dev. - * Update Build-Depends to use libjpeg-dev instead of libjpeg62-dev - (Closes: #647114). - * Add patch to fix build by testing for C headers rather than C++ headers. - Thanks to Ryan Niebur. (Closes: #654230) - * Add a patch to fix build problems caused by API changes in libav 0.8. - Thanks again to Ryan Niebur. (Closes: #654230) - - -- Vagrant Cascadian Mon, 16 Jan 2012 11:58:05 -0800 - -zoneminder (1.24.4-1) unstable; urgency=low - - [ Peter Howard ] - * Initial release of 1.24.4 (Closes: #634985). - - Fix 32/64-bit type declarations (Closes: #614404). - * Update patches. - - [ Vagrant Cascadian ] - * Add patch to fix FTBFS by using libv4l1-videodev.h from libv4l-dev. - Thanks to Andreas Metzler for reporting the issue. - (Closes: #619813). - * Document adding the www-data user to the video group in README.Debian. - (Closes: #611324) - * Depend on libsys-mmap-perl to enable mapped memory support. - (Closes: #607331) - * Update libjs-mootools patch to use -nc variants (Closes: #635075). - * Depend on javascript-common, to ensure that /javascript is available in - the web server. - * Set the upstream version in postinst at build time. - * Use dh-autoreconf to properly clean up autogenerated files during build. - * Add Vcs-HG to debian/control. - * Add Build-Depends: libv4l-dev, libbz2-dev, dh-autoreconf, libsys-mmap-perl. - - -- Vagrant Cascadian Sun, 24 Jul 2011 16:44:30 +0200 - -zoneminder (1.24.2-9) unstable; urgency=low - - * Apply patch from Ubuntu to fix FTBFS with ffmpeg 0.6: - - Add -D__STDC_CONSTANT_MACROS to CPPFLAGS (closes: 614080). - * Update Standards-Version to 3.9.1, no changes necessary. - - -- Vagrant Cascadian Sun, 20 Feb 2011 23:43:02 -0800 - -zoneminder (1.24.2-8) unstable; urgency=medium - - [ Vagrant Cascadian ] - * Apply patch to fix V4L2 cameras without crop support (closes: #608790). - Thanks to piratebab. - * Add preinst script which aborts if dangerous symlinks exist. - (closes: #608793) - - [ Peter Howard ] - * Added to README.Debian with info about images and events directories. - (closes: #608793) - - -- Vagrant Cascadian Sat, 15 Jan 2011 19:39:26 -0800 - -zoneminder (1.24.2-7) unstable; urgency=medium - - * Do not set ownership of /var/cache/zoneminder when upgrading, which fixes a - regression causing upgrades to take inordinately long with large - installations (closes: #597040). - - -- Vagrant Cascadian Fri, 17 Sep 2010 11:24:41 -0700 - -zoneminder (1.24.2-6) unstable; urgency=low - - * Only remove database on purge. This requires only creating the database if - it doesn't already exist, and upgrading the database only if the database - is an older version (closes: #497107). - - * Do not prompt the user on database upgrades by using the --nointeractive - flag when calling zmupdate.pl from postinst (closes: #595902). - - -- Vagrant Cascadian Fri, 10 Sep 2010 10:06:06 -0700 - -zoneminder (1.24.2-5) unstable; urgency=low - - [ Peter Howard ] - * Add zip dependency - (closes: #494261) - * Add debian/watch file - (closes: #545552) - * Use packaged libjs-mootools - (closes: #585590) - * Miscellaneous cleanups - - [ Vagrant Cascadian ] - * Add vagrant@debian.org as uploader - * Update Standards-Version to 3.9.0, no changes necessary. - - -- Vagrant Cascadian Fri, 23 Jul 2010 18:12:50 -0500 - -zoneminder (1.24.2-4.1) unstable; urgency=low - - * Non-maintainer upload. - * Fix "package removed, processes still running": apply patch to - debian/postinst by Vagrant Cascadian: use invoke-rc.d and run - mysql-related actions only when mysql is running (closes: #583648). - - -- gregor herrmann Thu, 01 Jul 2010 19:47:10 +0200 - -zoneminder (1.24.2-4) unstable; urgency=high - * Update init.d to list mysql dependency - (closes: #583505) - * Change dependency from libmime-perl to libmime-tools-perl - (closes: #585589) - * Problems in changelog format fixed - (closes: #585592) - * Fix debian-rules-ignores-make-clean-error - (closes: #585593) - -- Peter Howard Mon, 14 jun 2010 15:02:10 +1000 - -zoneminder (1.24.2-3) unstable; urgency=high - * Changes symbols to build with libjpeg8 - (closes: #565326, #568327) - * Note: location of all perl files should have been fixed in previous release - (closes: #553096) - -- Peter Howard Mon, 26 apr 2010 15:02:10 +1000 - -zoneminder (1.24.2-2) unstable; urgency=high - - * Remove custom perl parth from zmpkg.pl, fix location of manpages. - (closes: #551746, #553092) - * Fix GCC4.4 bug - (closes: #531717) - * Fix potential bug in postinst script - - -- Peter Howard Sat, 14 Nov 2009 15:02:10 +1000 - -zoneminder (1.24.2-1) unstable; urgency=high - - * Initial release of zoneminder 1.24.2 - -- Peter Howard Fri, 11 Sep 2009 07:02:50 +1000 - -zoneminder (1.24.1-1) unstable; urgency=high - - * Initial release of zoneminder 1.24.1, closing CVE-2008-3882, - CVE-2008-3881, CVE-2008-3880 - (closes: #497640) - * Change syslog dependency to rsyslog. - (closes: #526918) - * Add missing perl dependency. - * Restore patch to disable "check for updates" by default. - * Removed spurious '$' in init script. - (closes: #486064) - * Change permission of zm.conf from 0600 to 0400 for CVE-2008-6755 - (closes: #528252) - -- Peter Howard Sat, 16 May 2009 07:02:50 +1000 - -zoneminder (1.23.3-4) unstable; urgency=high - - * update to get it building with latest unstable. Thanks to waldi@debian.org - (closes: #517569) - -- Peter Howard Thu, 16 Apr 2009 01:02:50 +1000 - -zoneminder (1.23.3-3) unstable; urgency=high - - * ffmpeg confirmed working - (closes: #475145) - * Fix upgrade problem intrudouced in 1.23.3-1 - (closes: #481637) - * Include libmime-lite-perl in dependencies - (closes: #486312) - -- Peter Howard Thu, 18 Sep 2008 01:02:50 +1000 - -zoneminder (1.23.3-2) unstable; urgency=high - - * ffmpeg finally working? - - -- Peter Howard Wed, 13 Aug 2008 01:02:50 +1000 - -zoneminder (1.23.3-1) unstable; urgency=high - - * Initial version for 1.23.3 - security fix. - (closes: #479034) - - -- Peter Howard Wed, 19 Mar 2008 01:02:50 +1000 - -zoneminder (1.23.2-2) unstable; urgency=low - - * Update to init.d - (closes: #468856) - * Add dependency on logging daemon - (closes: #471277) - - -- Peter Howard Wed, 19 Mar 2008 01:02:50 +1000 - -zoneminder (1.23.2-1) unstable; urgency=low - - * Initial version for 1.23.2 - (closes: #464152) - * Zoneminder 1.23.2 upstream includes fix for GCC 4.3 - (closes: #454980) - * Includes ffmpeg patch by Alexander Kushnirenko - - -- Peter Howard Sat, 01 Mar 2008 16:02:50 +1000 - -zoneminder (1.22.3-10) unstable; urgency=low - - * Fix bug introduced in -9 where perl is put under /usr/local - (closes: #457507) - - -- Peter Howard Mon, 24 Dec 2007 16:02:50 +1000 - -zoneminder (1.22.3-9) unstable; urgency=low - - * Starting zoneminder via init script now invokes "zmfix -a" - (closes: #481637) - * Change apache2-mpm-prefork dependency to apache2 - * Temp dir for export under /var/cache/zoneminder (but linked back to - /usr/share/zoneminder for now) - * Redo use of gnutls rather than openssl for md5 hashes - - -- Peter Howard Mon, 10 Dec 2007 16:02:50 +1000 - -zoneminder (1.22.3-8) unstable; urgency=low - - * Build now includes libpcre3 - (closes: #437533) - * "Monitor Presets" patch now applied to package during build. - - -- Peter Howard Sat, 18 Aug 2007 14:35:23 +1000 - -zoneminder (1.22.3-7) unstable; urgency=low - - * Turn off debug trace and crash dump on build - (closes:#414857,#414891) - * Additional perl libraries added in dependencies - (closes:#416291) - * Change preferred PHP version from 4 to 5 - -- Peter Howard Sun, 29 Jul 2007 15:11:13 +1000 - -zoneminder (1.22.3-6) unstable; urgency=low - - * Removed a similar bash only statement from zmpkg.pl - (closes:414882) - - -- Peter Howard Sat, 14 Apr 2007 11:46:56 +1000 - -zoneminder (1.22.3-5) unstable; urgency=low - - * Installs with "phone home" feature turned off by default, and permissions - on /etc/zm/zm.conf fixed (now the 0600 it s hould be) - (closes:415349) - * Removed "stupid bash-ism" on mysqld check in postinst file. - - -- Peter Howard Fri, 6 Apr 2007 15:50:00 +1000 - -zoneminder (1.22.3-4) unstable; urgency=low - - * Put libmysqlclient-15-dev in front of -14-dev so sbuild works - (closes: #414410) - - -- Peter Howard Mon, 12 Mar 2007 11:38:56 +1100 - -zoneminder (1.22.3-3) unstable; urgency=low - - * Clean up of postinstall, postrm ; user "zm" definitely was a mistake - * Also in postinstall: check and start MySQL if it's not running. - * init.d script now checks if zoneminder isn't running and still returns 0 - (which helps uninstalling) - * Addition of php5 dependency options as well as php4. - - -- Peter Howard Mon, 26 Feb 2007 10:40:52 +1100 - -zoneminder (1.22.3-2) unstable; urgency=low - - * Added zmuser in the mysql creation; this should fix the install problem - for people, but needs to be cleaned up (in -3) - - -- Peter Howard Fri, 16 Feb 2007 14:16:03 +1100 - -zoneminder (1.22.3-1) unstable; urgency=low - - * Initial Version. (closes: #248393) - * Patched out use of openssl; uses gnutls instead for MD5 hashes. - * Removed MakeMaker-inserted Perl licensing (with authors permission) in - various scripts; replaced with GPL. - - -- Peter Howard Wed, 7 Feb 2007 14:09:01 +1100 From 0ac26277e3b48dfa3134913867e3aba2ce2e18f5 Mon Sep 17 00:00:00 2001 From: Isaac Connor Date: Fri, 2 Jun 2017 16:52:52 -0400 Subject: [PATCH 52/60] debug, fix deprecations, fix audio --- src/zm_ffmpeg_camera.cpp | 23 ++-- src/zm_videostore.cpp | 227 +++++++++++++++++++++++---------------- 2 files changed, 144 insertions(+), 106 deletions(-) diff --git a/src/zm_ffmpeg_camera.cpp b/src/zm_ffmpeg_camera.cpp index d11ea936e..7ebbeae07 100644 --- a/src/zm_ffmpeg_camera.cpp +++ b/src/zm_ffmpeg_camera.cpp @@ -23,7 +23,7 @@ #include "zm_ffmpeg_camera.h" -extern "C"{ +extern "C" { #include "libavutil/time.h" } #ifndef AV_ERROR_MAX_STRING_SIZE @@ -125,8 +125,7 @@ int FfmpegCamera::PreCapture() return( 0 ); } -int FfmpegCamera::Capture( Image &image ) -{ +int FfmpegCamera::Capture( Image &image ) { if (!mCanCapture){ return -1; } @@ -459,8 +458,7 @@ int FfmpegCamera::CloseFfmpeg(){ av_frame_free( &mRawFrame ); #if HAVE_LIBSWSCALE - if ( mConvertContext ) - { + if ( mConvertContext ) { sws_freeContext( mConvertContext ); mConvertContext = NULL; } @@ -487,8 +485,7 @@ int FfmpegCamera::CloseFfmpeg(){ return 0; } -int FfmpegCamera::FfmpegInterruptCallback(void *ctx) -{ +int FfmpegCamera::FfmpegInterruptCallback(void *ctx) { FfmpegCamera* camera = reinterpret_cast(ctx); if (camera->mIsOpening){ int now = time(NULL); @@ -526,14 +523,14 @@ void *FfmpegCamera::ReopenFfmpegThreadCallback(void *ctx){ //Function to handle capture and store int FfmpegCamera::CaptureAndRecord( Image &image, timeval recording, char* event_file ) { - if (!mCanCapture){ + if ( ! mCanCapture ) { return -1; } int ret; static char errbuf[AV_ERROR_MAX_STRING_SIZE]; // If the reopen thread has a value, but mCanCapture != 0, then we have just reopened the connection to the ffmpeg device, and we can clean up the thread. - if (mReopenThread != 0) { + if ( mReopenThread != 0 ) { void *retval = 0; ret = pthread_join(mReopenThread, &retval); @@ -545,7 +542,7 @@ int FfmpegCamera::CaptureAndRecord( Image &image, timeval recording, char* event mReopenThread = 0; } - if (mVideoCodecContext->codec_id != AV_CODEC_ID_H264) { + if ( mVideoCodecContext->codec_id != AV_CODEC_ID_H264 ) { Error( "Input stream is not h264. The stored event file may not be viewable in browser." ); } @@ -689,7 +686,7 @@ else if ( packet.pts && video_last_pts > packet.pts ) { // The following lines should ensure that the queue always begins with a video keyframe if ( packet.stream_index == mAudioStreamId ) { -Debug(2, "Have audio packet, reocrd_audio is (%d) and packetqueue.size is (%d)", record_audio, packetqueue.size() ); +//Debug(2, "Have audio packet, reocrd_audio is (%d) and packetqueue.size is (%d)", record_audio, packetqueue.size() ); if ( record_audio && packetqueue.size() ) { // if it's audio, and we are doing audio, and there is already something in the queue packetqueue.queuePacket( &packet ); @@ -781,8 +778,10 @@ Debug(2, "Have audio packet, reocrd_audio is (%d) and packetqueue.size is (%d)", return 0; } } else { - Debug(4, "Not recording audio packet" ); + Debug(4, "Not doing recording of audio packet" ); } + } else { + Debug(4, "Have audio packet, but not recording atm" ); } } else { #if LIBAVUTIL_VERSION_CHECK(56, 23, 0, 23, 0) diff --git a/src/zm_videostore.cpp b/src/zm_videostore.cpp index 0f7892f80..826f62d35 100644 --- a/src/zm_videostore.cpp +++ b/src/zm_videostore.cpp @@ -27,7 +27,7 @@ #include "zm.h" #include "zm_videostore.h" -extern "C"{ +extern "C" { #include "libavutil/time.h" } @@ -37,23 +37,23 @@ VideoStore::VideoStore(const char *filename_in, const char *format_in, int64_t nStartTime, Monitor * monitor ) { + video_input_stream = p_video_input_stream; audio_input_stream = p_audio_input_stream; +#if LIBAVCODEC_VERSION_CHECK(57, 0, 0, 0, 0) + video_input_context = avcodec_alloc_context3( NULL ); + avcodec_parameters_to_context( video_input_context, video_input_stream->codecpar ); +#else video_input_context = video_input_stream->codec; +#endif //store inputs in variables local to class filename = filename_in; format = format_in; - keyframeMessage = false; - keyframeSkipNumber = 0; - Info("Opening video storage stream %s format: %s\n", filename, format); - //Init everything we need, shouldn't have to do this, ffmpeg_camera or something else will call it. - //av_register_all(); - ret = avformat_alloc_output_context2(&oc, NULL, NULL, filename); if ( ret < 0 ) { Warning("Could not create video storage stream %s as no output context" @@ -62,11 +62,11 @@ VideoStore::VideoStore(const char *filename_in, const char *format_in, av_make_error_string(ret).c_str() ); } else { - Debug(2, "Success alocateing output context"); + Debug(2, "Success allocating output context"); } //Couldn't deduce format from filename, trying from format name - if (!oc) { + if ( ! oc ) { avformat_alloc_output_context2(&oc, NULL, format, filename); if (!oc) { Fatal("Could not create video storage stream %s as no output context" @@ -83,36 +83,46 @@ VideoStore::VideoStore(const char *filename_in, const char *format_in, oc->metadata = pmetadata; output_format = oc->oformat; - Debug(2, "setting parameters"); -#if LIBAVCODEC_VERSION_CHECK(58, 0, 0, 0, 0) - AVCodec *codec = avcodec_find_decoder( video_input_stream->codecpar->codec_id ); - video_output_context = avcodec_alloc_context3( codec ); +#if LIBAVCODEC_VERSION_CHECK(57, 0, 0, 0, 0) + // Since we are not re-encoding, all we have to do is copy the parameters + video_output_context = avcodec_alloc_context3( NULL ); + + // Copy params from inputstream to context ret = avcodec_parameters_to_context( video_output_context, video_input_stream->codecpar ); + if ( ret < 0 ) { + Error( "Could not initialize context parameteres"); + return; + } else { + Debug( 2, "Success getting parameters"); + } + + video_output_stream = avformat_new_stream( oc, NULL ); + if ( ! video_output_stream ) { + Fatal("Unable to create video out stream\n"); + } else { + Debug(2, "Success creating video out stream" ); + } + + // Now copy them to the output stream + ret = avcodec_parameters_from_context( video_output_stream->codecpar, video_output_context ); if ( ret < 0 ) { Error( "Could not initialize stream parameteres"); return; } else { Debug(2, "Success setting parameters"); } - if ( avcodec_open2( video_output_context, codec, NULL ) < 0 ) { - Fatal("Unable to open video out codec\n"); - } - video_output_stream = avformat_new_stream( oc, codec ); - if (!video_output_stream) { - Fatal("Unable to create video out stream\n"); - } else { - Debug(2, "Success creating video out stream" ); - } + + zm_dump_stream_format( oc, 0, 0, 1 ); #else - video_output_stream = avformat_new_stream(oc, (AVCodec*)video_input_context->codec); - if (!video_output_stream) { + video_output_stream = avformat_new_stream(oc, (AVCodec*)video_input_context->codec ); + if ( ! video_output_stream ) { Fatal("Unable to create video out stream\n"); } else { Debug(2, "Success creating video out stream" ); } video_output_context = video_output_stream->codec; - ret = avcodec_copy_context(video_output_context, video_input_context ); + ret = avcodec_copy_context( video_output_context, video_input_context ); if (ret < 0) { Fatal("Unable to copy input video context to output video context %s\n", av_make_error_string(ret).c_str()); @@ -138,7 +148,7 @@ VideoStore::VideoStore(const char *filename_in, const char *format_in, // WHY? //video_output_context->codec_tag = 0; - if (!video_output_context->codec_tag) { + if ( ! video_output_context->codec_tag ) { Debug(2, "No codec_tag"); if (! oc->oformat->codec_tag || av_codec_get_id (oc->oformat->codec_tag, video_input_context->codec_tag) == video_output_context->codec_id @@ -178,14 +188,22 @@ VideoStore::VideoStore(const char *filename_in, const char *format_in, resample_context = NULL; #endif - if (audio_input_stream) { + if ( audio_input_stream ) { Debug(3, "Have audio stream" ); +#if LIBAVCODEC_VERSION_CHECK(57, 0, 0, 0, 0) + + audio_input_context = avcodec_alloc_context3( NULL ); + ret = avcodec_parameters_to_context( audio_input_context, audio_input_stream->codecpar ); +#else audio_input_context = audio_input_stream->codec; +#endif if ( audio_input_context->codec_id != AV_CODEC_ID_AAC ) { static char error_buffer[256]; avcodec_string(error_buffer, sizeof(error_buffer), audio_input_context, 0 ); - Debug(3, "Got something other than AAC (%s)", error_buffer ); + Debug(2, "Got something other than AAC (%s)", error_buffer ); + + if ( ! setup_resampler() ) { return; } @@ -198,10 +216,13 @@ VideoStore::VideoStore(const char *filename_in, const char *format_in, audio_output_stream = NULL; } else { Debug(2, "setting parameters"); - audio_output_context = audio_output_stream->codec; + #if LIBAVCODEC_VERSION_CHECK(57, 0, 0, 0, 0) + audio_output_context = avcodec_alloc_context3( NULL ); + // Copy params from inputstream to context ret = avcodec_parameters_to_context( audio_output_context, audio_input_stream->codecpar ); #else + audio_output_context = audio_output_stream->codec; ret = avcodec_copy_context(audio_output_context, audio_input_context); #endif if (ret < 0) { @@ -267,8 +288,10 @@ VideoStore::VideoStore(const char *filename_in, const char *format_in, video_last_dts = 0; audio_last_pts = 0; audio_last_dts = 0; - previous_pts = 0; - previous_dts = 0; + video_previous_pts = 0; + video_previous_dts = 0; + audio_previous_pts = 0; + audio_previous_dts = 0; } // VideoStore::VideoStore @@ -356,6 +379,14 @@ bool VideoStore::setup_resampler() { #ifdef HAVE_LIBAVRESAMPLE static char error_buffer[256]; + // Newer ffmpeg wants to keep everything separate... so have to lookup our own decoder, can't reuse the one from the camera. + AVCodec *audio_input_codec = avcodec_find_decoder(audio_input_stream->codecpar->codec_id); + ret = avcodec_open2( audio_input_context, audio_input_codec, NULL ); + if ( ret < 0 ) { + Error("Can't open input codec!"); + return false; + } + audio_output_codec = avcodec_find_encoder(AV_CODEC_ID_AAC); if ( ! audio_output_codec ) { Error("Could not find codec for AAC"); @@ -363,8 +394,8 @@ bool VideoStore::setup_resampler() { } Debug(2, "Have audio output codec"); - audio_output_stream = avformat_new_stream( oc, audio_output_codec ); - audio_output_context = audio_output_stream->codec; + //audio_output_context = audio_output_stream->codec; + audio_output_context = avcodec_alloc_context3( audio_output_codec ); if ( ! audio_output_context ) { Error( "could not allocate codec context for AAC\n"); @@ -374,18 +405,15 @@ bool VideoStore::setup_resampler() { Debug(2, "Have audio_output_context"); - AVDictionary *opts = NULL; - av_dict_set(&opts, "strict", "experimental", 0); - /* put sample parameters */ audio_output_context->bit_rate = audio_input_context->bit_rate; audio_output_context->sample_rate = audio_input_context->sample_rate; audio_output_context->channels = audio_input_context->channels; audio_output_context->channel_layout = audio_input_context->channel_layout; audio_output_context->sample_fmt = audio_input_context->sample_fmt; - //audio_output_context->refcounted_frames = 1; + audio_output_context->refcounted_frames = 1; - if (audio_output_codec->supported_samplerates) { + if ( audio_output_codec->supported_samplerates ) { int found = 0; for ( unsigned int i = 0; audio_output_codec->supported_samplerates[i]; i++) { if ( audio_output_context->sample_rate == audio_output_codec->supported_samplerates[i] ) { @@ -402,36 +430,14 @@ bool VideoStore::setup_resampler() { } /* check that the encoder supports s16 pcm input */ - if (!check_sample_fmt( audio_output_codec, audio_output_context->sample_fmt)) { + if ( ! check_sample_fmt( audio_output_codec, audio_output_context->sample_fmt ) ) { Debug( 3, "Encoder does not support sample format %s, setting to FLTP", av_get_sample_fmt_name( audio_output_context->sample_fmt)); audio_output_context->sample_fmt = AV_SAMPLE_FMT_FLTP; } - //audio_output_stream->time_base = audio_input_stream->time_base; audio_output_context->time_base = (AVRational){ 1, audio_output_context->sample_rate }; - Debug(3, "Audio Time bases input stream (%d/%d) input codec: (%d/%d) output_stream (%d/%d) output codec (%d/%d)", - audio_input_stream->time_base.num, - audio_input_stream->time_base.den, - audio_input_context->time_base.num, - audio_input_context->time_base.den, - audio_output_stream->time_base.num, - audio_output_stream->time_base.den, - audio_output_context->time_base.num, - audio_output_context->time_base.den - ); - - ret = avcodec_open2(audio_output_context, audio_output_codec, &opts ); - av_dict_free(&opts); - if ( ret < 0 ) { - av_strerror(ret, error_buffer, sizeof(error_buffer)); - Fatal( "could not open codec (%d) (%s)\n", ret, error_buffer ); - audio_output_codec = NULL; - audio_output_context = NULL; - audio_output_stream = NULL; - return false; - } Debug(1, "Audio output bit_rate (%d) sample_rate(%d) channels(%d) fmt(%d) layout(%d) frame_size(%d)", audio_output_context->bit_rate, @@ -442,7 +448,28 @@ bool VideoStore::setup_resampler() { audio_output_context->frame_size ); - output_frame_size = audio_output_context->frame_size; + // Now copy them to the output stream + audio_output_stream = avformat_new_stream( oc, audio_output_codec ); + + ret = avcodec_parameters_from_context( audio_output_stream->codecpar, audio_output_context ); + if ( ret < 0 ) { + Error( "Could not initialize stream parameteres"); + return false; + } + + AVDictionary *opts = NULL; + av_dict_set( &opts, "strict", "experimental", 0); + ret = avcodec_open2( audio_output_context, audio_output_codec, &opts ); + av_dict_free(&opts); + if ( ret < 0 ) { + av_strerror(ret, error_buffer, sizeof(error_buffer)); + Fatal( "could not open codec (%d) (%s)\n", ret, error_buffer ); + audio_output_codec = NULL; + audio_output_context = NULL; + audio_output_stream = NULL; + return false; + } + /** Create a new frame to store the audio samples. */ if (!(input_frame = zm_av_frame_alloc())) { Error("Could not allocate input frame"); @@ -577,9 +604,9 @@ int VideoStore::writeVideoFramePacket( AVPacket *ipkt ) { if ( ipkt->pts < video_last_pts ) { Debug(1, "Resetting video_last_pts from (%d) to (%d)", video_last_pts, ipkt->pts ); // wrap around, need to figure out the distance FIXME having this wrong should cause a jump, but then play ok? - opkt.pts = previous_pts + av_rescale_q( ipkt->pts, video_input_stream->time_base, video_output_stream->time_base); + opkt.pts = video_previous_pts + av_rescale_q( ipkt->pts, video_input_stream->time_base, video_output_stream->time_base); } else { - opkt.pts = previous_pts + av_rescale_q( ipkt->pts - video_last_pts, video_input_stream->time_base, video_output_stream->time_base); + opkt.pts = video_previous_pts + av_rescale_q( ipkt->pts - video_last_pts, video_input_stream->time_base, video_output_stream->time_base); } } Debug(3, "opkt.pts = %d from ipkt->pts(%d) - last_pts(%d)", opkt.pts, ipkt->pts, video_last_pts ); @@ -603,24 +630,20 @@ int VideoStore::writeVideoFramePacket( AVPacket *ipkt ) { // why are we using cur_dts instead of packet.dts? I think cur_dts is in AV_TIME_BASE_Q, but ipkt.dts is in video_input_stream->time_base if ( video_input_stream->cur_dts < video_last_dts ) { Debug(1, "Resetting video_last_dts from (%d) to (%d) p.dts was (%d)", video_last_dts, video_input_stream->cur_dts, ipkt->dts ); - opkt.dts = previous_dts + av_rescale_q(video_input_stream->cur_dts, AV_TIME_BASE_Q, video_output_stream->time_base); + opkt.dts = video_previous_dts + av_rescale_q(video_input_stream->cur_dts, AV_TIME_BASE_Q, video_output_stream->time_base); } else { - opkt.dts = previous_dts + av_rescale_q(video_input_stream->cur_dts - video_last_dts, AV_TIME_BASE_Q, video_output_stream->time_base); + opkt.dts = video_previous_dts + av_rescale_q(video_input_stream->cur_dts - video_last_dts, AV_TIME_BASE_Q, video_output_stream->time_base); } - Debug(3, "opkt.dts = %d from video_input_stream->cur_dts(%d) - previus_dts(%d)", - opkt.dts, video_input_stream->cur_dts, video_last_dts - ); + Debug(3, "opkt.dts = %d from video_input_stream->cur_dts(%d) - previus_dts(%d)", opkt.dts, video_input_stream->cur_dts, video_last_dts ); video_last_dts = video_input_stream->cur_dts; } else { if ( ipkt->dts < video_last_dts ) { Debug(1, "Resetting video_last_dts from (%d) to (%d)", video_last_dts, ipkt->dts ); - opkt.dts = previous_dts + av_rescale_q( ipkt->dts, video_input_stream->time_base, video_output_stream->time_base); + opkt.dts = video_previous_dts + av_rescale_q( ipkt->dts, video_input_stream->time_base, video_output_stream->time_base); } else { - opkt.dts = previous_dts + av_rescale_q( ipkt->dts - video_last_dts, video_input_stream->time_base, video_output_stream->time_base); + opkt.dts = video_previous_dts + av_rescale_q( ipkt->dts - video_last_dts, video_input_stream->time_base, video_output_stream->time_base); } - Debug(3, "opkt.dts = %d from ipkt.dts(%d) - previus_dts(%d)", - opkt.dts, ipkt->dts, video_last_dts - ); + Debug(3, "opkt.dts = %d from ipkt.dts(%d) - previus_dts(%d)", opkt.dts, ipkt->dts, video_last_dts ); video_last_dts = ipkt->dts; } } @@ -657,15 +680,15 @@ Debug(1, "writing video packet pts(%d) dts(%d) duration(%d)", opkt.pts, opkt.dts dumpPacket( ipkt); dumpPacket(&opkt); - } else if ((previous_dts > 0) && (previous_dts > opkt.dts)) { - Warning("%s:%d: DTS out of order: %lld \u226E %lld; discarding frame", __FILE__, __LINE__, previous_dts, opkt.dts); - previous_dts = opkt.dts; + } else if ((video_previous_dts > 0) && (video_previous_dts > opkt.dts)) { + Warning("%s:%d: DTS out of order: %lld \u226E %lld; discarding frame", __FILE__, __LINE__, video_previous_dts, opkt.dts); + video_previous_dts = opkt.dts; dumpPacket(&opkt); } else { - previous_dts = opkt.dts; // Unsure if av_interleaved_write_frame() clobbers opkt.dts when out of order, so storing in advance - previous_pts = opkt.pts; + video_previous_dts = opkt.dts; // Unsure if av_interleaved_write_frame() clobbers opkt.dts when out of order, so storing in advance + video_previous_pts = opkt.pts; ret = av_interleaved_write_frame(oc, &opkt); if(ret<0){ // There's nothing we can really do if the frame is rejected, just drop it and get on with the next @@ -678,17 +701,16 @@ Debug(1, "writing video packet pts(%d) dts(%d) duration(%d)", opkt.pts, opkt.dts return 0; -} +} // end int VideoStore::writeVideoFramePacket( AVPacket *ipkt ) int VideoStore::writeAudioFramePacket( AVPacket *ipkt ) { Debug(4, "writeAudioFrame"); - if(!audio_output_stream) { + if ( ! audio_output_stream ) { Debug(1, "Called writeAudioFramePacket when no audio_output_stream"); return 0;//FIXME -ve return codes do not free packet in ffmpeg_camera at the moment } - if ( audio_output_codec ) { #ifdef HAVE_LIBAVRESAMPLE @@ -724,12 +746,10 @@ int VideoStore::writeAudioFramePacket( AVPacket *ipkt ) { av_make_error_string(ret).c_str()); dumpPacket( ipkt ); av_frame_free( &input_frame ); - zm_av_packet_unref( &opkt ); return 0; } if ( ! data_present ) { Debug(2, "Not ready to transcode a frame yet."); - zm_av_packet_unref(&opkt); return 0; } #endif @@ -775,10 +795,21 @@ int VideoStore::writeAudioFramePacket( AVPacket *ipkt ) { * The output audio stream encoder is used to do this. */ #if LIBAVCODEC_VERSION_CHECK(57, 0, 0, 0, 0) + if (( ret = avcodec_send_frame( audio_output_context, output_frame ) ) < 0 ) { + Error( "Could not send frame (error '%s')", + av_make_error_string(ret).c_str()); + zm_av_packet_unref(&opkt); + return 0; + } + if (( ret = avcodec_receive_packet( audio_output_context, &opkt )) < 0 ) { + Error( "Could not recieve packet (error '%s')", + av_make_error_string(ret).c_str()); + zm_av_packet_unref(&opkt); + return 0; + } #else if (( ret = avcodec_encode_audio2( audio_output_context, &opkt, output_frame, &data_present )) < 0) { -#endif Error( "Could not encode frame (error '%s')", av_make_error_string(ret).c_str()); zm_av_packet_unref(&opkt); @@ -789,6 +820,7 @@ int VideoStore::writeAudioFramePacket( AVPacket *ipkt ) { zm_av_packet_unref(&opkt); return 0; } +#endif #endif } else { @@ -802,14 +834,17 @@ int VideoStore::writeAudioFramePacket( AVPacket *ipkt ) { //Scale the PTS of the outgoing packet to be the correct time base if ( ipkt->pts != AV_NOPTS_VALUE ) { - if ( !audio_last_pts ) { + if ( ! audio_last_pts ) { opkt.pts = 0; + Debug(1, "No audio_last_pts"); } else { if ( audio_last_pts > ipkt->pts ) { Debug(1, "Resetting audeo_start_pts from (%d) to (%d)", audio_last_pts, ipkt->pts ); + opkt.pts = audio_previous_pts + av_rescale_q(ipkt->pts, audio_input_stream->time_base, audio_output_stream->time_base); + } else { + opkt.pts = audio_previous_pts + av_rescale_q(ipkt->pts - audio_last_pts, audio_input_stream->time_base, audio_output_stream->time_base); } - opkt.pts = previous_pts + av_rescale_q(ipkt->pts - audio_last_pts, audio_input_stream->time_base, audio_output_stream->time_base); - Debug(2, "opkt.pts = %d from ipkt->pts(%d) - last_pts(%d)", opkt.pts, ipkt->pts, audio_last_pts ); + Debug(2, "audio opkt.pts = %d from ipkt->pts(%d) - last_pts(%d)", opkt.pts, ipkt->pts, audio_last_pts ); } audio_last_pts = ipkt->pts; } else { @@ -820,28 +855,30 @@ int VideoStore::writeAudioFramePacket( AVPacket *ipkt ) { //Scale the DTS of the outgoing packet to be the correct time base if ( ! audio_last_dts ) { opkt.dts = 0; + } else { if( ipkt->dts == AV_NOPTS_VALUE ) { // So if the input has no dts assigned... still need an output dts... so we use cur_dts? if ( audio_last_dts > audio_input_stream->cur_dts ) { - Debug(1, "Resetting audio_last_pts from (%d) to cur_dts (%d)", audio_last_dts, audio_input_stream->cur_dts ); - opkt.dts = previous_dts + av_rescale_q( audio_input_stream->cur_dts, AV_TIME_BASE_Q, audio_output_stream->time_base); + Debug(1, "Resetting audio_last_dts from (%d) to cur_dts (%d)", audio_last_dts, audio_input_stream->cur_dts ); + opkt.dts = audio_previous_dts + av_rescale_q( audio_input_stream->cur_dts, AV_TIME_BASE_Q, audio_output_stream->time_base); } else { - opkt.dts = previous_dts + av_rescale_q( audio_input_stream->cur_dts - audio_last_dts, AV_TIME_BASE_Q, audio_output_stream->time_base); + opkt.dts = audio_previous_dts + av_rescale_q( audio_input_stream->cur_dts - audio_last_dts, AV_TIME_BASE_Q, audio_output_stream->time_base); } audio_last_dts = audio_input_stream->cur_dts; Debug(2, "opkt.dts = %d from video_input_stream->cur_dts(%d) - last_dts(%d)", opkt.dts, audio_input_stream->cur_dts, audio_last_dts ); } else { if ( audio_last_dts > ipkt->dts ) { Debug(1, "Resetting audio_last_dts from (%d) to (%d)", audio_last_dts, ipkt->dts ); - opkt.dts = previous_dts + av_rescale_q(ipkt->dts, audio_input_stream->time_base, audio_output_stream->time_base); + opkt.dts = audio_previous_dts + av_rescale_q(ipkt->dts, audio_input_stream->time_base, audio_output_stream->time_base); } else { - opkt.dts = previous_dts + av_rescale_q(ipkt->dts - audio_last_dts, audio_input_stream->time_base, audio_output_stream->time_base); + opkt.dts = audio_previous_dts + av_rescale_q(ipkt->dts - audio_last_dts, audio_input_stream->time_base, audio_output_stream->time_base); } Debug(2, "opkt.dts = %d from ipkt->dts(%d) - last_dts(%d)", opkt.dts, ipkt->dts, audio_last_dts ); } } + audio_last_dts = ipkt->dts; if ( opkt.dts > opkt.pts ) { Debug(1,"opkt.dts(%d) must be <= opkt.pts(%d). Decompression must happen before presentation.", opkt.dts, opkt.pts ); opkt.dts = opkt.pts; @@ -849,15 +886,17 @@ int VideoStore::writeAudioFramePacket( AVPacket *ipkt ) { // I wonder if we could just use duration instead of all the hoop jumping above? opkt.duration = av_rescale_q(ipkt->duration, audio_input_stream->time_base, audio_output_stream->time_base); + Debug( 2, "opkt.pts (%d), opkt.dts(%d) opkt.duration = (%d)", opkt.pts, opkt.dts, opkt.duration ); // pkt.pos: byte position in stream, -1 if unknown opkt.pos = -1; - opkt.flags = ipkt->flags; opkt.stream_index = ipkt->stream_index; Debug(2, "Stream index is %d", opkt.stream_index ); AVPacket safepkt; memcpy(&safepkt, &opkt, sizeof(AVPacket)); + audio_previous_dts = opkt.dts; // Unsure if av_interleaved_write_frame() clobbers opkt.dts when out of order, so storing in advance + audio_previous_pts = opkt.pts; ret = av_interleaved_write_frame(oc, &opkt); if(ret!=0){ Error("Error writing audio frame packet: %s\n", av_make_error_string(ret).c_str()); From eeefb2c8e2e3be7c86189020d812949b5ef8b91f Mon Sep 17 00:00:00 2001 From: Isaac Connor Date: Fri, 2 Jun 2017 16:53:14 -0400 Subject: [PATCH 53/60] need previous_pts and dts for both video and audio. I don't think they can share --- src/zm_videostore.h | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/src/zm_videostore.h b/src/zm_videostore.h index b76153cb8..e4d337df0 100644 --- a/src/zm_videostore.h +++ b/src/zm_videostore.h @@ -61,8 +61,10 @@ AVAudioResampleContext* resample_context; int64_t audio_last_dts; // These are for output, should start at zero. We assume they do not wrap because we just aren't going to save files that big. - int64_t previous_pts; - int64_t previous_dts; + int64_t video_previous_pts; + int64_t video_previous_dts; + int64_t audio_previous_pts; + int64_t audio_previous_dts; int64_t filter_in_rescale_delta_last; From 7b8222f73b178653b98ed43e2a66d5f6cde04b71 Mon Sep 17 00:00:00 2001 From: Isaac Connor Date: Fri, 2 Jun 2017 20:17:08 -0400 Subject: [PATCH 54/60] fix type for WEB_EVENT_DISK_SPACE to boolean. --- scripts/ZoneMinder/lib/ZoneMinder/ConfigData.pm.in | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/scripts/ZoneMinder/lib/ZoneMinder/ConfigData.pm.in b/scripts/ZoneMinder/lib/ZoneMinder/ConfigData.pm.in index 294564dae..ff8ec00f3 100644 --- a/scripts/ZoneMinder/lib/ZoneMinder/ConfigData.pm.in +++ b/scripts/ZoneMinder/lib/ZoneMinder/ConfigData.pm.in @@ -1585,7 +1585,7 @@ our @options = ( this overhead is fairly small but may be noticeable on IO-constrained systems. `, - type => $types{string}, + type => $types{boolean}, category => 'web', }, { From d910bcf1219eb89ce00c2840555ef45314b43279 Mon Sep 17 00:00:00 2001 From: Isaac Connor Date: Fri, 2 Jun 2017 20:18:05 -0400 Subject: [PATCH 55/60] fix quoting on config --- scripts/ZoneMinder/lib/ZoneMinder/ConfigData.pm.in | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/scripts/ZoneMinder/lib/ZoneMinder/ConfigData.pm.in b/scripts/ZoneMinder/lib/ZoneMinder/ConfigData.pm.in index 294564dae..5ac143d10 100644 --- a/scripts/ZoneMinder/lib/ZoneMinder/ConfigData.pm.in +++ b/scripts/ZoneMinder/lib/ZoneMinder/ConfigData.pm.in @@ -3366,7 +3366,7 @@ our @options = ( { name => 'ZM_WEB_M_DEFAULT_SCALE', default => '100', - description => q`'What the default scaling factor applied to 'live' or 'event' views is (%)`, + description => q`What the default scaling factor applied to 'live' or 'event' views is (%)`, help => q` Normally ZoneMinder will display 'live' or 'event' streams in their native size. However if you have monitors with large @@ -3387,7 +3387,7 @@ our @options = ( { name => 'ZM_WEB_M_DEFAULT_RATE', default => '100', - description => 'What the default replay rate factor applied to \'event\' views is (%)', + description => q`What the default replay rate factor applied to 'event' views is (%)`, help => q` Normally ZoneMinder will display 'event' streams at their native rate, i.e. as close to real-time as possible. However if From 44eba78e40be02142bdef681d196b13230ae4b96 Mon Sep 17 00:00:00 2001 From: Isaac Connor Date: Fri, 2 Jun 2017 20:42:55 -0400 Subject: [PATCH 56/60] put back empty files --- distros/ubuntu1204/NEWS | 0 distros/ubuntu1204/changelog | 0 2 files changed, 0 insertions(+), 0 deletions(-) create mode 100644 distros/ubuntu1204/NEWS create mode 100644 distros/ubuntu1204/changelog diff --git a/distros/ubuntu1204/NEWS b/distros/ubuntu1204/NEWS new file mode 100644 index 000000000..e69de29bb diff --git a/distros/ubuntu1204/changelog b/distros/ubuntu1204/changelog new file mode 100644 index 000000000..e69de29bb From c1ecbae94670f98916c8bc7e609f149dbfc47a4c Mon Sep 17 00:00:00 2001 From: Andrew Bauer Date: Fri, 2 Jun 2017 21:01:59 -0500 Subject: [PATCH 57/60] Update startpackpack.sh add an entry to the debian changelog before calling packpack --- utils/packpack/startpackpack.sh | 16 +++++++++++++++- 1 file changed, 15 insertions(+), 1 deletion(-) diff --git a/utils/packpack/startpackpack.sh b/utils/packpack/startpackpack.sh index 6d9e37b51..a64be651a 100755 --- a/utils/packpack/startpackpack.sh +++ b/utils/packpack/startpackpack.sh @@ -151,6 +151,16 @@ setdebpkgver () { } +# This adds an entry to the debian changelog +setdebchangelog () { +DATE=`date -R` +cat < debian/changelog +zoneminder ($VERSION-${DIST}-1) unstable; urgency=low + * + -- Isaac Connor $DATE +EOF +} + ################ # MAIN PROGRAM # ################ @@ -220,7 +230,9 @@ if [ "${TRAVIS_EVENT_TYPE}" == "cron" ] || [ "${TRAVIS}" != "true" ]; then else ln -sfT distros/ubuntu1604 debian fi - + + setdebchangelog + echo "Starting packpack..." packpack/packpack @@ -239,6 +251,8 @@ elif [ "${OS}" == "ubuntu" ] && [ "${DIST}" == "trusty" ] && [ "${ARCH}" == "x86 ln -sfT distros/ubuntu1204 debian + setdebchangelog + echo "Starting packpack..." packpack/packpack From 7ae0b4a54669534d0b7e1394e8301e4c55dbb102 Mon Sep 17 00:00:00 2001 From: Isaac Connor Date: Sat, 3 Jun 2017 10:13:39 -0400 Subject: [PATCH 58/60] handle older versions of ffmpeg --- src/zm_videostore.cpp | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/src/zm_videostore.cpp b/src/zm_videostore.cpp index 826f62d35..89537d87f 100644 --- a/src/zm_videostore.cpp +++ b/src/zm_videostore.cpp @@ -379,8 +379,12 @@ bool VideoStore::setup_resampler() { #ifdef HAVE_LIBAVRESAMPLE static char error_buffer[256]; +#if LIBAVCODEC_VERSION_CHECK(57, 0, 0, 0, 0) // Newer ffmpeg wants to keep everything separate... so have to lookup our own decoder, can't reuse the one from the camera. AVCodec *audio_input_codec = avcodec_find_decoder(audio_input_stream->codecpar->codec_id); +#else + AVCodec *audio_input_codec = avcodec_find_decoder(audio_input_context->codec_id); +#endif ret = avcodec_open2( audio_input_context, audio_input_codec, NULL ); if ( ret < 0 ) { Error("Can't open input codec!"); From 07704dd5d680cc59423a5e2d487e2db652a58f79 Mon Sep 17 00:00:00 2001 From: Isaac Connor Date: Sun, 4 Jun 2017 17:30:39 -0400 Subject: [PATCH 59/60] coments --- scripts/zmfilter.pl.in | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/scripts/zmfilter.pl.in b/scripts/zmfilter.pl.in index aeb11b509..c69ad57b1 100644 --- a/scripts/zmfilter.pl.in +++ b/scripts/zmfilter.pl.in @@ -139,8 +139,10 @@ if ( ! EVENT_PATH ) { die; } +# In future, should not be neccessary wrt StorageAreas chdir( EVENT_PATH ); +# SHould not be neccessary... but nice to get a local var. What if it fails? my $dbh = zmDbConnect(); if ( $filter_parm ) { @@ -149,7 +151,8 @@ if ( $filter_parm ) { Info( "Scanning for events\n" ); } -if ( !$filter_parm ) { +if ( ! $filter_parm ) { + Debug("Sleeping due to start delay: " . START_DELAY . ' seconds...' ); sleep( START_DELAY ); } @@ -182,7 +185,7 @@ sub getFilters { if ( $filter_name ) { $sql .= ' Name = ? and'; } else { - $sql .= ' Background = 1 and'; + $sql .= ' Background = 1 AND'; } $sql .= '( AutoArchive = 1 or AutoVideo = 1 From 07835969f1f429e041ab2d8afcfa014e14319842 Mon Sep 17 00:00:00 2001 From: Isaac Connor Date: Sun, 4 Jun 2017 17:31:17 -0400 Subject: [PATCH 60/60] get rid of viewport line that prevents zooming in and out --- web/skins/classic/includes/functions.php | 1 - 1 file changed, 1 deletion(-) diff --git a/web/skins/classic/includes/functions.php b/web/skins/classic/includes/functions.php index 0a85569ed..78115db1c 100644 --- a/web/skins/classic/includes/functions.php +++ b/web/skins/classic/includes/functions.php @@ -44,7 +44,6 @@ function xhtmlHeaders( $file, $title ) { - <?php echo ZM_WEB_TITLE_PREFIX ?> - <?php echo validHtmlStr($title) ?>