XML Plugin: testing with eyeZm v1.1 and 1.24.3, bugfixes accordingly

git-svn-id: http://svn.zoneminder.com/svn/zm/trunk@3174 e3e1d417-86f3-4887-817a-d78f3d33393f
This commit is contained in:
jaidhar 2010-11-04 19:25:34 +00:00
parent e86444cbc3
commit b60e60b062
11 changed files with 185 additions and 14 deletions

View File

@ -6,4 +6,5 @@ SUBDIRS = \
includes \
views
dist_web_DATA =
dist_web_DATA = \
skin.php

View File

@ -247,7 +247,9 @@ SUBDIRS = \
includes \
views
dist_web_DATA =
dist_web_DATA = \
skin.php
all: all-recursive
.SUFFIXES:

View File

@ -3,4 +3,6 @@ AUTOMAKE_OPTIONS = gnu
webdir = @WEB_PREFIX@/skins/xml/includes
dist_web_DATA = \
init.php
init.php \
config.php \
functions.php

View File

@ -204,7 +204,9 @@ top_srcdir = @top_srcdir@
AUTOMAKE_OPTIONS = gnu
webdir = @WEB_PREFIX@/skins/xml/includes
dist_web_DATA = \
init.php
init.php \
config.php \
functions.php
all: all-am

View File

@ -0,0 +1,115 @@
<?php
//
// ZoneMinder HTML configuration file, $Date: 2010-11-03 09:36:03 -0700 (Wed, 03 Nov 2010) $, $Revision: 3166 $
// Copyright (C) 2001-2008 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.
//
define ( "XML_PROTOCOL_VERSION", "1");
define ( "XML_FEATURE_SET", "1");
$rates = array(
"10000" => "100x",
"5000" => "50x",
"2500" => "25x",
"1000" => "10x",
"400" => "4x",
"200" => "2x",
"100" => $SLANG['Real'],
"50" => "1/2x",
"25" => "1/4x",
);
$scales = array(
"400" => "4x",
"300" => "3x",
"200" => "2x",
"150" => "1.5x",
"100" => $SLANG['Actual'],
"75" => "3/4x",
"50" => "1/2x",
"33" => "1/3x",
"25" => "1/4x",
);
$bwArray = array(
"high" => $SLANG['High'],
"medium" => $SLANG['Medium'],
"low" => $SLANG['Low']
);
switch ( $_COOKIE['zmBandwidth'] )
{
case "high" :
{
define( "ZM_WEB_REFRESH_MAIN", ZM_WEB_H_REFRESH_MAIN ); // How often (in seconds) the main console window refreshes
define( "ZM_WEB_REFRESH_CYCLE", ZM_WEB_H_REFRESH_CYCLE ); // How often the cycle watch windows swaps to the next monitor
define( "ZM_WEB_REFRESH_IMAGE", ZM_WEB_H_REFRESH_IMAGE ); // How often the watched image is refreshed (if not streaming)
define( "ZM_WEB_REFRESH_STATUS", ZM_WEB_H_REFRESH_STATUS ); // How often the little status frame refreshes itself in the watch window
define( "ZM_WEB_REFRESH_EVENTS", ZM_WEB_H_REFRESH_EVENTS ); // How often the event listing is refreshed in the watch window, only for recent events
define( "ZM_WEB_CAN_STREAM", ZM_WEB_H_CAN_STREAM ); // Override the automatic detection of browser streaming capability
define( "ZM_WEB_STREAM_METHOD", ZM_WEB_H_STREAM_METHOD ); // Which method should be used to send video streams to your browser
define( "ZM_WEB_DEFAULT_SCALE", ZM_WEB_H_DEFAULT_SCALE ); // What the default scaling factor applied to 'live' or 'event' views is (%)
define( "ZM_WEB_DEFAULT_RATE", ZM_WEB_H_DEFAULT_RATE ); // What the default replay rate factor applied to 'event' views is (%)
define( "ZM_WEB_VIDEO_BITRATE", ZM_WEB_H_VIDEO_BITRATE ); // What the bitrate of any streamed video should be
define( "ZM_WEB_VIDEO_MAXFPS", ZM_WEB_H_VIDEO_MAXFPS ); // What the maximum frame rate of any streamed video should be
define( "ZM_WEB_SCALE_THUMBS", ZM_WEB_H_SCALE_THUMBS ); // Image scaling for thumbnails, bandwidth versus cpu in rescaling
define( "ZM_WEB_EVENTS_VIEW", ZM_WEB_H_EVENTS_VIEW ); // What the default view of multiple events should be.
define( "ZM_WEB_SHOW_PROGRESS", ZM_WEB_H_SHOW_PROGRESS ); // Whether to show the progress of replay in event view.
define( "ZM_WEB_AJAX_TIMEOUT", ZM_WEB_H_AJAX_TIMEOUT ); // Timeout to use for Ajax requests, no timeout used if unset
break;
}
case "medium" :
{
define( "ZM_WEB_REFRESH_MAIN", ZM_WEB_M_REFRESH_MAIN ); // How often (in seconds) the main console window refreshes
define( "ZM_WEB_REFRESH_CYCLE", ZM_WEB_M_REFRESH_CYCLE ); // How often the cycle watch windows swaps to the next monitor
define( "ZM_WEB_REFRESH_IMAGE", ZM_WEB_M_REFRESH_IMAGE ); // How often the watched image is refreshed (if not streaming)
define( "ZM_WEB_REFRESH_STATUS", ZM_WEB_M_REFRESH_STATUS ); // How often the little status frame refreshes itself in the watch window
define( "ZM_WEB_REFRESH_EVENTS", ZM_WEB_M_REFRESH_EVENTS ); // How often the event listing is refreshed in the watch window, only for recent events
define( "ZM_WEB_CAN_STREAM", ZM_WEB_M_CAN_STREAM ); // Override the automatic detection of browser streaming capability
define( "ZM_WEB_STREAM_METHOD", ZM_WEB_M_STREAM_METHOD ); // Which method should be used to send video streams to your browser
define( "ZM_WEB_DEFAULT_SCALE", ZM_WEB_M_DEFAULT_SCALE ); // What the default scaling factor applied to 'live' or 'event' views is (%)
define( "ZM_WEB_DEFAULT_RATE", ZM_WEB_M_DEFAULT_RATE ); // What the default replay rate factor applied to 'event' views is (%)
define( "ZM_WEB_VIDEO_BITRATE", ZM_WEB_M_VIDEO_BITRATE ); // What the bitrate of any streamed video should be
define( "ZM_WEB_VIDEO_MAXFPS", ZM_WEB_M_VIDEO_MAXFPS ); // What the maximum frame rate of any streamed video should be
define( "ZM_WEB_SCALE_THUMBS", ZM_WEB_M_SCALE_THUMBS ); // Image scaling for thumbnails, bandwidth versus cpu in rescaling
define( "ZM_WEB_EVENTS_VIEW", ZM_WEB_M_EVENTS_VIEW ); // What the default view of multiple events should be.
define( "ZM_WEB_SHOW_PROGRESS", ZM_WEB_M_SHOW_PROGRESS ); // Whether to show the progress of replay in event view.
define( "ZM_WEB_AJAX_TIMEOUT", ZM_WEB_M_AJAX_TIMEOUT ); // Timeout to use for Ajax requests, no timeout used if unset
break;
}
case "low" :
{
define( "ZM_WEB_REFRESH_MAIN", ZM_WEB_L_REFRESH_MAIN ); // How often (in seconds) the main console window refreshes
define( "ZM_WEB_REFRESH_CYCLE", ZM_WEB_L_REFRESH_CYCLE ); // How often the cycle watch windows swaps to the next monitor
define( "ZM_WEB_REFRESH_IMAGE", ZM_WEB_L_REFRESH_IMAGE ); // How often the watched image is refreshed (if not streaming)
define( "ZM_WEB_REFRESH_STATUS", ZM_WEB_L_REFRESH_STATUS ); // How often the little status frame refreshes itself in the watch window
define( "ZM_WEB_REFRESH_EVENTS", ZM_WEB_L_REFRESH_EVENTS ); // How often the event listing is refreshed in the watch window, only for recent events
define( "ZM_WEB_CAN_STREAM", ZM_WEB_L_CAN_STREAM ); // Override the automatic detection of browser streaming capability
define( "ZM_WEB_STREAM_METHOD", ZM_WEB_L_STREAM_METHOD ); // Which method should be used to send video streams to your browser
define( "ZM_WEB_DEFAULT_SCALE", ZM_WEB_L_DEFAULT_SCALE ); // What the default scaling factor applied to 'live' or 'event' views is (%)
define( "ZM_WEB_DEFAULT_RATE", ZM_WEB_L_DEFAULT_RATE ); // What the default replay rate factor applied to 'event' views is (%)
define( "ZM_WEB_VIDEO_BITRATE", ZM_WEB_L_VIDEO_BITRATE ); // What the bitrate of any streamed video should be
define( "ZM_WEB_VIDEO_MAXFPS", ZM_WEB_L_VIDEO_MAXFPS ); // What the maximum frame rate of any streamed video should be
define( "ZM_WEB_SCALE_THUMBS", ZM_WEB_L_SCALE_THUMBS ); // Image scaling for thumbnails, bandwidth versus cpu in rescaling
define( "ZM_WEB_EVENTS_VIEW", ZM_WEB_L_EVENTS_VIEW ); // What the default view of multiple events should be.
define( "ZM_WEB_SHOW_PROGRESS", ZM_WEB_L_SHOW_PROGRESS ); // Whether to show the progress of replay in event view.
define( "ZM_WEB_AJAX_TIMEOUT", ZM_WEB_L_AJAX_TIMEOUT ); // Timeout to use for Ajax requests, no timeout used if unset
break;
}
}
?>

View File

@ -1,4 +1,5 @@
<?php
function xml_header()
{
header ("content-type: text/xml");
@ -15,4 +16,20 @@ function xml_tag_sec($tag, $open)
else $tok = "</";
echo $tok.$tag.">";
}
function xhtmlHeaders( $file, $title )
{
?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<style type="text/css">
body {
border: 0px solid;
margin: 0px;
padding: 0px;
}
</style>
</head>
<?php
}
?>

30
web/skins/xml/skin.php Normal file
View File

@ -0,0 +1,30 @@
<?php
//
// ZoneMinder HTML interface file, $Date: 2008-09-26 02:47:20 -0700 (Fri, 26 Sep 2008) $, $Revision: 2632 $
// Copyright (C) 2001-2008 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 ( empty($_COOKIE['zmBandwidth']) )
$_COOKIE['zmBandwidth'] = "low";
foreach ( getSkinIncludes( 'includes/config.php' ) as $includeFile )
require_once $includeFile;
foreach ( getSkinIncludes( 'includes/functions.php' ) as $includeFile )
require_once $includeFile;
?>

View File

@ -6,4 +6,4 @@ webdir = @WEB_PREFIX@/skins/xml/views
dist_web_DATA = \
console.php \
xml_include.php
none.php

View File

@ -246,7 +246,7 @@ SUBDIRS =
webdir = @WEB_PREFIX@/skins/xml/views
dist_web_DATA = \
console.php \
xml_include.php
none.php
all: all-recursive

View File

@ -26,7 +26,6 @@
*
* Protocol Version 1, Updated 10/25/10
*/
require_once('xml_include.php');
$eventCounts = array(
array(
"title" => $SLANG['Events'],
@ -166,13 +165,16 @@ if (isset($_GET['action']) && (strcmp($_GET['action'],"login") != 0)) {
getStreamSrc( array(
"mode=jpeg",
"monitor=".$monitor,
"bitrate=".ZM_WEB_VIDEO_BITRATE,
"maxfps=".$fps,
"scale=".$scale,
"format=".ZM_MPEG_LIVE_FORMAT,
"maxfps=".$fps,
"buffer=1000"
) );
header("Location: ".$streamSrc);
noCacheHeaders();
xhtmlHeaders( __FILE__, "Stream" );
echo "<body>\n";
echo "<div style=\"border: 0px solid; padding: 0px; background-color: black; position: absolute; top: 0px; left; 0px; margin: 0px; width: ".$_GET['width']."px; height: ".$_GET['height']."px;\">\n";
outputImageStream("liveStream", $streamSrc, $_GET['width'], $_GET['height'], "stream");
echo "</div></body></html>";
exit;
} else if (strcmp($action, "vevent") == 0) {
if (!canView('Events')) {
@ -181,7 +183,7 @@ if (isset($_GET['action']) && (strcmp($_GET['action'],"login") != 0)) {
}
$baseURL = trim(shell_exec('pwd'))."/events/".$_REQUEST['mid']."/".$_REQUEST['eid']."/";
$relativeURL = "./events/".$_REQUEST['mid']."/".$_REQUEST['eid']."/";
$shellCmd = "ffmpeg -y -r ".$_REQUEST['fps']." -i ".$baseURL."%03d-capture.jpg ".$baseURL."capture.mov 2> /dev/null";
$shellCmd = "ffmpeg -y -r ".$_REQUEST['fps']." -i ".$baseURL."%03d-capture.jpg -r 10 ".$baseURL."capture.mov 2> /dev/null";
shell_exec("rm -f ".$baseURL."capture.mov");
$shellOutput = shell_exec($shellCmd);
header("Location: ".$relativeURL."capture.mov");
@ -210,8 +212,8 @@ xml_header();
xml_tag_sec("ZM_XML", 1);
xml_tag_sec("GENERAL", 1);
xml_tag_val("RUNNING", $running);
xml_tag_val("PROTOVER", "1");
xml_tag_val("FEATURESET", "1");
xml_tag_val("PROTOVER", XML_PROTOCOL_VERSION);
xml_tag_val("FEATURESET", XML_FEATURE_SET);
xml_tag_val("VERSION", ZM_VERSION);
xml_tag_val("USER", $user['Username']);
xml_tag_val("UID", $user['Id']);

View File