From a7b3b7333f8f1688940608e35832b9475e57dfe0 Mon Sep 17 00:00:00 2001 From: louis Date: Tue, 28 Oct 2014 18:09:10 +0100 Subject: [PATCH 1/3] added 'active' Token for cutting marks --- HISTORY | 2 + displaychannel.c | 1 + displayreplay.c | 51 +-------------- displayreplay.h | 4 -- skins/metrixhd/xmlfiles/displaychannel.xml | 1 + skins/metrixhd/xmlfiles/displayreplay.xml | 20 ++++-- skinskeleton/xmlfiles/displayreplay.xml | 1 + views/displayreplayview.c | 72 +++++++++++++++++++++- views/displayreplayview.h | 7 ++- 9 files changed, 97 insertions(+), 62 deletions(-) diff --git a/HISTORY b/HISTORY index e918aea..35945a8 100644 --- a/HISTORY +++ b/HISTORY @@ -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 diff --git a/displaychannel.c b/displaychannel.c index 0ddb514..a2bfc24 100644 --- a/displaychannel.c +++ b/displaychannel.c @@ -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; } diff --git a/displayreplay.c b/displayreplay.c index 53a43d8..5a82eea 100644 --- a/displayreplay.c +++ b/displayreplay.c @@ -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++; - } -} diff --git a/displayreplay.h b/displayreplay.h index a63c8d8..e299e91 100644 --- a/displayreplay.h +++ b/displayreplay.h @@ -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(); diff --git a/skins/metrixhd/xmlfiles/displaychannel.xml b/skins/metrixhd/xmlfiles/displaychannel.xml index 1e087d7..c182d21 100644 --- a/skins/metrixhd/xmlfiles/displaychannel.xml +++ b/skins/metrixhd/xmlfiles/displaychannel.xml @@ -266,6 +266,7 @@ --> + diff --git a/skins/metrixhd/xmlfiles/displayreplay.xml b/skins/metrixhd/xmlfiles/displayreplay.xml index 0b40986..244a783 100644 --- a/skins/metrixhd/xmlfiles/displayreplay.xml +++ b/skins/metrixhd/xmlfiles/displayreplay.xml @@ -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 --> - - - - - + + + + + + + + + + + + + @@ -221,6 +230,7 @@ --> + diff --git a/skinskeleton/xmlfiles/displayreplay.xml b/skinskeleton/xmlfiles/displayreplay.xml index 8911566..b6e4d6d 100644 --- a/skinskeleton/xmlfiles/displayreplay.xml +++ b/skinskeleton/xmlfiles/displayreplay.xml @@ -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 --> diff --git a/views/displayreplayview.c b/views/displayreplayview.c index 0995dfe..7c72a90 100644 --- a/views/displayreplayview.c +++ b/views/displayreplayview.c @@ -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(); diff --git a/views/displayreplayview.h b/views/displayreplayview.h index 750ec95..e637214 100644 --- a/views/displayreplayview.h +++ b/views/displayreplayview.h @@ -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); From a9e7a34c112e58fe12a0bf4668fa81f6c23ab167 Mon Sep 17 00:00:00 2001 From: louis Date: Tue, 28 Oct 2014 23:16:23 +0100 Subject: [PATCH 2/3] fixed possible crash when switching channel --- displaychannel.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/displaychannel.c b/displaychannel.c index a2bfc24..5d2701a 100644 --- a/displaychannel.c +++ b/displaychannel.c @@ -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 ? "-" : ""); From 3d702a9ad5f04179d78659f48579f3466abbe69a Mon Sep 17 00:00:00 2001 From: louis Date: Tue, 28 Oct 2014 23:30:38 +0100 Subject: [PATCH 3/3] diisplay only active timers --- libcore/timers.c | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/libcore/timers.c b/libcore/timers.c index 09af69b..00f40e9 100644 --- a/libcore/timers.c +++ b/libcore/timers.c @@ -24,8 +24,10 @@ cGlobalSortedTimers::cGlobalSortedTimers(bool forceRefresh) : cVectorHasFlags(tfActive)) + Append(Timer); + } //if remotetimers plugin is available, take timers also from him if (pRemoteTimers) {