]> git.vomp.tv Git - vompclient.git/commitdiff
Fix timers nsec addition. Don't update barclocks if paused
authorChris Tallon <chris@vomp.tv>
Tue, 3 Mar 2020 17:00:04 +0000 (17:00 +0000)
committerChris Tallon <chris@vomp.tv>
Tue, 3 Mar 2020 17:00:04 +0000 (17:00 +0000)
defines.h
dvbsubtitles.cc
inputman.cc
main.cc
timers.cc
vvideorec.cc

index d6eed72d7370c5b5e8495dd6414a039d1ffc5634..82dbbafdd915f6445e0f335a0f70f2b8c46bf262 100644 (file)
--- a/defines.h
+++ b/defines.h
@@ -31,11 +31,20 @@ typedef unsigned long long ULLONG;
 
 #define BENCHMARK_FPS
 
+
+// Global useful functions
+
 //ULLONG htonll(ULLONG a);
 //ULLONG ntohll(ULLONG a);
 void MILLISLEEP(ULONG a);
 long long getTimeMS();
 
+#include <string>
+#include <chrono>
+#include <iomanip>
+std::string tp2str(const std::chrono::time_point<std::chrono::system_clock>& tp);
+
+
 int getClockRealTime(struct timespec *tp);
 
 //#define WINDOWS_LEGACY
index db440e91e937bbc54fab7250e920c06830cd183d..4663d13a8d84d47e3d5412341585a0dc30e87b91 100644 (file)
 
 
 #ifdef DVBSDEBUG
-
-// DBG
 #include <stdio.h>
-#include <string>
-#include <chrono>
-#include <iomanip>
-
-std::string tp2str(const std::chrono::time_point<std::chrono::system_clock>& tp)
-{
-  auto tms = std::chrono::time_point_cast<std::chrono::milliseconds>(tp);
-  std::chrono::milliseconds e = tms.time_since_epoch();
-  long long c = e.count();
-  time_t tt = c / 1000;
-  int ttm = c % 1000;
-  auto stm = std::localtime(&tt);
-  std::stringstream ss;
-  ss << std::put_time(stm, "%T") << "." << std::setfill('0') << std::setw(3) << ttm;
-  return ss.str();
-}
-
 #endif
 
-
-
-
+#include "defines.h"
 #include "demuxer.h"
 #include "osdreceiver.h"
 #include "video.h"
index 230df7f6b0969e7a173c7abfc257c065713498e0..5aab2f7507e100be7996746ac56858fb46a65e7e 100644 (file)
@@ -59,9 +59,9 @@ bool InputMan::init()
   i1 = inputLinux->init();
   if (!i1) { delete inputLinux; inputLinux = NULL; }
 
-  inputCEC = new InputCEC();
-  i2 = inputCEC->init();
-  if (!i2) { delete inputCEC; inputCEC = NULL; }
+//  inputCEC = new InputCEC();
+//  i2 = inputCEC->init();
+//  if (!i2) { delete inputCEC; inputCEC = NULL; }
 #endif
 
   inputUDP = new InputUDP();
diff --git a/main.cc b/main.cc
index 65975a2894e4fa2604b280cfe5327623ed08bbce..c6f0c736dd27d8a0bb46af3a0cb5715408cf2226 100644 (file)
--- a/main.cc
+++ b/main.cc
 #include <stdlib.h>
 #include <string.h>
 #include <signal.h>
+
+#include <thread>
+#include <string>
+#include <chrono>
+#include <iomanip>
+
 #ifndef WIN32
-#include <unistd.h>
-#include <endian.h>
+  #include <unistd.h>
+  #include <endian.h>
 #endif
-#include <thread>
 
 #include "defines.h"
 
 #ifdef HANDLE_VT_SWITCHING
-#include <signal.h>
-#include <sys/ioctl.h>
-#include <linux/vt.h>
+  #include <sys/ioctl.h>
+  #include <linux/vt.h>
 #endif
+
 #include "log.h"
 #include "timers.h"
 #include "vdr.h"
 #include "boxstack.h"
 #include "command.h"
+#include "inputman.h"
+#include "wol.h"
+#include "vsleeptimer.h"
 
 #ifdef VOMP_PLATTFORM_NMT
-
-#include "lednmt.h"
-#include "osddirectfb.h"
-#include "audionmt.h"
-#include "videonmt.h"
-
+  #include "lednmt.h"
+  #include "osddirectfb.h"
+  #include "audionmt.h"
+  #include "videonmt.h"
 #endif
 
 #ifdef VOMP_PLATFORM_RASPBERRY
-
-#include "ledraspberry.h"
-#include "osdopenvg.h"
-#include "audioomx.h"
-#include "videoomx.h"
-
+  #include "ledraspberry.h"
+  #include "osdopenvg.h"
+  #include "audioomx.h"
+  #include "videoomx.h"
 #endif
 
-#include "inputman.h"
-#include "wol.h"
-#include "vsleeptimer.h"
 
 
 #ifndef WIN32 // FIXME do we need any if WIN32 stuff in here? windows has own winmain file
@@ -447,6 +448,7 @@ void shutdown(int code)
     delete sleeptimer;
     logger->log("Core", Log::NOTICE, "Sleeptimer module shut down");
   }
+
 #ifdef HANDLE_VT_SWITCHING
   ioctl(fdtty, VT_UNLOCKSWITCH, 1);
   close(fdtty);
@@ -524,3 +526,16 @@ int max(int a, int b)
   if (a > b) return a;
   else return b;
 }
+
+std::string tp2str(const std::chrono::time_point<std::chrono::system_clock>& tp)
+{
+  auto tms = std::chrono::time_point_cast<std::chrono::milliseconds>(tp);
+  std::chrono::milliseconds e = tms.time_since_epoch();
+  long long c = e.count();
+  time_t tt = c / 1000;
+  int ttm = c % 1000;
+  auto stm = std::localtime(&tt);
+  std::stringstream ss;
+  ss << std::put_time(stm, "%T") << "." << std::setfill('0') << std::setw(3) << ttm;
+  return ss.str();
+}
index 7caed9beed3d757570d8a267fa648efc4dad0161..09ffa51fa7eaa7e692f2fbf091de132cbf585428 100644 (file)
--- a/timers.cc
+++ b/timers.cc
@@ -95,18 +95,14 @@ bool Timers::setTimerD(TimerReceiver* client, int clientReference, long int requ
 {
   std::chrono::system_clock::time_point fireTime = std::chrono::system_clock::now();
   fireTime += std::chrono::seconds(requestedSecs);
-  //fireTime += std::chrono::nanoseconds(requestedNSecs);
-  fireTime += std::chrono::duration_cast<std::chrono::seconds>(std::chrono::nanoseconds(requestedNSecs));
-
+  fireTime += std::chrono::nanoseconds(requestedNSecs);
   return setTimerC(client, clientReference, fireTime);
 }
 
 bool Timers::setTimerT(TimerReceiver* client, int clientReference, long int requestedTime, long int requestedTimeNSecs)
 {
   std::chrono::system_clock::time_point fireTime = std::chrono::system_clock::from_time_t(requestedTime);
-  //fireTime += std::chrono::nanoseconds(requestedTimeNSecs);
-  fireTime += std::chrono::duration_cast<std::chrono::seconds>(std::chrono::nanoseconds(requestedTimeNSecs));
-
+  fireTime += std::chrono::nanoseconds(requestedTimeNSecs);
   return setTimerC(client, clientReference, fireTime);
 }
 
index bd080d33ee1c30f21b7e039f121d7590fc7c750e..2e406b85be8b46e45fb38d68d6f7e969dedee102 100644 (file)
@@ -840,16 +840,24 @@ void VVideoRec::doBar(int action_in)
 
   boxstack->update(this, &barRegion);
 
-  if (action_in != -1) {
-         timers->cancelTimer(this, 1);
+  if (action_in != -1)
+  {
+    timers->cancelTimer(this, 1);
 
+    if ((playerState == PlayerVideoRec::S_FFWD) || (playerState == PlayerVideoRec::S_FBWD))
+      barScanHold = true;
+    else
+      barScanHold = false;
 
-         if ((playerState == PlayerVideoRec::S_FFWD) || (playerState == PlayerVideoRec::S_FBWD)) barScanHold = true;
-         else barScanHold = false;
+    if (!barGenHold && !barScanHold && !barVasHold)
+      timers->setTimerD(this, 1, 4);
 
-         if (!barGenHold && !barScanHold && !barVasHold) timers->setTimerD(this, 1, 4);
+      Log::getInstance()->log("VVideoRec", Log::DEBUG, "player state: %i", playerState);
 
-         timers->setTimerD(this, 2, 0, 200000000);
+    if ((playerState == PlayerVideoRec::S_PAUSE_P) || (playerState == PlayerVideoRec::S_PAUSE_I))
+      timers->cancelTimer(this, 2);
+    else
+      timers->setTimerD(this, 2, 0, 200'000'000);
   }
 }
 
@@ -873,7 +881,7 @@ void VVideoRec::timercall(int clientReference)
 #else 
          doBar(-1);
 #endif
-      timers->setTimerD(this, 2, 0, 200000000);
+      timers->setTimerD(this, 2, 0, 200'000'000);
       break;
     }
   }