From dc8aa908609187bddce9804abfd9e116a365642e Mon Sep 17 00:00:00 2001 From: stan Date: Tue, 20 Nov 2007 17:06:45 +0000 Subject: [PATCH] Added stream replay mode control. git-svn-id: http://svn.zoneminder.com/svn/zm/trunk@2245 e3e1d417-86f3-4887-817a-d78f3d33393f --- src/zms.cpp | 10 +++++++++- web/zm_html_view_eventX.css | 2 +- web/zm_html_view_eventX.php | 27 ++++++++++++++++++++++----- web/zm_lang_en_gb.php | 4 ++++ 4 files changed, 36 insertions(+), 7 deletions(-) diff --git a/src/zms.cpp b/src/zms.cpp index 45ffa3d6f..1b6897135 100644 --- a/src/zms.cpp +++ b/src/zms.cpp @@ -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 ) { diff --git a/web/zm_html_view_eventX.css b/web/zm_html_view_eventX.css index 9c90cc85f..c5fe6d4a6 100644 --- a/web/zm_html_view_eventX.css +++ b/web/zm_html_view_eventX.css @@ -38,7 +38,7 @@ body { } #menuBar1 span { - padding: 0px 20px; + padding: 0px 3px; } #menuBar2 { diff --git a/web/zm_html_view_eventX.php b/web/zm_html_view_eventX.php index 75f7e1246..d83e34637 100644 --- a/web/zm_html_view_eventX.php +++ b/web/zm_html_view_eventX.php @@ -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="; var streamTimeoutId = 0; @@ -505,9 +523,8 @@ function updateProgressBar()