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

View File

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

View File

@ -41,6 +41,15 @@ if ( !isset( $rate ) )
if ( !isset( $scale ) ) if ( !isset( $scale ) )
$scale = reScale( SCALE_BASE, $event['DefaultScale'], ZM_WEB_DEFAULT_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_sections = 40;
$panel_section_width = (int)ceil(reScale($event['Width'],$scale)/$panel_sections); $panel_section_width = (int)ceil(reScale($event['Width'],$scale)/$panel_sections);
$panel_width = ($panel_sections*$panel_section_width-1); $panel_width = ($panel_sections*$panel_section_width-1);
@ -112,6 +121,15 @@ function changeScale()
$(streamImg).setStyles( { width: newWidth, height: newHeight } ); $(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 streamParms = "view=request&request=stream&connkey=<?= $connkey ?>";
var streamTimeoutId = 0; var streamTimeoutId = 0;
@ -505,9 +523,8 @@ function updateProgressBar()
</div> </div>
<div id="menuBar1"> <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><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><?= $zmSlangScale ?>: <?= buildSelect( "scale", $scales, "changeScale();" ); ?></span>
</span>
</div> </div>
<div id="menuBar2"> <div id="menuBar2">
<?php <?php
@ -533,12 +550,12 @@ if ( ZM_OPT_MPEG != "no" )
<?php <?php
if ( ZM_STREAM_METHOD == 'mpeg' && ZM_MPEG_LIVE_FORMAT ) 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 ); outputVideoStream( $stream_src, reScale( $event['Width'], $scale ), reScale( $event['Height'], $scale ), $event['Name'], ZM_MPEG_LIVE_FORMAT );
} }
else 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() ) if ( canStreamNative() )
{ {
outputImageStream( $stream_src, reScale( $event['Width'], $scale ), reScale( $event['Height'], $scale ), $event['Name'] ); outputImageStream( $stream_src, reScale( $event['Width'], $scale ), reScale( $event['Height'], $scale ), $event['Name'] );

View File

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