summaryrefslogtreecommitdiff
path: root/coreengine
diff options
context:
space:
mode:
Diffstat (limited to 'coreengine')
-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);