timeshift support

This commit is contained in:
louis 2015-05-16 11:02:09 +02:00
parent 53547389a4
commit 5aa23d261e
4 changed files with 41 additions and 8 deletions

View File

@ -115,10 +115,14 @@ void cSDDisplayReplay::Flush(void) {
}
void cSDDisplayReplay::SetTimeShiftValues(const cRecording *recording) {
bool isTimeShift = false;
#if APIVERSNUM >= 20101
int usage = recording->IsInUse();
if (!(usage & ruTimer))
if (usage & ruTimer)
isTimeShift = true;
#endif
if (!isTimeShift)
return;
const cRecordingInfo *recInfo = recording->Info();
if (!recInfo)
return;

View File

@ -149,15 +149,17 @@
</progressbar>
<!-- Available Variables cutmarks:
{timeshift} true if a timeshifted recording is displayed
{marks[]} array of available marks
{marks[position]} frame of current mark
{marks[endposition]} frame where startmark ends
{marks[total]} total number of frames
{marks[timeshifttotal]} total number of frames of timeshift event
{marks[active]} true if current replay position hits exactly the mark
{marks[startmark]} true if mark is start mark
-->
<cutmarks>
<area x="5%" y="89%" width="90%" height="3%" layer="3">
<area condition="not{timeshift}" x="5%" y="89%" width="90%" height="3%" layer="3">
<loop name="marks" x="0" y="0" orientation="absolute">
<!-- draw mark -->
<drawrectangle condition="not{marks[active]}" x="{marks[position]}/{marks[total]}*{areawidth}" y="0" width="1" height="100%" color="{clrWhite}" />
@ -175,6 +177,24 @@
<drawrectangle condition="{marks[startmark]}" x="{marks[position]}/{marks[total]}*{areawidth}" y="30%" width="{marks[endposition]}/{marks[total]}*{areawidth} - {marks[position]}/{marks[total]}*{areawidth}" height="40%" color="{clrWhite}" />
</loop>
</area>
<area condition="{timeshift}" x="5%" y="89%" width="90%" height="3%" layer="3">
<loop name="marks" x="0" y="0" orientation="absolute">
<!-- draw mark -->
<drawrectangle condition="not{marks[active]}" x="{marks[position]}/{marks[timeshifttotal]}*{areawidth}" y="0" width="1" height="100%" color="{clrWhite}" />
<drawrectangle condition="not{marks[active]} ++ {marks[startmark]}" x="{marks[position]}/{marks[timeshifttotal]}*{areawidth}" y="0" width="5" height="1" color="{clrWhite}" />
<drawrectangle condition="not{marks[active]} ++ {marks[startmark]}" x="{marks[position]}/{marks[timeshifttotal]}*{areawidth}" y="{areaheight}-1" width="5" height="1" color="{clrWhite}" />
<drawrectangle condition="not{marks[active]} ++ not{marks[startmark]}" x="{marks[position]}/{marks[timeshifttotal]}*{areawidth} - 5" y="0" width="5" height="1" color="{clrWhite}" />
<drawrectangle condition="not{marks[active]} ++ not{marks[startmark]}" x="{marks[position]}/{marks[timeshifttotal]}*{areawidth} - 5" y="{areaheight}-1" width="5" height="1" color="{clrWhite}" />
<!-- draw active mark -->
<drawrectangle condition="{marks[active]}" x="{marks[position]}/{marks[timeshifttotal]}*{areawidth}" y="0" width="1" height="100%" color="{clrRed}" />
<drawrectangle condition="{marks[active]} ++ {marks[startmark]}" x="{marks[position]}/{marks[timeshifttotal]}*{areawidth}" y="0" width="5" height="1" color="{clrRed}" />
<drawrectangle condition="{marks[active]} ++ {marks[startmark]}" x="{marks[position]}/{marks[timeshifttotal]}*{areawidth}" y="{areaheight}-1" width="5" height="1" color="{clrRed}" />
<drawrectangle condition="{marks[active]} ++ not{marks[startmark]}" x="{marks[position]}/{marks[timeshifttotal]}*{areawidth} - 5" y="0" width="5" height="1" color="{clrRed}" />
<drawrectangle condition="{marks[active]} ++ not{marks[startmark]}" x="{marks[position]}/{marks[timeshifttotal]}*{areawidth} - 5" y="{areaheight}-1" width="5" height="1" color="{clrRed}" />
<!-- draw bar to next mark if mark is startmark-->
<drawrectangle condition="{marks[startmark]}" x="{marks[position]}/{marks[timeshifttotal]}*{areawidth}" y="30%" width="{marks[endposition]}/{marks[timeshifttotal]}*{areawidth} - {marks[position]}/{marks[timeshifttotal]}*{areawidth}" height="40%" color="{clrWhite}" />
</loop>
</area>
</cutmarks>
<!-- Available Variables controlicons and controliconsmodeonly:

View File

@ -70,6 +70,8 @@
<!-- 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>
</totaltime>
@ -83,15 +85,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>
</progressbar>
<!-- Available Variables cutmarks:
{timeshift} true if a timeshifted recording is displayed
{marks[]} array of available marks
{marks[position]} frame of current mark
{marks[endposition]} frame where startmark ends
{marks[total]} total number of frames
{marks[timeshifttotal]} total number of frames of timeshift event
{marks[active]} true if current replay position hits exactly the mark
{marks[startmark]} true if mark is start mark
-->

View File

@ -271,7 +271,6 @@ void cDisplayReplayView::DrawProgressBar(int current, int total) {
intTokens.insert(pair<string,int>("current", current));
intTokens.insert(pair<string,int>("total", total));
intTokens.insert(pair<string,int>("timeshift", timeShiftActive));
if (timeShiftActive) {
intTokens.insert(pair<string,int>("timeshifttotal", timeShiftFramesTotal));
}
@ -288,13 +287,14 @@ void cDisplayReplayView::DrawMarks(const cMarks *marks, int current, int total)
map < string, string > stringTokens;
map < string, int > intTokens;
intTokens.insert(pair<string,int>("timeshift", timeShiftActive));
map < string, vector< map< string, string > > > loopTokens;
vector< map< string, string > > markTokens;
stringstream tot;
if (!timeShiftActive)
tot << total;
else
tot << timeShiftFramesTotal;
stringstream timeshifttot;
timeshifttot << timeShiftFramesTotal;
bool isStartMark = true;
for (const cMark *m = marks->First(); m; m = marks->Next(m)) {
@ -303,6 +303,9 @@ void cDisplayReplayView::DrawMarks(const cMarks *marks, int current, int total)
pos << m->Position();
markVals.insert(pair< string, string >("marks[position]", pos.str()));
markVals.insert(pair< string, string >("marks[total]", tot.str()));
if (timeShiftActive) {
markVals.insert(pair< string, string >("marks[timeshifttotal]", timeshifttot.str()));
}
markVals.insert(pair< string, string >("marks[startmark]", isStartMark ? "1" : "0"));
markVals.insert(pair< string, string >("marks[active]", (m->Position() == current) ? "1" : "0"));
const cMark *m2 = marks->Next(m);