2003-07-11 17:27:56 +08:00
|
|
|
<?php
|
2004-01-08 19:45:57 +08:00
|
|
|
//
|
|
|
|
// ZoneMinder web watch feed view file, $Date$, $Revision$
|
2006-01-17 19:32:47 +08:00
|
|
|
// Copyright (C) 2003, 2004, 2005, 2006 Philip Coombes
|
2004-01-08 19:45:57 +08:00
|
|
|
//
|
|
|
|
// This program is free software; you can redistribute it and/or
|
|
|
|
// modify it under the terms of the GNU General Public License
|
|
|
|
// as published by the Free Software Foundation; either version 2
|
|
|
|
// of the License, or (at your option) any later version.
|
|
|
|
//
|
|
|
|
// This program is distributed in the hope that it will be useful,
|
|
|
|
// but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
|
|
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
|
|
|
// GNU General Public License for more details.
|
|
|
|
//
|
|
|
|
// You should have received a copy of the GNU General Public License
|
|
|
|
// along with this program; if not, write to the Free Software
|
|
|
|
// Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
|
|
|
|
//
|
2003-07-11 17:27:56 +08:00
|
|
|
|
2004-01-08 19:45:57 +08:00
|
|
|
if ( !canView( 'Stream' ) )
|
|
|
|
{
|
|
|
|
$view = "error";
|
|
|
|
return;
|
|
|
|
}
|
2004-02-18 23:36:35 +08:00
|
|
|
|
|
|
|
if ( empty($mode) )
|
2004-01-08 19:45:57 +08:00
|
|
|
{
|
2005-10-19 21:30:05 +08:00
|
|
|
if ( ZM_WEB_USE_STREAMS && canStream() )
|
2004-01-08 19:45:57 +08:00
|
|
|
$mode = "stream";
|
|
|
|
else
|
|
|
|
$mode = "still";
|
|
|
|
}
|
2003-07-11 17:27:56 +08:00
|
|
|
|
2005-11-10 20:04:37 +08:00
|
|
|
$sql = "select M.*,C.CanMoveMap,C.CanMoveRel,C.CanMoveCon from Monitors as M left join Controls as C on (M.ControlId = C.Id ) where M.Id = '$mid'";
|
2007-09-06 20:59:19 +08:00
|
|
|
$monitor = dbFetchOne( $sql );
|
2004-01-08 19:45:57 +08:00
|
|
|
|
2005-10-20 00:52:28 +08:00
|
|
|
if ( !isset( $scale ) )
|
2006-01-18 01:07:13 +08:00
|
|
|
$scale = reScale( SCALE_BASE, $monitor['DefaultScale'], ZM_WEB_DEFAULT_SCALE );
|
2005-10-20 00:52:28 +08:00
|
|
|
|
2004-01-08 19:45:57 +08:00
|
|
|
if ( $mode != "stream" )
|
|
|
|
{
|
2004-03-16 05:39:15 +08:00
|
|
|
// Prompt an image to be generated
|
2004-01-08 19:45:57 +08:00
|
|
|
if ( ZM_WEB_REFRESH_METHOD == "http" )
|
2004-04-19 19:23:40 +08:00
|
|
|
header("Refresh: ".ZM_WEB_REFRESH_IMAGE."; URL=$PHP_SELF?view=watchfeed&mid=$mid&mode=still&scale=$scale" );
|
2004-01-08 19:45:57 +08:00
|
|
|
}
|
2006-03-28 06:01:33 +08:00
|
|
|
noCacheHeaders();
|
2004-01-08 19:45:57 +08:00
|
|
|
|
2005-02-24 18:43:29 +08:00
|
|
|
$image_src = getStreamSrc( array( "mode=single", "monitor=".$mid, "scale=".$scale ) );
|
2004-05-05 19:22:50 +08:00
|
|
|
|
2003-07-11 17:27:56 +08:00
|
|
|
?>
|
2004-12-29 03:22:23 +08:00
|
|
|
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
|
2003-07-11 17:27:56 +08:00
|
|
|
<html>
|
|
|
|
<head>
|
2005-05-06 20:24:57 +08:00
|
|
|
<title><?= ZM_WEB_TITLE_PREFIX ?> - <?= $monitor['Name'] ?> - <?= $zmSlangFeed ?></title>
|
2004-12-29 02:20:11 +08:00
|
|
|
<link rel="stylesheet" href="zm_html_styles.css" type="text/css">
|
2004-12-29 03:29:43 +08:00
|
|
|
<script type="text/javascript">
|
2004-02-19 18:48:33 +08:00
|
|
|
<?php
|
|
|
|
if ( $mode != "stream" && ZM_WEB_REFRESH_METHOD == "javascript" )
|
2003-07-11 17:27:56 +08:00
|
|
|
{
|
2004-02-19 18:48:33 +08:00
|
|
|
if ( ZM_WEB_DOUBLE_BUFFER )
|
|
|
|
{
|
|
|
|
?>
|
|
|
|
function fetchImage()
|
2003-07-11 17:27:56 +08:00
|
|
|
{
|
2004-02-20 17:48:14 +08:00
|
|
|
var now = new Date();
|
|
|
|
var zm_image = new Image();
|
2004-05-05 19:22:50 +08:00
|
|
|
zm_image.src = '<?= $image_src ?>'+'&'+now.getTime();
|
2004-02-19 18:48:33 +08:00
|
|
|
|
|
|
|
document['zmImage'].src = zm_image.src;
|
2003-07-11 17:27:56 +08:00
|
|
|
}
|
2004-02-19 18:48:33 +08:00
|
|
|
|
2004-04-19 19:23:40 +08:00
|
|
|
window.setInterval( "fetchImage()", <?= ZM_WEB_REFRESH_IMAGE*1000 ?> );
|
2003-07-11 17:27:56 +08:00
|
|
|
<?php
|
2004-02-19 18:48:33 +08:00
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
2003-07-11 17:27:56 +08:00
|
|
|
?>
|
2004-04-19 19:23:40 +08:00
|
|
|
window.setTimeout( "window.location.reload(true)", <?= ZM_WEB_REFRESH_IMAGE*1000 ?> );
|
2003-07-11 17:27:56 +08:00
|
|
|
<?php
|
2004-02-19 18:48:33 +08:00
|
|
|
}
|
2004-01-08 19:45:57 +08:00
|
|
|
}
|
2003-07-11 17:27:56 +08:00
|
|
|
?>
|
|
|
|
</script>
|
|
|
|
</head>
|
|
|
|
<body>
|
2004-02-19 18:48:33 +08:00
|
|
|
<table width="96%" align="center" border="0" cellspacing="0" cellpadding="2">
|
2004-03-04 23:05:54 +08:00
|
|
|
<tr><td colspan="5" align="center">
|
2003-07-11 17:27:56 +08:00
|
|
|
<?php
|
2004-01-08 19:45:57 +08:00
|
|
|
if ( $mode == "stream" )
|
|
|
|
{
|
2006-01-15 06:48:32 +08:00
|
|
|
if ( ZM_STREAM_METHOD == 'mpeg' && ZM_MPEG_LIVE_FORMAT )
|
2003-07-11 17:27:56 +08:00
|
|
|
{
|
2006-01-15 06:48:32 +08:00
|
|
|
$stream_src = getStreamSrc( array( "mode=mpeg", "monitor=".$mid, "scale=".$scale, "bitrate=".ZM_WEB_VIDEO_BITRATE, "maxfps=".ZM_WEB_VIDEO_MAXFPS, "format=".ZM_MPEG_LIVE_FORMAT ) );
|
|
|
|
outputVideoStream( $stream_src, reScale( $monitor['Width'], $scale ), reScale( $monitor['Height'], $scale ), $monitor['Name'], ZM_MPEG_LIVE_FORMAT );
|
2004-01-08 19:45:57 +08:00
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
2005-02-24 18:43:29 +08:00
|
|
|
$stream_src = getStreamSrc( array( "mode=jpeg", "monitor=".$mid, "scale=".$scale, "maxfps=".ZM_WEB_VIDEO_MAXFPS ) );
|
2004-03-04 23:05:54 +08:00
|
|
|
if ( canStreamNative() )
|
|
|
|
{
|
2005-11-10 20:04:37 +08:00
|
|
|
if ( $control && ($monitor['CanMoveMap'] || $monitor['CanMoveRel'] || $monitor['CanMoveCon']) )
|
2005-02-24 18:43:29 +08:00
|
|
|
{
|
2005-12-08 19:10:44 +08:00
|
|
|
outputControlStream( $stream_src, reScale( $monitor['Width'], $scale ), reScale( $monitor['Height'], $scale ), $monitor, $scale, "ControlSink".$mid );
|
2005-02-24 18:43:29 +08:00
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
2005-12-08 19:10:44 +08:00
|
|
|
outputImageStream( $stream_src, reScale( $monitor['Width'], $scale ), reScale( $monitor['Height'], $scale ), $monitor['Name'] );
|
2005-02-24 18:43:29 +08:00
|
|
|
}
|
2004-03-04 23:05:54 +08:00
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
2005-12-08 19:10:44 +08:00
|
|
|
outputHelperStream( $stream_src, reScale( $monitor['Width'], $scale ), reScale( $monitor['Height'], $scale ) );
|
2004-03-04 23:05:54 +08:00
|
|
|
}
|
2003-07-11 17:27:56 +08:00
|
|
|
}
|
2004-01-08 19:45:57 +08:00
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
2005-11-10 20:04:37 +08:00
|
|
|
if ( $control && ($monitor['CanMoveMap'] || $monitor['CanMoveRel'] || $monitor['CanMoveCon']) )
|
2005-02-24 18:43:29 +08:00
|
|
|
{
|
2005-12-08 19:10:44 +08:00
|
|
|
outputControlStill( $image_src, reScale( $monitor['Width'], $scale ), reScale( $monitor['Height'], $scale ), $monitor, $scale, "ControlSink".$mid );
|
2005-02-24 18:43:29 +08:00
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
2005-12-08 19:10:44 +08:00
|
|
|
outputImageStill( $image_src, reScale( $monitor['Width'], $scale ), reScale( $monitor['Height'], $scale ), $monitor['Name'] );
|
2005-02-24 18:43:29 +08:00
|
|
|
}
|
2004-01-08 19:45:57 +08:00
|
|
|
}
|
2003-07-11 17:27:56 +08:00
|
|
|
?>
|
2004-03-04 23:05:54 +08:00
|
|
|
</td></tr>
|
2003-07-11 17:27:56 +08:00
|
|
|
</table>
|
|
|
|
</body>
|
|
|
|
</html>
|