From 9aaf61ec38bbfe57ec47f6fe66f1e78af7544226 Mon Sep 17 00:00:00 2001 From: Marten Richter Date: Sat, 19 Jan 2013 18:53:45 +0100 Subject: [PATCH] Codecleanup dvbsubtitles --- dvbsubtitles.cc | 17 +++++++++++++---- dvbsubtitles.h | 2 ++ 2 files changed, 15 insertions(+), 4 deletions(-) diff --git a/dvbsubtitles.cc b/dvbsubtitles.cc index e581a18..0b898a1 100644 --- a/dvbsubtitles.cc +++ b/dvbsubtitles.cc @@ -87,7 +87,7 @@ uint64_t cTimeMs::Elapsed(void) return Now() - begin; } -cTimeMs SubtitleTimeout; + //-------- End of cTimeMs borrowed from the vdr tools -------- DVBSubtitleCLUT::DVBSubtitleCLUT() @@ -549,7 +549,9 @@ DVBSubtitles::DVBSubtitles(OSDReceiver* tosd) pageOnDisplay(65536), running(false), showing(false), - threadNudged(false) + threadNudged(false), + SubtitleTimeout(0), + timeout_clear(false) { #ifndef WIN32 pthread_mutex_init(&input_mutex, NULL); @@ -811,6 +813,7 @@ void DVBSubtitles::finishPage(const DVBSubtitlePage& page) } // after displaying regions set the page timeout timer SubtitleTimeout.Set(page.timeout * 1000); + timeout_clear=false; Log::getInstance()->log("SUBTITLES", Log::DEBUG, "SubtitleTimeout %d", page.timeout); } @@ -941,13 +944,18 @@ void DVBSubtitles::threadMethod() sleeptime.tv_sec = 0; sleeptime.tv_nsec = 0; uint64_t wakeup = 0; + timeout_clear=false; while (1) { if (SubtitleTimeout.TimedOut()) // do we have a subtitle timeout { lockOutput(); - if (showing && !osdMenuShowing) - osd->clearOSD(); // if we have the timeout, lets clear the OSD + if (showing && !osdMenuShowing) { + if (!timeout_clear) { + osd->clearOSD(); // if we have the timeout, lets clear the OSD + timeout_clear=true; + } + } unlockOutput(); } else // if not lets check when will we have it @@ -958,6 +966,7 @@ void DVBSubtitles::threadMethod() { sleeptime.tv_sec = (int)(wakeup / 1000); sleeptime.tv_nsec = (long)(wakeup % 1000) * 10000L / 1000L * 100000L; + timeout_clear=false; } } threadCheckExit(); diff --git a/dvbsubtitles.h b/dvbsubtitles.h index 7258c18..701bf9e 100644 --- a/dvbsubtitles.h +++ b/dvbsubtitles.h @@ -146,6 +146,8 @@ class DVBSubtitles : public Thread_TYPE bool running; bool showing; bool threadNudged; + cTimeMs SubtitleTimeout; + bool timeout_clear; void nudge(); void lockInput(); void unlockInput(); -- 2.39.5