diff options
| author | Peter Bieringer <pb@bieringer.de> | 2021-03-01 07:25:50 +0100 |
|---|---|---|
| committer | Peter Bieringer <pb@bieringer.de> | 2021-03-01 07:25:50 +0100 |
| commit | 105fe893a205e15e6bb167bb225bb2aef6f7028a (patch) | |
| tree | 2b060d0c6b75b585055676413a8aff621b9fb3d0 /coreengine | |
| parent | 764f6576206b0a1cca25a774553d1412b0906a0f (diff) | |
| parent | 402044d4c4cbf626ddc57cef48bf0d0ddc88790a (diff) | |
| download | vdr-plugin-skindesigner-105fe893a205e15e6bb167bb225bb2aef6f7028a.tar.gz vdr-plugin-skindesigner-105fe893a205e15e6bb167bb225bb2aef6f7028a.tar.bz2 | |
Merge remote-tracking branch 'upstream/master'
Diffstat (limited to 'coreengine')
| -rw-r--r-- | coreengine/definitions.h | 32 | ||||
| -rw-r--r-- | coreengine/listelements.c | 4 | ||||
| -rw-r--r-- | coreengine/viewdisplayreplay.c | 126 | ||||
| -rw-r--r-- | coreengine/viewdisplayreplay.h | 11 | ||||
| -rw-r--r-- | coreengine/viewelement.c | 2 | ||||
| -rw-r--r-- | coreengine/viewelementsdisplaychannel.c | 10 | ||||
| -rw-r--r-- | coreengine/viewelementsdisplaychannel.h | 3 | ||||
| -rw-r--r-- | coreengine/viewelementsdisplayreplay.c | 105 | ||||
| -rw-r--r-- | coreengine/viewelementsdisplayreplay.h | 38 |
9 files changed, 265 insertions, 66 deletions
diff --git a/coreengine/definitions.h b/coreengine/definitions.h index 6206843..678c54f 100644 --- a/coreengine/definitions.h +++ b/coreengine/definitions.h @@ -129,6 +129,7 @@ enum class eVeDisplayReplay { recinfo, currenttime, totaltime, + timeshifttimes, endtime, progressbar, cutmarks, @@ -433,6 +434,7 @@ enum class eDCProgressBarIT { remaining, permashift, livebuffer, + currentremaining, count }; @@ -813,6 +815,7 @@ enum class eLeMenuDefaultIT { remoteosd, filebrowser, epgsearch, + devstatus, count }; @@ -1489,6 +1492,13 @@ enum class eDRRecTitleST { recsubtitle, recdate, rectime, + eventstart, + eventstop, + count +}; + +enum class eDRRecTitleIT { + timeshift = 0, count }; @@ -1513,6 +1523,11 @@ enum class eDRCurrentTimeST { count }; +enum class eDRCurrentTimeIT { + timeshift = 0, + count +}; + enum class eDRTotalTimeST { rectotal = 0, timeshifttotal, @@ -1524,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/listelements.c b/coreengine/listelements.c index 96daba3..02b32d5 100644 --- a/coreengine/listelements.c +++ b/coreengine/listelements.c @@ -304,6 +304,7 @@ void cLeMenuDefault::SetTokenContainer(void) { tokenContainer->DefineIntToken("{remoteosd}", (int)eLeMenuDefaultIT::remoteosd); tokenContainer->DefineIntToken("{filebrowser}", (int)eLeMenuDefaultIT::filebrowser); tokenContainer->DefineIntToken("{epgsearch}", (int)eLeMenuDefaultIT::epgsearch); + tokenContainer->DefineIntToken("{devstatus}", (int)eLeMenuDefaultIT::devstatus); InheritTokenContainer(); } @@ -430,6 +431,8 @@ void cLeMenuDefault::SetMenuCategory(void) { tokenContainer->AddIntToken((int)eLeMenuDefaultIT::filebrowser, 1); } else if (!strcmp(plugName, "epgsearch")) { tokenContainer->AddIntToken((int)eLeMenuDefaultIT::epgsearch, 1); + } else if (!strcmp(plugName, "devstatus")) { + tokenContainer->AddIntToken((int)eLeMenuDefaultIT::devstatus, 1); } } @@ -968,6 +971,7 @@ bool cCeMenuSchedules::Parse(bool forced) { } tokenContainer->AddIntToken((int)eCeMenuSchedulesIT::duration, event->Duration() / 60); tokenContainer->AddIntToken((int)eCeMenuSchedulesIT::durationhours, event->Duration() / 3600); + tokenContainer->AddIntToken((int)eCeMenuSchedulesIT::durationminutes, (event->Duration() / 60) % 60); if (timerMatch == tmFull || timerMatch == tmPartial) { cTimer_Detail_V1 data; diff --git a/coreengine/viewdisplayreplay.c b/coreengine/viewdisplayreplay.c index 9a65db2..30986bb 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]); @@ -142,17 +148,21 @@ void cViewReplay::PreCache(void) { void cViewReplay::ClearVariables(void) { cView::ClearVariables(); + recording = NULL; + lastEvent = NULL; modeOnly = false; lastFlush = 0; lastFlushModeOnly = 0; message = false; - reclength = -1; timeShiftActive = false; timeShiftFramesTotal = -1; timeShiftLength = -1; timeShiftDuration = ""; + timeshiftrest = ""; if (veCustomTokens) veCustomTokens->Reset(); + if (veTimeshiftTimes) + veTimeshiftTimes->Set(cString(""), cString(""), cString("")); if (veEndTime) veEndTime->Set(cString("")); if (veCutMarks) @@ -161,65 +171,82 @@ 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) { - if (veRecTitle) { - veRecTitle->Set(recording); - } - if (veRecInfo) { - veRecInfo->Set(recording); - } - if (veScraperContent) { - veScraperContent->Set(recording); - } -} - -void cViewReplay::GetTimers(void) { +void cViewReplay::GetGlobalTimers(void) { if (!timersLoaded) { timersLoaded = true; globalTimers.LoadTimers(); } } -void cViewReplay::SetTimeShiftValues(const cRecording *recording) { - //check for instant recording +void cViewReplay::SetTimeShiftValues(int current, int total) { if (!recording) return; const char *recName = recording->Name(); - if (recName && *recName == '@') + if (recName && *recName != '@') 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(); - if (!event) + const cSchedule *Schedule = NULL; + { + LOCK_SCHEDULES_READ; + Schedule = Schedules->GetSchedule(recInfo->ChannelID()); + } + if (!Schedule) return; - double fps = recording->FramesPerSecond(); - time_t liveEventStop = event->EndTime(); + // Get event at actual recording position + const cEvent *eventEnde = Schedule->GetEventAround(time(0)); + if (!eventEnde) + return; + // End of live program + time_t liveEventStop = eventEnde->EndTime(); + // Begin of timeshift recording time_t recordingStart = time(0) - recording->LengthInSeconds(); - int framesTotal = (liveEventStop - recordingStart)*fps; - int recLength = liveEventStop - recordingStart; - SetTimeShift(framesTotal, recLength); + // actual timeshiftlength in sec + timeShiftLength = liveEventStop - recordingStart; + // 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); + veRecTitle->Parse(); + lastEvent = eventReplay; + } + 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) { + this->recording = recording; + if (veRecTitle) { + veRecTitle->Set(recording); + } + if (veRecInfo) { + veRecInfo->Set(recording); + } + if (veScraperContent) { + veScraperContent->Set(recording); + } } void cViewReplay::SetTitle(const char *title) { @@ -236,32 +263,47 @@ 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 || !recording) + 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) + if (!veEndTime || !recording) return; int totalLength = total; - int recordingLength = reclength; + int recordingLength = recording->LengthInSeconds(); if (timeShiftActive && timeShiftFramesTotal > 0) { totalLength = timeShiftFramesTotal; recordingLength = timeShiftLength; } 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); if (veProgressbar) veProgressbar->Set(current, total, timeShiftActive, timeShiftFramesTotal); Render((int)eVeDisplayReplay::progressbar); diff --git a/coreengine/viewdisplayreplay.h b/coreengine/viewdisplayreplay.h index 9098275..8e61f3b 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; @@ -21,6 +22,8 @@ private: cVeDrJump *veJump; cVeDrOnPause *veOnPause; cVeDrOnPause *veOnPauseModeOnly; + const cRecording *recording; + const cEvent *lastEvent; bool modeOnly; time_t lastFlush; time_t lastFlushModeOnly; @@ -29,9 +32,11 @@ private: bool timeShiftActive; int timeShiftFramesTotal; int timeShiftLength; + cString timeshiftrest; cString timeShiftDuration; bool timersLoaded; cGlobalTimers globalTimers; + void GetGlobalTimers(void); void SetViewElements(void); void ClearVariables(void); void SetViewElementObjects(void); @@ -41,14 +46,12 @@ public: virtual ~cViewReplay(void); 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 SetTimeShiftValues(int current, int total); void SetTitle(const char *title); - void GetTimers(void); - void SetTimeShiftValues(const cRecording *recording); 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/viewelementsdisplaychannel.c b/coreengine/viewelementsdisplaychannel.c index 4b71970..9a307a7 100644 --- a/coreengine/viewelementsdisplaychannel.c +++ b/coreengine/viewelementsdisplaychannel.c @@ -216,16 +216,19 @@ void cVeDcProgressBar::SetTokenContainer(void) { tokenContainer->DefineIntToken("{remaining}", (int)eDCProgressBarIT::remaining); tokenContainer->DefineIntToken("{permashift}", (int)eDCProgressBarIT::permashift); tokenContainer->DefineIntToken("{livebuffer}", (int)eDCProgressBarIT::livebuffer); + tokenContainer->DefineIntToken("{currentremaining}", (int)eDCProgressBarIT::currentremaining); InheritTokenContainer(); } void cVeDcProgressBar::Set(const cEvent *p) { if (!p) { startTime = -1; + endTime = -1; duration = -1; return; } startTime = p->StartTime(); + endTime = p-> EndTime(); duration = p->Duration(); int current = 0; @@ -249,18 +252,24 @@ void cVeDcProgressBar::Set(const cEvent *p) { } else { tokenContainer->AddIntToken((int)eDCProgressBarIT::permashift, 0); } + tokenContainer->AddIntToken((int)eDCProgressBarIT::currentremaining, (int)round((endTime - t) / 60)); } bool cVeDcProgressBar::Parse(bool force) { if (!cViewElement::Parse(force)) return false; + int current = 0; time_t t = time(NULL); if (t > startTime) current = t - startTime; + if (!(current > currentLast + 3) && !force && !Dirty()) return false; + + currentLast = current; SetDirty(); + if (duration <= 0) { tokenContainer->AddIntToken((int)eDCProgressBarIT::duration, 0); tokenContainer->AddIntToken((int)eDCProgressBarIT::elapsed, 0); @@ -276,6 +285,7 @@ bool cVeDcProgressBar::Parse(bool force) { } else { tokenContainer->AddIntToken((int)eDCProgressBarIT::permashift, 0); } + tokenContainer->AddIntToken((int)eDCProgressBarIT::currentremaining, (int)round((endTime - t) / 60)); } return true; } diff --git a/coreengine/viewelementsdisplaychannel.h b/coreengine/viewelementsdisplaychannel.h index b1a7691..fbae6d2 100644 --- a/coreengine/viewelementsdisplaychannel.h +++ b/coreengine/viewelementsdisplaychannel.h @@ -51,6 +51,7 @@ class cVeDcProgressBar : public cViewElement { private: int currentLast; int startTime; + int endTime; int duration; int GetLiveBuffer(void); public: @@ -199,4 +200,4 @@ public: cVeDcGroupChannelListDetail(void) {}; virtual ~cVeDcGroupChannelListDetail(void) {}; }; -#endif //__VIEWELEMENTSDC_H
\ No newline at end of file +#endif //__VIEWELEMENTSDC_H diff --git a/coreengine/viewelementsdisplayreplay.c b/coreengine/viewelementsdisplayreplay.c index 6cd4b25..4116153 100644 --- a/coreengine/viewelementsdisplayreplay.c +++ b/coreengine/viewelementsdisplayreplay.c @@ -8,7 +8,9 @@ ******************************************************************/ cVeDrRecTitle::cVeDrRecTitle(void) { recording = NULL; + event = NULL; title = NULL; + timeshiftActive = false; } cVeDrRecTitle::~cVeDrRecTitle(void) { @@ -21,19 +23,27 @@ void cVeDrRecTitle::SetTokenContainer(void) { tokenContainer->DefineStringToken("{recsubtitle}", (int)eDRRecTitleST::recsubtitle); tokenContainer->DefineStringToken("{recdate}", (int)eDRRecTitleST::recdate); tokenContainer->DefineStringToken("{rectime}", (int)eDRRecTitleST::rectime); + tokenContainer->DefineStringToken("{eventstart}", (int)eDRRecTitleST::eventstart); + tokenContainer->DefineStringToken("{eventstop}", (int)eDRRecTitleST::eventstop); + tokenContainer->DefineIntToken("{timeshift}", (int)eDRRecTitleIT::timeshift); InheritTokenContainer(); } -void cVeDrRecTitle::Set(const cRecording *recording) { +void cVeDrRecTitle::Set(const cRecording *recording, const cEvent *event, bool timeshiftActive) { + this->timeshiftActive = timeshiftActive; 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 +53,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,15 +70,29 @@ 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())); + tokenContainer->AddIntToken((int)eDRRecTitleIT::timeshift, timeshiftActive); + if (event) { + tokenContainer->AddStringToken((int)eDRRecTitleST::eventstart, *TimeString(event->StartTime())); + tokenContainer->AddStringToken((int)eDRRecTitleST::eventstop, *TimeString(event->EndTime())); + } } else if (title) { tokenContainer->AddStringToken((int)eDRRecTitleST::rectitle, title); } @@ -138,6 +164,7 @@ bool cVeDrRecInfo::Parse(bool force) { cVeDrCurrentTime::cVeDrCurrentTime(void) { changed = true; current = NULL; + timeshiftActive = false; } cVeDrCurrentTime::~cVeDrCurrentTime(void) { @@ -147,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; } @@ -163,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; @@ -174,8 +204,8 @@ bool cVeDrCurrentTime::Parse(bool force) { cVeDrTotalTime::cVeDrTotalTime(void) { changed = true; total = NULL; - timeshiftActive = false; timeshiftDuration = NULL; + timeshiftActive = false; } cVeDrTotalTime::~cVeDrTotalTime(void) { @@ -191,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); @@ -217,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) { @@ -229,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; @@ -244,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; @@ -255,8 +336,8 @@ bool cVeDrEndTime::Parse(bool force) { cVeDrProgressBar::cVeDrProgressBar(void) { current = -1; total = -1; - timeshiftActive = false; timeshiftTotal = -1; + timeshiftActive = false; changed = true; } @@ -273,12 +354,13 @@ 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; this->timeshiftActive = timeshiftActive; this->timeshiftTotal = timeshiftTotal; + changed = true; } @@ -302,6 +384,7 @@ bool cVeDrProgressBar::Parse(bool force) { cVeDrCutMarks::cVeDrCutMarks(void) { cutmarksIndex = -1; lastMarks = NULL; + timeshiftActive = false; Reset(); } @@ -595,7 +678,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/coreengine/viewelementsdisplayreplay.h b/coreengine/viewelementsdisplayreplay.h index 7e5d156..0cc4be6 100644 --- a/coreengine/viewelementsdisplayreplay.h +++ b/coreengine/viewelementsdisplayreplay.h @@ -10,13 +10,15 @@ class cVeDrRecTitle : public cViewElement { private: const cRecording *recording; + const cEvent *event; char *title; + bool timeshiftActive; 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, bool timeshiftActive = false); + void Set(const char *title = NULL); bool Parse(bool forced = false); }; @@ -41,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); }; @@ -62,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); }; @@ -72,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); }; @@ -95,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); }; @@ -119,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); }; @@ -207,4 +229,4 @@ public: bool Parse(bool forced = false); }; -#endif //__VIEWELEMENTSDR_H
\ No newline at end of file +#endif //__VIEWELEMENTSDR_H |
