2014-09-27 09:25:14 +02:00
|
|
|
#define __STL_CONFIG_H
|
2015-03-19 16:31:39 +01:00
|
|
|
#include <vdr/player.h>
|
2014-09-27 09:25:14 +02:00
|
|
|
#include "displayreplay.h"
|
|
|
|
|
|
|
|
cSDDisplayReplay::cSDDisplayReplay(cTemplate *replayTemplate, bool ModeOnly) {
|
|
|
|
doOutput = true;
|
|
|
|
initial = true;
|
2015-05-10 12:55:23 +02:00
|
|
|
initialModeSet = false;
|
2014-09-27 09:25:14 +02:00
|
|
|
modeOnly = ModeOnly;
|
2015-01-18 12:03:06 +01:00
|
|
|
replayView = NULL;
|
2014-09-27 09:25:14 +02:00
|
|
|
if (!replayTemplate) {
|
|
|
|
doOutput = false;
|
|
|
|
esyslog("skindesigner: displayReplay no valid template - aborting");
|
|
|
|
return;
|
|
|
|
}
|
|
|
|
replayView = new cDisplayReplayView(replayTemplate->GetRootView());
|
|
|
|
if (!replayView->createOsd()) {
|
|
|
|
doOutput = false;
|
|
|
|
return;
|
|
|
|
}
|
2015-04-11 16:21:33 +02:00
|
|
|
replayView->DrawDebugGrid();
|
2014-09-27 09:25:14 +02:00
|
|
|
}
|
|
|
|
|
|
|
|
cSDDisplayReplay::~cSDDisplayReplay() {
|
2015-01-18 12:03:06 +01:00
|
|
|
if (replayView)
|
|
|
|
delete replayView;
|
2014-09-27 09:25:14 +02:00
|
|
|
}
|
|
|
|
|
|
|
|
void cSDDisplayReplay::SetRecording(const cRecording *Recording) {
|
2015-02-01 14:45:33 +01:00
|
|
|
if (!doOutput || !Recording)
|
2014-09-27 09:25:14 +02:00
|
|
|
return;
|
2015-05-16 07:57:14 +02:00
|
|
|
if (initial) {
|
2015-03-31 11:53:25 +02:00
|
|
|
replayView->SetRecordingLength(Recording->LengthInSeconds());
|
2015-05-16 07:57:14 +02:00
|
|
|
SetTimeShiftValues(Recording);
|
|
|
|
}
|
2014-09-27 09:25:14 +02:00
|
|
|
replayView->DrawTitle(Recording);
|
|
|
|
replayView->DrawRecordingInformation(Recording);
|
|
|
|
replayView->DrawScraperContent(Recording);
|
|
|
|
}
|
|
|
|
|
2015-02-01 14:45:33 +01:00
|
|
|
void cSDDisplayReplay::SetTitle(const char *Title) {
|
|
|
|
if (!doOutput || !Title)
|
|
|
|
return;
|
|
|
|
replayView->DrawTitle(Title);
|
|
|
|
}
|
|
|
|
|
2014-09-27 09:25:14 +02:00
|
|
|
void cSDDisplayReplay::SetMode(bool Play, bool Forward, int Speed) {
|
|
|
|
if (!doOutput)
|
|
|
|
return;
|
2014-11-29 11:23:54 +01:00
|
|
|
if (!Play && Speed < 0) {
|
2015-03-19 16:31:39 +01:00
|
|
|
string recFileName = "";
|
|
|
|
cControl *control = cControl::Control();
|
|
|
|
if (control) {
|
|
|
|
const cRecording *recording = control->GetRecording();
|
|
|
|
if (recording && recording->FileName())
|
|
|
|
recFileName = recording->FileName();
|
|
|
|
}
|
|
|
|
replayView->DrawOnPause(recFileName, modeOnly);
|
2014-11-29 11:23:54 +01:00
|
|
|
} else {
|
|
|
|
replayView->ClearOnPause();
|
|
|
|
}
|
2015-07-25 14:19:32 +02:00
|
|
|
|
2014-09-27 09:25:14 +02:00
|
|
|
replayView->DrawControlIcons(Play, Forward, Speed, modeOnly);
|
2015-05-10 12:55:23 +02:00
|
|
|
initialModeSet = true;
|
2014-09-27 09:25:14 +02:00
|
|
|
}
|
|
|
|
|
|
|
|
void cSDDisplayReplay::SetProgress(int Current, int Total) {
|
|
|
|
if (!doOutput)
|
|
|
|
return;
|
2015-01-22 18:08:12 +01:00
|
|
|
replayView->DelayOnPause();
|
2014-09-27 09:25:14 +02:00
|
|
|
replayView->DrawProgressBar(Current, Total);
|
2014-10-28 18:09:10 +01:00
|
|
|
replayView->DrawMarks(marks, Current, Total);
|
2015-03-31 11:53:25 +02:00
|
|
|
replayView->DrawEndTime(Current, Total);
|
2014-09-27 09:25:14 +02:00
|
|
|
}
|
|
|
|
|
|
|
|
void cSDDisplayReplay::SetCurrent(const char *Current) {
|
|
|
|
if (!doOutput)
|
|
|
|
return;
|
|
|
|
replayView->DrawCurrent(Current);
|
|
|
|
}
|
|
|
|
|
|
|
|
void cSDDisplayReplay::SetTotal(const char *Total) {
|
|
|
|
if (!doOutput)
|
|
|
|
return;
|
|
|
|
replayView->DrawTotal(Total);
|
|
|
|
}
|
|
|
|
|
|
|
|
void cSDDisplayReplay::SetJump(const char *Jump) {
|
|
|
|
if (!doOutput)
|
|
|
|
return;
|
|
|
|
replayView->DrawJump(Jump);
|
|
|
|
}
|
|
|
|
|
|
|
|
void cSDDisplayReplay::SetMessage(eMessageType Type, const char *Text) {
|
|
|
|
if (!doOutput)
|
|
|
|
return;
|
|
|
|
replayView->DrawMessage(Type, Text);
|
|
|
|
}
|
|
|
|
|
|
|
|
void cSDDisplayReplay::Flush(void) {
|
|
|
|
if (!doOutput)
|
|
|
|
return;
|
2015-01-06 06:07:48 +01:00
|
|
|
if (!modeOnly) {
|
|
|
|
replayView->DrawDate();
|
|
|
|
replayView->DrawTime();
|
|
|
|
}
|
2015-07-25 14:19:32 +02:00
|
|
|
if (modeOnly) {
|
|
|
|
cControl *control = cControl::Control();
|
|
|
|
if (control) {
|
|
|
|
double fps = control->FramesPerSecond();
|
|
|
|
int current = 0;
|
|
|
|
int total = 0;
|
|
|
|
if (control->GetIndex(current, total))
|
|
|
|
replayView->DrawProgressModeOnly(fps, current, total);
|
|
|
|
}
|
|
|
|
}
|
2015-05-10 12:55:23 +02:00
|
|
|
if (initial && initialModeSet) {
|
2015-01-22 18:08:12 +01:00
|
|
|
replayView->DrawBackground(modeOnly);
|
2015-01-06 06:23:36 +01:00
|
|
|
replayView->DrawCustomTokens();
|
2014-09-27 09:25:14 +02:00
|
|
|
replayView->DoFadeIn();
|
|
|
|
initial = false;
|
|
|
|
} else {
|
2015-06-05 14:48:45 +02:00
|
|
|
if (replayView->CustomTokenChange())
|
|
|
|
replayView->DrawCustomTokens();
|
2014-09-27 09:25:14 +02:00
|
|
|
replayView->Flush();
|
|
|
|
}
|
|
|
|
}
|
2015-05-16 07:57:14 +02:00
|
|
|
|
|
|
|
void cSDDisplayReplay::SetTimeShiftValues(const cRecording *recording) {
|
2015-05-16 11:02:09 +02:00
|
|
|
bool isTimeShift = false;
|
|
|
|
#if APIVERSNUM >= 20101
|
2015-05-16 07:57:14 +02:00
|
|
|
int usage = recording->IsInUse();
|
2015-05-16 11:02:09 +02:00
|
|
|
if (usage & ruTimer)
|
|
|
|
isTimeShift = true;
|
|
|
|
#endif
|
|
|
|
if (!isTimeShift)
|
2015-05-16 07:57:14 +02:00
|
|
|
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();
|
2015-05-22 14:30:16 +02:00
|
|
|
time_t recordingStart = time(0) - recording->LengthInSeconds();
|
2015-05-16 07:57:14 +02:00
|
|
|
int framesTotal = (liveEventStop - recordingStart)*fps;
|
|
|
|
int recLength = liveEventStop - recordingStart;
|
|
|
|
replayView->SetTimeShift(framesTotal, recLength);
|
|
|
|
}
|