summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMartin Schirrmacher <vdr.skinflatplus@schirrmacher.eu>2017-09-09 15:54:18 +0200
committerMartin Schirrmacher <vdr.skinflatplus@schirrmacher.eu>2017-09-09 15:54:18 +0200
commitab8c11e9983c5d80fcc2c30abd953fa29f606589 (patch)
tree3183e3ae57b271813f2d9e3a4164ace2481e3a4f
parent06bec42a4f84720c25a7d11d5c5858d338a13bdd (diff)
downloadskin-flatplus-ab8c11e9983c5d80fcc2c30abd953fa29f606589.tar.gz
skin-flatplus-ab8c11e9983c5d80fcc2c30abd953fa29f606589.tar.bz2
add patch for locking from nanohcv; fix SetItemEvent for older vdr versions
-rw-r--r--Makefile2
-rw-r--r--baserender.c34
-rw-r--r--displaymenu.c25
-rw-r--r--displaymenu.h6
4 files changed, 33 insertions, 34 deletions
diff --git a/Makefile b/Makefile
index 78bac338..9e657686 100644
--- a/Makefile
+++ b/Makefile
@@ -48,6 +48,8 @@ SKINFLATPLUS_WIDGETDIR ?= $(LIBDIR)/$(PLUGIN)/widgets
export CFLAGS = $(call PKGCFG,cflags)
export CXXFLAGS = $(call PKGCFG,cxxflags)
+CXXFLAGS += -std=c++11
+
### Allow user defined options to overwrite defaults:
-include $(PLGCFG)
diff --git a/baserender.c b/baserender.c
index 785202eb..1e8dc316 100644
--- a/baserender.c
+++ b/baserender.c
@@ -10,31 +10,7 @@
#include FT_FREETYPE_H
#if VDRVERSNUM >= 20301
-#include <vdr/thread.h>
-
-class cRecCounter : public cThread
-{
- private:
- int numRec;
- cCondWait condWait;
- cRecCounter() { numRec = 0; }
- protected:
- void Action(void) {
- LOCK_TIMERS_READ;
- for(const cTimer *ti = Timers->First(); ti; ti = Timers->Next(ti)) {
- if( ti->HasFlags(tfRecording) ) numRec++;
- }
- condWait.Signal();
- }
- public:
- static int Count(void) {
- cRecCounter rc;
- rc.Start();
- if(rc.condWait.Wait(500))
- return rc.numRec;
- return 0;
- }
-};
+ #include <future>
#endif
cFlatBaseRender::cFlatBaseRender(void) {
@@ -452,7 +428,13 @@ void cFlatBaseRender::TopBarUpdate(void) {
if( Config.TopBarRecordingShow ) {
// look for timers
#if VDRVERSNUM >= 20301
- numRec = cRecCounter::Count();
+ auto recCounterFuture = std::async([&numRec](){
+ LOCK_TIMERS_READ;
+ for(const cTimer *ti = Timers->First(); ti; ti = Timers->Next(ti)) {
+ if( ti->HasFlags(tfRecording) ) numRec++;
+ }
+ });
+ recCounterFuture.get();
#else
for(cTimer *ti = Timers.First(); ti; ti = Timers.Next(ti))
if( ti->HasFlags(tfRecording) ) numRec++;
diff --git a/displaymenu.c b/displaymenu.c
index 3ba9bcac..af90ddeb 100644
--- a/displaymenu.c
+++ b/displaymenu.c
@@ -6,6 +6,10 @@
#include <fstream>
#include <iostream>
+#if VDRVERSNUM >= 20301
+ #include <future>
+#endif
+
#ifndef VDRLOGO
#define VDRLOGO "vdrlogo_default"
#endif
@@ -1488,7 +1492,11 @@ bool cFlatDisplayMenu::SetItemTimer(const cTimer *Timer, int Index, bool Current
return true;
}
+#if APIVERSNUM >= 20308
bool cFlatDisplayMenu::SetItemEvent(const cEvent *Event, int Index, bool Current, bool Selectable, const cChannel *Channel, bool WithDate, eTimerMatch TimerMatch, bool TimerActive) {
+#else
+bool cFlatDisplayMenu::SetItemEvent(const cEvent *Event, int Index, bool Current, bool Selectable, const cChannel *Channel, bool WithDate, eTimerMatch TimerMatch) {
+#endif
if( Config.MenuEventView == 0 )
return false;
@@ -1900,10 +1908,6 @@ bool cFlatDisplayMenu::SetItemRecording(const cRecording *Recording, int Index,
if( Config.MenuRecordingView == 0 )
return false;
-#if VDRVERSNUM >= 20301
- LOCK_RECORDINGS_READ;
-#endif
-
cString buffer;
cString RecName = GetRecordingName(Recording, Level, Total == 0).c_str();
@@ -1919,6 +1923,7 @@ bool cFlatDisplayMenu::SetItemRecording(const cRecording *Recording, int Index,
LastRecFolder = RecFolder;
if( RecFolder != "" && LastItemRecordingLevel > 0 ) {
#if VDRVERSNUM >= 20301
+ LOCK_RECORDINGS_READ;
for(const cRecording *Rec = Recordings->First(); Rec; Rec = Recordings->Next(Rec)) {
#else
for(cRecording *Rec = Recordings.First(); Rec; Rec = Recordings.Next(Rec)) {
@@ -1932,6 +1937,7 @@ bool cFlatDisplayMenu::SetItemRecording(const cRecording *Recording, int Index,
}
} else {
#if VDRVERSNUM >= 20301
+ LOCK_RECORDINGS_READ;
for(const cRecording *Rec = Recordings->First(); Rec; Rec = Recordings->Next(Rec)) {
#else
for(cRecording *Rec = Recordings.First(); Rec; Rec = Recordings.Next(Rec)) {
@@ -3218,13 +3224,18 @@ void cFlatDisplayMenu::SetRecording(const cRecording *Recording) {
// lent from skinelchi
if( Config.RecordingAdditionalInfoShow ) {
#if VDRVERSNUM >= 20301
- LOCK_CHANNELS_READ;
- const cChannel *channel = Channels->GetByChannelID(((cRecordingInfo *)recInfo)->ChannelID());
+ auto channelFuture = std::async([&recAdditional](tChannelID channelId){
+ LOCK_CHANNELS_READ;
+ const cChannel *channel = Channels->GetByChannelID(channelId);
+ if (channel)
+ recAdditional << trVDR("Channel") << ": " << channel->Number() << " - " << channel->Name() << endl;
+ }, recInfo->ChannelID());
+ channelFuture.get();
#else
cChannel *channel = Channels.GetByChannelID(((cRecordingInfo *)recInfo)->ChannelID());
-#endif
if (channel)
recAdditional << trVDR("Channel") << ": " << channel->Number() << " - " << channel->Name() << endl;
+#endif
const cEvent *Event = recInfo->GetEvent();
if( Event ) {
diff --git a/displaymenu.h b/displaymenu.h
index dc01e28e..248fb2e8 100644
--- a/displaymenu.h
+++ b/displaymenu.h
@@ -130,7 +130,11 @@ class cFlatDisplayMenu : public cFlatBaseRender, public cSkinDisplayMenu {
virtual void SetMessage(eMessageType Type, const char *Text);
virtual void SetItem(const char *Text, int Index, bool Current, bool Selectable);
- virtual bool SetItemEvent(const cEvent *Event, int Index, bool Current, bool Selectable, const cChannel *Channel, bool WithDate, eTimerMatch TimerMatch, bool TimerActive);
+ #if APIVERSNUM >= 20308
+ virtual bool SetItemEvent(const cEvent *Event, int Index, bool Current, bool Selectable, const cChannel *Channel, bool WithDate, eTimerMatch TimerMatch, bool TimerActive);
+ #else
+ virtual bool SetItemEvent(const cEvent *Event, int Index, bool Current, bool Selectable, const cChannel *Channel, bool WithDate, eTimerMatch TimerMatch);
+ #endif
virtual bool SetItemTimer(const cTimer *Timer, int Index, bool Current, bool Selectable);
virtual bool SetItemChannel(const cChannel *Channel, int Index, bool Current, bool Selectable, bool WithProvider);
virtual bool SetItemRecording(const cRecording *Recording, int Index, bool Current, bool Selectable, int Level, int Total, int New);