コード例 #1
0
ファイル: functions.php プロジェクト: OverByThere/modern
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
ファイル: monitors.old.php プロジェクト: mondychan/modern
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 
}
コード例 #3
0
ファイル: cycle.php プロジェクト: moeiscool/ZoneMinder-video
$monitor = $monitors[$monIdx];
$nextMid = $monIdx == count($monitors) - 1 ? $monitors[0]['Id'] : $monitors[$monIdx + 1]['Id'];
$montageWidth = $monitor['ScaledWidth'];
$montageHeight = $monitor['ScaledHeight'];
$widthScale = $montageWidth * SCALE_BASE / $monitor['Width'];
$heightScale = $montageHeight * SCALE_BASE / $monitor['Height'];
$scale = (int) ($widthScale < $heightScale ? $widthScale : $heightScale);
if (false && (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));
} elseif ($mode == 'stream' && canStream()) {
    $streamMode = "jpeg";
    $streamSrc = getStreamSrc(array("mode=" . $streamMode, "monitor=" . $monitor['Id'], "scale=" . $scale, "maxfps=" . ZM_WEB_VIDEO_MAXFPS));
} else {
    $streamMode = "single";
    $streamSrc = getStreamSrc(array("mode=" . $streamMode, "monitor=" . $monitor['Id'], "scale=" . $scale));
}
noCacheHeaders();
$focusWindow = true;
xhtmlHeaders(__FILE__, $SLANG['CycleWatch']);
?>
<body>
  <div id="page">
    <div id="header">
      <div id="headerButtons">
<?php 
if ($mode == "stream") {
    ?>
        <a href="?view=<?php 
    echo $view;
    ?>
コード例 #4
0
', 'zmWatch<?php 
    echo $monitor['Id'];
    ?>
', 'watch', <?php 
    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 
コード例 #5
0
ファイル: montage.php プロジェクト: bill-mcgonigle/ZoneMinder
      <div id="headerButtons">
        <a href="?view=<?php 
echo $_REQUEST['view'];
?>
"><?php 
echo translate('Refresh');
?>
</a>
      </div>
    </div>
    <div id="content">
      <div id="monitorImages">
<?php 
foreach ($monitors as $monitor) {
    $scale = getDeviceScale($monitor['Width'], $monitor['Height'], $imagesPerLine * 1.1);
    $imagePath = getStreamSrc(array("mode=single", "monitor=" . $monitor['Id'], "scale=" . $scale), '&amp;');
    ?>
        <a href="?view=watch&amp;mid=<?php 
    echo $monitor['Id'];
    ?>
"><img src="<?php 
    echo viewImagePath($imagePath);
    ?>
" alt="<?php 
    echo $monitor['Name'];
    ?>
"/></a>
<?php 
}
?>
      </div>
コード例 #6
0
ファイル: montagereview.php プロジェクト: schrorg/ZoneMinder
    else if (avgFrac >= 0.2)  currentDisplayInterval = (currentDisplayInterval * 1.50).toFixed(1);
    else if (avgFrac >= 0.1)  currentDisplayInterval = (currentDisplayInterval * 2.00).toFixed(1);
    else currentDisplayInterval                      = (currentDisplayInterval * 2.50).toFixed(1);
    currentDisplayInterval=Math.min(Math.max(currentDisplayInterval, 30),10000);   // limit this from about 30fps to .1 fps
    imageLoadTimesEvaluated=0;
    setSpeed(speedIndex);
    $('fps').innerHTML="Display refresh rate is " + (1000 / currentDisplayInterval).toFixed(1) + " per second, avgFrac=" + avgFrac.toFixed(3) + ".";
}

function SetImageSource(monId,val)
{
    if(liveMode==1)
    {   // This uses the standard php routine to set up the url and authentication, but because it is called repeatedly the built in random number is not usable, so one is appended below for two total (yuck)
        var effectiveScale = (100.0 * monitorCanvasObj[monId].width) / monitorWidth[monId];
        var $x =  "<?php 
echo getStreamSrc(array("mode=single"), "&");
?>
" + "&monitor=" + monId.toString() +  "&scale=" + effectiveScale +  Math.random().toString() ;
        return $x;
    }
    else
    {
        var zeropad = <?php 
echo sprintf("\"%0" . ZM_EVENT_IMAGE_DIGITS . "d\"", 0);
?>
;
        for(var i=0; i<ePath.length; i++)  // Search for a match
        {
            if(eMonId[i]==monId && val >= eStartSecs[i] && val <= eEndSecs[i])
            {
                var frame=parseInt((val - eStartSecs[i])/(eEndSecs[i]-eStartSecs[i])*eventFrames[i])+1;
コード例 #7
0
ファイル: event.php プロジェクト: bill-mcgonigle/ZoneMinder
    echo getEventDefaultVideoPath($event);
    ?>
" type="video/mp4">
      Your browser does not support the video tag.
      </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 
コード例 #8
0
ファイル: playback.php プロジェクト: OverByThere/modern
    echo "<li class=\"preset-list-item\"><input type=\"radio\" id=\"preset-{$cameras['Id']}\" class=\"preset-list-default-preset\" name=\"defaultpreset\" value=\"" . $cameras['Id'] . "\"";
    if ($defaultPresetId == $cameras['Id']) {
        echo " checked";
    }
    echo "><a class=\"preset-list-link\" href=\"#\" data-value=\"" . $cameras['MonitorIds'] . "\">" . $cameras['Name'] . "</a></li>";
}
echo "</ul>";
?>
          </div>

          <div id="choose-cameras" class="choose-cameras dialog-modal" title="Camera Selection"> <!-- begin choose-cameras -->
            <ul class="monitor-stream-thumbnails">
              <?php 
$i = 1;
$connkey = generateConnKey();
$streamMode = "single";
$sql = "SELECT * FROM Monitors";
foreach (dbFetchAll($sql) as $row) {
    echo "<li class=\"monitor-stream-thumbnail-item\">";
    outputImageStillModern("monitor-stream-thumbnail-" . $row['Id'], getStreamSrc(array("mode=" . $streamMode, "monitor=" . $row['Id'])), 160, 120, $row['Name'], "monitor-thumbnail", $row['Id']);
    echo "</li>";
    $i++;
}
?>
            </ul>
          </div> <!-- end choose-cameras -->
        </div>

      </div> <!-- end view-wrapper -->
    </body>
  </html>
コード例 #9
0
ファイル: montage.php プロジェクト: bill-mcgonigle/ZoneMinder
', 'zmWatch<?php 
    echo $monitor['Id'];
    ?>
', 'watch', <?php 
    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, "recorder" => $monitor['ServerHost']));
        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, "recorder" => $monitor['ServerHost']));
        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 
コード例 #10
0
     logXml("Streaming H264 on Monitor " . $monitor . ", " . $width . "x" . $height . " @" . $br);
     /* Get thumbnail source */
     $thumbsrc = getStreamSrc(array("mode=single", "monitor=" . $monitor, "scale=" . $scale, "maxfps=" . $fps, "buffer=1000"));
     logXml("Using thumbnail image from " . $thumbsrc);
     /* Generate H264 Web-page */
     echo "<meta name=\"viewport\" content=\"width=" . $width . "\" />\n";
     h264vidHtml($width, $height, $monitor, $br, $thumbsrc);
 } else {
     if (!strcmp($vcodec, "mjpeg")) {
         /* MJPEG streaming */
         /* If $fps=0, get a single-shot */
         if (!$fps) {
             /* single-shot */
             $streamSrc = getStreamSrc(array("mode=single", "monitor=" . $monitor, "scale=" . $scale, "maxfps=0", "buffer=1000"));
         } else {
             $streamSrc = getStreamSrc(array("mode=jpeg", "monitor=" . $monitor, "scale=" . $scale, "maxfps=" . $fps, "buffer=1000"));
         }
         noCacheHeaders();
         xhtmlHeaders(__FILE__, "Stream");
         logXml("Streaming MJPEG on Monitor " . $monitor . ", " . $width . "x" . $height . " @" . $fps . "fps");
         echo "<meta name=\"viewport\" content=\"width=" . $width . "\" />\n";
         echo "<body>\n";
         echo "<div style=\"border: 0px solid; padding: 0px; background-color: black; position: absolute; top: 0px; left; 0px; margin: 0px; width: " . $width . "px; height: " . $height . "px;\">\n";
         logXml("Using stream source: " . $streamSrc);
         outputImageStream("liveStream", $streamSrc, $width, $height, "stream");
         echo "</div></body></html>";
     } else {
         logXmlErr("Unsupported codec " . $vcodec . " selected for streaming");
         echo "Unsupported codec " . $vcodec . " selected for streaming";
     }
 }
コード例 #11
0
ファイル: cycle.php プロジェクト: bill-mcgonigle/ZoneMinder
$monitor = $monitors[$monIdx];
$nextMid = $monIdx == count($monitors) - 1 ? $monitors[0]['Id'] : $monitors[$monIdx + 1]['Id'];
$montageWidth = $monitor['ScaledWidth'];
$montageHeight = $monitor['ScaledHeight'];
$widthScale = $montageWidth * SCALE_BASE / $monitor['Width'];
$heightScale = $montageHeight * SCALE_BASE / $monitor['Height'];
$scale = (int) ($widthScale < $heightScale ? $widthScale : $heightScale);
if (false && (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, "recorder=" . $monitor['ServerHost']));
} elseif ($mode == 'stream' && canStream()) {
    $streamMode = "jpeg";
    $streamSrc = getStreamSrc(array("mode=" . $streamMode, "monitor=" . $monitor['Id'], "scale=" . $scale, "maxfps=" . ZM_WEB_VIDEO_MAXFPS, "recorder=" . $monitor['ServerHost']));
} else {
    $streamMode = "single";
    $streamSrc = getStreamSrc(array("mode=" . $streamMode, "monitor=" . $monitor['Id'], "scale=" . $scale, "recorder=" . $monitor['ServerHost']));
}
noCacheHeaders();
$focusWindow = true;
xhtmlHeaders(__FILE__, translate('CycleWatch'));
?>
<body>
  <div id="page">
    <div id="header">
      <div id="headerButtons">
<?php 
if ($mode == "stream") {
    ?>
        <a href="?view=<?php 
    echo $view;
    ?>
コード例 #12
0
ファイル: eventmain.php プロジェクト: mondychan/modern
    ?>
-->
</div>
<?php 
}
?>
</div>

<div class="eventStream">
	<div class="imageFeed">
<?php 
if (ZM_WEB_STREAM_METHOD == 'mpeg' && ZM_MPEG_LIVE_FORMAT) {
    $streamSrc = getStreamSrc(array("source=event", "mode=mpeg", !empty($currentevent) ? "event=" . $currentevent['Id'] : "eventlist=" . $eventlist, "frame=1", "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", !empty($currentevent) ? "event=" . $currentevent['Id'] : "eventlist=" . $eventlist, "frame=1", "scale=" . $scale, "rate=" . $rate, "maxfps=" . ZM_WEB_VIDEO_MAXFPS, "replay=" . $replayMode));
    //echo $streamSrc;
    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));
    }
}
?>
	</div>
	<p class="dvrControls">
		
		<button id="prevBtn" title="<?php 
echo $SLANG['Prev'];
?>
" class="inactive" onclick="streamPrev( true )">&lt;+</button>