2014-09-27 09:25:14 +02:00
|
|
|
#include "displayreplay.h"
|
|
|
|
|
2016-01-26 18:32:38 +01:00
|
|
|
cSDDisplayReplay::cSDDisplayReplay(cViewReplay *replayView, bool ModeOnly) {
|
|
|
|
init = true;
|
|
|
|
view = replayView;
|
|
|
|
ok = view->Init();
|
|
|
|
if (!ok)
|
|
|
|
esyslog("skindesigner: Error initiating displayreplay view - aborting");
|
|
|
|
view->SetModeOnly(ModeOnly);
|
2014-09-27 09:25:14 +02:00
|
|
|
}
|
|
|
|
|
|
|
|
cSDDisplayReplay::~cSDDisplayReplay() {
|
2016-01-26 18:32:38 +01:00
|
|
|
view->Close();
|
2014-09-27 09:25:14 +02:00
|
|
|
}
|
|
|
|
|
|
|
|
void cSDDisplayReplay::SetRecording(const cRecording *Recording) {
|
2016-01-26 18:32:38 +01:00
|
|
|
if (ok) {
|
|
|
|
view->SetRecording(Recording);
|
|
|
|
if (init) {
|
|
|
|
view->SetRecordingLength(Recording->LengthInSeconds());
|
|
|
|
SetTimeShiftValues(Recording);
|
|
|
|
init = false;
|
|
|
|
}
|
2015-05-16 07:57:14 +02:00
|
|
|
}
|
2014-09-27 09:25:14 +02:00
|
|
|
}
|
|
|
|
|
2015-02-01 14:45:33 +01:00
|
|
|
void cSDDisplayReplay::SetTitle(const char *Title) {
|
2016-01-26 18:32:38 +01:00
|
|
|
view->SetTitle(Title);
|
2015-02-01 14:45:33 +01:00
|
|
|
}
|
|
|
|
|
2014-09-27 09:25:14 +02:00
|
|
|
void cSDDisplayReplay::SetMode(bool Play, bool Forward, int Speed) {
|
2016-01-26 18:32:38 +01:00
|
|
|
if (!ok)
|
2014-09-27 09:25:14 +02:00
|
|
|
return;
|
2014-11-29 11:23:54 +01:00
|
|
|
if (!Play && Speed < 0) {
|
2015-03-19 16:31:39 +01:00
|
|
|
cControl *control = cControl::Control();
|
|
|
|
if (control) {
|
|
|
|
const cRecording *recording = control->GetRecording();
|
2016-01-26 18:32:38 +01:00
|
|
|
if (recording && recording->FileName()) {
|
|
|
|
view->StartOnPause(recording->FileName());
|
|
|
|
}
|
2015-03-19 16:31:39 +01:00
|
|
|
}
|
2014-11-29 11:23:54 +01:00
|
|
|
} else {
|
2016-01-26 18:32:38 +01:00
|
|
|
view->ClearOnPause();
|
2014-11-29 11:23:54 +01:00
|
|
|
}
|
2015-07-25 14:19:32 +02:00
|
|
|
|
2016-01-26 18:32:38 +01:00
|
|
|
view->SetControlIcons(Play, Forward, Speed);
|
2014-09-27 09:25:14 +02:00
|
|
|
}
|
|
|
|
|
|
|
|
void cSDDisplayReplay::SetProgress(int Current, int Total) {
|
2016-01-26 18:32:38 +01:00
|
|
|
if (ok) {
|
|
|
|
view->SetProgressbar(Current, Total);
|
|
|
|
view->SetMarks(marks, Current, Total);
|
|
|
|
view->SetEndTime(Current, Total);
|
2016-03-22 16:55:46 +01:00
|
|
|
view->DelayOnPause();
|
2016-01-26 18:32:38 +01:00
|
|
|
}
|
2014-09-27 09:25:14 +02:00
|
|
|
}
|
|
|
|
|
|
|
|
void cSDDisplayReplay::SetCurrent(const char *Current) {
|
2016-01-26 18:32:38 +01:00
|
|
|
if (ok)
|
|
|
|
view->SetCurrent(Current);
|
2014-09-27 09:25:14 +02:00
|
|
|
}
|
|
|
|
|
|
|
|
void cSDDisplayReplay::SetTotal(const char *Total) {
|
2016-01-26 18:32:38 +01:00
|
|
|
if (ok)
|
|
|
|
view->SetTotal(Total);
|
2014-09-27 09:25:14 +02:00
|
|
|
}
|
|
|
|
|
|
|
|
void cSDDisplayReplay::SetJump(const char *Jump) {
|
2016-01-26 18:32:38 +01:00
|
|
|
if (ok)
|
|
|
|
view->SetJump(Jump);
|
2014-09-27 09:25:14 +02:00
|
|
|
}
|
|
|
|
|
|
|
|
void cSDDisplayReplay::SetMessage(eMessageType Type, const char *Text) {
|
2016-01-26 18:32:38 +01:00
|
|
|
if (ok)
|
|
|
|
view->SetMessage(Type, Text);
|
2014-09-27 09:25:14 +02:00
|
|
|
}
|
|
|
|
|
|
|
|
void cSDDisplayReplay::Flush(void) {
|
2016-01-26 18:32:38 +01:00
|
|
|
if (!ok)
|
2014-09-27 09:25:14 +02:00
|
|
|
return;
|
2016-07-22 15:21:09 +02:00
|
|
|
view->Flush();
|
2014-09-27 09:25:14 +02:00
|
|
|
}
|
2015-05-16 07:57:14 +02:00
|
|
|
|
|
|
|
void cSDDisplayReplay::SetTimeShiftValues(const cRecording *recording) {
|
2016-02-13 14:58:31 +01:00
|
|
|
//check for instant recording
|
|
|
|
const char *recName = recording->Name();
|
|
|
|
if (recName && *recName == '@')
|
|
|
|
return;
|
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;
|
2016-06-12 11:02:28 +02:00
|
|
|
else {
|
|
|
|
cGlobalTimers globalTimers;
|
|
|
|
globalTimers.LoadTimers();
|
|
|
|
if (globalTimers.IsRecording(recording))
|
|
|
|
isTimeShift = true;
|
|
|
|
}
|
2015-05-16 11:02:09 +02:00
|
|
|
#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;
|
2016-01-26 18:32:38 +01:00
|
|
|
view->SetTimeShift(framesTotal, recLength);
|
2015-05-16 07:57:14 +02:00
|
|
|
}
|