Added stream replay mode control.

git-svn-id: http://svn.zoneminder.com/svn/zm/trunk@2245 e3e1d417-86f3-4887-817a-d78f3d33393f
This commit is contained in:
stan 2007-11-20 17:06:45 +00:00
parent 2457b6ddaa
commit dc8aa90860
4 changed files with 36 additions and 7 deletions

View File

@ -64,6 +64,7 @@ int main( int argc, const char *argv[] )
unsigned int maxfps = 10;
unsigned int bitrate = 100000;
unsigned int ttl = 0;
EventStream::StreamMode replay = EventStream::MODE_SINGLE;
char username[64] = "";
char password[64] = "";
char auth[64] = "";
@ -104,6 +105,8 @@ int main( int argc, const char *argv[] )
{
char *name = strtok( parms[p], "=" );
char *value = strtok( NULL, "=" );
if ( !value )
value = "";
if ( !strcmp( name, "source" ) )
{
source = !strcmp( value, "event" )?ZMS_EVENT:ZMS_MONITOR;
@ -135,6 +138,11 @@ int main( int argc, const char *argv[] )
bitrate = atoi( value );
else if ( !strcmp( name, "ttl" ) )
ttl = atoi(value);
else if ( !strcmp( name, "replay" ) )
{
replay = !strcmp( value, "gapless" )?EventStream::MODE_ALL_GAPLESS:EventStream::MODE_SINGLE;
replay = !strcmp( value, "all" )?EventStream::MODE_ALL:replay;
}
else if ( !strcmp( name, "connkey" ) )
connkey = atoi(value);
else if ( config.opt_use_auth )
@ -275,7 +283,7 @@ int main( int argc, const char *argv[] )
stream.setStreamScale( scale );
stream.setStreamReplayRate( rate );
stream.setStreamMaxFPS( maxfps );
stream.setStreamMode( EventStream::MODE_ALL_GAPLESS );
stream.setStreamMode( replay );
stream.setStreamQueue( connkey );
if ( monitor_id && event_time )
{

View File

@ -38,7 +38,7 @@ body {
}
#menuBar1 span {
padding: 0px 20px;
padding: 0px 3px;
}
#menuBar2 {

View File

@ -41,6 +41,15 @@ if ( !isset( $rate ) )
if ( !isset( $scale ) )
$scale = reScale( SCALE_BASE, $event['DefaultScale'], ZM_WEB_DEFAULT_SCALE );
$replayModes = array(
'single' => $zmSlangReplaySingle,
'all' => $zmSlangReplayAll,
'gapless' => $zmSlangReplayGapless,
);
if ( !isset( $replayMode ) )
$replayMode = array_shift( array_keys( $replayModes ) );
$panel_sections = 40;
$panel_section_width = (int)ceil(reScale($event['Width'],$scale)/$panel_sections);
$panel_width = ($panel_sections*$panel_section_width-1);
@ -112,6 +121,15 @@ function changeScale()
$(streamImg).setStyles( { width: newWidth, height: newHeight } );
}
function changeReplayMode()
{
var replayMode = $('replayMode').getValue();
Cookie.set( 'replayMode', replayMode, { duration: 10*365 })
window.location.reload();
}
var streamParms = "view=request&request=stream&connkey=<?= $connkey ?>";
var streamTimeoutId = 0;
@ -505,9 +523,8 @@ function updateProgressBar()
</div>
<div id="menuBar1">
<span><input size="16" id="eventName" name="eventName" value="<?= $event['Name'] ?>"/>&nbsp;&nbsp;<input type="button" value="<?= $zmSlangRename ?>" onclick="renameEvent()"<?php if ( !canEdit( 'Events' ) ) { ?> disabled<?php } ?>/></span>
<span id="menuControls">
<span><?= $zmSlangReplay ?>: <?= buildSelect( "replayMode", $replayModes, "changeReplayMode();" ); ?></span>
<span><?= $zmSlangScale ?>: <?= buildSelect( "scale", $scales, "changeScale();" ); ?></span>
</span>
</div>
<div id="menuBar2">
<?php
@ -533,12 +550,12 @@ if ( ZM_OPT_MPEG != "no" )
<?php
if ( ZM_STREAM_METHOD == 'mpeg' && ZM_MPEG_LIVE_FORMAT )
{
$stream_src = getStreamSrc( array( "source=event", "mode=mpeg", "event=".$eid, "frame=".(!empty($fid)?$fid:1), "scale=".$scale, "rate=".$rate, "bitrate=".ZM_WEB_VIDEO_BITRATE, "maxfps=".ZM_WEB_VIDEO_MAXFPS, "format=".ZM_MPEG_REPLAY_FORMAT ) );
$stream_src = getStreamSrc( array( "source=event", "mode=mpeg", "event=".$eid, "frame=".(!empty($fid)?$fid:1), "scale=".$scale, "rate=".$rate, "bitrate=".ZM_WEB_VIDEO_BITRATE, "maxfps=".ZM_WEB_VIDEO_MAXFPS, "format=".ZM_MPEG_REPLAY_FORMAT, "replay=".$replayMode ) );
outputVideoStream( $stream_src, reScale( $event['Width'], $scale ), reScale( $event['Height'], $scale ), $event['Name'], ZM_MPEG_LIVE_FORMAT );
}
else
{
$stream_src = getStreamSrc( array( "source=event", "mode=jpeg", "event=".$eid, "frame=".(!empty($fid)?$fid:1), "scale=".$scale, "rate=".$rate, "maxfps=".ZM_WEB_VIDEO_MAXFPS ) );
$stream_src = getStreamSrc( array( "source=event", "mode=jpeg", "event=".$eid, "frame=".(!empty($fid)?$fid:1), "scale=".$scale, "rate=".$rate, "maxfps=".ZM_WEB_VIDEO_MAXFPS, "replay=".$replayMode ) );
if ( canStreamNative() )
{
outputImageStream( $stream_src, reScale( $event['Width'], $scale ), reScale( $event['Height'], $scale ), $event['Name'] );

View File

@ -506,6 +506,10 @@ $zmSlangPrev = 'Prev';
$zmSlangRate = 'Rate';
$zmSlangReal = 'Real';
$zmSlangRecord = 'Record';
$zmSlangReplay = 'Replay';
$zmSlangReplaySingle = 'Single Event';
$zmSlangReplayAll = 'All Events';
$zmSlangReplayGapless = 'Gapless Events';
$zmSlangRefImageBlendPct = 'Reference Image Blend %ge';
$zmSlangRefresh = 'Refresh';
$zmSlangRemoteHostName = 'Remote Host Name';