]> git.vomp.tv Git - vompclient.git/commitdiff
31 CWFs
authorChris Tallon <chris@vomp.tv>
Fri, 24 Apr 2020 16:06:16 +0000 (17:06 +0100)
committerChris Tallon <chris@vomp.tv>
Fri, 24 Apr 2020 16:06:16 +0000 (17:06 +0100)
region.h
util.cc
vepgsummary.cc
vvideorec.cc
vvideorec.h

index ee667095d66bb301a77c9edb7022878d49e386c2..94b93f7aaf714f411ba5155fae4e6a7d9a792d5e 100644 (file)
--- a/region.h
+++ b/region.h
@@ -26,6 +26,9 @@
 class Region
 {
   public:
+    Region() = default;
+    Region(UINT ix, UINT iy, UINT iw, UINT ih) : x(ix), y(iy), w(iw), h(ih) {}
+
     bool overlappedBy(Region& doesthisOverlap);
     Region subtract(Region& other);
     Region operator + (Region& other);
diff --git a/util.cc b/util.cc
index f46afdf67cf4e1db1bd5e662e665fc58e6e3647c..550de1fc47611c33316ccf93053952e23b536924 100644 (file)
--- a/util.cc
+++ b/util.cc
@@ -43,8 +43,8 @@ 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;
+  time_t tt = static_cast<long>(c / 1000); // when are we going longlong for time_t ?
+  int ttm = static_cast<int>(c % 1000);
   auto stm = std::localtime(&tt);
   std::stringstream ss;
   ss << std::put_time(stm, "%T") << "." << std::setfill('0') << std::setw(3) << ttm;
index 42fb17e5e441808396733c2652880f64407cc9a3..a3e5e80ef9f770d521aefc6aec79ac1207921bea 100644 (file)
@@ -127,7 +127,7 @@ VEpgSummary::VEpgSummary(Event *tevent, Channel* tchannel)
   }
 
   epgTVmedia.setPosition(summary->getRegionR().w-130-10,0);
-  epgTVmedia.setSize(130,(UINT)(195/Osd::getInstance()->getPixelAspect()));
+  epgTVmedia.setSize(130, static_cast<UINT>(195 / Osd::getInstance()->getPixelAspect()));
   summary->add(&epgTVmedia);
   if (movieview) movieview->add(&epgTVmedia);
   if (seriesview) seriesview->add(&epgTVmedia);
@@ -217,8 +217,8 @@ void VEpgSummary::processMessage(Message* m)
                int x = m->parameter - getScreenX();
                int y = m->tag - getScreenY();
 
-               if ((boxRed.getX() <= x) && (boxRed.getX() + (int)boxRed.getWidth() >= x) &&
-                               (boxRed.getY() <= y) && (boxRed.getY() + (int)boxRed.getHeight() >= y)) {
+               if ((boxRed.getX() <= x) && (boxRed.getX() + static_cast<int>(boxRed.getWidth()) >= x) &&
+                               (boxRed.getY() <= y) && (boxRed.getY() + static_cast<int>(boxRed.getHeight()) >= y)) {
                        BoxStack::getInstance()->handleCommand(Input::RED);
                        cancel = false;
                }
index ebc076ed1c10ba82f85b3989d122982991478552..e64c88e510cac2c69742c958ada1404e0b72bf71 100644 (file)
@@ -59,7 +59,7 @@ VVideoRec::VVideoRec(Recording* rec, bool ish264)
   player = new PlayerVideoRec(Control::getInstance(), this, this);
   player->init(myRec->IsPesRecording,myRec->recInfo->fps);
 
-  char* cstartMargin = vdr->configLoad("Timers", "Start margin");
+  char* cstartMargin = vdr->configLoad("Timers", "Start margin"); // NCONFIG
   char* cendMargin = vdr->configLoad("Timers", "End margin");
   if (!cstartMargin)
   {
@@ -299,7 +299,7 @@ int VVideoRec::handleCommand(int command)
         // skip to previous mark
         Log* logger = Log::getInstance();
         int currentFrame = (player->getCurrentFrameNum()); // get current Frame
-        currentFrame -= (int)(5. * myRec->recInfo->fps); // subtrack 5 seconds, else you cannot skip more than once back ..
+        currentFrame -= static_cast<int>(5 * myRec->recInfo->fps); // subtrack 5 seconds, else you cannot skip more than once back ..
 
         int prevMark = myRec->getPrevMark(currentFrame); // find previous Frame
         if (prevMark)
@@ -468,7 +468,7 @@ void VVideoRec::processMessage(Message* m)
         {
           // chasing playback
           // Work out an approximate length in frames (good to 1s...)
-                       lengthFrames = (ULONG)((double)(myRec->recInfo->timerEnd - myRec->recInfo->timerStart) * myRec->recInfo->fps);
+          lengthFrames = static_cast<ULONG>((myRec->recInfo->timerEnd - myRec->recInfo->timerStart) * myRec->recInfo->fps);
         }
         else
         {
@@ -500,7 +500,7 @@ void VVideoRec::processMessage(Message* m)
           && y<=barRegion.y + 12 - 2+28)
       {
         int cx=x-(barRegion.x + progBarXbase + 4);
-        double percent=((double)cx)/302.*100.;
+        double percent = cx / 302. * 100.;
         player->jumpToPercent(percent);
         doBar(3);
         return;
@@ -932,7 +932,7 @@ void VVideoRec::drawBarClocks()
   {
     // chasing playback
     // Work out an approximate length in frames (good to 1s...)
-    lengthFrames =(ULONG) ((double)(myRec->recInfo->timerEnd - myRec->recInfo->timerStart) * myRec->recInfo->fps);
+    lengthFrames = static_cast<ULONG>((myRec->recInfo->timerEnd - myRec->recInfo->timerStart) * myRec->recInfo->fps);
   }
   else
   {
@@ -976,7 +976,7 @@ void VVideoRec::drawBarClocks()
 
   if (myRec->recInfo->timerEnd > time(NULL)) // if chasing
   {
-    int nrWidth = (int)(302 * ((double)(lengthFrames - player->getLengthFrames()) / lengthFrames));
+    int nrWidth = 302 * (lengthFrames - player->getLengthFrames()) / lengthFrames;
 
     Log::getInstance()->log("GVASDF", Log::DEBUG, "Length Frames: %lu", lengthFrames);
     Log::getInstance()->log("GVASDF", Log::DEBUG, "Player lf: %lu", player->getLengthFrames());
@@ -1009,12 +1009,12 @@ void VVideoRec::drawBarClocks()
   {
     // Draw blips where start and end margins probably are
 
-         posPix =(int) (302. * myRec->recInfo->fps * ((double)startMargin) /((double) lengthFrames));
+    posPix = static_cast<int>(302 * startMargin * myRec->recInfo->fps / lengthFrames);
 
     rectangle(barRegion.x + progBarXbase + 2 + posPix, barRegion.y + 12 - 2, 2, 2, DrawStyle::LIGHTTEXT);
     rectangle(barRegion.x + progBarXbase + 2 + posPix, barRegion.y + 12 + 24, 2, 2, DrawStyle::LIGHTTEXT);
 
-    posPix = (int)(302. * ((double)lengthFrames - ((double)endMargin) * myRec->recInfo->fps) / ((double)lengthFrames));
+    posPix   = static_cast<int>(302 * (lengthFrames - endMargin * myRec->recInfo->fps) / lengthFrames);
 
     rectangle(barRegion.x + progBarXbase + 2 + posPix, barRegion.y + 12 - 2, 2, 2, DrawStyle::LIGHTTEXT);
     rectangle(barRegion.x + progBarXbase + 2 + posPix, barRegion.y + 12 + 24, 2, 2, DrawStyle::LIGHTTEXT);
@@ -1088,15 +1088,14 @@ void VVideoRec::clearOSD()
 
 void VVideoRec::clearOSDArea(UINT posX, UINT posY, UINT width, UINT height, const DisplayRegion& region)
 {
-  Region r;
-  r.x = posX+region.windowx; r.y = posY+region.windowy; r.w = width; r.h = height;
+  Region r(r.x = posX + region.windowx, posY + region.windowy, width, height);
   //now convert to our display
-  float scalex=720.f/((float) (region.framewidth+1));
-  float scaley=576.f/((float) (region.frameheight+1));
-  r.x=(UINT)floor(scalex*((float)r.x));
-  r.y=(UINT)floor(scaley*((float)r.y));
-  r.w=(UINT)(ceil(scalex*((float)r.w))+1.f);
-  r.h=(UINT)(ceil(scaley*((float)r.h))+1.f);
+  float scalex = 720.f / static_cast<float>(region.framewidth + 1);
+  float scaley = 576.f / static_cast<float>(region.frameheight + 1);
+  r.x = static_cast<UINT>(floor(scalex * static_cast<float>(r.x)));
+  r.y = static_cast<UINT>(floor(scaley * static_cast<float>(r.y)));
+  r.w = static_cast<UINT>(ceil(scalex * static_cast<float>(r.w)) + 1.f);
+  r.h = static_cast<UINT>(ceil(scaley * static_cast<float>(r.h)) + 1.f);
 
   rectangle(r, transparent);
   boxstack->update(this, &r);
index 2a68ee6dedb0131b6d30abf1fcb7cca83d388f24..a5a65355b5789ed2f35c31c133d8f6be807eae05 100644 (file)
@@ -73,7 +73,7 @@ class VVideoRec : public Boxx, public TimerReceiver, public OSDReceiver
     DrawStyle transparent;
     DrawStyle barBlue;
 
-    UCHAR videoMode;
+    int videoMode;
     void toggleChopSides();
 
     bool playing{};