summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--HISTORY3
-rw-r--r--displaychannel.c25
-rw-r--r--displaymenu.c27
-rw-r--r--displaymessage.c20
-rw-r--r--displayreplay.c19
-rw-r--r--displaytracks.c22
-rw-r--r--displayvolume.c20
7 files changed, 78 insertions, 58 deletions
diff --git a/HISTORY b/HISTORY
index b65936c..605222a 100644
--- a/HISTORY
+++ b/HISTORY
@@ -52,3 +52,6 @@ VDR Plugin 'nOpacity' Revision History
(thanks @maverick-me)
- optical redesign of displayVolume (thanks @maverick-me)
- Display of reruns of shows in detailed EPG view using epgseach.
+- completely rewrote epgsearch handling in schedules views (see README for
+ more information about epgsearch integration)
+- Fixed "fade in" bug, cancelling threads correctly
diff --git a/displaychannel.c b/displaychannel.c
index ba8102c..563e50b 100644
--- a/displaychannel.c
+++ b/displaychannel.c
@@ -31,6 +31,9 @@ cNopacityDisplayChannel::cNopacityDisplayChannel(bool WithInfo) {
}
cNopacityDisplayChannel::~cNopacityDisplayChannel() {
+ Cancel(-1);
+ while (Active())
+ cCondWait::SleepMs(10);
osd->DestroyPixmap(pixmapBackgroundTop);
osd->DestroyPixmap(pixmapBackgroundBottom);
osd->DestroyPixmap(pixmapLogo);
@@ -293,8 +296,7 @@ void cNopacityDisplayChannel::DrawSignal(void) {
lastSignalStrength = SignalStrength;
lastSignalQuality = SignalQuality;
lastSignalDisplay = Now;
- }
-
+ }
}
void cNopacityDisplayChannel::SetChannel(const cChannel *Channel, int Number) {
@@ -319,12 +321,12 @@ void cNopacityDisplayChannel::SetChannel(const cChannel *Channel, int Number) {
ChannelNumber = cString::sprintf("%d%s", Channel->Number(), Number ? "-" : "");
} else
groupSep = true;
- } else if (Number) {
+ } else if (Number) {
ChannelNumber = cString::sprintf("%d-", Number);
} else {
ChannelName = ChannelString(NULL, 0);
}
-
+
cString channelString = cString::sprintf("%s %s", *ChannelNumber, *ChannelName);
if (!groupSep) {
@@ -493,11 +495,11 @@ void cNopacityDisplayChannel::Flush(void) {
void cNopacityDisplayChannel::Action(void) {
uint64_t Start = cTimeMs::Now();
- while (true) {
+ while (Running()) {
uint64_t Now = cTimeMs::Now();
cPixmap::Lock();
double t = min(double(Now - Start) / FadeTime, 1.0);
- int Alpha = t * ALPHA_OPAQUE;
+ int Alpha = t * ALPHA_OPAQUE;
pixmapBackgroundTop->SetAlpha(Alpha);
pixmapBackgroundBottom->SetAlpha(Alpha);
pixmapLogo->SetAlpha(Alpha);
@@ -517,13 +519,14 @@ void cNopacityDisplayChannel::Action(void) {
pixmapSignalMeter->SetAlpha(Alpha);
pixmapSignalLabel->SetAlpha(Alpha);
}
- osd->Flush();
+ if (Running())
+ osd->Flush();
cPixmap::Unlock();
- int Delta = cTimeMs::Now() - Now;
- if (Delta < FrameTime)
- cCondWait::SleepMs(FrameTime - Delta);
+ int Delta = cTimeMs::Now() - Now;
+ if (Running() && (Delta < FrameTime))
+ cCondWait::SleepMs(FrameTime - Delta);
if ((int)(Now - Start) > FadeTime) {
break;
}
- }
+ }
} \ No newline at end of file
diff --git a/displaymenu.c b/displaymenu.c
index 46be742..bbd27e1 100644
--- a/displaymenu.c
+++ b/displaymenu.c
@@ -35,10 +35,9 @@ cNopacityDisplayMenu::cNopacityDisplayMenu(void) {
}
cNopacityDisplayMenu::~cNopacityDisplayMenu() {
- if (Running()) {
- Cancel();
- cCondWait::SleepMs(300);
- }
+ Cancel(-1);
+ while (Active())
+ cCondWait::SleepMs(10);
delete menuView;
menuItems.Clear();
if (detailView) {
@@ -472,7 +471,7 @@ void cNopacityDisplayMenu::Flush(void) {
DrawTimers();
}
if (initial) {
- if (FadeTime)
+ if (config.menuFadeTime)
Start();
}
initMenu = false;
@@ -486,21 +485,21 @@ void cNopacityDisplayMenu::Action(void) {
uint64_t Now = cTimeMs::Now();
cPixmap::Lock();
double t = min(double(Now - Start) / FadeTime, 1.0);
- int Alpha = t * ALPHA_OPAQUE;
+ int Alpha = t * ALPHA_OPAQUE;
menuView->SetPixmapAlpha(Alpha);
- for (cNopacityMenuItem *item = menuItems.First(); item; item = menuItems.Next(item)) {
+ for (cNopacityMenuItem *item = menuItems.First(); Running() && item; item = menuItems.Next(item)) {
item->SetAlpha(Alpha);
item->SetAlphaIcon(Alpha);
}
- for (cNopacityTimer *t = timers.First(); t; t = timers.Next(t)) {
+ for (cNopacityTimer *t = timers.First(); Running() && t; t = timers.Next(t))
t->SetAlpha(Alpha);
- }
- osd->Flush();
+ if (Running())
+ osd->Flush();
cPixmap::Unlock();
- int Delta = cTimeMs::Now() - Now;
- if (Delta < FrameTime)
- cCondWait::SleepMs(FrameTime - Delta);
+ int Delta = cTimeMs::Now() - Now;
+ if (Running() && (Delta < FrameTime))
+ cCondWait::SleepMs(FrameTime - Delta);
if ((int)(Now - Start) > FadeTime)
break;
- }
+ }
}
diff --git a/displaymessage.c b/displaymessage.c
index ad420af..64e772a 100644
--- a/displaymessage.c
+++ b/displaymessage.c
@@ -16,6 +16,9 @@ cNopacityDisplayMessage::cNopacityDisplayMessage(void) {
}
cNopacityDisplayMessage::~cNopacityDisplayMessage() {
+ Cancel(-1);
+ while (Active())
+ cCondWait::SleepMs(10);
osd->DestroyPixmap(pixmap);
delete font;
delete osd;
@@ -53,18 +56,19 @@ void cNopacityDisplayMessage::Flush(void) {
void cNopacityDisplayMessage::Action(void) {
uint64_t Start = cTimeMs::Now();
- while (true) {
+ while (Running()) {
uint64_t Now = cTimeMs::Now();
cPixmap::Lock();
double t = min(double(Now - Start) / FadeTime, 1.0);
- int Alpha = t * ALPHA_OPAQUE;
+ int Alpha = t * ALPHA_OPAQUE;
pixmap->SetAlpha(Alpha);
- osd->Flush();
+ if (Running())
+ osd->Flush();
cPixmap::Unlock();
- int Delta = cTimeMs::Now() - Now;
- if (Delta < FrameTime)
- cCondWait::SleepMs(FrameTime - Delta);
+ int Delta = cTimeMs::Now() - Now;
+ if (Running() && (Delta < FrameTime))
+ cCondWait::SleepMs(FrameTime - Delta);
if ((int)(Now - Start) > FadeTime)
break;
- }
-} \ No newline at end of file
+ }
+}
diff --git a/displayreplay.c b/displayreplay.c
index 728dd16..873c1a1 100644
--- a/displayreplay.c
+++ b/displayreplay.c
@@ -15,6 +15,9 @@ cNopacityDisplayReplay::cNopacityDisplayReplay(bool ModeOnly) {
}
cNopacityDisplayReplay::~cNopacityDisplayReplay() {
+ Cancel(-1);
+ while (Active())
+ cCondWait::SleepMs(10);
if (!modeOnly) {
osd->DestroyPixmap(pixmapHeader);
osd->DestroyPixmap(pixmapBackground);
@@ -41,7 +44,6 @@ cNopacityDisplayReplay::~cNopacityDisplayReplay() {
delete fontReplayHeader;
delete fontReplay;
delete osd;
-
}
void cNopacityDisplayReplay::SetGeometry(void) {
@@ -284,11 +286,11 @@ void cNopacityDisplayReplay::Flush(void) {
void cNopacityDisplayReplay::Action(void) {
uint64_t Start = cTimeMs::Now();
- while (true) {
+ while (Running()) {
uint64_t Now = cTimeMs::Now();
cPixmap::Lock();
double t = min(double(Now - Start) / FadeTime, 1.0);
- int Alpha = t * ALPHA_OPAQUE;
+ int Alpha = t * ALPHA_OPAQUE;
if (!modeOnly) {
pixmapHeader->SetAlpha(Alpha);
pixmapBackground->SetAlpha(Alpha);
@@ -312,12 +314,13 @@ void cNopacityDisplayReplay::Action(void) {
pixmapFwdBackground->SetAlpha(Alpha);
pixmapFwd->SetAlpha(Alpha);
pixmapFwdSpeed->SetAlpha(Alpha);
- osd->Flush();
+ if (Running())
+ osd->Flush();
cPixmap::Unlock();
- int Delta = cTimeMs::Now() - Now;
- if (Delta < FrameTime)
- cCondWait::SleepMs(FrameTime - Delta);
+ int Delta = cTimeMs::Now() - Now;
+ if (Running() && (Delta < FrameTime))
+ cCondWait::SleepMs(FrameTime - Delta);
if ((int)(Now - Start) > FadeTime)
break;
- }
+ }
}
diff --git a/displaytracks.c b/displaytracks.c
index ab1add7..f0d239f 100644
--- a/displaytracks.c
+++ b/displaytracks.c
@@ -18,6 +18,9 @@ cNopacityDisplayTracks::cNopacityDisplayTracks(const char *Title, int NumTracks,
}
cNopacityDisplayTracks::~cNopacityDisplayTracks() {
+ Cancel(-1);
+ while (Active())
+ cCondWait::SleepMs(10);
osd->DestroyPixmap(pixmapContainer);
osd->DestroyPixmap(pixmapHeader);
menuItems.Clear();
@@ -163,22 +166,23 @@ void cNopacityDisplayTracks::Flush(void) {
void cNopacityDisplayTracks::Action(void) {
uint64_t Start = cTimeMs::Now();
- while (true) {
+ while (Running()) {
uint64_t Now = cTimeMs::Now();
cPixmap::Lock();
double t = min(double(Now - Start) / FadeTime, 1.0);
- int Alpha = t * ALPHA_OPAQUE;
+ int Alpha = t * ALPHA_OPAQUE;
pixmapContainer->SetAlpha(Alpha);
pixmapHeader->SetAlpha(Alpha);
- for (cNopacityMenuItem *item = menuItems.First(); item; item = menuItems.Next(item)) {
+ for (cNopacityMenuItem *item = menuItems.First(); Running() && item; item = menuItems.Next(item)) {
item->SetAlpha(Alpha);
}
- osd->Flush();
+ if (Running())
+ osd->Flush();
cPixmap::Unlock();
- int Delta = cTimeMs::Now() - Now;
- if (Delta < FrameTime)
- cCondWait::SleepMs(FrameTime - Delta);
+ int Delta = cTimeMs::Now() - Now;
+ if (Running() && (Delta < FrameTime))
+ cCondWait::SleepMs(FrameTime - Delta);
if ((int)(Now - Start) > FadeTime)
break;
- }
-} \ No newline at end of file
+ }
+}
diff --git a/displayvolume.c b/displayvolume.c
index 46eba0c..ae541bd 100644
--- a/displayvolume.c
+++ b/displayvolume.c
@@ -45,6 +45,9 @@ cNopacityDisplayVolume::cNopacityDisplayVolume(void) {
}
cNopacityDisplayVolume::~cNopacityDisplayVolume() {
+ Cancel(-1);
+ while (Active())
+ cCondWait::SleepMs(10);
osd->DestroyPixmap(pixmapBackgroundTop);
osd->DestroyPixmap(pixmapBackgroundBottom);
osd->DestroyPixmap(pixmapLabel);
@@ -114,7 +117,7 @@ tColor cNopacityDisplayVolume::DrawProgressbarBackground(int left, int top, int
void cNopacityDisplayVolume::Flush(void) {
if (initial)
- if (FadeTime)
+ if (config.volumeFadeTime)
Start();
initial = false;
osd->Flush();
@@ -122,21 +125,22 @@ void cNopacityDisplayVolume::Flush(void) {
void cNopacityDisplayVolume::Action(void) {
uint64_t Start = cTimeMs::Now();
- while (true) {
+ while (Running()) {
uint64_t Now = cTimeMs::Now();
cPixmap::Lock();
double t = min(double(Now - Start) / FadeTime, 1.0);
- int Alpha = t * ALPHA_OPAQUE;
+ int Alpha = t * ALPHA_OPAQUE;
pixmapBackgroundTop->SetAlpha(Alpha);
pixmapBackgroundBottom->SetAlpha(Alpha);
pixmapProgressBar->SetAlpha(Alpha);
pixmapLabel->SetAlpha(Alpha);
- osd->Flush();
+ if (Running())
+ osd->Flush();
cPixmap::Unlock();
- int Delta = cTimeMs::Now() - Now;
- if (Delta < FrameTime)
- cCondWait::SleepMs(FrameTime - Delta);
+ int Delta = cTimeMs::Now() - Now;
+ if (Running() && (Delta < FrameTime))
+ cCondWait::SleepMs(FrameTime - Delta);
if ((int)(Now - Start) > FadeTime)
break;
- }
+ }
}