summaryrefslogtreecommitdiff
path: root/coreengine
diff options
context:
space:
mode:
Diffstat (limited to 'coreengine')
-rw-r--r--coreengine/definitions.h23
-rw-r--r--coreengine/viewdisplayreplay.c49
-rw-r--r--coreengine/viewdisplayreplay.h5
-rw-r--r--coreengine/viewelement.c2
-rw-r--r--coreengine/viewelementsdisplayreplay.c68
-rw-r--r--coreengine/viewelementsdisplayreplay.h30
6 files changed, 156 insertions, 21 deletions
diff --git a/coreengine/definitions.h b/coreengine/definitions.h
index 943bea8..678c54f 100644
--- a/coreengine/definitions.h
+++ b/coreengine/definitions.h
@@ -129,6 +129,7 @@ enum class eVeDisplayReplay {
recinfo,
currenttime,
totaltime,
+ timeshifttimes,
endtime,
progressbar,
cutmarks,
@@ -1522,6 +1523,11 @@ enum class eDRCurrentTimeST {
count
};
+enum class eDRCurrentTimeIT {
+ timeshift = 0,
+ count
+};
+
enum class eDRTotalTimeST {
rectotal = 0,
timeshifttotal,
@@ -1533,11 +1539,28 @@ enum class eDRTotalTimeIT {
count
};
+enum class eDRTimeshiftTimesST {
+ recstart = 0,
+ playbacktime,
+ timeshiftrest,
+ count
+};
+
+enum class eDRTimeshiftTimesIT {
+ timeshift = 0,
+ count
+};
+
enum class eDREndTimeST {
recend = 0,
count
};
+enum class eDREndTimeIT {
+ timeshift = 0,
+ count
+};
+
enum class eDRProgressbarIT {
current = 0,
total,
diff --git a/coreengine/viewdisplayreplay.c b/coreengine/viewdisplayreplay.c
index 30b7c36..c3aeb00 100644
--- a/coreengine/viewdisplayreplay.c
+++ b/coreengine/viewdisplayreplay.c
@@ -6,6 +6,7 @@
cViewReplay::cViewReplay(void) {
veCustomTokens = NULL;
+ veTimeshiftTimes = NULL;
veEndTime = NULL;
veMessage = NULL;
veScraperContent = NULL;
@@ -45,6 +46,7 @@ void cViewReplay::SetViewElements(void) {
viewElementNames.insert(pair<string, int>("rectitle", (int)eVeDisplayReplay::rectitle));
viewElementNames.insert(pair<string, int>("recinfo", (int)eVeDisplayReplay::recinfo));
viewElementNames.insert(pair<string, int>("currenttime", (int)eVeDisplayReplay::currenttime));
+ viewElementNames.insert(pair<string, int>("timeshifttimes", (int)eVeDisplayReplay::timeshifttimes));
viewElementNames.insert(pair<string, int>("endtime", (int)eVeDisplayReplay::endtime));
viewElementNames.insert(pair<string, int>("totaltime", (int)eVeDisplayReplay::totaltime));
viewElementNames.insert(pair<string, int>("progressbar", (int)eVeDisplayReplay::progressbar));
@@ -92,6 +94,10 @@ void cViewReplay::SetViewElementObjects(void) {
{
veTotalTime = dynamic_cast<cVeDrTotalTime*>(viewElements[i]);
}
+ else if (dynamic_cast<cVeDrTimeshiftTimes*>(viewElements[i]))
+ {
+ veTimeshiftTimes = dynamic_cast<cVeDrTimeshiftTimes*>(viewElements[i]);
+ }
else if (dynamic_cast<cVeDrEndTime*>(viewElements[i]))
{
veEndTime = dynamic_cast<cVeDrEndTime*>(viewElements[i]);
@@ -153,8 +159,11 @@ void cViewReplay::ClearVariables(void) {
timeShiftFramesTotal = -1;
timeShiftLength = -1;
timeShiftDuration = "";
+ timeshiftrest = "";
if (veCustomTokens)
veCustomTokens->Reset();
+ if (veTimeshiftTimes)
+ veTimeshiftTimes->Set(cString(""), cString(""), cString(""));
if (veEndTime)
veEndTime->Set(cString(""));
if (veCutMarks)
@@ -200,17 +209,20 @@ void cViewReplay::SetTimeShiftValues(int current, int total) {
if (!Schedule)
return;
// Get event at actual recording position
- const cEvent *eventEnde = Schedule->GetEventAround(time(NULL));
+ const cEvent *eventEnde = Schedule->GetEventAround(time(0));
if (!eventEnde)
return;
- double fps = recording->FramesPerSecond();
+ // End of live program
time_t liveEventStop = eventEnde->EndTime();
+ // Begin of timeshift recording
time_t recordingStart = time(0) - recording->LengthInSeconds();
- timeShiftFramesTotal = (liveEventStop - recordingStart) * fps;
+ // actual timeshiftlength
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);
+ // timeshiftlength until end of live program
+ timeShiftFramesTotal = total * ((double)timeShiftLength / (double)recording->LengthInSeconds());
+ // Get event at actual replay position (add 30sec for a better match)
+ int timeShiftSecondsAfter = (int)(recording->LengthInSeconds() * (1.0 - (double)current / (double)total)) + 30;
+ const cEvent *eventReplay = Schedule->GetEventAround(time(0) - timeShiftSecondsAfter);
// Display title at replay position
if (eventReplay && eventReplay != lastEvent && veRecTitle) {
veRecTitle->Set(recording, eventReplay, true);
@@ -220,6 +232,9 @@ void cViewReplay::SetTimeShiftValues(int current, int total) {
int mins = (timeShiftLength / 60) % 60;
int hours = (timeShiftLength / 3600) % 24;
timeShiftDuration = cString::sprintf("%d:%02d", hours, mins);
+ mins = (timeShiftSecondsAfter / 60) % 60;
+ hours = (timeShiftSecondsAfter / 3600) % 24;
+ timeshiftrest = cString::sprintf("%d:%02d", hours, mins);
}
void cViewReplay::SetRecording(const cRecording *recording) {
@@ -249,16 +264,30 @@ void cViewReplay::SetTitle(const char *title) {
void cViewReplay::SetCurrent(const char *current) {
if (veCurrentTime)
- veCurrentTime->Set(current);
+ veCurrentTime->Set(current, timeShiftActive);
Render((int)eVeDisplayReplay::currenttime);
}
void cViewReplay::SetTotal(const char *total) {
if (veTotalTime)
- veTotalTime->Set(total, timeShiftActive, *timeShiftDuration);
+ veTotalTime->Set(total, *timeShiftDuration, timeShiftActive);
Render((int)eVeDisplayReplay::totaltime);
}
+void cViewReplay::SetTimeshiftTimes(int current, int total) {
+ if (!veTimeshiftTimes || reclength == 0)
+ return;
+ time_t recordingStart = 0;
+ time_t playbackTime = 0;
+ if (timeShiftActive) {
+ recordingStart = time(0) - recording->LengthInSeconds();
+ playbackTime = time(0) - (int)(recording->LengthInSeconds() * (1.0 - (double)current / (double)total));
+ } else
+ recordingStart = recording->Start();
+ veTimeshiftTimes->Set(TimeString(recordingStart), TimeString(playbackTime), timeshiftrest, timeShiftActive);
+ Render((int)eVeDisplayReplay::timeshifttimes);
+}
+
void cViewReplay::SetEndTime(int current, int total) {
if (!veEndTime || reclength == 0)
return;
@@ -270,12 +299,12 @@ void cViewReplay::SetEndTime(int current, int total) {
}
double rest = (double)(totalLength - current) / (double)totalLength;
time_t end = time(0) + rest * recordingLength;
- veEndTime->Set(TimeString(end));
+ veEndTime->Set(TimeString(end), timeShiftActive);
Render((int)eVeDisplayReplay::endtime);
}
void cViewReplay::SetProgressbar(int current, int total) {
- SetTimeShiftValues(current, total);
+// 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 310c6e9..5746ac2 100644
--- a/coreengine/viewdisplayreplay.h
+++ b/coreengine/viewdisplayreplay.h
@@ -12,6 +12,7 @@ private:
cVeDrScraperContent *veScraperContent;
cVeDrCurrentTime *veCurrentTime;
cVeDrTotalTime *veTotalTime;
+ cVeDrTimeshiftTimes *veTimeshiftTimes;
cVeDrEndTime *veEndTime;
cVeDrProgressBar *veProgressbar;
cVeDrCutMarks *veCutMarks;
@@ -31,11 +32,11 @@ private:
bool timeShiftActive;
int timeShiftFramesTotal;
int timeShiftLength;
+ cString timeshiftrest;
cString timeShiftDuration;
bool timersLoaded;
cGlobalTimers globalTimers;
void GetGlobalTimers(void);
- void SetTimeShiftValues(int current, int total);
void SetViewElements(void);
void ClearVariables(void);
void SetViewElementObjects(void);
@@ -47,9 +48,11 @@ public:
void SetModeOnly(bool modeOnly) { this->modeOnly = modeOnly; };
void SetRecordingLength(int length) { reclength = length; };
void SetRecording(const cRecording *recording);
+ void SetTimeShiftValues(int current, int total);
void SetTitle(const char *title);
void SetCurrent(const char *current);
void SetTotal(const char *total);
+ void SetTimeshiftTimes(int current, int total);
void SetEndTime(int current, int total);
void SetProgressbar(int current, int total);
void SetMarks(const cMarks *marks, int current, int total);
diff --git a/coreengine/viewelement.c b/coreengine/viewelement.c
index a30608f..abd5562 100644
--- a/coreengine/viewelement.c
+++ b/coreengine/viewelement.c
@@ -169,6 +169,8 @@ cViewElement *cViewElement::CreateViewElement(const char *name, const char *view
e = new cVeDrCurrentTime();
else if (!strcmp(name, "totaltime"))
e = new cVeDrTotalTime();
+ else if (!strcmp(name, "timeshifttimes"))
+ e = new cVeDrTimeshiftTimes();
else if (!strcmp(name, "endtime"))
e = new cVeDrEndTime();
else if (!strcmp(name, "progressbar") && !strcmp(viewname, "displayreplay"))
diff --git a/coreengine/viewelementsdisplayreplay.c b/coreengine/viewelementsdisplayreplay.c
index 64df8a8..4116153 100644
--- a/coreengine/viewelementsdisplayreplay.c
+++ b/coreengine/viewelementsdisplayreplay.c
@@ -10,6 +10,7 @@ cVeDrRecTitle::cVeDrRecTitle(void) {
recording = NULL;
event = NULL;
title = NULL;
+ timeshiftActive = false;
}
cVeDrRecTitle::~cVeDrRecTitle(void) {
@@ -163,6 +164,7 @@ bool cVeDrRecInfo::Parse(bool force) {
cVeDrCurrentTime::cVeDrCurrentTime(void) {
changed = true;
current = NULL;
+ timeshiftActive = false;
}
cVeDrCurrentTime::~cVeDrCurrentTime(void) {
@@ -172,14 +174,16 @@ cVeDrCurrentTime::~cVeDrCurrentTime(void) {
void cVeDrCurrentTime::SetTokenContainer(void) {
tokenContainer = new skindesignerapi::cTokenContainer();
tokenContainer->DefineStringToken("{reccurrent}", (int)eDRCurrentTimeST::reccurrent);
+ tokenContainer->DefineIntToken("{timeshift}", (int)eDRCurrentTimeIT::timeshift);
InheritTokenContainer();
}
-void cVeDrCurrentTime::Set(const char *current) {
+void cVeDrCurrentTime::Set(const char *current, bool timeshiftActive) {
if (!current)
return;
free(this->current);
this->current = strdup(current);
+ this->timeshiftActive = timeshiftActive;
changed = true;
}
@@ -188,6 +192,7 @@ bool cVeDrCurrentTime::Parse(bool force) {
return false;
tokenContainer->Clear();
tokenContainer->AddStringToken((int)eDRCurrentTimeST::reccurrent, current);
+ tokenContainer->AddIntToken((int)eDRCurrentTimeIT::timeshift, timeshiftActive);
SetDirty();
changed = false;
return true;
@@ -199,8 +204,8 @@ bool cVeDrCurrentTime::Parse(bool force) {
cVeDrTotalTime::cVeDrTotalTime(void) {
changed = true;
total = NULL;
- timeshiftActive = false;
timeshiftDuration = NULL;
+ timeshiftActive = false;
}
cVeDrTotalTime::~cVeDrTotalTime(void) {
@@ -216,7 +221,7 @@ void cVeDrTotalTime::SetTokenContainer(void) {
InheritTokenContainer();
}
-void cVeDrTotalTime::Set(const char *total, bool timeshiftActive, const char *timeshiftDuration) {
+void cVeDrTotalTime::Set(const char *total, const char *timeshiftDuration, bool timeshiftActive) {
if (!total)
return;
free(this->total);
@@ -242,10 +247,58 @@ bool cVeDrTotalTime::Parse(bool force) {
}
/******************************************************************
+* cVeDrTimeshiftTimes
+******************************************************************/
+cVeDrTimeshiftTimes::cVeDrTimeshiftTimes(void) {
+ changed = true;
+ start = "";
+ playbacktime = "";
+ timeshiftrest = "";
+ timeshiftActive = false;
+}
+
+cVeDrTimeshiftTimes::~cVeDrTimeshiftTimes(void) {
+}
+
+void cVeDrTimeshiftTimes::SetTokenContainer(void) {
+ tokenContainer = new skindesignerapi::cTokenContainer();
+ tokenContainer->DefineStringToken("{recstart}", (int)eDRTimeshiftTimesST::recstart);
+ tokenContainer->DefineStringToken("{playbacktime}", (int)eDRTimeshiftTimesST::playbacktime);
+ tokenContainer->DefineStringToken("{timeshiftrest}", (int)eDRTimeshiftTimesST::timeshiftrest);
+ tokenContainer->DefineIntToken("{timeshift}", (int)eDRTimeshiftTimesIT::timeshift);
+ InheritTokenContainer();
+}
+
+void cVeDrTimeshiftTimes::Set(cString start, cString playbacktime, cString timeshiftrest, bool timeshiftActive) {
+ this->timeshiftActive = timeshiftActive;
+ if (strcmp(*this->start, *start) || strcmp(*this->playbacktime, *playbacktime) || strcmp(*this->timeshiftrest, *timeshiftrest)) {
+ this->start = start;
+ this->playbacktime = playbacktime;
+ this->timeshiftrest = timeshiftrest;
+ changed = true;
+ }
+}
+
+bool cVeDrTimeshiftTimes::Parse(bool force) {
+ if (!cViewElement::Parse(force) || !changed)
+ return false;
+ tokenContainer->Clear();
+ tokenContainer->AddStringToken((int)eDRTimeshiftTimesST::recstart, *start);
+ tokenContainer->AddStringToken((int)eDRTimeshiftTimesST::playbacktime, *playbacktime);
+ tokenContainer->AddStringToken((int)eDRTimeshiftTimesST::timeshiftrest, *timeshiftrest);
+ tokenContainer->AddIntToken((int)eDRTimeshiftTimesIT::timeshift, timeshiftActive);
+ SetDirty();
+ changed = false;
+ return true;
+}
+
+/******************************************************************
* cVeDrEndTime
******************************************************************/
cVeDrEndTime::cVeDrEndTime(void) {
+ changed = true;
end = "";
+ timeshiftActive = false;
}
cVeDrEndTime::~cVeDrEndTime(void) {
@@ -254,10 +307,12 @@ cVeDrEndTime::~cVeDrEndTime(void) {
void cVeDrEndTime::SetTokenContainer(void) {
tokenContainer = new skindesignerapi::cTokenContainer();
tokenContainer->DefineStringToken("{recend}", (int)eDREndTimeST::recend);
+ tokenContainer->DefineIntToken("{timeshift}", (int)eDREndTimeIT::timeshift);
InheritTokenContainer();
}
-void cVeDrEndTime::Set(cString end) {
+void cVeDrEndTime::Set(cString end, bool timeshiftActive) {
+ this->timeshiftActive = timeshiftActive;
if (strcmp(*this->end, *end)) {
this->end = end;
changed = true;
@@ -269,6 +324,7 @@ bool cVeDrEndTime::Parse(bool force) {
return false;
tokenContainer->Clear();
tokenContainer->AddStringToken((int)eDREndTimeST::recend, *end);
+ tokenContainer->AddIntToken((int)eDREndTimeIT::timeshift, timeshiftActive);
SetDirty();
changed = false;
return true;
@@ -280,8 +336,8 @@ bool cVeDrEndTime::Parse(bool force) {
cVeDrProgressBar::cVeDrProgressBar(void) {
current = -1;
total = -1;
- timeshiftActive = false;
timeshiftTotal = -1;
+ timeshiftActive = false;
changed = true;
}
@@ -304,6 +360,7 @@ void cVeDrProgressBar::Set(int current, int total, bool timeshiftActive, int tim
this->total = total;
this->timeshiftActive = timeshiftActive;
this->timeshiftTotal = timeshiftTotal;
+
changed = true;
}
@@ -327,6 +384,7 @@ bool cVeDrProgressBar::Parse(bool force) {
cVeDrCutMarks::cVeDrCutMarks(void) {
cutmarksIndex = -1;
lastMarks = NULL;
+ timeshiftActive = false;
Reset();
}
diff --git a/coreengine/viewelementsdisplayreplay.h b/coreengine/viewelementsdisplayreplay.h
index f6d28e5..0cc4be6 100644
--- a/coreengine/viewelementsdisplayreplay.h
+++ b/coreengine/viewelementsdisplayreplay.h
@@ -43,11 +43,12 @@ class cVeDrCurrentTime : public cViewElement {
private:
bool changed;
char *current;
+ bool timeshiftActive;
public:
cVeDrCurrentTime(void);
virtual ~cVeDrCurrentTime(void);
void SetTokenContainer(void);
- void Set(const char *current);
+ void Set(const char *current, bool timeshiftActive = false);
bool Parse(bool forced = false);
};
@@ -64,7 +65,25 @@ public:
cVeDrTotalTime(void);
virtual ~cVeDrTotalTime(void);
void SetTokenContainer(void);
- void Set(const char *total, bool timeshiftActive, const char *timeshiftDuration);
+ void Set(const char *total, const char *timeshiftDuration = NULL, bool timeshiftActive = false);
+ bool Parse(bool forced = false);
+};
+
+/******************************************************************
+* cVeDrTimeshiftTimes
+******************************************************************/
+class cVeDrTimeshiftTimes : public cViewElement {
+private:
+ cString start;
+ cString playbacktime;
+ cString timeshiftrest;
+ bool changed;
+ bool timeshiftActive;
+public:
+ cVeDrTimeshiftTimes(void);
+ virtual ~cVeDrTimeshiftTimes(void);
+ void SetTokenContainer(void);
+ void Set(cString start, cString playbacktime, cString timeshiftrest, bool timeshiftActive = false);
bool Parse(bool forced = false);
};
@@ -74,12 +93,13 @@ public:
class cVeDrEndTime : public cViewElement {
private:
cString end;
+ bool timeshiftActive;
bool changed;
public:
cVeDrEndTime(void);
virtual ~cVeDrEndTime(void);
void SetTokenContainer(void);
- void Set(cString end);
+ void Set(cString end, bool timeshiftActive = false);
bool Parse(bool forced = false);
};
@@ -97,7 +117,7 @@ public:
cVeDrProgressBar(void);
virtual ~cVeDrProgressBar(void);
void SetTokenContainer(void);
- void Set(int current, int total, bool timeshiftActive, int timeshiftTotal);
+ void Set(int current, int total, bool timeshiftActive = false, int timeshiftTotal = 0);
bool Parse(bool forced = false);
};
@@ -121,7 +141,7 @@ public:
cVeDrCutMarks(void);
virtual ~cVeDrCutMarks(void);
void SetTokenContainer(void);
- void Set(const cMarks *marks, int current, int total, bool timeshiftActive, int timeshiftTotal);
+ void Set(const cMarks *marks, int current, int total, bool timeshiftActive = false, int timeshiftTotal = 0);
void Reset(void);
bool Parse(bool forced = false);
};