From 53547389a4108b4120f04d3623ac16e913aa93f5 Mon Sep 17 00:00:00 2001 From: louis Date: Sat, 16 May 2015 07:57:14 +0200 Subject: [PATCH] added timeshift support in displayreplay --- HISTORY | 1 + displayreplay.c | 23 +++++++++++++- displayreplay.h | 1 + skins/metrixhd/xmlfiles/displayreplay.xml | 14 +++++++-- views/displayreplayview.c | 38 ++++++++++++++++++++--- views/displayreplayview.h | 5 +++ 6 files changed, 75 insertions(+), 7 deletions(-) diff --git a/HISTORY b/HISTORY index a70c7e0..ddcfd87 100644 --- a/HISTORY +++ b/HISTORY @@ -331,6 +331,7 @@ Version 0.4.6 - added token {startsin} in displaymenuschedules - added viewelement in main menu - added permashift support in displaychannel +- added timeshift support in displayreplay diff --git a/displayreplay.c b/displayreplay.c index baea3b8..8cf3f1f 100644 --- a/displayreplay.c +++ b/displayreplay.c @@ -29,8 +29,10 @@ cSDDisplayReplay::~cSDDisplayReplay() { void cSDDisplayReplay::SetRecording(const cRecording *Recording) { if (!doOutput || !Recording) return; - if (initial) + if (initial) { replayView->SetRecordingLength(Recording->LengthInSeconds()); + SetTimeShiftValues(Recording); + } replayView->DrawTitle(Recording); replayView->DrawRecordingInformation(Recording); replayView->DrawScraperContent(Recording); @@ -111,3 +113,22 @@ void cSDDisplayReplay::Flush(void) { replayView->Flush(); } } + +void cSDDisplayReplay::SetTimeShiftValues(const cRecording *recording) { + int usage = recording->IsInUse(); + if (!(usage & ruTimer)) + return; + + const cRecordingInfo *recInfo = recording->Info(); + if (!recInfo) + return; + const cEvent *event = recInfo->GetEvent(); + if (!event) + return; + double fps = recording->FramesPerSecond(); + time_t liveEventStop = event->EndTime(); + time_t recordingStart = recording->Start(); + int framesTotal = (liveEventStop - recordingStart)*fps; + int recLength = liveEventStop - recordingStart; + replayView->SetTimeShift(framesTotal, recLength); +} diff --git a/displayreplay.h b/displayreplay.h index 9d83850..04840c5 100644 --- a/displayreplay.h +++ b/displayreplay.h @@ -14,6 +14,7 @@ private: bool initialModeSet; bool doOutput; bool modeOnly; + void SetTimeShiftValues(const cRecording *recording); public: cSDDisplayReplay(cTemplate *replayTemplate, bool ModeOnly); virtual ~cSDDisplayReplay(); diff --git a/skins/metrixhd/xmlfiles/displayreplay.xml b/skins/metrixhd/xmlfiles/displayreplay.xml index 6f92b74..907ea79 100644 --- a/skins/metrixhd/xmlfiles/displayreplay.xml +++ b/skins/metrixhd/xmlfiles/displayreplay.xml @@ -112,10 +112,13 @@ - + + @@ -130,12 +133,19 @@ - + + + + + +