summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorlouis <louis.braun@gmx.de>2015-05-16 07:57:14 +0200
committerlouis <louis.braun@gmx.de>2015-05-16 07:57:14 +0200
commit53547389a4108b4120f04d3623ac16e913aa93f5 (patch)
tree34b7365aa4daffe59d54e65ee6a4f23837defefd
parent727f20617cb17ab23f2e41a192366692c6d45374 (diff)
downloadvdr-plugin-skindesigner-53547389a4108b4120f04d3623ac16e913aa93f5.tar.gz
vdr-plugin-skindesigner-53547389a4108b4120f04d3623ac16e913aa93f5.tar.bz2
added timeshift support in displayreplay
-rw-r--r--HISTORY1
-rw-r--r--displayreplay.c23
-rw-r--r--displayreplay.h1
-rw-r--r--skins/metrixhd/xmlfiles/displayreplay.xml14
-rw-r--r--views/displayreplayview.c38
-rw-r--r--views/displayreplayview.h5
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 <vdrstatistics> 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 @@
<!-- Available Variables totaltime:
{rectotal} Total Time in hh:mm:ss
+ {timeshift} true if a timeshifted recording is displayed
+ {timeshifttotal} Total Time of timeshift event in hh:mm
-->
<totaltime>
<area x="69%" y="92%" width="30%" height="7%" layer="2">
- <drawtext align="right" valign="center" font="{light}" fontsize="100%" color="{clrWhite}" text="{rectotal}" />
+ <drawtext condition="not{timeshift}" align="right" valign="center" font="{light}" fontsize="100%" color="{clrWhite}" text="{rectotal}" />
+ <drawtext condition="{timeshift}" align="right" valign="center" font="{light}" fontsize="100%" color="{clrWhite}" text="{timeshifttotal} ({rectotal})" />
</area>
</totaltime>
@@ -130,12 +133,19 @@
<!-- Available Variables progressbar:
{current} current frame of recording
{total} total frames of recording
+ {timeshift} true if a timeshifted recording is displayed
+ {timeshifttotal} total number of frames of timeshift event
-->
<progressbar>
- <area x="5%" y="89%" width="90%" height="3%" layer="2">
+ <area condition="not{timeshift}" x="5%" y="89%" width="90%" height="3%" layer="2">
<fill color="{clrDarkGray}" />
<drawrectangle x="0" y="0" width="{current}/{total}*{areawidth}" height="100%" color="{clrTransBlueLight}" />
</area>
+ <area condition="{timeshift}" x="5%" y="89%" width="90%" height="3%" layer="2">
+ <fill color="{clrDarkGray}" />
+ <drawrectangle x="0" y="0" width="{total}/{timeshifttotal}*{areawidth}" height="100%" color="{clrTransWhite}" />
+ <drawrectangle x="0" y="0" width="{current}/{timeshifttotal}*{areawidth}" height="100%" color="{clrTransBlueLight}" />
+ </area>
</progressbar>
<!-- Available Variables cutmarks:
diff --git a/views/displayreplayview.c b/views/displayreplayview.c
index 4208438..3e2fd28 100644
--- a/views/displayreplayview.c
+++ b/views/displayreplayview.c
@@ -6,6 +6,10 @@
cDisplayReplayView::cDisplayReplayView(cTemplateView *tmplView) : cView(tmplView) {
length = 0;
+ timeShiftActive = false;
+ timeShiftFramesTotal = 0;
+ timeShiftLength = 1;
+ timeShiftDuration = "";
endLast = "";
onPauseView = NULL;
numMarksLast = 0;
@@ -32,6 +36,15 @@ bool cDisplayReplayView::createOsd(void) {
return ok;
}
+void cDisplayReplayView::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 cDisplayReplayView::DrawBackground(bool modeOnly) {
map < string, string > stringTokens;
map < string, int > intTokens;
@@ -218,7 +231,9 @@ void cDisplayReplayView::DrawCurrent(const char *current) {
void cDisplayReplayView::DrawTotal(const char *total) {
map < string, string > stringTokens;
map < string, int > intTokens;
+ intTokens.insert(pair<string,int>("timeshift", timeShiftActive));
stringTokens.insert(pair<string,string>("rectotal", total));
+ stringTokens.insert(pair<string,string>("timeshifttotal", timeShiftDuration));
ClearViewElement(veRecTotal);
DrawViewElement(veRecTotal, &stringTokens, &intTokens);
@@ -227,8 +242,14 @@ void cDisplayReplayView::DrawTotal(const char *total) {
void cDisplayReplayView::DrawEndTime(int current, int total) {
if (!current)
return;
- double rest = (double)(total - current) / (double)total;
- time_t end = time(0) + rest*length;
+ int totalLength = total;
+ int recordingLength = length;
+ if (timeShiftActive && timeShiftFramesTotal > 0) {
+ totalLength = timeShiftFramesTotal;
+ recordingLength = timeShiftLength;
+ }
+ double rest = (double)(totalLength - current) / (double)totalLength;
+ time_t end = time(0) + rest*recordingLength;
string endTime = *TimeString(end);
if (!endTime.compare(endLast)) {
return;
@@ -246,9 +267,15 @@ void cDisplayReplayView::DrawEndTime(int current, int total) {
void cDisplayReplayView::DrawProgressBar(int current, int total) {
map < string, string > stringTokens;
map < string, int > intTokens;
+
intTokens.insert(pair<string,int>("current", current));
intTokens.insert(pair<string,int>("total", total));
- stringTokens.insert(pair<string,string>("dummy", ""));
+ intTokens.insert(pair<string,int>("timeshift", timeShiftActive));
+
+ if (timeShiftActive) {
+ intTokens.insert(pair<string,int>("timeshifttotal", timeShiftFramesTotal));
+ }
+
ClearViewElement(veRecProgressBar);
DrawViewElement(veRecProgressBar, &stringTokens, &intTokens);
}
@@ -264,7 +291,10 @@ void cDisplayReplayView::DrawMarks(const cMarks *marks, int current, int total)
map < string, vector< map< string, string > > > loopTokens;
vector< map< string, string > > markTokens;
stringstream tot;
- tot << total;
+ if (!timeShiftActive)
+ tot << total;
+ else
+ tot << timeShiftFramesTotal;
bool isStartMark = true;
for (const cMark *m = marks->First(); m; m = marks->Next(m)) {
diff --git a/views/displayreplayview.h b/views/displayreplayview.h
index 1cfc634..87de67d 100644
--- a/views/displayreplayview.h
+++ b/views/displayreplayview.h
@@ -8,6 +8,10 @@
class cDisplayReplayView : public cView, public cViewHelpers {
private:
int length;
+ bool timeShiftActive;
+ int timeShiftFramesTotal;
+ int timeShiftLength;
+ string timeShiftDuration;
string endLast;
cDisplayReplayOnPauseView *onPauseView;
int numMarksLast;
@@ -20,6 +24,7 @@ public:
virtual ~cDisplayReplayView();
bool createOsd(void);
void SetRecordingLength(int length) { this->length = length; };
+ void SetTimeShift(int framesTotal, int timeShiftLength);
void DrawBackground(bool modeOnly);
void DrawDate(void);
void DrawTime(void);