1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
|
#define __STL_CONFIG_H
#include <vdr/player.h>
#include "displayreplay.h"
cSDDisplayReplay::cSDDisplayReplay(cTemplate *replayTemplate, bool ModeOnly) {
doOutput = true;
initial = true;
initialModeSet = false;
modeOnly = ModeOnly;
replayView = NULL;
if (!replayTemplate) {
doOutput = false;
esyslog("skindesigner: displayReplay no valid template - aborting");
return;
}
replayView = new cDisplayReplayView(replayTemplate->GetRootView());
if (!replayView->createOsd()) {
doOutput = false;
return;
}
replayView->DrawDebugGrid();
}
cSDDisplayReplay::~cSDDisplayReplay() {
if (replayView)
delete replayView;
}
void cSDDisplayReplay::SetRecording(const cRecording *Recording) {
if (!doOutput || !Recording)
return;
if (initial) {
replayView->SetRecordingLength(Recording->LengthInSeconds());
SetTimeShiftValues(Recording);
}
replayView->DrawTitle(Recording);
replayView->DrawRecordingInformation(Recording);
replayView->DrawScraperContent(Recording);
}
void cSDDisplayReplay::SetTitle(const char *Title) {
if (!doOutput || !Title)
return;
replayView->DrawTitle(Title);
}
void cSDDisplayReplay::SetMode(bool Play, bool Forward, int Speed) {
if (!doOutput)
return;
if (!Play && Speed < 0) {
string recFileName = "";
cControl *control = cControl::Control();
if (control) {
const cRecording *recording = control->GetRecording();
if (recording && recording->FileName())
recFileName = recording->FileName();
}
replayView->DrawOnPause(recFileName, modeOnly);
} else {
replayView->ClearOnPause();
}
replayView->DrawControlIcons(Play, Forward, Speed, modeOnly);
initialModeSet = true;
}
void cSDDisplayReplay::SetProgress(int Current, int Total) {
if (!doOutput)
return;
replayView->DelayOnPause();
replayView->DrawProgressBar(Current, Total);
replayView->DrawMarks(marks, Current, Total);
replayView->DrawEndTime(Current, Total);
}
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;
if (!modeOnly) {
replayView->DrawDate();
replayView->DrawTime();
}
if (initial && initialModeSet) {
replayView->DrawBackground(modeOnly);
replayView->DrawCustomTokens();
replayView->DoFadeIn();
initial = false;
} else {
replayView->Flush();
}
}
void cSDDisplayReplay::SetTimeShiftValues(const cRecording *recording) {
bool isTimeShift = false;
#if APIVERSNUM >= 20101
int usage = recording->IsInUse();
if (usage & ruTimer)
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;
replayView->SetTimeShift(framesTotal, recLength);
}
|