示例#1
0
function outputlivestream($monitor, $inwidth = 0, $inheight = 0)
{
    $scale = isset($_REQUEST['scale']) ? validInt($_REQUEST['scale']) : reScale(SCALE_BASE, $monitor['DefaultScale'], ZM_WEB_DEFAULT_SCALE);
    $connkey = $monitor['connKey'];
    // Minor hack
    //$connKey = generateConnKey();
    if (ZM_WEB_STREAM_METHOD == 'mpeg' && ZM_MPEG_LIVE_FORMAT) {
        $streamMode = "mpeg";
        $streamSrc = getStreamSrc(array("mode=" . $streamMode, "monitor=" . $monitor['Id'], "scale=" . $scale, "bitrate=" . ZM_WEB_VIDEO_BITRATE, "maxfps=" . ZM_WEB_VIDEO_MAXFPS, "format=" . ZM_MPEG_LIVE_FORMAT, "buffer=" . $monitor['StreamReplayBuffer']));
    } elseif (canStream()) {
        $streamMode = "jpeg";
        $streamSrc = getStreamSrc(array("mode=" . $streamMode, "monitor=" . $monitor['Id'], "scale=" . $scale, "maxfps=" . ZM_WEB_VIDEO_MAXFPS, "buffer=" . $monitor['StreamReplayBuffer']));
    } else {
        $streamMode = "single";
        $streamSrc = getStreamSrc(array("mode=" . $streamMode, "monitor=" . $monitor['Id'], "scale=" . $scale));
    }
    $width = !empty($inwidth) ? $inwidth : 150;
    $height = empty($inheight) ? $width * $monitor['Height'] / $monitor['Width'] : $inheight;
    $width = (int) $width;
    $height = (int) $height;
    if ($streamMode === "mpeg") {
        outputVideoStream('liveStream' . $monitor['Id'], $streamSrc, reScale($width, $scale), reScale($height, $scale), ZM_MPEG_LIVE_FORMAT, $monitor['Name']);
    } elseif ($streamMode == "jpeg") {
        if (canStreamNative()) {
            outputImageStream('liveStream' . $monitor['Id'], $streamSrc, reScale($width, $scale), reScale($height, $scale), $monitor['Name']);
        } elseif (canStreamApplet()) {
            outputHelperStream('liveStream' . $monitor['Id'], $streamSrc, reScale($width, $scale), reScale($height, $scale), $monitor['Name']);
        }
    } else {
        outputImageStill('liveStream' . $monitor['Id'], $streamSrc, reScale($width, $scale), reScale($height, $scale), $monitor['Name']);
    }
}
示例#2
0
function addEventToZip($eid, $mid, $zip)
{
    $query = "SELECT Id, MonitorId, StartTime, Frames FROM Events WHERE Id={$eid}";
    $results = dbFetchAll($query);
    $scale = max(reScale(SCALE_BASE, '100', ZM_WEB_DEFAULT_SCALE), SCALE_BASE);
    foreach ($results as $result) {
        for ($counter = 1; $counter <= $result['Frames']; $counter++) {
            $event['Id'] = $result['Id'];
            $event['StartTime'] = $result['StartTime'];
            $event['MonitorId'] = $result['MonitorId'];
            $imageData = getImageSrc($event, $counter, $scale, isset($_REQUEST['show']) && $_REQUEST['show'] == "capt");
            $imagePath = $imageData['thumbPath'];
            $eventPath = $imageData['eventPath'];
            $dImagePath = sprintf("%s/%0" . ZM_EVENT_IMAGE_DIGITS . "d-diag-d.jpg", $eventPath, $counter);
            $rImagePath = sprintf("%s/%0" . ZM_EVENT_IMAGE_DIGITS . "d-diag-r.jpg", $eventPath, $counter);
            $frames[] = viewImagePath($imagePath);
        }
        $zip->addDirectory("events/" . $event['MonitorId']);
        $zip->addDirectory("events/" . $event['MonitorId'] . "/" . $event['Id']);
    }
    $i = 0;
    $filesString = "";
    foreach ($frames as $frame) {
        $i++;
        $filesName = sprintf("%0" . ZM_EVENT_IMAGE_DIGITS . "d-capture.jpg", $i);
        $filesString .= "\nframes.push(\"events/" . $mid . "/" . $eid . "/" . $filesName . "\");";
        $zip->addLargeFile($frame, "events/" . $mid . "/" . $eid . "/" . $filesName);
    }
    return $filesString;
}
示例#3
0
function outputLiveStreamSrcModern($monitor, $inwidth = 0, $inheight = 0)
{
    $scale = isset($_REQUEST['scale']) ? validInt($_REQUEST['scale']) : reScale(SCALE_BASE, $monitor['DefaultScale'], ZM_WEB_DEFAULT_SCALE);
    $connKey = generateAuthHashModern(false);
    //$connkey = $monitor['connKey']; // Minor hack
    if (ZM_WEB_STREAM_METHOD == 'mpeg' && ZM_MPEG_LIVE_FORMAT) {
        $streamMode = "mpeg";
        $streamSrc = getStreamSrcModern(array("mode=" . $streamMode, "monitor=" . $monitor['Id'], "scale=" . $scale, "bitrate=" . ZM_WEB_VIDEO_BITRATE, "maxfps=" . ZM_WEB_VIDEO_MAXFPS, "format=" . ZM_MPEG_LIVE_FORMAT, "buffer=" . $monitor['StreamReplayBuffer']));
    } elseif (canStream()) {
        $streamMode = "jpeg";
        $streamSrc = getStreamSrcModern(array("mode=" . $streamMode, "monitor=" . $monitor['Id'], "scale=" . $scale, "maxfps=" . ZM_WEB_VIDEO_MAXFPS, "buffer=" . $monitor['StreamReplayBuffer']));
    } else {
        $streamMode = "single";
        $streamSrc = getStreamSrcModern(array("mode=" . $streamMode, "monitor=" . $monitor['Id'], "scale=" . $scale));
    }
    return $streamSrc;
}
示例#4
0
function getStreamHTML($monitor, $scale = 100)
{
    //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));
        outputVideoStream("liveStream", $streamSrc, reScale($monitor->Width(), $scale), reScale($monitor->Height(), $scale), ZM_MPEG_LIVE_FORMAT, $monitor->Name());
    } else {
        if (canStream()) {
            $streamSrc = $monitor->getStreamSrc(array('mode=jpeg', 'scale=' . $scale, 'maxfps=' . ZM_WEB_VIDEO_MAXFPS, 'buffer=' . $monitor->StreamReplayBuffer()));
            if (canStreamNative()) {
                outputImageStream("liveStream", $streamSrc, reScale($monitor->Width(), $scale), reScale($monitor->Height(), $scale), $monitor->Name());
            } elseif (canStreamApplet()) {
                outputHelperStream("liveStream", $streamSrc, reScale($monitor->Width(), $scale), reScale($monitor->Height(), $scale), $monitor->Name());
            }
        } else {
            $streamSrc = $monitor->getStreamSrc(array('mode=single', "scale=" . $scale));
            outputImageStill("liveStream", $streamSrc, reScale($monitor->Width(), $scale), reScale($monitor->Height(), $scale), $monitor->Name());
            Info("The system has fallen back to single jpeg mode for streaming. Consider enabling Cambozola or upgrading the client browser.");
        }
    }
}
示例#5
0
/views/assets/images/onerror.png">
    </main>
    <script src="skins/<?php 
echo $skin;
?>
/views/assets/vendor/js/jquery.min.js"></script>
    <script>
      var eid = <?php 
echo $_REQUEST['eid'];
?>
;

      <?php 
$query = "SELECT Id, MonitorId, StartTime, Frames FROM Events WHERE Id={$_REQUEST['eid']}";
$results = dbFetchAll($query);
$scale = max(reScale(SCALE_BASE, '100', ZM_WEB_DEFAULT_SCALE), SCALE_BASE);
foreach ($results as $result) {
    for ($counter = 1; $counter <= $result['Frames']; $counter++) {
        $event['Id'] = $result['Id'];
        $event['StartTime'] = $result['StartTime'];
        $event['MonitorId'] = $result['MonitorId'];
        $imageData = getImageSrc($event, $counter, $scale, isset($_REQUEST['show']) && $_REQUEST['show'] == "capt");
        $imagePath = $imageData['thumbPath'];
        $eventPath = $imageData['eventPath'];
        $dImagePath = sprintf("%s/%0" . ZM_EVENT_IMAGE_DIGITS . "d-diag-d.jpg", $eventPath, $counter);
        $rImagePath = sprintf("%s/%0" . ZM_EVENT_IMAGE_DIGITS . "d-diag-r.jpg", $eventPath, $counter);
        $frames[] = viewImagePath($imagePath);
    }
}
echo "var unprocessed = '" . implode(',', $frames) . "';";
echo "var frames = unprocessed.split(',');";
示例#6
0
        $monitors[$i]['zma'] = zmaStatus($monitors[$i]);
    }
    $monitors[$i]['ZoneCount'] = dbFetchOne("select count(Id) as ZoneCount from Zones where MonitorId = '" . $monitors[$i]['Id'] . "'", "ZoneCount");
    $counts = array();
    for ($j = 0; $j < count($eventCounts); $j++) {
        $filter = addFilterTerm($eventCounts[$j]['filter'], count($eventCounts[$j]['filter']['terms']), array("cnj" => "and", "attr" => "MonitorId", "op" => "=", "val" => $monitors[$i]['Id']));
        parseFilter($filter);
        $counts[] = "count(if(1" . $filter['sql'] . ",1,NULL)) as EventCount{$j}";
        $monitors[$i]['eventCounts'][$j]['filter'] = $filter;
    }
    $sql = "select " . join($counts, ", ") . " from Events as E where MonitorId = '" . $monitors[$i]['Id'] . "'";
    $counts = dbFetchOne($sql);
    if ($monitors[$i]['Function'] != 'None') {
        $cycleCount++;
        $scaleWidth = reScale($monitors[$i]['Width'], $monitors[$i]['DefaultScale'], ZM_WEB_DEFAULT_SCALE);
        $scaleHeight = reScale($monitors[$i]['Height'], $monitors[$i]['DefaultScale'], ZM_WEB_DEFAULT_SCALE);
        if ($maxWidth < $scaleWidth) {
            $maxWidth = $scaleWidth;
        }
        if ($maxHeight < $scaleHeight) {
            $maxHeight = $scaleHeight;
        }
    }
    $monitors[$i] = array_merge($monitors[$i], $counts);
    $seqIdList[] = $monitors[$i]['Id'];
    $displayMonitors[] = $monitors[$i];
}
$states = dbFetchAll("select * from States");
/* XML Dump Starts here */
xml_header();
/* Print out the general section */
示例#7
0
</a>
      </div>
      <h2><?php 
echo $SLANG['Cycle'];
?>
 - <?php 
echo validHtmlStr($monitor['Name']);
?>
</h2>
    </div>
    <div id="content">
      <div id="imageFeed">
<?php 
if ($streamMode == "mpeg") {
    outputVideoStream("liveStream", $streamSrc, reScale($monitor['Width'], $scale), reScale($monitor['Height'], $scale), ZM_MPEG_LIVE_FORMAT, validHtmlStr($monitor['Name']));
} elseif ($streamMode == "jpeg") {
    if (canStreamNative()) {
        outputImageStream("liveStream", $streamSrc, reScale($monitor['Width'], $scale), reScale($monitor['Height'], $scale), validHtmlStr($monitor['Name']));
    } elseif (canStreamApplet()) {
        outputHelperStream("liveStream", $streamSrc, reScale($monitor['Width'], $scale), reScale($monitor['Height'], $scale), validHtmlStr($monitor['Name']));
    }
} else {
    outputImageStill("liveStream", $streamSrc, reScale($monitor['Width'], $scale), reScale($monitor['Height'], $scale), validHtmlStr($monitor['Name']));
}
?>
      </div>
    </div>
  </div>
</body>
</html>
示例#8
0
}
$sql = 'SELECT E.*,M.Name AS MonitorName,M.DefaultRate FROM Events AS E INNER JOIN Monitors AS M ON E.MonitorId = M.Id WHERE E.Id = ?' . $midSql;
$event = dbFetchOne($sql, NULL, array($_REQUEST['eid']));
$deviceWidth = isset($device) && !empty($device['width']) ? $device['width'] : DEVICE_WIDTH;
$deviceHeight = isset($device) && !empty($device['height']) ? $device['height'] : DEVICE_HEIGHT;
if ($deviceWidth >= 352 && $deviceHeight >= 288) {
    $videoSize = "352x288";
} elseif ($deviceWidth >= 176 && $deviceHeight >= 144) {
    $videoSize = "176x144";
} else {
    $videoSize = "128x96";
}
$eventWidth = $event['Width'];
$eventHeight = $event['Height'];
if (!isset($rate)) {
    $_REQUEST['rate'] = reScale(RATE_BASE, $event['DefaultRate'], ZM_WEB_DEFAULT_RATE);
}
$eventPath = ZM_DIR_EVENTS . '/' . getEventPath($event);
$videoFormats = array();
$ffmpegFormats = preg_split('/\\s+/', ZM_FFMPEG_FORMATS);
foreach ($ffmpegFormats as $ffmpegFormat) {
    preg_match('/^([^*]+)(\\**)$/', $ffmpegFormat, $matches);
    $videoFormats[$matches[1]] = $matches[1];
    if ($matches[2] == '*') {
        $defaultVideoFormat = $matches[1];
    } elseif ($matches[2] == '**') {
        $defaultPhoneFormat = $matches[1];
    }
}
if (!isset($_REQUEST['videoFormat'])) {
    if (isset($defaultPhoneFormat)) {
示例#9
0
} elseif ($streamMode == "jpeg") {
    if (canStreamNative()) {
        outputImageStream("liveStream", $streamSrc, reScale($monitor['Width'], $scale), reScale($monitor['Height'], $scale), $monitor['Name']);
    } elseif (canStreamApplet()) {
        outputHelperStream("liveStream", $streamSrc, reScale($monitor['Width'], $scale), reScale($monitor['Height'], $scale), $monitor['Name']);
    }
} else {
    ?>
        <a href="?view=<?php 
    echo $_REQUEST['view'];
    ?>
&amp;mid=<?php 
    echo $monitor['Id'];
    ?>
"><?php 
    echo outputImageStill("liveStream", $streamSrc, reScale($monitor['Width'], $scale), reScale($monitor['Height'], $scale), $monitor['Name']);
    ?>
</a>
<?php 
}
?>
      </p>
<?php 
if ($showPtzControls) {
    foreach (getSkinIncludes('includes/control_functions.php') as $includeFile) {
        require_once $includeFile;
    }
    ?>
      <div id="ptzControls">
        <?php 
    echo ptzControls($monitor);
示例#10
0
          <div id="imagePanel">
            <div id="imageFrame" style="width: <?php 
echo reScale($monitor->Width(), $scale);
?>
px; height: <?php 
echo reScale($monitor->Height(), $scale);
?>
px;">
                <?php 
echo getStreamHTML($monitor, $scale);
?>
                <svg id="zoneSVG" class="zones" style="width: <?php 
echo reScale($monitor->Width(), $scale);
?>
px; height: <?php 
echo reScale($monitor->Height(), $scale);
?>
px;margin-top: -<?php 
echo $monitor->Height;
?>
px;background: none;">
                  <polygon id="zonePoly" points="<?php 
echo $zone['AreaCoords'];
?>
" class="<?php 
echo $zone['Type'];
?>
"/>
                  Sorry, your browser does not support inline SVG
                </svg>
            </div>
示例#11
0
            $dclass = "warnText";
        } else {
            $dclass = "infoText";
        }
    }
    if ($monitor['Function'] == 'None') {
        $fclass = "errorText";
    } elseif ($monitor['Function'] == 'Monitor') {
        $fclass = "warnText";
    } else {
        $fclass = "infoText";
    }
    if (!$monitor['Enabled']) {
        $fclass .= " disabledText";
    }
    $scale = max(reScale(SCALE_BASE, $monitor['DefaultScale'], ZM_WEB_DEFAULT_SCALE), SCALE_BASE);
    ?>
   <!-- <tr>
     <td><?php 
    echo $monitor['Name'];
    ?>
</td>
     <td class="colFunction"><?php 
    echo makePopupLink('?view=function&mid=' . $monitor['Id'], 'zmFunction', 'function', '<span class="' . $fclass . '">' . $monitor['Function'] . '</span>');
    ?>
</td>
     <?php 
    if ($monitor['Type'] == "Local") {
        ?>
      <td class="colSource"><?php 
        echo makePopupLink('?view=monitor&mid=' . $monitor['Id'], 'zmMonitor' . $monitor['Id'], 'monitor', '<span class="' . $dclass . '">' . $monitor['Device'] . ' (' . $monitor['Channel'] . ')</span>');
示例#12
0
elseif ( !empty( $limit ) )
{
$eventsSql .= " limit 0, ".dbEscape($limit);
}
*/
$eventsSql .= "  limit {$offset},{$events_per_page} ";
$maxWidth = 0;
$maxHeight = 0;
$archived = false;
$unarchived = false;
$events = array();
foreach (dbFetchAll($eventsSql) as $event) {
    $events[] = $event;
    $scale = max(reScale(SCALE_BASE, $event['DefaultScale'], ZM_WEB_DEFAULT_SCALE), SCALE_BASE);
    $eventWidth = reScale($event['Width'], $scale);
    $eventHeight = reScale($event['Height'], $scale);
    if ($maxWidth < $eventWidth) {
        $maxWidth = $eventWidth;
    }
    if ($maxHeight < $eventHeight) {
        $maxHeight = $eventHeight;
    }
    if ($event['Archived']) {
        $archived = true;
    } else {
        $unarchived = true;
    }
}
$count = count($events);
?>
<input type="hidden" id="inptMonitorName" value="<?php 
示例#13
0
     $data .= '[' . $event['jstime'] . ', ' . $event[$defeventtype[$eventtype][0]] . '],';
 } else {
     $data .= '[' . $event[$defeventtype[$eventtype][0]] . ', ' . $event['jstime'] . '],';
 }
 if ($event['type'] == 'single') {
     $datapoint .= '[' . $event['jstime'] . ', ' . $event[$defeventtype[$eventtype][0]] . '],';
     $scale = max(reScale(SCALE_BASE, $event['DefaultScale'], ZM_WEB_DEFAULT_SCALE), SCALE_BASE);
     $eventdetail .= '[' . $event['eventid'] . ',' . reScale($event['Width'], $scale) . ',' . reScale($event['Height'], $scale) . '],';
 } else {
     $e_ids = explode(',', $event['eventid']);
     $e_hs = explode(',', $event['Height']);
     $e_ws = explode(',', $event['Width']);
     foreach ($e_ids as $k => $id) {
         $datapoint .= '[' . $event['jstime'] . ', ' . $event[$defeventtype[$eventtype][0]] . '],';
         $scale = max(reScale(SCALE_BASE, $event['DefaultScale'], ZM_WEB_DEFAULT_SCALE), SCALE_BASE);
         $eventdetail .= '[' . $id . ',' . reScale($e_ws[$k], $scale) . ',' . reScale($e_hs[$k], $scale) . '],';
     }
     $mydate = date('Y-m-d', $event['mktime']);
     switch ($interval) {
         case '1day':
             $myinterval = '1hr';
             $mystime = $event['mktime'];
             $myetime = $event['mktime'] + 86399;
             break;
         case '1hr':
             $myinterval = 'event';
             $mystime = $event['mktime'];
             $myetime = $event['mktime'] + 3599;
             break;
         case '5min':
             $myinterval = 'event';
示例#14
0
      </video>
    </div>
<?php 
} else {
    ?>
    <div id="imageFeed">
<?php 
    if (ZM_WEB_STREAM_METHOD == 'mpeg' && ZM_MPEG_LIVE_FORMAT) {
        $streamSrc = getStreamSrc(array("source=event", "mode=mpeg", "event=" . $eid, "frame=" . $fid, "scale=" . $scale, "rate=" . $rate, "bitrate=" . ZM_WEB_VIDEO_BITRATE, "maxfps=" . ZM_WEB_VIDEO_MAXFPS, "format=" . ZM_MPEG_REPLAY_FORMAT, "replay=" . $replayMode));
        outputVideoStream("evtStream", $streamSrc, reScale($event['Width'], $scale), reScale($event['Height'], $scale), ZM_MPEG_LIVE_FORMAT);
    } else {
        $streamSrc = getStreamSrc(array("source=event", "mode=jpeg", "event=" . $eid, "frame=" . $fid, "scale=" . $scale, "rate=" . $rate, "maxfps=" . ZM_WEB_VIDEO_MAXFPS, "replay=" . $replayMode));
        if (canStreamNative()) {
            outputImageStream("evtStream", $streamSrc, reScale($event['Width'], $scale), reScale($event['Height'], $scale), validHtmlStr($event['Name']));
        } else {
            outputHelperStream("evtStream", $streamSrc, reScale($event['Width'], $scale), reScale($event['Height'], $scale));
        }
    }
    # end if ZM_WEB_STREAM_METHOD == 'mpeg' && ZM_MPEG_LIVE_FORMAT )
    ?>
        </div>
        <p id="dvrControls">
          <input type="button" value="&lt;+" id="prevBtn" title="<?php 
    echo translate('Prev');
    ?>
" class="inactive" onclick="streamPrev( true )"/>
          <input type="button" value="&lt;&lt;" id="fastRevBtn" title="<?php 
    echo translate('Rewind');
    ?>
" class="inactive" disabled="disabled" onclick="streamFastRev( true )"/>
          <input type="button" value="&lt;" id="slowRevBtn" title="<?php 
示例#15
0
    echo $monitor->scaleWidth();
    ?>
, <?php 
    echo $monitor->scaleHeight();
    ?>
 );">
<?php 
    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));
        outputVideoStream("liveStream" . $monitor->Id(), $streamSrc, reScale($monitor->Width(), $scale), reScale($monitor->Height(), $scale), ZM_MPEG_LIVE_FORMAT);
    } else {
        $streamSrc = $monitor->getStreamSrc(array("mode=jpeg", "scale=" . $scale, "maxfps=" . ZM_WEB_VIDEO_MAXFPS));
        if (canStreamNative()) {
            outputImageStream("liveStream" . $monitor->Id(), $streamSrc, reScale($monitor->Width(), $scale), reScale($monitor->Height(), $scale), validHtmlStr($monitor->Name()));
        } else {
            outputHelperStream("liveStream" . $monitor->Id(), $streamSrc, reScale($monitor->Width(), $scale), reScale($monitor->Height(), $scale));
        }
    }
    ?>
            </div>
<?php 
    if (!ZM_WEB_COMPACT_MONTAGE) {
        ?>
            <div id="monitorState<?php 
        echo $monitor->index();
        ?>
" class="monitorState idle"><?php 
        echo translate('State');
        ?>
:&nbsp;<span id="stateValue<?php 
        echo $monitor->index();
示例#16
0
function displayMonitor($monitor, $bandwidth)
{
    if (!defined(ZM_WEB_DEFAULT_SCALE)) {
        $scale = 40;
    } else {
        $scale = ZM_WEB_DEFAULT_SCALE;
    }
    if ($bandwidth == 'high') {
        if (ZM_STREAM_METHOD == 'mpeg' && ZM_MPEG_LIVE_FORMAT) {
            $streamMode = "mpeg";
            $streamSrc = getStreamSrc(array("mode=" . $streamMode, "monitor=" . $monitor['Id'], "scale=" . $scale, "bitrate=" . ZM_WEB_VIDEO_BITRATE, "maxfps=" . ZM_WEB_VIDEO_MAXFPS, "format=" . ZM_MPEG_LIVE_FORMAT, "buffer=" . $monitor['StreamReplayBuffer']));
        }
        if (canStream()) {
            $streamMode = "jpeg";
            $streamSrc = getStreamSrc(array("mode=" . $streamMode, "monitor=" . $monitor['Id'], "scale=" . $scale, "maxfps=" . ZM_WEB_VIDEO_MAXFPS, "buffer=" . $monitor['StreamReplayBuffer']));
        }
    }
    if ($bandwidth == 'low' || $bandwidth == "medium" || $bandwidth == "" || !$bandwidth) {
        $streamSrc = getStreamSrc(array("mode=single", "monitor=" . $monitor['Id'], "scale=" . $scale));
    }
    $width = $monitor['Width'] * ('.' . $scale) + 20;
    ?>
<li id="monitor_<?php 
    echo $monitor['Id'];
    ?>
" style="width:<?php 
    echo $width;
    ?>
px;">
 <div class="mon_header">
  <h3 style="display:inline;"><?php 
    echo $monitor['Name'];
    ?>
</h3>
  <div class="right">
   <div class="spinner"></div>
   <div class="minimize"><img src="skins/new/graphics/minimize.png" style="width:15px;" alt="minimize" /></div>
  </div>
 </div>
 <div class="mon">
  <a rel="monitor" href="?view=watch&amp;mid=<?php 
    echo $monitor['Id'];
    ?>
" title="<?php 
    echo $monitor['Name'];
    ?>
">
   <?php 
    $name = $monitor['Name'] . "_live";
    outputImageStill("{$name}", $streamSrc, reScale($monitor['Width'], $scale), reScale($monitor['Height'], $scale), $monitor['Name']);
    ?>
  </a>
 </div>
 <div class="monfooter">
 </div>
</li>
<?php 
}
示例#17
0
function createListThumbnail( $event, $overwrite=false )
{
    $sql = "select * from Frames where EventId = '".$event['Id']."' and Score = '".$event['MaxScore']."' order by FrameId limit 1";
    if ( !($frame = dbFetchOne( $sql )) )
        return( false );

    $frameId = $frame['FrameId'];

    if ( ZM_WEB_LIST_THUMB_WIDTH )
    {
        $thumbWidth = ZM_WEB_LIST_THUMB_WIDTH;
        $scale = (SCALE_BASE*ZM_WEB_LIST_THUMB_WIDTH)/$event['Width'];
        $thumbHeight = reScale( $event['Height'], $scale );
    }
    elseif ( ZM_WEB_LIST_THUMB_HEIGHT )
    {
        $thumbHeight = ZM_WEB_LIST_THUMB_HEIGHT;
        $scale = (SCALE_BASE*ZM_WEB_LIST_THUMB_HEIGHT)/$event['Height'];
        $thumbWidth = reScale( $event['Width'], $scale );
    }
    else
    {
        Fatal( "No thumbnail width or height specified, please check in Options->Web" );
    }

    $imageData = getImageSrc( $event, $frame, $scale, false, $overwrite );
    $thumbData = $frame;
    $thumbData['Path'] = $imageData['thumbPath'];
    $thumbData['Width'] = (int)$thumbWidth;
    $thumbData['Height'] = (int)$thumbHeight;

    return( $thumbData );
}
示例#18
0
function getSlotShowEventBehaviour($slot)
{
    global $monitors;
    $monitor =& $monitors[$slot['event']['MonitorId']];
    return "showEvent( '" . $slot['event']['Id'] . "', '" . getSlotFrame($slot) . "', '" . reScale($monitor['Width'], $monitor['DefaultScale'], ZM_WEB_DEFAULT_SCALE) . "', '" . reScale($monitor['Height'], $monitor['DefaultScale'], ZM_WEB_DEFAULT_SCALE) . "' )";
}
示例#19
0
function createListThumbnail($event, $overwrite = false)
{
    if (!($frame = dbFetchOne("SELECT * FROM Frames WHERE EventId=? AND Score=? ORDER BY FrameId LIMIT 1", NULL, array($event['Id'], $event['MaxScore'])))) {
        return false;
    }
    $frameId = $frame['FrameId'];
    if (ZM_WEB_LIST_THUMB_WIDTH) {
        $thumbWidth = ZM_WEB_LIST_THUMB_WIDTH;
        $scale = SCALE_BASE * ZM_WEB_LIST_THUMB_WIDTH / $event['Width'];
        $thumbHeight = reScale($event['Height'], $scale);
    } elseif (ZM_WEB_LIST_THUMB_HEIGHT) {
        $thumbHeight = ZM_WEB_LIST_THUMB_HEIGHT;
        $scale = SCALE_BASE * ZM_WEB_LIST_THUMB_HEIGHT / $event['Height'];
        $thumbWidth = reScale($event['Width'], $scale);
    } else {
        Fatal("No thumbnail width or height specified, please check in Options->Web");
    }
    $imageData = getImageSrc($event, $frame, $scale, false, $overwrite);
    $thumbData = $frame;
    $thumbData['Path'] = $imageData['thumbPath'];
    $thumbData['Width'] = (int) $thumbWidth;
    $thumbData['Height'] = (int) $thumbHeight;
    return $thumbData;
}
示例#20
0
        } else {
            $dclass = "infoText";
        }
    }
    if ($monitor['Function'] == 'None') {
        $fclass = "errorText";
    } else {
        $fclass = "infoText";
    }
    if (!$monitor['Enabled']) {
        $fclass .= " disabledText";
    }
    $scale = max(reScale(SCALE_BASE, $monitor['DefaultScale'], ZM_WEB_DEFAULT_SCALE), SCALE_BASE);
    ?>
            <td class="colName"><?php 
    echo makePopupLink('?view=watch&amp;mid=' . $monitor['Id'], 'zmWatch' . $monitor['Id'], array('watch', reScale($monitor['Width'], $scale), reScale($monitor['Height'], $scale)), $monitor['Name'], $running && $monitor['Function'] != 'None' && canView('Stream'));
    ?>
</td>
            <td class="colFunction"><?php 
    echo makePopupLink('?view=function&amp;mid=' . $monitor['Id'], 'zmFunction', 'function', '<span class="' . $fclass . '">' . translate('Fn' . $monitor['Function']) . (empty($monitor['Enabled']) ? ', disabled' : '') . '</span>', canEdit('Monitors'));
    ?>
</td>
<?php 
    if (count($servers)) {
        ?>
			<td class="colServer"><?php 
        $Server = new Server($monitor['ServerId']);
        echo $Server->Name();
        ?>
</td>
<?php 
示例#21
0
          <div id="imagePanel">
            <div id="imageFrame" style="width: <?php 
echo reScale($monitor['Width'], $scale);
?>
px; height: <?php 
echo reScale($monitor['Height'], $scale);
?>
px;">
              <img name="zoneImage" id="zoneImage" src="<?php 
echo $zoneImage;
?>
" width="<?php 
echo reScale($monitor['Width'], $scale);
?>
" height="<?php 
echo reScale($monitor['Height'], $scale);
?>
" alt="Zone Image"/>
            </div>
          </div>
          <table id="zonePoints" cellspacing="0">
            <tbody>
              <tr>
<?php 
$pointCols = 2;
for ($i = 0; $i < $pointCols; $i++) {
    ?>
                <td>
                  <table cellspacing="0">
                    <thead>
                      <tr>
示例#22
0
    echo $monitor['scaleWidth'];
    ?>
, <?php 
    echo $monitor['scaleHeight'];
    ?>
 );">
<?php 
    if (ZM_WEB_STREAM_METHOD == 'mpeg' && ZM_MPEG_LIVE_FORMAT) {
        $streamSrc = getStreamSrc(array("mode=mpeg", "monitor=" . $monitor['Id'], "scale=" . $scale, "bitrate=" . ZM_WEB_VIDEO_BITRATE, "maxfps=" . ZM_WEB_VIDEO_MAXFPS, "format=" . ZM_MPEG_LIVE_FORMAT));
        outputVideoStream("liveStream" . $monitor['Id'], $streamSrc, reScale($monitor['Width'], $scale), reScale($monitor['Height'], $scale), ZM_MPEG_LIVE_FORMAT);
    } else {
        $streamSrc = getStreamSrc(array("mode=jpeg", "monitor=" . $monitor['Id'], "scale=" . $scale, "maxfps=" . ZM_WEB_VIDEO_MAXFPS));
        if (canStreamNative()) {
            outputImageStream("liveStream" . $monitor['Id'], $streamSrc, reScale($monitor['Width'], $scale), reScale($monitor['Height'], $scale), validHtmlStr($monitor['Name']));
        } else {
            outputHelperStream("liveStream" . $monitor['Id'], $streamSrc, reScale($monitor['Width'], $scale), reScale($monitor['Height'], $scale));
        }
    }
    ?>
            </div>
<?php 
    if (!ZM_WEB_COMPACT_MONTAGE) {
        ?>
            <div id="monitorState<?php 
        echo $monitor['index'];
        ?>
" class="monitorState idle"><?php 
        echo $SLANG['State'];
        ?>
:&nbsp;<span id="stateValue<?php 
        echo $monitor['index'];
示例#23
0
            if (filesize($file) > 0) {
                preg_match('/^(.+)-((?:r[_\\d]+)|(?:F[_\\d]+))-((?:s[_\\d]+)|(?:S[0-9a-z]+))\\.([^.]+)$/', $file, $matches);
                if (preg_match('/^r(.+)$/', $matches[2], $temp_matches)) {
                    $rate = (int) (100 * preg_replace('/_/', '.', $temp_matches[1]));
                    $rateText = isset($rates[$rate]) ? $rates[$rate] : $rate . "x";
                } elseif (preg_match('/^F(.+)$/', $matches[2], $temp_matches)) {
                    $rateText = $temp_matches[1] . "fps";
                }
                if (preg_match('/^s(.+)$/', $matches[3], $temp_matches)) {
                    $scale = (int) (100 * preg_replace('/_/', '.', $temp_matches[1]));
                    $scaleText = isset($scales[$scale]) ? $scales[$scale] : $scale . "x";
                } elseif (preg_match('/^S(.+)$/', $matches[3], $temp_matches)) {
                    $scaleText = $temp_matches[1];
                }
                $width = $scale ? reScale($event['Width'], $scale) : $event['Width'];
                $height = $scale ? reScale($event['Height'], $scale) : $event['Height'];
                ?>
        <tr>
          <td><?php 
                echo $matches[4];
                ?>
</td>
          <td><?php 
                echo filesize($file);
                ?>
</td>
          <td><?php 
                echo $rateText;
                ?>
</td>
          <td><?php 
示例#24
0
    ?>
"/></p>
<?php 
}
if (file_exists($rImagePath)) {
    ?>
      <p id="refImagePath"><?php 
    echo $rImagePath;
    ?>
</p>
      <p id="refImage"><img src="<?php 
    echo viewImagePath($rImagePath);
    ?>
" width="<?php 
    echo reScale($event['Width'], $event['DefaultScale'], $scale);
    ?>
" height="<?php 
    echo reScale($event['Height'], $event['DefaultScale'], $scale);
    ?>
" class="<?php 
    echo $imageData['imageClass'];
    ?>
"/></p>
<?php 
}
?>
    </div>
  </div>
</body>
</html>
示例#25
0
?>
</div>
        </div>
      </div>
      <div id="imageFeed">
<?php 
if ($streamMode == "mpeg") {
    outputVideoStream("liveStream", $streamSrc, reScale($monitor->Width(), $scale), reScale($monitor->Height(), $scale), ZM_MPEG_LIVE_FORMAT, $monitor->Name());
} elseif ($streamMode == "jpeg") {
    if (canStreamNative()) {
        outputImageStream("liveStream", $streamSrc, reScale($monitor->Width(), $scale), reScale($monitor->Height(), $scale), $monitor->Name());
    } elseif (canStreamApplet()) {
        outputHelperStream("liveStream", $streamSrc, reScale($monitor->Width(), $scale), reScale($monitor->Height(), $scale), $monitor->Name());
    }
} else {
    outputImageStill("liveStream", $streamSrc, reScale($monitor->Width(), $scale), reScale($monitor->Height(), $scale), $monitor->Name());
}
?>
      </div>
      <div id="monitorStatus">
<?php 
if (canEdit('Monitors')) {
    ?>
        <div id="enableDisableAlarms"><a id="enableAlarmsLink" href="#" onclick="cmdEnableAlarms(); return( false );" class="hidden"><?php 
    echo translate('EnableAlarms');
    ?>
</a><a id="disableAlarmsLink" href="#" onclick="cmdDisableAlarms(); return( false );" class="hidden"><?php 
    echo translate('DisableAlarms');
    ?>
</a></div>
<?php 
示例#26
0
    ?>
</td>
              <td class="colAvgScore"><?php 
    echo $event['AvgScore'];
    ?>
</td>
              <td class="colMaxScore"><?php 
    echo makePopupLink('?view=frame&amp;eid=' . $event['Id'] . '&amp;fid=0', 'zmImage', array('image', reScale($event['Width'], $scale), reScale($event['Height'], $scale)), $event['MaxScore']);
    ?>
</td>
<?php 
    if (ZM_WEB_LIST_THUMBS) {
        if ($thumbData = createListThumbnail($event)) {
            ?>
              <td class="colThumbnail"><?php 
            echo makePopupLink('?view=frame&amp;eid=' . $event['Id'] . '&amp;fid=' . $thumbData['FrameId'], 'zmImage', array('image', reScale($event['Width'], $scale), reScale($event['Height'], $scale)), '<img src="' . viewImagePath($thumbData['Path']) . '" width="' . $thumbData['Width'] . '" height="' . $thumbData['Height'] . '" alt="' . $thumbData['FrameId'] . '/' . $event['MaxScore'] . '"/>');
            ?>
</td>
<?php 
        } else {
            ?>
              <td class="colThumbnail">&nbsp;</td>
<?php 
        }
    }
    ?>
              <td class="colMark"><input type="checkbox" name="markEids[]" value="<?php 
    echo $event['Id'];
    ?>
" onclick="configureButton( this, 'markEids' );"<?php 
    if (!canEdit('Events')) {
示例#27
0
if ($user['MonitorIds']) {
    $midSql = " and MonitorId in (" . join(",", preg_split('/["\'\\s]*,["\'\\s]*/', dbEscape($user['MonitorIds']))) . ")";
} else {
    $midSql = '';
}
$sql = "select E.*,M.Name as MonitorName,M.Id as mid, M.Width,M.Height,M.DefaultRate,M.DefaultScale from Events as E inner join Monitors as M on E.MonitorId = M.Id where E.Id = '" . dbEscape($eid) . "'" . $midSql;
$event = dbFetchOne($sql);
if (isset($_REQUEST['rate'])) {
    $rate = validInt($_REQUEST['rate']);
} else {
    $rate = reScale(RATE_BASE, $event['DefaultRate'], ZM_WEB_DEFAULT_RATE);
}
if (isset($_REQUEST['scale'])) {
    $scale = validInt($_REQUEST['scale']);
} else {
    $scale = reScale(SCALE_BASE, $event['DefaultScale'], ZM_WEB_DEFAULT_SCALE);
}
$replayModes = array('single' => $SLANG['ReplaySingle'], 'all' => $SLANG['ReplayAll'], 'gapless' => $SLANG['ReplayGapless']);
if (isset($_REQUEST['streamMode'])) {
    $streamMode = validHtmlStr($_REQUEST['streamMode']);
} else {
    $streamMode = canStream() ? 'stream' : 'stills';
}
if (isset($_REQUEST['replayMode'])) {
    $replayMode = validHtmlStr($_REQUEST['replayMode']);
} else {
    $replayMode = array_shift(array_keys($replayModes));
}
parseSort();
parseFilter($_REQUEST['filter']);
$filterQuery = $_REQUEST['filter']['query'];