Merge branch 'master' of git://projects.vdr-developer.org/vdr-plugin-skindesigner

This commit is contained in:
Manuel Reimer 2014-10-29 17:11:02 +01:00
commit 9609e183f2
10 changed files with 102 additions and 65 deletions

View File

@ -45,5 +45,7 @@ Version 0.0.3
- added tokens for current video and audio bitrate in displaychannel. Thx @rofafor for the original code
in the femon plugin and _Martin_ for extracting the code in skinflatplus
- changed skin metrixHD to display bitrate infos
- added "active" Token for cutting marks so that a mark can be displayed in a dedicated way if current position
in replay exactly hits the mark

View File

@ -46,7 +46,7 @@ void cSDDisplayChannel::SetChannel(const cChannel *Channel, int Number) {
cString ChannelID("");
if (Channel) {
ChannelName = Channel->Name();
ChannelName = Channel->Name() ? Channel->Name() : "";
ChannelID = Channel->GetChannelID().ToString();
if (!Channel->GroupSep()) {
ChannelNumber = cString::sprintf("%d%s", Channel->Number(), Number ? "-" : "");
@ -159,6 +159,7 @@ void cSDDisplayChannel::SetMessage(eMessageType Type, const char *Text) {
channelView->ClearSignalBackground();
channelView->ClearScraperContent();
channelView->ClearAudioInfo();
channelView->ClearBitrates();
channelView->DisplayMessage(Type, Text);
groupSep = true;
}

View File

@ -5,8 +5,6 @@ cSDDisplayReplay::cSDDisplayReplay(cTemplate *replayTemplate, bool ModeOnly) {
doOutput = true;
initial = true;
modeOnly = ModeOnly;
numMarksLast = 0;
lastMarks = NULL;
if (!replayTemplate) {
doOutput = false;
esyslog("skindesigner: displayReplay no valid template - aborting");
@ -24,9 +22,6 @@ cSDDisplayReplay::~cSDDisplayReplay() {
if (!doOutput)
return;
delete replayView;
if (lastMarks) {
delete[] lastMarks;
}
}
void cSDDisplayReplay::SetRecording(const cRecording *Recording) {
@ -47,9 +42,7 @@ void cSDDisplayReplay::SetProgress(int Current, int Total) {
if (!doOutput)
return;
replayView->DrawProgressBar(Current, Total);
if (MarksChanged()) {
replayView->DrawMarks(marks, Total);
}
replayView->DrawMarks(marks, Current, Total);
}
void cSDDisplayReplay::SetCurrent(const char *Current) {
@ -87,45 +80,3 @@ void cSDDisplayReplay::Flush(void) {
replayView->Flush();
}
}
/****************************************************************************************
* Private Functions
*****************************************************************************************/
bool cSDDisplayReplay::MarksChanged(void) {
if (!marks)
return false;
int numMarks = marks->Count();
if (numMarks != numMarksLast) {
RememberMarks();
return true;
}
if (!lastMarks)
return false;
int i=0;
for (const cMark *m = marks->First(); m; m = marks->Next(m)) {
if (m->Position() != lastMarks[i]) {
RememberMarks();
return true;
}
i++;
}
return false;
}
void cSDDisplayReplay::RememberMarks(void) {
if (!marks)
return;
numMarksLast = marks->Count();
if (numMarksLast < 1)
return;
if (lastMarks) {
delete[] lastMarks;
}
lastMarks = new int[numMarksLast];
int i=0;
for (const cMark *m = marks->First(); m; m = marks->Next(m)) {
lastMarks[i] = m->Position();
i++;
}
}

View File

@ -13,10 +13,6 @@ private:
bool initial;
bool doOutput;
bool modeOnly;
int numMarksLast;
int *lastMarks;
bool MarksChanged(void);
void RememberMarks(void);
public:
cSDDisplayReplay(cTemplate *replayTemplate, bool ModeOnly);
virtual ~cSDDisplayReplay();

View File

@ -24,8 +24,10 @@ cGlobalSortedTimers::cGlobalSortedTimers(bool forceRefresh) : cVector<const cTim
initial = false;
}
for (cTimer *Timer = Timers.First(); Timer; Timer = Timers.Next(Timer))
Append(Timer);
for (cTimer *Timer = Timers.First(); Timer; Timer = Timers.Next(Timer)) {
if (Timer->HasFlags(tfActive))
Append(Timer);
}
//if remotetimers plugin is available, take timers also from him
if (pRemoteTimers) {

View File

@ -266,6 +266,7 @@
-->
<message>
<area x="10%" y="45%" width="80%" height="10%" layer="1">
<fill color="{clrTransBlack}" />
<drawrectangle condition="{status}" x="20" y="0" width="20" height="100%" color="{clrGreen}" />
<drawrectangle condition="{info}" x="20" y="0" width="20" height="100%" color="{clrBlue}" />
<drawrectangle condition="{warning}" x="20" y="0" width="20" height="100%" color="{clrYellow}" />

View File

@ -130,16 +130,25 @@
{marks[position]} frame of current mark
{marks[endposition]} frame where startmark ends
{marks[total]} total number of frames
{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">
<loop name="marks" x="0" y="0" orientation="absolute">
<drawrectangle x="{marks[position]}/{marks[total]}*{areawidth}" y="0" width="1" height="100%" color="{clrWhite}" />
<drawrectangle condition="{marks[startmark]}" x="{marks[position]}/{marks[total]}*{areawidth}" y="0" width="5" height="1" color="{clrWhite}" />
<drawrectangle condition="{marks[startmark]}" x="{marks[position]}/{marks[total]}*{areawidth}" y="{areaheight}-1" width="5" height="1" color="{clrWhite}" />
<drawrectangle condition="not{marks[startmark]}" x="{marks[position]}/{marks[total]}*{areawidth} - 5" y="0" width="5" height="1" color="{clrWhite}" />
<drawrectangle condition="not{marks[startmark]}" x="{marks[position]}/{marks[total]}*{areawidth} - 5" y="{areaheight}-1" width="5" height="1" color="{clrWhite}" />
<!-- draw mark -->
<drawrectangle condition="not{marks[active]}" x="{marks[position]}/{marks[total]}*{areawidth}" y="0" width="1" height="100%" color="{clrWhite}" />
<drawrectangle condition="not{marks[active]} ++ {marks[startmark]}" x="{marks[position]}/{marks[total]}*{areawidth}" y="0" width="5" height="1" color="{clrWhite}" />
<drawrectangle condition="not{marks[active]} ++ {marks[startmark]}" x="{marks[position]}/{marks[total]}*{areawidth}" y="{areaheight}-1" width="5" height="1" color="{clrWhite}" />
<drawrectangle condition="not{marks[active]} ++ not{marks[startmark]}" x="{marks[position]}/{marks[total]}*{areawidth} - 5" y="0" width="5" height="1" color="{clrWhite}" />
<drawrectangle condition="not{marks[active]} ++ not{marks[startmark]}" x="{marks[position]}/{marks[total]}*{areawidth} - 5" y="{areaheight}-1" width="5" height="1" color="{clrWhite}" />
<!-- draw active mark -->
<drawrectangle condition="{marks[active]}" x="{marks[position]}/{marks[total]}*{areawidth}" y="0" width="1" height="100%" color="{clrRed}" />
<drawrectangle condition="{marks[active]} ++ {marks[startmark]}" x="{marks[position]}/{marks[total]}*{areawidth}" y="0" width="5" height="1" color="{clrRed}" />
<drawrectangle condition="{marks[active]} ++ {marks[startmark]}" x="{marks[position]}/{marks[total]}*{areawidth}" y="{areaheight}-1" width="5" height="1" color="{clrRed}" />
<drawrectangle condition="{marks[active]} ++ not{marks[startmark]}" x="{marks[position]}/{marks[total]}*{areawidth} - 5" y="0" width="5" height="1" color="{clrRed}" />
<drawrectangle condition="{marks[active]} ++ not{marks[startmark]}" x="{marks[position]}/{marks[total]}*{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[total]}*{areawidth}" y="30%" width="{marks[endposition]}/{marks[total]}*{areawidth} - {marks[position]}/{marks[total]}*{areawidth}" height="40%" color="{clrWhite}" />
</loop>
</area>
@ -221,6 +230,7 @@
-->
<message>
<area x="10%" y="45%" width="80%" height="10%" layer="1">
<fill color="{clrTransBlack}" />
<drawrectangle condition="{status}" x="20" y="0" width="20" height="100%" color="{clrGreen}" />
<drawrectangle condition="{info}" x="20" y="0" width="20" height="100%" color="{clrBlue}" />
<drawrectangle condition="{warning}" x="20" y="0" width="20" height="100%" color="{clrYellow}" />

View File

@ -76,6 +76,7 @@
{marks[position]} frame of current mark
{marks[endposition]} frame where startmark ends
{marks[total]} total number of frames
{marks[active]} true if current replay position hits exactly the mark
{marks[startmark]} true if mark is start mark
-->
<cutmarks>

View File

@ -6,11 +6,17 @@
cDisplayReplayView::cDisplayReplayView(cTemplateView *tmplView) : cView(tmplView) {
lastDate = "";
numMarksLast = 0;
lastMarks = NULL;
markActive = -1;
DeleteOsdOnExit();
SetFadeTime(tmplView->GetNumericParameter(ptFadeTime));
}
cDisplayReplayView::~cDisplayReplayView() {
if (lastMarks) {
delete[] lastMarks;
}
CancelSave();
FadeOut();
}
@ -189,10 +195,11 @@ void cDisplayReplayView::DrawProgressBar(int current, int total) {
DrawViewElement(veRecProgressBar, &stringTokens, &intTokens);
}
void cDisplayReplayView::DrawMarks(const cMarks *marks, int total) {
void cDisplayReplayView::DrawMarks(const cMarks *marks, int current, int total) {
if (!marks)
return;
if (!MarksChanged(marks, current))
return;
map < string, string > stringTokens;
map < string, int > intTokens;
map < string, vector< map< string, string > > > loopTokens;
@ -208,6 +215,7 @@ void cDisplayReplayView::DrawMarks(const cMarks *marks, int total) {
markVals.insert(pair< string, string >("marks[position]", pos.str()));
markVals.insert(pair< string, string >("marks[total]", tot.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);
if (m2) {
stringstream posNext;
@ -326,6 +334,66 @@ void cDisplayReplayView::DrawMessage(eMessageType type, const char *text) {
DrawViewElement(veMessage, &stringTokens, &intTokens);
}
/****************************************************************************************
* Private Functions
*****************************************************************************************/
bool cDisplayReplayView::MarksChanged(const cMarks *marks, int current) {
if (!marks)
return false;
bool redraw = false;
//if mark was active, we redraw always
if (markActive >= 0) {
markActive = -1;
redraw = true;
}
//check if current position in recording hits mark exactly
for (const cMark *m = marks->First(); m; m = marks->Next(m)) {
if (m->Position() == current) {
markActive = current;
redraw = true;
break;
}
}
if (redraw)
return true;
//if number of marks has changed, redraw
int numMarks = marks->Count();
if (numMarks != numMarksLast) {
RememberMarks(marks);
return true;
}
if (!lastMarks)
return false;
//if position has changed, redraw
int i=0;
for (const cMark *m = marks->First(); m; m = marks->Next(m)) {
if (m->Position() != lastMarks[i]) {
RememberMarks(marks);
return true;
}
i++;
}
return false;
}
void cDisplayReplayView::RememberMarks(const cMarks *marks) {
if (!marks)
return;
numMarksLast = marks->Count();
if (numMarksLast < 1)
return;
if (lastMarks) {
delete[] lastMarks;
}
lastMarks = new int[numMarksLast];
int i=0;
for (const cMark *m = marks->First(); m; m = marks->Next(m)) {
lastMarks[i] = m->Position();
i++;
}
}
void cDisplayReplayView::Action(void) {
SetInitFinished();

View File

@ -7,6 +7,11 @@
class cDisplayReplayView : public cView {
private:
cString lastDate;
int numMarksLast;
int *lastMarks;
int markActive;
bool MarksChanged(const cMarks *marks, int current);
void RememberMarks(const cMarks *marks);
virtual void Action(void);
public:
cDisplayReplayView(cTemplateView *tmplView);
@ -20,7 +25,7 @@ public:
void DrawCurrent(const char *current);
void DrawTotal(const char *total);
void DrawProgressBar(int current, int total);
void DrawMarks(const cMarks *marks, int total);
void DrawMarks(const cMarks *marks, int current, int total);
void DrawControlIcons(bool play, bool forward, int speed, bool modeOnly);
void DrawJump(const char *jump);
void DrawMessage(eMessageType type, const char *text);