spacing updates. Use MP4 instead of H264/H265 in viewing codec dropdown

This commit is contained in:
Isaac Connor 2019-03-19 12:16:31 -04:00
parent 6b6e787e4e
commit 71cd024fda
4 changed files with 24 additions and 26 deletions

View File

@ -499,7 +499,7 @@ CREATE TABLE `Monitors` (
`ReturnDelay` smallint(5) unsigned,
`DefaultRate` smallint(5) unsigned NOT NULL default '100',
`DefaultScale` smallint(5) unsigned NOT NULL default '100',
`DefaultCodec` enum('auto','H264','H265','MJPEG') NOT NULL default 'auto',
`DefaultCodec` enum('auto','MP4','MJPEG') NOT NULL default 'auto',
`SignalCheckPoints` INT UNSIGNED NOT NULL default '0',
`SignalCheckColour` varchar(32) NOT NULL default '#0000BE',
`WebColour` varchar(32) NOT NULL default 'red',

View File

@ -5,7 +5,7 @@ SET @s = (SELECT IF(
AND column_name = 'DefaultCodec'
) > 0,
"SELECT 'Column DefaultCodec already exists in Monitors'",
"ALTER TABLE Monitors ADD `DefaultCodec` enum('auto','H264','H265','MJPEG') NOT NULL default 'auto' AFTER `DefaultScale`"
"ALTER TABLE Monitors ADD `DefaultCodec` enum('auto','MP4','MJPEG') NOT NULL default 'auto' AFTER `DefaultScale`"
));
PREPARE stmt FROM @s;

View File

@ -23,20 +23,20 @@ if ( !canView('Events') ) {
return;
}
$eid = validInt( $_REQUEST['eid'] );
$eid = validInt($_REQUEST['eid']);
$fid = !empty($_REQUEST['fid'])?validInt($_REQUEST['fid']):1;
$Event = new ZM\Event( $eid );
$Event = new ZM\Event($eid);
if ( $user['MonitorIds'] ) {
$monitor_ids = explode( ',', $user['MonitorIds'] );
if ( count($monitor_ids) and ! in_array( $Event->MonitorId(), $monitor_ids ) ) {
$monitor_ids = explode(',', $user['MonitorIds']);
if ( count($monitor_ids) and ! in_array($Event->MonitorId(), $monitor_ids) ) {
$view = 'error';
return;
}
}
$Monitor = $Event->Monitor();
if (isset($_REQUEST['rate'])) {
if ( isset($_REQUEST['rate']) ) {
$rate = validInt($_REQUEST['rate']);
} else if ( isset($_COOKIE['zmEventRate']) ) {
$rate = $_COOKIE['zmEventRate'];
@ -44,40 +44,39 @@ if (isset($_REQUEST['rate'])) {
$rate = reScale(RATE_BASE, $Monitor->DefaultRate(), ZM_WEB_DEFAULT_RATE);
}
if (isset($_REQUEST['scale'])) {
if ( isset($_REQUEST['scale']) ) {
$scale = validInt($_REQUEST['scale']);
} else if ( isset( $_COOKIE['zmEventScaleAuto'] ) ) {
} else if ( isset($_COOKIE['zmEventScaleAuto']) ) {
// If we're using scale to fit use it on all monitors
$scale = 'auto';
} else if ( isset( $_COOKIE['zmEventScale'.$Event->MonitorId()] ) ) {
} else if ( isset($_COOKIE['zmEventScale'.$Event->MonitorId()]) ) {
$scale = $_COOKIE['zmEventScale'.$Event->MonitorId()];
} else {
$scale = reScale(SCALE_BASE, $Monitor->DefaultScale(), ZM_WEB_DEFAULT_SCALE);
}
$codec = 'auto';
if (isset($_REQUEST['codec'])) {
if ( isset($_REQUEST['codec']) ) {
$codec = $_REQUEST['codec'];
session_start();
$_SESSION['zmEventCodec'.$Event->MonitorId()] = $codec;
session_write_close();
} else if ( isset( $_SESSION['zmEventCodec'.$Event->MonitorId()] ) ) {
} else if ( isset($_SESSION['zmEventCodec'.$Event->MonitorId()]) ) {
$codec = $_SESSION['zmEventCodec'.$Event->MonitorId()];
} else {
$codec = $Monitor->DefaultCodec();
}
$codecs = array(
'auto' => translate('Auto'),
'H264' => translate('H264'),
'H265' => translate('H265'),
'MP4' => translate('MP4'),
'MJPEG' => translate('MJPEG'),
);
$replayModes = array(
'none' => translate('None'),
'single' => translate('ReplaySingle'),
'all' => translate('ReplayAll'),
'gapless' => translate('ReplayGapless'),
'none' => translate('None'),
'single' => translate('ReplaySingle'),
'all' => translate('ReplayAll'),
'gapless' => translate('ReplayGapless'),
);
if ( isset( $_REQUEST['streamMode'] ) )
@ -106,7 +105,7 @@ if ( $Monitor->VideoWriter() == '2' ) {
}
parseSort();
parseFilter( $_REQUEST['filter'] );
parseFilter($_REQUEST['filter']);
$filterQuery = $_REQUEST['filter']['query'];
$connkey = generateConnKey();
@ -115,7 +114,7 @@ $focusWindow = true;
$popup = (isset($_REQUEST['popup']) && ($_REQUEST['popup'] == 1));
xhtmlHeaders(__FILE__, translate('Event') );
xhtmlHeaders(__FILE__, translate('Event'));
?>
<body>
<div id="page">
@ -168,15 +167,15 @@ if ( canEdit('Events') ) {
} // end if Event->DefaultVideo
?>
<div id="exportEvent"><button type="button" data-on-click="exportEvent"><?php echo translate('Export') ?></button></div>
<div id="replayControl"><label for="replayMode"><?php echo translate('Replay') ?></label><?php echo buildSelect( "replayMode", $replayModes, "changeReplayMode();" ); ?></div>
<div id="scaleControl"><label for="scale"><?php echo translate('Scale') ?></label><?php echo buildSelect( "scale", $scales, "changeScale();" ); ?></div>
<div id="codecControl"><label for="codec"><?php echo translate('Codec') ?></label><?php echo htmlSelect('codec', $codecs, $codec, array('onchange'=>'changeCodec(this);') ); ?></div>
<div id="replayControl"><label for="replayMode"><?php echo translate('Replay') ?></label><?php echo buildSelect('replayMode', $replayModes, 'changeReplayMode();'); ?></div>
<div id="scaleControl"><label for="scale"><?php echo translate('Scale') ?></label><?php echo buildSelect('scale', $scales, 'changeScale();'); ?></div>
<div id="codecControl"><label for="codec"><?php echo translate('Codec') ?></label><?php echo htmlSelect('codec', $codecs, $codec, array('onchange'=>'changeCodec(this);')); ?></div>
</div>
</div>
<div id="content">
<div id="eventVideo" class="">
<?php
if ( ($codec == 'H264' || $codec == 'H265' || $codec == 'auto' ) && $Event->DefaultVideo() ) {
if ( ($codec == 'MP4' || $codec == 'auto' ) && $Event->DefaultVideo() ) {
?>
<div id="videoFeed">
<video id="videoobj" class="video-js vjs-default-skin" style="transform: matrix(1, 0, 0, 1, 0, 0)" width="<?php echo reScale( $Event->Width(), $scale ) ?>" height="<?php echo reScale( $Event->Height(), $scale ) ?>" data-setup='{ "controls": true, "autoplay": true, "preload": "auto", "plugins": { "zoomrotate": { "zoom": "<?php echo $Zoom ?>"}}}'>

View File

@ -454,8 +454,7 @@ $savejpegopts = array(
$codecs = array(
'auto' => translate('Auto'),
'H264' => translate('H264'),
'H265' => translate('H265'),
'MP4' => translate('MP4'),
'MJPEG' => translate('MJPEG'),
);