]> git.vomp.tv Git - vompclient-marten.git/commitdiff
Codecleanup dvbsubtitles
authorMarten Richter <marten.richter@freenet.de>
Sat, 19 Jan 2013 17:53:45 +0000 (18:53 +0100)
committerMarten Richter <marten.richter@freenet.de>
Sat, 19 Jan 2013 17:53:45 +0000 (18:53 +0100)
dvbsubtitles.cc
dvbsubtitles.h

index e581a1885b4aa68672e6956709673924b6a8dd76..0b898a1adfc52544f68902f29a5b6dd96b54593f 100644 (file)
@@ -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();
index 7258c1833cc64620b2aad4bc4f8359d549a6ab74..701bf9e64c0665e64e80c19b30b75cbedc875aaa 100644 (file)
@@ -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();