From 264b98548f1a23b7e4d3e9ffdc15a8c790848b6b Mon Sep 17 00:00:00 2001 From: Andrew Bauer Date: Tue, 25 Mar 2014 17:12:26 -0500 Subject: [PATCH 1/3] Fix prev button while in gapless mode. All buttons tested and working. --- src/zm_event.cpp | 11 ++++++++++- src/zm_event.h | 1 + 2 files changed, 11 insertions(+), 1 deletion(-) diff --git a/src/zm_event.cpp b/src/zm_event.cpp index 1d3aef6ea..3c0d86cac 100644 --- a/src/zm_event.cpp +++ b/src/zm_event.cpp @@ -1048,7 +1048,11 @@ void EventStream::processCommand( const CmdMsg *msg ) { Debug( 1, "Got PREV command" ); if ( replay_rate >= 0 ) + { curr_frame_id = 0; + if ( mode == MODE_ALL_GAPLESS ) + keep_curr_frame_id = true; + } else curr_frame_id = event_data->frame_count-1; paused = false; @@ -1061,7 +1065,11 @@ void EventStream::processCommand( const CmdMsg *msg ) if ( replay_rate >= 0 ) curr_frame_id = event_data->frame_count-1; else + { curr_frame_id = 0; + if ( mode == MODE_ALL_GAPLESS ) + keep_curr_frame_id = true; + } paused = false; forceEventChange = true; break; @@ -1168,7 +1176,7 @@ void EventStream::checkEventLoaded() loadEventData( event_id ); Debug( 2, "Current frame id = %d", curr_frame_id ); - if ( curr_frame_id <= 0 ) + if ( curr_frame_id <= 0 && !keep_curr_frame_id ) curr_frame_id = event_data->frame_count; else curr_frame_id = 1; @@ -1184,6 +1192,7 @@ void EventStream::checkEventLoaded() } mysql_free_result( result ); forceEventChange = false; + keep_curr_frame_id = false; } else { diff --git a/src/zm_event.h b/src/zm_event.h index f50a5bf06..6f979c02b 100644 --- a/src/zm_event.h +++ b/src/zm_event.h @@ -221,6 +221,7 @@ protected: protected: StreamMode mode; bool forceEventChange; + bool keep_curr_frame_id; protected: int curr_frame_id; From 3f7f3982107a5e78f72f24ecde37b74446dd1ddd Mon Sep 17 00:00:00 2001 From: Andrew Bauer Date: Fri, 28 Mar 2014 17:18:34 -0500 Subject: [PATCH 2/3] rework prev and next buttons --- src/zm_event.cpp | 15 +++------------ src/zm_event.h | 1 - 2 files changed, 3 insertions(+), 13 deletions(-) diff --git a/src/zm_event.cpp b/src/zm_event.cpp index 3c0d86cac..c7b041f2a 100644 --- a/src/zm_event.cpp +++ b/src/zm_event.cpp @@ -1048,13 +1048,9 @@ void EventStream::processCommand( const CmdMsg *msg ) { Debug( 1, "Got PREV command" ); if ( replay_rate >= 0 ) - { curr_frame_id = 0; - if ( mode == MODE_ALL_GAPLESS ) - keep_curr_frame_id = true; - } else - curr_frame_id = event_data->frame_count-1; + curr_frame_id = event_data->frame_count+1; paused = false; forceEventChange = true; break; @@ -1063,13 +1059,9 @@ void EventStream::processCommand( const CmdMsg *msg ) { Debug( 1, "Got NEXT command" ); if ( replay_rate >= 0 ) - curr_frame_id = event_data->frame_count-1; + curr_frame_id = event_data->frame_count+1; else - { curr_frame_id = 0; - if ( mode == MODE_ALL_GAPLESS ) - keep_curr_frame_id = true; - } paused = false; forceEventChange = true; break; @@ -1176,7 +1168,7 @@ void EventStream::checkEventLoaded() loadEventData( event_id ); Debug( 2, "Current frame id = %d", curr_frame_id ); - if ( curr_frame_id <= 0 && !keep_curr_frame_id ) + if ( replay_rate < 0 ) curr_frame_id = event_data->frame_count; else curr_frame_id = 1; @@ -1192,7 +1184,6 @@ void EventStream::checkEventLoaded() } mysql_free_result( result ); forceEventChange = false; - keep_curr_frame_id = false; } else { diff --git a/src/zm_event.h b/src/zm_event.h index 6f979c02b..f50a5bf06 100644 --- a/src/zm_event.h +++ b/src/zm_event.h @@ -221,7 +221,6 @@ protected: protected: StreamMode mode; bool forceEventChange; - bool keep_curr_frame_id; protected: int curr_frame_id; From b126ca3e01499ea4755a7b6a6fa5aa4059208083 Mon Sep 17 00:00:00 2001 From: Andrew Bauer Date: Sun, 30 Mar 2014 11:18:14 -0500 Subject: [PATCH 3/3] modify play button --- src/zm_event.cpp | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/src/zm_event.cpp b/src/zm_event.cpp index c7b041f2a..8973b39c4 100644 --- a/src/zm_event.cpp +++ b/src/zm_event.cpp @@ -877,6 +877,11 @@ void EventStream::processCommand( const CmdMsg *msg ) // Clear paused flag paused = false; } + + // If we are in single event mode and at the last frame, replay the current event + if ( (mode == MODE_SINGLE) && (curr_frame_id == event_data->frame_count) ) + curr_frame_id = 1; + replay_rate = ZM_RATE_BASE; break; }