summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorkamel5 <vdr.kamel5 (at) gmx (dot) net>2021-02-10 16:02:44 +0100
committerkamel5 <vdr.kamel5 (at) gmx (dot) net>2021-02-11 17:34:23 +0100
commit628a28201b797635486aad40fad042c4c4222656 (patch)
tree40ccd82922d6bf8c5ea1d26fc0626334f0788900
parent538d59ca4e83733c6e0b35c21a65d3efe198d176 (diff)
downloadvdr-plugin-skindesigner-628a28201b797635486aad40fad042c4c4222656.tar.gz
vdr-plugin-skindesigner-628a28201b797635486aad40fad042c4c4222656.tar.bz2
Revision cViewReplay::SetTimeShiftValues()
When the timeshift recording reaches the end time of the start event, the progress bar and the end time no longer shows any useful information. From this version the current live event is used to calculate the progress bar and the end time.
-rw-r--r--coreengine/viewdisplayreplay.c34
-rw-r--r--coreengine/viewdisplayreplay.h1
2 files changed, 17 insertions, 18 deletions
diff --git a/coreengine/viewdisplayreplay.c b/coreengine/viewdisplayreplay.c
index db767dc..aed160d 100644
--- a/coreengine/viewdisplayreplay.c
+++ b/coreengine/viewdisplayreplay.c
@@ -162,15 +162,6 @@ void cViewReplay::ClearVariables(void) {
globalTimers.ClearTimers();
}
-void cViewReplay::SetTimeShift(int framesTotal, int timeShiftLength) {
- timeShiftActive = true;
- timeShiftFramesTotal = framesTotal;
- this->timeShiftLength = timeShiftLength;
- int mins = (timeShiftLength / 60) % 60;
- int hours = (timeShiftLength / 3600) % 24;
- timeShiftDuration = cString::sprintf("%d:%02d", hours, mins);
-}
-
void cViewReplay::SetRecording(const cRecording *recording) {
this->recording = recording;
if (veRecTitle) {
@@ -195,31 +186,40 @@ void cViewReplay::GetGlobalTimers(void) {
void cViewReplay::SetTimeShiftValues(void) {
if (!recording)
return;
- bool isTimeShift = false;
+ timeShiftActive = false;
#if APIVERSNUM >= 20101
int usage = recording->IsInUse();
if (usage & ruTimer)
- isTimeShift = true;
+ timeShiftActive = true;
else {
GetGlobalTimers();
if (globalTimers.IsRecording(recording))
- isTimeShift = true;
+ timeShiftActive = true;
}
#endif
- if (!isTimeShift)
+ if (!timeShiftActive)
return;
const cRecordingInfo *recInfo = recording->Info();
if (!recInfo)
return;
- const cEvent *event = recInfo->GetEvent();
+ const cSchedule *Schedule = NULL;
+ {
+ LOCK_SCHEDULES_READ;
+ Schedule = Schedules->GetSchedule(recInfo->ChannelID());
+ }
+ if (!Schedule)
+ return;
+ const cEvent *event = Schedule->GetEventAround(time(NULL));
if (!event)
return;
double fps = recording->FramesPerSecond();
time_t liveEventStop = event->EndTime();
time_t recordingStart = time(0) - recording->LengthInSeconds();
- int framesTotal = (liveEventStop - recordingStart)*fps;
- int recLength = liveEventStop - recordingStart;
- SetTimeShift(framesTotal, recLength);
+ timeShiftFramesTotal = (liveEventStop - recordingStart) * fps;
+ timeShiftLength = liveEventStop - recordingStart;
+ int mins = (timeShiftLength / 60) % 60;
+ int hours = (timeShiftLength / 3600) % 24;
+ timeShiftDuration = cString::sprintf("%d:%02d", hours, mins);
}
void cViewReplay::SetTitle(const char *title) {
diff --git a/coreengine/viewdisplayreplay.h b/coreengine/viewdisplayreplay.h
index b9ed9eb..55e7966 100644
--- a/coreengine/viewdisplayreplay.h
+++ b/coreengine/viewdisplayreplay.h
@@ -45,7 +45,6 @@ public:
void PreCache(void);
void SetModeOnly(bool modeOnly) { this->modeOnly = modeOnly; };
void SetRecordingLength(int length) { reclength = length; };
- void SetTimeShift(int framesTotal, int timeShiftLength);
void SetRecording(const cRecording *recording);
void SetTitle(const char *title);
void SetCurrent(const char *current);