Merge branch 'release-1.34'

This commit is contained in:
Isaac Connor 2020-05-15 16:02:29 -04:00
commit 3c2e26ac32
1 changed files with 14 additions and 10 deletions

View File

@ -39,16 +39,18 @@ function probeV4L() {
} }
$monitors = array(); $monitors = array();
foreach ( dbFetchAll("SELECT Id, Name, Device,Channel FROM Monitors WHERE Type = 'Local' ORDER BY Device, Channel" ) as $monitor ) foreach ( dbFetchAll("SELECT Id, Name, Device, Channel FROM Monitors WHERE Type = 'Local' ORDER BY Device, Channel" ) as $monitor )
$monitors[$monitor['Device'].':'.$monitor['Channel']] = $monitor; $monitors[$monitor['Device'].':'.$monitor['Channel']] = $monitor;
$devices = array(); $devices = array();
$preferredStandards = array('PAL', 'NTSC'); $preferredStandards = array('PAL', 'NTSC');
$preferredFormats = array('BGR3', 'RGB3', 'YUYV', 'UYVY', 'JPEG', 'MJPG', '422P', 'YU12', 'GREY'); $preferredFormats = array('BGR3', 'RGB3', 'YUYV', 'UYVY', 'JPEG', 'MJPG', '422P', 'YU12', 'GREY');
foreach ( $output as $line ) { foreach ( $output as $line ) {
if ( !preg_match('/^d:([^|]+).*S:([^|]*).*F:([^|]+).*I:(\d+)\|(.+)$/', $line, $deviceMatches) ) if ( !preg_match('/^d:([^|]+).*S:([^|]*).*F:([^|]+).*I:(\d+)\|(.+)$/', $line, $deviceMatches) ) {
ZM\Fatal("Can't parse command output '$line'"); ZM\Error("Can't parse command output '$line'");
$standards = explode('/',$deviceMatches[2]); continue;
}
$standards = explode('/', $deviceMatches[2]);
$preferredStandard = false; $preferredStandard = false;
foreach ( $preferredStandards as $standard ) { foreach ( $preferredStandards as $standard ) {
if ( in_array( $standard, $standards ) ) { if ( in_array( $standard, $standards ) ) {
@ -56,7 +58,7 @@ function probeV4L() {
break; break;
} }
} }
$formats = explode('/',$deviceMatches[3]); $formats = explode('/', $deviceMatches[3]);
$preferredFormat = false; $preferredFormat = false;
foreach ( $preferredFormats as $format ) { foreach ( $preferredFormats as $format ) {
if ( in_array($format, $formats) ) { if ( in_array($format, $formats) ) {
@ -73,8 +75,10 @@ function probeV4L() {
); );
$inputs = array(); $inputs = array();
for ( $i = 0; $i < $deviceMatches[4]; $i++ ) { for ( $i = 0; $i < $deviceMatches[4]; $i++ ) {
if ( !preg_match('/i'.$i.':([^|]+)\|i'.$i.'T:([^|]+)\|/', $deviceMatches[5], $inputMatches) ) if ( !preg_match('/i'.$i.':([^|]+)\|i'.$i.'T:([^|]+)\|/', $deviceMatches[5], $inputMatches) ) {
ZM\Fatal("Can't parse input '".$deviceMatches[5]."'"); ZM\Error("Can't parse input '".$deviceMatches[5]."'");
continue;
}
if ( $inputMatches[2] == 'Camera' ) { if ( $inputMatches[2] == 'Camera' ) {
$input = array( $input = array(
'index' => $i, 'index' => $i,
@ -101,7 +105,7 @@ function probeV4L() {
$inputMonitor['Colours'] = 1; $inputMonitor['Colours'] = 1;
$inputMonitor['SignalCheckColour'] = '#000023'; $inputMonitor['SignalCheckColour'] = '#000023';
} }
$inputDesc = base64_encode(serialize($inputMonitor)); $inputDesc = base64_encode(json_encode($inputMonitor));
$inputString = $deviceMatches[1].', chan '.$i.($input['free']?(' - '.translate('Available')):(' ('.$monitors[$input['id']]['Name'].')')); $inputString = $deviceMatches[1].', chan '.$i.($input['free']?(' - '.translate('Available')):(' ('.$monitors[$input['id']]['Name'].')'));
$inputs[] = $input; $inputs[] = $input;
$cameras[$inputDesc] = $inputString; $cameras[$inputDesc] = $inputString;
@ -288,7 +292,7 @@ function probeNetwork() {
if ( isset($macBases[$macRoot]) ) { if ( isset($macBases[$macRoot]) ) {
$macBase = $macBases[$macRoot]; $macBase = $macBases[$macRoot];
$camera = call_user_func($macBase['probeFunc'], $ip); $camera = call_user_func($macBase['probeFunc'], $ip);
$sourceDesc = base64_encode(serialize($camera['monitor'])); $sourceDesc = base64_encode(json_encode($camera['monitor']));
$sourceString = $camera['model'].' @ '.$host; $sourceString = $camera['model'].' @ '.$host;
if ( isset($monitors[$ip]) ) { if ( isset($monitors[$ip]) ) {
$monitor = $monitors[$ip]; $monitor = $monitors[$ip];
@ -330,7 +334,7 @@ xhtmlHeaders(__FILE__, translate('MonitorProbe') );
</p> </p>
<p> <p>
<label for="probe"><?php echo translate('DetectedCameras') ?></label> <label for="probe"><?php echo translate('DetectedCameras') ?></label>
<?php echo buildSelect('probe', $cameras, 'configureButtons(this)'); ?> <?php echo htmlSelect('probe', $cameras, null, array('data-on-change-this'=>'configureButtons(this)')); ?>
</p> </p>
<div id="contentButtons"> <div id="contentButtons">
<button type="button" name="saveBtn" value="Save" data-on-click-this="submitCamera" disabled="disabled"> <button type="button" name="saveBtn" value="Save" data-on-click-this="submitCamera" disabled="disabled">