Eliminate a look sequence report in displayreplay

This commit is contained in:
kamel5 2019-06-21 14:07:00 +02:00
parent 9278f18cb9
commit 8a04a17fc0
4 changed files with 47 additions and 36 deletions

View File

@ -157,6 +157,8 @@ void cViewReplay::ClearVariables(void) {
veEndTime->Set(cString(""));
if (veCutMarks)
veCutMarks->Reset();
timersLoaded = false;
globalTimers.ClearTimers();
}
void cViewReplay::SetTimeShift(int framesTotal, int timeShiftLength) {
@ -180,6 +182,44 @@ void cViewReplay::SetRecording(const cRecording *recording) {
}
}
void cViewReplay::GetTimers(void) {
if (!timersLoaded) {
timersLoaded = true;
globalTimers.LoadTimers();
}
}
void cViewReplay::SetTimeShiftValues(const cRecording *recording) {
//check for instant recording
const char *recName = recording->Name();
if (recName && *recName == '@')
return;
bool isTimeShift = false;
#if APIVERSNUM >= 20101
int usage = recording->IsInUse();
if (usage & ruTimer)
isTimeShift = true;
else {
if (globalTimers.IsRecording(recording))
isTimeShift = true;
}
#endif
if (!isTimeShift)
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 = time(0) - recording->LengthInSeconds();
int framesTotal = (liveEventStop - recordingStart)*fps;
int recLength = liveEventStop - recordingStart;
SetTimeShift(framesTotal, recLength);
}
void cViewReplay::SetTitle(const char *title) {
if (veRecTitle) {
veRecTitle->Set(title);

View File

@ -30,6 +30,8 @@ private:
int timeShiftFramesTotal;
int timeShiftLength;
cString timeShiftDuration;
bool timersLoaded;
cGlobalTimers globalTimers;
void SetViewElements(void);
void ClearVariables(void);
void SetViewElementObjects(void);
@ -43,6 +45,8 @@ public:
void SetTimeShift(int framesTotal, int timeShiftLength);
void SetRecording(const cRecording *recording);
void SetTitle(const char *title);
void GetTimers(void);
void SetTimeShiftValues(const cRecording *recording);
void SetCurrent(const char *current);
void SetTotal(const char *total);
void SetEndTime(int current, int total);
@ -57,4 +61,4 @@ public:
void Flush(void);
};
#endif //__VIEWDISPLAYREPLAY_H1
#endif //__VIEWDISPLAYREPLAY_H1

View File

@ -18,7 +18,7 @@ void cSDDisplayReplay::SetRecording(const cRecording *Recording) {
view->SetRecording(Recording);
if (init) {
view->SetRecordingLength(Recording->LengthInSeconds());
SetTimeShiftValues(Recording);
view->SetTimeShiftValues(Recording);
init = false;
}
}
@ -78,38 +78,6 @@ void cSDDisplayReplay::SetMessage(eMessageType Type, const char *Text) {
void cSDDisplayReplay::Flush(void) {
if (!ok)
return;
view->GetTimers();
view->Flush();
}
void cSDDisplayReplay::SetTimeShiftValues(const cRecording *recording) {
//check for instant recording
const char *recName = recording->Name();
if (recName && *recName == '@')
return;
bool isTimeShift = false;
#if APIVERSNUM >= 20101
int usage = recording->IsInUse();
if (usage & ruTimer)
isTimeShift = true;
else {
cGlobalTimers globalTimers;
globalTimers.LoadTimers();
if (globalTimers.IsRecording(recording))
isTimeShift = true;
}
#endif
if (!isTimeShift)
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 = time(0) - recording->LengthInSeconds();
int framesTotal = (liveEventStop - recordingStart)*fps;
int recLength = liveEventStop - recordingStart;
view->SetTimeShift(framesTotal, recLength);
}

View File

@ -10,7 +10,6 @@ private:
bool ok;
bool init;
cViewReplay *view;
void SetTimeShiftValues(const cRecording *recording);
public:
cSDDisplayReplay(cViewReplay *replayView, bool ModeOnly);
virtual ~cSDDisplayReplay();