This commit is contained in:
Isaac Connor 2021-09-28 10:31:04 -04:00
commit 509a5549be
5 changed files with 44 additions and 16 deletions

1
.gitignore vendored
View File

@ -124,6 +124,7 @@ src/zmc
src/zmf src/zmf
src/zms src/zms
src/zmu src/zmu
src/zm_rtsp_server
src/zoneminder-zmc.8 src/zoneminder-zmc.8
src/zoneminder-zmc.8.gz src/zoneminder-zmc.8.gz
src/zoneminder-zmf.8 src/zoneminder-zmf.8

View File

@ -399,7 +399,6 @@ sub checkFilter {
) { ) {
$Event->save(); $Event->save();
} }
$ZoneMinder::Database::dbh->commit() if !$$filter{LockRows};
} # end if UpdateDiskSpace } # end if UpdateDiskSpace
} # end foreach event } # end foreach event
ZoneMinder::Database::end_transaction($dbh, $in_transaction) if $$filter{LockRows}; ZoneMinder::Database::end_transaction($dbh, $in_transaction) if $$filter{LockRows};

View File

@ -61,13 +61,15 @@ static enum AVPixelFormat find_fmt_by_hw_type(const enum AVHWDeviceType type) {
case AV_HWDEVICE_TYPE_DXVA2: case AV_HWDEVICE_TYPE_DXVA2:
return AV_PIX_FMT_DXVA2_VLD; return AV_PIX_FMT_DXVA2_VLD;
case AV_HWDEVICE_TYPE_D3D11VA: case AV_HWDEVICE_TYPE_D3D11VA:
return = AV_PIX_FMT_D3D11; return AV_PIX_FMT_D3D11;
case AV_HWDEVICE_TYPE_VDPAU: case AV_HWDEVICE_TYPE_VDPAU:
return AV_PIX_FMT_VDPAU; return AV_PIX_FMT_VDPAU;
case AV_HWDEVICE_TYPE_CUDA: case AV_HWDEVICE_TYPE_CUDA:
return AV_PIX_FMT_CUDA; return AV_PIX_FMT_CUDA;
#ifdef AV_HWDEVICE_TYPE_MMAL
case AV_HWDEVICE_TYPE_MMAL: case AV_HWDEVICE_TYPE_MMAL:
return AV_PIX_FMT_MMAL; return AV_PIX_FMT_MMAL;
#endif
case AV_HWDEVICE_TYPE_VIDEOTOOLBOX: case AV_HWDEVICE_TYPE_VIDEOTOOLBOX:
return AV_PIX_FMT_VIDEOTOOLBOX; return AV_PIX_FMT_VIDEOTOOLBOX;
default: default:

View File

@ -69,6 +69,11 @@
// setlocale( LC_CTYPE, 'en_GB' ); Character class settings 4.3.0 and after // setlocale( LC_CTYPE, 'en_GB' ); Character class settings 4.3.0 and after
// setlocale( LC_TIME, 'en_GB' ); Date and time formatting 4.3.0 and after // setlocale( LC_TIME, 'en_GB' ); Date and time formatting 4.3.0 and after
setlocale( LC_TIME, 'en_GB.utf8' );
define("DATE_FMT_CONSOLE_LONG", "%a %d %b, %Hh%M");
define( "STRF_FMT_DATETIME_SHORT", "%d/%m/%y %H:%M:%S" );
define( "STRF_FMT_DATETIME_SHORTER", "%x %H:%M:%S" );
// Simple String Replacements // Simple String Replacements
$SLANG = array( $SLANG = array(
'SystemLog' => 'System Log', 'SystemLog' => 'System Log',

View File

@ -21,44 +21,50 @@
require_once('includes/Server.php'); require_once('includes/Server.php');
require_once('includes/Storage.php'); require_once('includes/Storage.php');
if ( !canEdit('Monitors', empty($_REQUEST['mid'])?0:$_REQUEST['mid']) ) { if (!canEdit('Monitors', empty($_REQUEST['mid'])?0:$_REQUEST['mid'])) {
$view = 'error'; $view = 'error';
return; return;
} }
$Server = null; $Server = null;
if ( defined('ZM_SERVER_ID') ) { if (defined('ZM_SERVER_ID')) {
$Server = dbFetchOne('SELECT * FROM Servers WHERE Id=?', NULL, array(ZM_SERVER_ID)); $Server = dbFetchOne('SELECT * FROM Servers WHERE Id=?', NULL, array(ZM_SERVER_ID));
} }
if ( !$Server ) { if (!$Server) {
$Server = array('Id' => ''); $Server = array('Id' => '');
} }
$mid = null; $mid = null;
$monitor = null; $monitor = null;
if ( !empty($_REQUEST['mid']) ) { if (!empty($_REQUEST['mid'])) {
$mid = validInt($_REQUEST['mid']); $mid = validInt($_REQUEST['mid']);
$monitor = new ZM\Monitor($mid); $monitor = new ZM\Monitor($mid);
if ( $monitor and ZM_OPT_X10 ) if ($monitor->Id()) {
$x10Monitor = dbFetchOne('SELECT * FROM TriggersX10 WHERE MonitorId = ?', NULL, array($mid)); if (ZM_OPT_X10) {
$x10Monitor = dbFetchOne('SELECT * FROM TriggersX10 WHERE MonitorId = ?', NULL, array($mid));
}
} else {
$monitor->Name(translate('Monitor').'-'.$mid);
$monitor->WebColour(random_colour());
}
} }
if ( !$monitor ) { if (!$monitor) {
$monitor = new ZM\Monitor(); $monitor = new ZM\Monitor();
$monitor->Name(translate('Monitor').'-'.getTableAutoInc('Monitors')); $monitor->Name(translate('Monitor').'-'.getTableAutoInc('Monitors'));
$monitor->WebColour(random_colour()); $monitor->WebColour(random_colour());
} # end if $_REQUEST['mid'] } # end if $_REQUEST['mid']
if ( isset($_REQUEST['dupId']) ) { if (isset($_REQUEST['dupId'])) {
$monitor = new ZM\Monitor($_REQUEST['dupId']); $monitor = new ZM\Monitor($_REQUEST['dupId']);
$monitor->GroupIds(); // have to load before we change the Id $monitor->GroupIds(); // have to load before we change the Id
if ( ZM_OPT_X10 ) if (ZM_OPT_X10)
$x10Monitor = dbFetchOne('SELECT * FROM TriggersX10 WHERE MonitorId = ?', NULL, array($_REQUEST['dupId'])); $x10Monitor = dbFetchOne('SELECT * FROM TriggersX10 WHERE MonitorId = ?', NULL, array($_REQUEST['dupId']));
$clonedName = $monitor->Name(); $clonedName = $monitor->Name();
$monitor->Name('Clone of '.$monitor->Name()); $monitor->Name('Clone of '.$monitor->Name());
$monitor->Id($mid); $monitor->Id($mid);
} }
if ( ZM_OPT_X10 && empty($x10Monitor) ) { if (ZM_OPT_X10 && empty($x10Monitor)) {
$x10Monitor = array( $x10Monitor = array(
'Activation' => '', 'Activation' => '',
'AlarmInput' => '', 'AlarmInput' => '',
@ -69,14 +75,14 @@ if ( ZM_OPT_X10 && empty($x10Monitor) ) {
function fourcc($a, $b, $c, $d) { function fourcc($a, $b, $c, $d) {
return ord($a) | (ord($b) << 8) | (ord($c) << 16) | (ord($d) << 24); return ord($a) | (ord($b) << 8) | (ord($c) << 16) | (ord($d) << 24);
} }
if ( isset($_REQUEST['newMonitor']) ) { if (isset($_REQUEST['newMonitor'])) {
# Update the monitor object with whatever has been set so far. # Update the monitor object with whatever has been set so far.
$monitor->set($_REQUEST['newMonitor']); $monitor->set($_REQUEST['newMonitor']);
if ( ZM_OPT_X10 ) if (ZM_OPT_X10)
$newX10Monitor = $_REQUEST['newX10Monitor']; $newX10Monitor = $_REQUEST['newX10Monitor'];
} else { } else {
if ( ZM_OPT_X10 ) if (ZM_OPT_X10)
$newX10Monitor = $x10Monitor; $newX10Monitor = $x10Monitor;
} }
@ -349,6 +355,7 @@ $codecs = array(
'MJPEG' => translate('MJPEG'), 'MJPEG' => translate('MJPEG'),
); );
$monitors = dbFetchAll('SELECT Id, Name FROM Monitors ORDER BY Name,Sequence ASC');
$controls = ZM\Control::find(null, array('order'=>'lower(Name)')); $controls = ZM\Control::find(null, array('order'=>'lower(Name)'));
xhtmlHeaders(__FILE__, translate('Monitor').' - '.validHtmlStr($monitor->Name())); xhtmlHeaders(__FILE__, translate('Monitor').' - '.validHtmlStr($monitor->Name()));
@ -446,6 +453,21 @@ foreach ( $tabs as $name=>$value ) {
switch ( $name ) { switch ( $name ) {
case 'general' : case 'general' :
{ {
if (!$monitor->Id()) {
$monitor_ids = array();
foreach ($monitors as $m) { $monitor_ids[] = $m['Id']; }
$available_monitor_ids = array_diff(range(min($monitor_ids),max($monitor_ids)), $monitor_ids);
?>
<tr class="Id">
<td class="text-right pr-3"><?php echo translate('Id') ?></td>
<td><input type="number" step="1" min="1" name="newMonitor[Id]" placeholder="leave blank for auto"/><br/>
10 Available Ids:
<?php echo implode(', ', array_slice($available_monitor_ids, 0, 10)); ?>
</td>
</tr>
<?php
} # end if ! $monitor->Id()
?> ?>
<tr class="Name"> <tr class="Name">
<td class="text-right pr-3"><?php echo translate('Name') ?></td> <td class="text-right pr-3"><?php echo translate('Name') ?></td>
@ -518,7 +540,6 @@ switch ( $name ) {
<td class="text-right pr-3"><?php echo translate('LinkedMonitors'); echo makeHelpLink('OPTIONS_LINKED_MONITORS') ?></td> <td class="text-right pr-3"><?php echo translate('LinkedMonitors'); echo makeHelpLink('OPTIONS_LINKED_MONITORS') ?></td>
<td> <td>
<?php <?php
$monitors = dbFetchAll('SELECT Id, Name FROM Monitors ORDER BY Name,Sequence ASC');
$monitor_options = array(); $monitor_options = array();
foreach ( $monitors as $linked_monitor ) { foreach ( $monitors as $linked_monitor ) {
if ( (!$monitor->Id() || ($monitor->Id()!= $linked_monitor['Id'])) && visibleMonitor($linked_monitor['Id']) ) { if ( (!$monitor->Id() || ($monitor->Id()!= $linked_monitor['Id'])) && visibleMonitor($linked_monitor['Id']) ) {