From c3f7a2cfdf876ff0980e2838c5dbc65ad998404a Mon Sep 17 00:00:00 2001 From: kamel5 Date: Mon, 8 Feb 2021 15:22:40 +0100 Subject: [PATCH] Fixed a bug in timeshift mode that prevented the progress bar from updating in pause mode --- coreengine/viewdisplayreplay.c | 7 ++++++- coreengine/viewdisplayreplay.h | 3 ++- coreengine/viewelementsdisplayreplay.c | 4 ++-- displayreplay.c | 2 -- 4 files changed, 10 insertions(+), 6 deletions(-) diff --git a/coreengine/viewdisplayreplay.c b/coreengine/viewdisplayreplay.c index f871afb..db767dc 100644 --- a/coreengine/viewdisplayreplay.c +++ b/coreengine/viewdisplayreplay.c @@ -142,6 +142,7 @@ void cViewReplay::PreCache(void) { void cViewReplay::ClearVariables(void) { cView::ClearVariables(); + recording = NULL; modeOnly = false; lastFlush = 0; lastFlushModeOnly = 0; @@ -171,6 +172,7 @@ void cViewReplay::SetTimeShift(int framesTotal, int timeShiftLength) { } void cViewReplay::SetRecording(const cRecording *recording) { + this->recording = recording; if (veRecTitle) { veRecTitle->Set(recording); } @@ -180,6 +182,7 @@ void cViewReplay::SetRecording(const cRecording *recording) { if (veScraperContent) { veScraperContent->Set(recording); } + SetTimeShiftValues(); } void cViewReplay::GetGlobalTimers(void) { @@ -189,7 +192,7 @@ void cViewReplay::GetGlobalTimers(void) { } } -void cViewReplay::SetTimeShiftValues(const cRecording *recording) { +void cViewReplay::SetTimeShiftValues(void) { if (!recording) return; bool isTimeShift = false; @@ -220,6 +223,7 @@ void cViewReplay::SetTimeShiftValues(const cRecording *recording) { } void cViewReplay::SetTitle(const char *title) { + recording = NULL; if (veRecTitle) { veRecTitle->Set(title); } @@ -259,6 +263,7 @@ void cViewReplay::SetEndTime(int current, int total) { } void cViewReplay::SetProgressbar(int current, int total) { + SetTimeShiftValues(); if (veProgressbar) veProgressbar->Set(current, total, timeShiftActive, timeShiftFramesTotal); Render((int)eVeDisplayReplay::progressbar); diff --git a/coreengine/viewdisplayreplay.h b/coreengine/viewdisplayreplay.h index 0dc682a..b9ed9eb 100644 --- a/coreengine/viewdisplayreplay.h +++ b/coreengine/viewdisplayreplay.h @@ -21,6 +21,7 @@ private: cVeDrJump *veJump; cVeDrOnPause *veOnPause; cVeDrOnPause *veOnPauseModeOnly; + const cRecording *recording; bool modeOnly; time_t lastFlush; time_t lastFlushModeOnly; @@ -33,6 +34,7 @@ private: bool timersLoaded; cGlobalTimers globalTimers; void GetGlobalTimers(void); + void SetTimeShiftValues(void); void SetViewElements(void); void ClearVariables(void); void SetViewElementObjects(void); @@ -46,7 +48,6 @@ public: void SetTimeShift(int framesTotal, int timeShiftLength); void SetRecording(const cRecording *recording); void SetTitle(const char *title); - void SetTimeShiftValues(const cRecording *recording); void SetCurrent(const char *current); void SetTotal(const char *total); void SetEndTime(int current, int total); diff --git a/coreengine/viewelementsdisplayreplay.c b/coreengine/viewelementsdisplayreplay.c index 6cd4b25..9249d37 100644 --- a/coreengine/viewelementsdisplayreplay.c +++ b/coreengine/viewelementsdisplayreplay.c @@ -273,7 +273,7 @@ void cVeDrProgressBar::SetTokenContainer(void) { } void cVeDrProgressBar::Set(int current, int total, bool timeshiftActive, int timeshiftTotal) { - if (this->current == current) + if (!(this->current != current || this->total != total)) return; this->current = current; this->total = total; @@ -595,7 +595,7 @@ void cVeDrProgressModeonly::SetTokenContainer(void) { } void cVeDrProgressModeonly::Set(double fps, int current, int total) { - if (this->current == current) + if (!(this->current != current || this->total != total)) return; this->fps = fps; this->current = current; diff --git a/displayreplay.c b/displayreplay.c index 9921a9d..2a8b646 100644 --- a/displayreplay.c +++ b/displayreplay.c @@ -18,7 +18,6 @@ void cSDDisplayReplay::SetRecording(const cRecording *Recording) { view->SetRecording(Recording); if (init) { view->SetRecordingLength(Recording->LengthInSeconds()); - view->SetTimeShiftValues(Recording); init = false; } } @@ -30,7 +29,6 @@ void cSDDisplayReplay::SetTitle(const char *Title) { view->SetTitle(Title); if (init) { view->SetRecordingLength(0); - view->SetTimeShiftValues(NULL); init = false; } }