summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--coreengine/viewdisplayreplay.c49
-rw-r--r--coreengine/viewdisplayreplay.h3
-rw-r--r--coreengine/viewelementsdisplayreplay.c24
-rw-r--r--coreengine/viewelementsdisplayreplay.h7
4 files changed, 55 insertions, 28 deletions
diff --git a/coreengine/viewdisplayreplay.c b/coreengine/viewdisplayreplay.c
index aed160d..927780a 100644
--- a/coreengine/viewdisplayreplay.c
+++ b/coreengine/viewdisplayreplay.c
@@ -143,6 +143,7 @@ void cViewReplay::PreCache(void) {
void cViewReplay::ClearVariables(void) {
cView::ClearVariables();
recording = NULL;
+ lastEvent = NULL;
modeOnly = false;
lastFlush = 0;
lastFlushModeOnly = 0;
@@ -162,20 +163,6 @@ void cViewReplay::ClearVariables(void) {
globalTimers.ClearTimers();
}
-void cViewReplay::SetRecording(const cRecording *recording) {
- this->recording = recording;
- if (veRecTitle) {
- veRecTitle->Set(recording);
- }
- if (veRecInfo) {
- veRecInfo->Set(recording);
- }
- if (veScraperContent) {
- veScraperContent->Set(recording);
- }
- SetTimeShiftValues();
-}
-
void cViewReplay::GetGlobalTimers(void) {
if (!timersLoaded) {
timersLoaded = true;
@@ -183,7 +170,7 @@ void cViewReplay::GetGlobalTimers(void) {
}
}
-void cViewReplay::SetTimeShiftValues(void) {
+void cViewReplay::SetTimeShiftValues(int current, int total) {
if (!recording)
return;
timeShiftActive = false;
@@ -209,21 +196,43 @@ void cViewReplay::SetTimeShiftValues(void) {
}
if (!Schedule)
return;
- const cEvent *event = Schedule->GetEventAround(time(NULL));
- if (!event)
+ // Get event at actual recording position
+ const cEvent *eventEnde = Schedule->GetEventAround(time(NULL));
+ if (!eventEnde)
return;
double fps = recording->FramesPerSecond();
- time_t liveEventStop = event->EndTime();
+ time_t liveEventStop = eventEnde->EndTime();
time_t recordingStart = time(0) - recording->LengthInSeconds();
timeShiftFramesTotal = (liveEventStop - recordingStart) * fps;
timeShiftLength = liveEventStop - recordingStart;
+ // Get event at actual replay position
+ int secondsafter = (int)(recording->LengthInSeconds() * (1.0 - (double)current / (double)total));
+ const cEvent *eventReplay = Schedule->GetEventAround(time(NULL) - secondsafter);
+ // Display title at replay position
+ if (eventReplay && eventReplay != lastEvent && veRecTitle) {
+ veRecTitle->Set(recording, eventReplay);
+ veRecTitle->Parse();
+ lastEvent = eventReplay;
+ }
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) {
+ veRecTitle->Set(recording);
+ }
+ if (veRecInfo) {
+ veRecInfo->Set(recording);
+ }
+ if (veScraperContent) {
+ veScraperContent->Set(recording);
+ }
+}
+
void cViewReplay::SetTitle(const char *title) {
- recording = NULL;
if (veRecTitle) {
veRecTitle->Set(title);
}
@@ -263,7 +272,7 @@ void cViewReplay::SetEndTime(int current, int total) {
}
void cViewReplay::SetProgressbar(int current, int total) {
- SetTimeShiftValues();
+ SetTimeShiftValues(current, total);
if (veProgressbar)
veProgressbar->Set(current, total, timeShiftActive, timeShiftFramesTotal);
Render((int)eVeDisplayReplay::progressbar);
diff --git a/coreengine/viewdisplayreplay.h b/coreengine/viewdisplayreplay.h
index 55e7966..310c6e9 100644
--- a/coreengine/viewdisplayreplay.h
+++ b/coreengine/viewdisplayreplay.h
@@ -22,6 +22,7 @@ private:
cVeDrOnPause *veOnPause;
cVeDrOnPause *veOnPauseModeOnly;
const cRecording *recording;
+ const cEvent *lastEvent;
bool modeOnly;
time_t lastFlush;
time_t lastFlushModeOnly;
@@ -34,7 +35,7 @@ private:
bool timersLoaded;
cGlobalTimers globalTimers;
void GetGlobalTimers(void);
- void SetTimeShiftValues(void);
+ void SetTimeShiftValues(int current, int total);
void SetViewElements(void);
void ClearVariables(void);
void SetViewElementObjects(void);
diff --git a/coreengine/viewelementsdisplayreplay.c b/coreengine/viewelementsdisplayreplay.c
index 9249d37..5efb2d3 100644
--- a/coreengine/viewelementsdisplayreplay.c
+++ b/coreengine/viewelementsdisplayreplay.c
@@ -8,6 +8,7 @@
******************************************************************/
cVeDrRecTitle::cVeDrRecTitle(void) {
recording = NULL;
+ event = NULL;
title = NULL;
}
@@ -24,16 +25,20 @@ void cVeDrRecTitle::SetTokenContainer(void) {
InheritTokenContainer();
}
-void cVeDrRecTitle::Set(const cRecording *recording) {
+void cVeDrRecTitle::Set(const cRecording *recording, const cEvent *event) {
if (this->title) {
free(this->title);
this->title = NULL;
}
if (this->recording)
this->recording = NULL;
+ if (this->event)
+ this->event = NULL;
if (!recording)
return;
this->recording = recording;
+ if (event)
+ this->event = event;
}
void cVeDrRecTitle::Set(const char *title) {
@@ -43,6 +48,8 @@ void cVeDrRecTitle::Set(const char *title) {
}
if (this->recording)
this->recording = NULL;
+ if (this->event)
+ this->event = NULL;
if (!title)
return;
free(this->title);
@@ -58,13 +65,22 @@ bool cVeDrRecTitle::Parse(bool force) {
tokenContainer->Clear();
if (recording) {
const char *recName = NULL;
+ const char *recShortText = NULL;
const cRecordingInfo *recInfo = recording->Info();
- if (recInfo)
+ if (event) {
+ recName = event->Title();
+ recShortText = event->ShortText();
+ } else if (recInfo) {
recName = recInfo->Title();
- if (!recName)
+ recShortText = recInfo->ShortText();
+ }
+ if (!recName) {
recName = recording->Name();
+ recShortText = "";
+ }
+
tokenContainer->AddStringToken((int)eDRRecTitleST::rectitle, recName);
- tokenContainer->AddStringToken((int)eDRRecTitleST::recsubtitle, recInfo ? recInfo->ShortText() : "");
+ tokenContainer->AddStringToken((int)eDRRecTitleST::recsubtitle, recShortText);
tokenContainer->AddStringToken((int)eDRRecTitleST::recdate, *ShortDateString(recording->Start()));
tokenContainer->AddStringToken((int)eDRRecTitleST::rectime, *TimeString(recording->Start()));
} else if (title) {
diff --git a/coreengine/viewelementsdisplayreplay.h b/coreengine/viewelementsdisplayreplay.h
index 7e5d156..c9e40f9 100644
--- a/coreengine/viewelementsdisplayreplay.h
+++ b/coreengine/viewelementsdisplayreplay.h
@@ -10,13 +10,14 @@
class cVeDrRecTitle : public cViewElement {
private:
const cRecording *recording;
+ const cEvent *event;
char *title;
public:
cVeDrRecTitle(void);
virtual ~cVeDrRecTitle(void);
void SetTokenContainer(void);
- void Set(const cRecording *recording);
- void Set(const char *title);
+ void Set(const cRecording *recording = NULL, const cEvent *event = NULL);
+ void Set(const char *title = NULL);
bool Parse(bool forced = false);
};
@@ -207,4 +208,4 @@ public:
bool Parse(bool forced = false);
};
-#endif //__VIEWELEMENTSDR_H \ No newline at end of file
+#endif //__VIEWELEMENTSDR_H