mirror of
https://projects.vdr-developer.org/git/vdr-plugin-skindesigner.git
synced 2023-10-19 17:58:31 +02:00
added timeshift support in displayreplay
This commit is contained in:
parent
727f20617c
commit
53547389a4
1
HISTORY
1
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
|
||||
|
||||
|
||||
|
||||
|
@ -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);
|
||||
}
|
||||
|
@ -14,6 +14,7 @@ private:
|
||||
bool initialModeSet;
|
||||
bool doOutput;
|
||||
bool modeOnly;
|
||||
void SetTimeShiftValues(const cRecording *recording);
|
||||
public:
|
||||
cSDDisplayReplay(cTemplate *replayTemplate, bool ModeOnly);
|
||||
virtual ~cSDDisplayReplay();
|
||||
|
@ -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:
|
||||
|
@ -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)) {
|
||||
|
@ -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);
|
||||
|
Loading…
Reference in New Issue
Block a user