Added double buffering.

git-svn-id: http://svn.zoneminder.com/svn/zm/trunk@867 e3e1d417-86f3-4887-817a-d78f3d33393f
pull/27/merge
stan 2004-02-19 10:48:33 +00:00
parent a7015c32cd
commit ef655bf763
8 changed files with 120 additions and 54 deletions

View File

@ -6,9 +6,9 @@ webdir = @WEB_PREFIX@
webuser = @WEB_USER@
webgroup = @WEB_GROUP@
web_DATA = zm_actions.php zm_config.php zm_db.php zm_funcs.php zm_html.php zm_html_view_bandwidth.php zm_html_view_function.php zm_html_view_none.php zm_html_view_video.php zm_html_view_console.php zm_html_view_state.php zm_html_view_frame.php zm_html_view_optionhelp.php zm_html_view_watchevents.php zm_html_view_cycle.php zm_html_view_login.php zm_html_view_options.php zm_html_view_watchfeed.php zm_html_view_error.php zm_html_view_logout.php zm_html_view_postlogin.php zm_html_view_watch.php zm_html_view_event.php zm_html_view_monitor.php zm_html_view_watchstatus.php zm_html_view_events.php zm_html_view_montagefeed.php zm_html_view_settings.php zm_html_view_zone.php zm_html_view_filter.php zm_html_view_montage.php zm_html_view_frames.php zm_html_view_stats.php zm_html_view_zones.php zm_html_view_filtersave.php zm_html_view_montagestatus.php zm_html_view_user.php zm.php zm_styles.css zm_wml.php zm_wml_view_console.php zm_wml_view_feed.php zm_html_view_version.php zm_lang.php zm_lang_en_gb.php zm_lang_en_us.php zm_lang_de_de.php zm_lang_pl_pl.php zm_lang_ja_jp.php zm_lang_fr_fr.php zm_lang_ru_ru.php favicon.ico
web_DATA = zm_actions.php zm_config.php zm_db.php zm_funcs.php zm_html.php zm_html_view_bandwidth.php zm_html_view_function.php zm_html_view_none.php zm_html_view_video.php zm_html_view_console.php zm_html_view_state.php zm_html_view_frame.php zm_html_view_optionhelp.php zm_html_view_watchevents.php zm_html_view_cycle.php zm_html_view_login.php zm_html_view_options.php zm_html_view_watchmenu.php zm_html_view_watchfeed.php zm_html_view_watchfetch.php zm_html_view_error.php zm_html_view_logout.php zm_html_view_postlogin.php zm_html_view_watch.php zm_html_view_event.php zm_html_view_monitor.php zm_html_view_watchstatus.php zm_html_view_events.php zm_html_view_montagefeed.php zm_html_view_settings.php zm_html_view_zone.php zm_html_view_filter.php zm_html_view_montage.php zm_html_view_frames.php zm_html_view_stats.php zm_html_view_zones.php zm_html_view_filtersave.php zm_html_view_montagestatus.php zm_html_view_user.php zm.php zm_styles.css zm_wml.php zm_wml_view_console.php zm_wml_view_feed.php zm_html_view_version.php zm_lang.php zm_lang_en_gb.php zm_lang_en_us.php zm_lang_de_de.php zm_lang_pl_pl.php zm_lang_ja_jp.php zm_lang_fr_fr.php zm_lang_ru_ru.php favicon.ico
EXTRA_DIST = zm_config.php.z zm_actions.php zm_db.php zm_funcs.php zm_html.php zm_html_view_bandwidth.php zm_html_view_function.php zm_html_view_none.php zm_html_view_video.php zm_html_view_console.php zm_html_view_state.php zm_html_view_frame.php zm_html_view_optionhelp.php zm_html_view_watchevents.php zm_html_view_cycle.php zm_html_view_login.php zm_html_view_options.php zm_html_view_watchfeed.php zm_html_view_error.php zm_html_view_logout.php zm_html_view_postlogin.php zm_html_view_watch.php zm_html_view_event.php zm_html_view_monitor.php zm_html_view_watchstatus.php zm_html_view_events.php zm_html_view_montagefeed.php zm_html_view_settings.php zm_html_view_zone.php zm_html_view_filter.php zm_html_view_montage.php zm_html_view_frames.php zm_html_view_stats.php zm_html_view_zones.php zm_html_view_filtersave.php zm_html_view_montagestatus.php zm_html_view_user.php zm.php zm_styles.css zm_wml.php zm_wml_view_console.php zm_wml_view_feed.php zm_html_view_version.php zm_lang.php zm_lang_en_gb.php zm_lang_en_us.php zm_lang_de_de.php zm_lang_pl_pl.php zm_lang_ja_jp.php zm_lang_fr_fr.php zm_lang_ru_ru.php swap.pl retag.sh favicon.ico
EXTRA_DIST = zm_config.php.z zm_actions.php zm_db.php zm_funcs.php zm_html.php zm_html_view_bandwidth.php zm_html_view_function.php zm_html_view_none.php zm_html_view_video.php zm_html_view_console.php zm_html_view_state.php zm_html_view_frame.php zm_html_view_optionhelp.php zm_html_view_watchevents.php zm_html_view_cycle.php zm_html_view_login.php zm_html_view_options.php zm_html_view_watchmenu.php zm_html_view_watchfeed.php zm_html_view_watchfetch.php zm_html_view_error.php zm_html_view_logout.php zm_html_view_postlogin.php zm_html_view_watch.php zm_html_view_event.php zm_html_view_monitor.php zm_html_view_watchstatus.php zm_html_view_events.php zm_html_view_montagefeed.php zm_html_view_settings.php zm_html_view_zone.php zm_html_view_filter.php zm_html_view_montage.php zm_html_view_frames.php zm_html_view_stats.php zm_html_view_zones.php zm_html_view_filtersave.php zm_html_view_montagestatus.php zm_html_view_user.php zm.php zm_styles.css zm_wml.php zm_wml_view_console.php zm_wml_view_feed.php zm_html_view_version.php zm_lang.php zm_lang_en_gb.php zm_lang_en_us.php zm_lang_de_de.php zm_lang_pl_pl.php zm_lang_ja_jp.php zm_lang_fr_fr.php zm_lang_ru_ru.php swap.pl retag.sh favicon.ico
# Yes, you are correct. This is a HACK!
install-data-hook:

View File

@ -123,9 +123,9 @@ webdir = @WEB_PREFIX@
webuser = @WEB_USER@
webgroup = @WEB_GROUP@
web_DATA = zm_actions.php zm_config.php zm_db.php zm_funcs.php zm_html.php zm_html_view_bandwidth.php zm_html_view_function.php zm_html_view_none.php zm_html_view_video.php zm_html_view_console.php zm_html_view_state.php zm_html_view_frame.php zm_html_view_optionhelp.php zm_html_view_watchevents.php zm_html_view_cycle.php zm_html_view_login.php zm_html_view_options.php zm_html_view_watchfeed.php zm_html_view_error.php zm_html_view_logout.php zm_html_view_postlogin.php zm_html_view_watch.php zm_html_view_event.php zm_html_view_monitor.php zm_html_view_watchstatus.php zm_html_view_events.php zm_html_view_montagefeed.php zm_html_view_settings.php zm_html_view_zone.php zm_html_view_filter.php zm_html_view_montage.php zm_html_view_frames.php zm_html_view_stats.php zm_html_view_zones.php zm_html_view_filtersave.php zm_html_view_montagestatus.php zm_html_view_user.php zm.php zm_styles.css zm_wml.php zm_wml_view_console.php zm_wml_view_feed.php zm_html_view_version.php zm_lang.php zm_lang_en_gb.php zm_lang_en_us.php zm_lang_de_de.php zm_lang_pl_pl.php zm_lang_ja_jp.php zm_lang_fr_fr.php zm_lang_ru_ru.php favicon.ico
web_DATA = zm_actions.php zm_config.php zm_db.php zm_funcs.php zm_html.php zm_html_view_bandwidth.php zm_html_view_function.php zm_html_view_none.php zm_html_view_video.php zm_html_view_console.php zm_html_view_state.php zm_html_view_frame.php zm_html_view_optionhelp.php zm_html_view_watchevents.php zm_html_view_cycle.php zm_html_view_login.php zm_html_view_options.php zm_html_view_watchmenu.php zm_html_view_watchfeed.php zm_html_view_watchfetch.php zm_html_view_error.php zm_html_view_logout.php zm_html_view_postlogin.php zm_html_view_watch.php zm_html_view_event.php zm_html_view_monitor.php zm_html_view_watchstatus.php zm_html_view_events.php zm_html_view_montagefeed.php zm_html_view_settings.php zm_html_view_zone.php zm_html_view_filter.php zm_html_view_montage.php zm_html_view_frames.php zm_html_view_stats.php zm_html_view_zones.php zm_html_view_filtersave.php zm_html_view_montagestatus.php zm_html_view_user.php zm.php zm_styles.css zm_wml.php zm_wml_view_console.php zm_wml_view_feed.php zm_html_view_version.php zm_lang.php zm_lang_en_gb.php zm_lang_en_us.php zm_lang_de_de.php zm_lang_pl_pl.php zm_lang_ja_jp.php zm_lang_fr_fr.php zm_lang_ru_ru.php favicon.ico
EXTRA_DIST = zm_config.php.z zm_actions.php zm_db.php zm_funcs.php zm_html.php zm_html_view_bandwidth.php zm_html_view_function.php zm_html_view_none.php zm_html_view_video.php zm_html_view_console.php zm_html_view_state.php zm_html_view_frame.php zm_html_view_optionhelp.php zm_html_view_watchevents.php zm_html_view_cycle.php zm_html_view_login.php zm_html_view_options.php zm_html_view_watchfeed.php zm_html_view_error.php zm_html_view_logout.php zm_html_view_postlogin.php zm_html_view_watch.php zm_html_view_event.php zm_html_view_monitor.php zm_html_view_watchstatus.php zm_html_view_events.php zm_html_view_montagefeed.php zm_html_view_settings.php zm_html_view_zone.php zm_html_view_filter.php zm_html_view_montage.php zm_html_view_frames.php zm_html_view_stats.php zm_html_view_zones.php zm_html_view_filtersave.php zm_html_view_montagestatus.php zm_html_view_user.php zm.php zm_styles.css zm_wml.php zm_wml_view_console.php zm_wml_view_feed.php zm_html_view_version.php zm_lang.php zm_lang_en_gb.php zm_lang_en_us.php zm_lang_de_de.php zm_lang_pl_pl.php zm_lang_ja_jp.php zm_lang_fr_fr.php zm_lang_ru_ru.php swap.pl retag.sh favicon.ico
EXTRA_DIST = zm_config.php.z zm_actions.php zm_db.php zm_funcs.php zm_html.php zm_html_view_bandwidth.php zm_html_view_function.php zm_html_view_none.php zm_html_view_video.php zm_html_view_console.php zm_html_view_state.php zm_html_view_frame.php zm_html_view_optionhelp.php zm_html_view_watchevents.php zm_html_view_cycle.php zm_html_view_login.php zm_html_view_options.php zm_html_view_watchmenu.php zm_html_view_watchfeed.php zm_html_view_watchfetch.php zm_html_view_error.php zm_html_view_logout.php zm_html_view_postlogin.php zm_html_view_watch.php zm_html_view_event.php zm_html_view_monitor.php zm_html_view_watchstatus.php zm_html_view_events.php zm_html_view_montagefeed.php zm_html_view_settings.php zm_html_view_zone.php zm_html_view_filter.php zm_html_view_montage.php zm_html_view_frames.php zm_html_view_stats.php zm_html_view_zones.php zm_html_view_filtersave.php zm_html_view_montagestatus.php zm_html_view_user.php zm.php zm_styles.css zm_wml.php zm_wml_view_console.php zm_wml_view_feed.php zm_html_view_version.php zm_lang.php zm_lang_en_gb.php zm_lang_en_us.php zm_lang_de_de.php zm_lang_pl_pl.php zm_lang_ja_jp.php zm_lang_fr_fr.php zm_lang_ru_ru.php swap.pl retag.sh favicon.ico
subdir = web
mkinstalldirs = $(SHELL) $(top_srcdir)/mkinstalldirs
CONFIG_HEADER = $(top_builddir)/config.h

View File

@ -384,6 +384,21 @@ function createVideo( $event, $rate, $scale, $overwrite=0 )
return( $status?"":rtrim($result) );
}
function createImage( $monitor, $scale )
{
if ( is_array( $monitor ) )
{
$monitor = $monitor['Id'];
}
chdir( ZM_DIR_IMAGES );
$command = ZMU_COMMAND." -m $monitor -i";
if ( !empty($scale) && $scale < 100 )
$command .= " -S $scale";
$status = exec( escapeshellcmd( $command ) );
chdir( '..' );
return( $status );
}
function reScale( $dimension, $scale=SCALE_SCALE )
{
if ( $scale == SCALE_SCALE )

View File

@ -116,10 +116,12 @@ switch( $view )
case "montagefeed" :
case "montagestatus" :
case "watch" :
case "watchmenu" :
case "watchfeed" :
case "settings" :
case "watchfetch" :
case "watchstatus" :
case "watchevents" :
case "settings" :
case "events" :
case "filter" :
case "filtersave" :

View File

@ -44,8 +44,17 @@ window.resizeTo( <?= reScale($monitor['Width'],$width_scale)+$jws['watch']['w']
window.focus();
</script>
</head>
<frameset rows="<?= reScale($monitor['Height'],$height_scale)+32 ?>,16,*" border="1" frameborder="no" framespacing="0">
<frame src="<?= $PHP_SELF ?>?view=watchfeed&&mode=<?= $mode ?>&mid=<?= $monitor['Id'] ?>&scale=<?= $scale ?>" marginwidth="0" marginheight="0" name="MonitorStream" scrolling="no">
<frameset rows="24,<?= ZM_WEB_DOUBLE_BUFFER?'0,':'' ?><?= reScale($monitor['Height'],$height_scale)+8 ?>,16,*" border="1" frameborder="no" framespacing="0">
<frame src="<?= $PHP_SELF ?>?view=watchmenu&mode=<?= $mode ?>&mid=<?= $monitor['Id'] ?>&scale=<?= $scale ?>" marginwidth="0" marginheight="0" name="MonitorMenu" scrolling="no">
<?php
if ( ZM_WEB_DOUBLE_BUFFER )
{
?>
<frame src="about:blank" name="MonitorFetch" scrolling="no">
<?php
}
?>
<frame src="<?= $PHP_SELF ?>?view=watchfeed&mode=<?= $mode ?>&mid=<?= $monitor['Id'] ?>&scale=<?= $scale ?>" marginwidth="0" marginheight="0" name="MonitorStream" scrolling="no">
<frame src="<?= $PHP_SELF ?>?view=watchstatus&mid=<?= $monitor['Id'] ?>" marginwidth="0" marginheight="0" name="MonitorStatus" scrolling="no">
<frame src="<?= $PHP_SELF ?>?view=watchevents&max_events=<?= MAX_EVENTS ?>&mid=<?= $monitor['Id'] ?>" marginwidth="0" marginheight="0" name="MonitorEvents" scrolling="auto">
</frameset>

View File

@ -32,6 +32,9 @@ if ( empty($mode) )
$mode = "still";
}
if ( !isset( $scale ) )
$scale = SCALE_SCALE;
$result = mysql_query( "select * from Monitors where Id = '$mid'" );
if ( !$result )
die( mysql_error() );
@ -39,15 +42,13 @@ $monitor = mysql_fetch_assoc( $result );
if ( $mode != "stream" )
{
// Prompt an image to be generated
chdir( ZM_DIR_IMAGES );
$command = ZMU_COMMAND." -m $mid -i";
if ( !empty($scale) && $scale < 100 )
$command .= " -S $scale";
$status = exec( escapeshellcmd( $command ) );
chdir( '..' );
if ( !ZM_WEB_DOUBLE_BUFFER )
{
// Prompt an image to be generated
createImage( $monitor, $scale );
}
if ( ZM_WEB_REFRESH_METHOD == "http" )
header("Refresh: ".REFRESH_IMAGE."; URL=$PHP_SELF?view=watchfeed&mid=$mid&mode=still" );
header("Refresh: ".REFRESH_IMAGE."; URL=$PHP_SELF?view=watchfeed&mid=$mid&mode=still&scale=$scale" );
}
header("Expires: Mon, 26 Jul 1997 05:00:00 GMT"); // Date in the past
header("Last-Modified: " . gmdate("D, d M Y H:i:s") . " GMT"); // always modified
@ -55,58 +56,44 @@ header("Cache-Control: no-store, no-cache, must-revalidate"); // HTTP/1.1
header("Cache-Control: post-check=0, pre-check=0", false);
header("Pragma: no-cache"); // HTTP/1.0
if ( !isset( $scale ) )
$scale = SCALE_SCALE;
?>
<html>
<head>
<title>ZM - <?= $monitor['Name'] ?> - <?= $zmSlangFeed ?></title>
<link rel="stylesheet" href="zm_styles.css" type="text/css">
<script language="JavaScript">
function newWindow(Url,Name,Width,Height)
{
var Name = window.open(Url,Name,"resizable,width="+Width+",height="+Height);
}
function closeWindow()
{
top.window.close();
}
<?php
if ( $mode != "stream" && ZM_WEB_REFRESH_METHOD == "javascript" )
{
if ( ZM_WEB_DOUBLE_BUFFER )
{
?>
function fetchImage()
{
window.parent.MonitorFetch.location.reload( true );
zm_image = new Image();
zm_image.src = '<?= ZM_DIR_IMAGES.'/'.$monitor['Name'] ?>.jpg';
document['zmImage'].src = zm_image.src;
}
window.parent.MonitorFetch.location = '<?= $PHP_SELF ?>?view=watchfetch&mid=<?= $monitor['Id'] ?>&scale=<?= $scale ?>';
window.setInterval( "fetchImage()", <?= REFRESH_IMAGE*1000 ?> );
<?php
}
else
{
?>
window.setTimeout( "window.location.reload(true)", <?= REFRESH_IMAGE*1000 ?> );
<?php
}
}
?>
</script>
</head>
<body>
<table width="96%" align="center" border="0" cellspacing="0" cellpadding="4">
<form name="view_form" method="get" action="<?= $PHP_SELF ?>" target="_parent">
<input type="hidden" name="view" value="watch">
<input type="hidden" name="mode" value="<?= $mode ?>">
<input type="hidden" name="mid" value="<?= $mid ?>">
<tr>
<td width="25%" align="left" class="text"><b><?= $monitor['Name'] ?></b></td>
<td align="center" valign="middle" class="text">
<?= $zmSlangScale ?>: <?= buildSelect( "scale", $scales, "document.view_form.submit();" ); ?>
</td>
<?php if ( canView( 'Monitors' ) && $monitor['Type'] == "Local" ) { ?>
<td align="center" class="text"><a href="javascript: newWindow( '<?= $PHP_SELF ?>?view=settings&mid=<?= $monitor['Id'] ?>', 'zmSettings<?= $monitor['Id'] ?>', <?= $jws['settings']['w'] ?>, <?= $jws['settings']['h'] ?> );"><?= $zmSlangSettings ?></a></td>
<?php } else { ?>
<td align="center" class="text">&nbsp;</td>
<?php } ?>
<?php if ( $mode == "stream" ) { ?>
<td align="center" class="text"><a href="<?= $PHP_SELF ?>?view=watchfeed&mode=still&mid=<?= $mid ?>&scale=<?= $scale ?>"><?= $zmSlangStills ?></a></td>
<?php } elseif ( canStream() ) { ?>
<td align="center" class="text"><a href="<?= $PHP_SELF ?>?view=watchfeed&mode=stream&mid=<?= $mid ?>&scale=<?= $scale ?>"><?= $zmSlangStream ?></a></td>
<?php } else { ?>
<td align="center" class="text">&nbsp;</td>
<?php } ?>
<td align="right" class="text"><a href="javascript: closeWindow();"><?= $zmSlangClose ?></a></td>
</tr>
<table width="96%" align="center" border="0" cellspacing="0" cellpadding="2">
<?php
if ( $mode == "stream" )
{
@ -127,11 +114,10 @@ if ( $mode == "stream" )
else
{
?>
<tr><td colspan="5" align="center"><img src="<?= ZM_DIR_IMAGES.'/'.$monitor['Name'] ?>.jpg" border="0" width="<?= reScale( $monitor['Width'], $scale ) ?>" height="<?= reScale( $monitor['Height'], $scale ) ?>"></td></tr>
<tr><td colspan="5" align="center"><img name="zmImage" src="<?= ZM_DIR_IMAGES.'/'.$monitor['Name'] ?>.jpg" border="0" width="<?= reScale( $monitor['Width'], $scale ) ?>" height="<?= reScale( $monitor['Height'], $scale ) ?>"></td></tr>
<?php
}
?>
</form>
</table>
</body>
</html>

View File

@ -0,0 +1,45 @@
<?php
//
// ZoneMinder web watch fetch view file, $Date$, $Revision$
// Copyright (C) 2003 Philip Coombes
//
// 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.
//
if ( !canView( 'Stream' ) )
{
$view = "error";
return;
}
header("Expires: Mon, 26 Jul 1997 05:00:00 GMT"); // Date in the past
header("Last-Modified: " . gmdate("D, d M Y H:i:s") . " GMT"); // always modified
header("Cache-Control: no-store, no-cache, must-revalidate"); // HTTP/1.1
header("Cache-Control: post-check=0, pre-check=0", false);
header("Pragma: no-cache"); // HTTP/1.0
if ( !isset( $scale ) )
$scale = SCALE_SCALE;
// Prompt an image to be generated
createImage( $mid, $scale );
?>
<html>
<head>
<script language="JavaScript">
</script>
</head>
</html>

View File

@ -851,6 +851,15 @@ my @options =
type => { db_type=>'string', hint=>'javascript|http', pattern=>qr|^([jh])|i, format=>q( $1 =~ /^j/ ? 'javascript' : 'http' ) },
category => 'web',
},
{
name => "ZM_WEB_DOUBLE_BUFFER",
default => "yes",
description => "Whether still images should be double buffered to avoid flickering",
requires => [ { name => "ZM_WEB_REFRESH_METHOD", value => "javascript" } ],
help => "From version 1.18.0 ZoneMinder can use a double buffering method to preload still image prior to displaying them on screen. This reduces flickering and makes viewing still images a more pleasant experience. However some devices may not support the JavaScript/frames combination needed to make this possible in which case this option should be switched off. As this option uses JavaScript it will only have an effect if the ZM_WEB_REFRESH_METHOD option is set to JavaScript also.",
type => $types{boolean},
category => 'web',
},
{
name => "ZM_WEB_H_REFRESH_MAIN",
default => "300",
@ -936,7 +945,7 @@ my @options =
},
{
name => "ZM_WEB_M_REFRESH_IMAGE",
default => "15",
default => "10",
description => "How often (in seconds) the watched image is refreshed (if not streaming)",
help => "The live images from a monitor can be viewed in either streamed or stills mode. This option determines how often a stills image is refreshed, it has no effect if streaming is selected.",
type => $types{integer},
@ -1002,7 +1011,7 @@ my @options =
},
{
name => "ZM_WEB_L_REFRESH_IMAGE",
default => "30",
default => "15",
description => "How often (in seconds) the watched image is refreshed (if not streaming)",
help => "The live images from a monitor can be viewed in either streamed or stills mode. This option determines how often a stills image is refreshed, it has no effect if streaming is selected.",
type => $types{integer},