]> git.vomp.tv Git - vompclient.git/commitdiff
CWFs
authorChris Tallon <chris@vomp.tv>
Sun, 14 Aug 2022 17:38:48 +0000 (17:38 +0000)
committerChris Tallon <chris@vomp.tv>
Sun, 14 Aug 2022 17:38:48 +0000 (17:38 +0000)
src/colour.h
src/playerradiolive.cc
src/vvideorec.cc
src/wpictureview.cc

index 9122f1bafcfd195b42e9137490f601a337e38b8c..ceadff77d674132bebf1ae0af49c08a91362eac4 100644 (file)
@@ -48,9 +48,9 @@ class Colour
     void set(int Tred, int Tgreen, int Tblue, int Talpha)
     { red = Tred; green = Tgreen; blue = Tblue; alpha = Talpha; }
 
-    inline unsigned long rgba() const
+    inline u4 rgba() const
     {
-      return (alpha << 24) | (red << 16) | (green << 8) | blue;
+      return tou4((alpha << 24) | (red << 16) | (green << 8) | blue);
     }
 
     int red;
index f7ded9b5d11962bf09bad600d6a0e8dd2efb5825..5f11f5c21296bc93dafae1087e4f2b3280253c50 100644 (file)
@@ -226,7 +226,7 @@ void PlayerRadioLive::chunkToDemuxer()
   StreamChunk s = streamChunks.front();
   streamChunks.pop();
   //logger->debug(TAG, "About to call demuxer with {} {}", (void*)s.data, s.len);
-  /*int a =*/ demuxer->put(static_cast<u1*>(s.data), s.len);
+  /*int a =*/ demuxer->put(static_cast<u1*>(s.data), toi4(s.len));
   //logger->debug(TAG, "put {} to demuxer", a);
   free(s.data);  
 }
@@ -427,9 +427,9 @@ void PlayerRadioLive::threadMethod()
             u4 j = 0;
             while (j < chan->numAPids && !found)
             {
-              if (Audio::getInstance()->streamTypeSupported(chan->apids[j].type))
+              if (Audio::getInstance()->streamTypeSupported(toi4(chan->apids[j].type)))
               {
-                demuxer->setAID(chan->apids[j].pid, 0, chan->apids[j].type, true);
+                demuxer->setAID(toi4(chan->apids[j].pid), 0, toi4(chan->apids[j].type), true);
                 audio->setStreamType(Audio::MPEG2_PES);
                 logger->debug(TAG, "Demuxer pids: {} {} {}", chan->vpid, chan->apids[j].pid, chan->apids[j].type);
                 found = true;
@@ -445,9 +445,9 @@ void PlayerRadioLive::threadMethod()
               u4 j = 0;
               while (j < chan->numDPids && !found)
               {
-                if (Audio::getInstance()->streamTypeSupported(chan->dpids[j].type))
+                if (Audio::getInstance()->streamTypeSupported(toi4(chan->dpids[j].type)))
                 {
-                  demuxer->setAID(chan->dpids[j].pid, 1, chan->dpids[j].type, true);
+                  demuxer->setAID(toi4(chan->dpids[j].pid), 1, toi4(chan->dpids[j].type), true);
                   audio->setStreamType(Audio::MPEG2_PES);
                   logger->debug(TAG, "Demuxer pids: {} {} (ac3) {}", chan->vpid, chan->dpids[j].pid, chan->dpids[j].type);
                   found=true;
@@ -489,7 +489,7 @@ void PlayerRadioLive::threadMethod()
       if (state == S_PREBUFFERING)
       {
         ++preBufferCount;
-        u4 percentDone = (preBufferCount * 100) / preBufferAmount;
+        u4 percentDone = tou4((preBufferCount * 100) / preBufferAmount);
 
         logger->debug(TAG, "Prebuffering {}%", percentDone);
         
index ebeba5f688b6b4e414ee66c19011bcc0c0b56479..b7410ea11296884fa6ba745e1687dad0b775a826 100644 (file)
@@ -70,7 +70,7 @@ VVideoRec::VVideoRec(Recording* rec, bool ish264)
   }
   else
   {
-    startMargin = atoi(cstartMargin) * 60;
+    startMargin = tou4(atoi(cstartMargin)) * 60;
     delete[] cstartMargin;
   }
 
@@ -80,7 +80,7 @@ VVideoRec::VVideoRec(Recording* rec, bool ish264)
   }
   else
   {
-    endMargin = atoi(cendMargin) * 60;
+    endMargin = tou4(atoi(cendMargin)) * 60;
     delete[] cendMargin;
   }
 
@@ -104,7 +104,7 @@ VVideoRec::VVideoRec(Recording* rec, bool ish264)
   clocksRegion.x = barRegion.x + 140;
   clocksRegion.y = barRegion.y + 12;
   clocksRegion.w = 170;
-  clocksRegion.h = getFontHeight();
+  clocksRegion.h = tou4(getFontHeight());
 //  barBlue.set(0, 0, 150, 150);
   barBlue.set(0, 0, 0, 128);
 
@@ -304,7 +304,7 @@ int VVideoRec::handleCommand(int command)
       {
         // skip to previous mark
         LogNT* logger = LogNT::getInstance();
-        int currentFrame = (player->getCurrentFrameNum()); // get current Frame
+        i4 currentFrame = toi4(player->getCurrentFrameNum()); // get current Frame
         currentFrame -= toi4(5 * myRec->recInfo->fps); // subtrack 5 seconds, else you cannot skip more than once back ..
 
         int prevMark = myRec->getPrevMark(currentFrame); // find previous Frame
@@ -328,9 +328,9 @@ int VVideoRec::handleCommand(int command)
       {
         // skip to next mark
         LogNT* logger = LogNT::getInstance();
-        int currentFrame = (player->getCurrentFrameNum());
+        i4 currentFrame = toi4(player->getCurrentFrameNum());
 
-        int nextMark = myRec->getNextMark(currentFrame);
+        i4 nextMark = myRec->getNextMark(currentFrame);
 
         if (nextMark)
         {
@@ -453,8 +453,8 @@ void VVideoRec::processMessage(Message* m)
 
   if (m->message == Message::MOUSE_LBDOWN)
   {
-    u4 x = m->parameter - getScreenX();
-    u4 y = m->tag - getScreenY();
+    u4 x = m->parameter - tou4(getScreenX());
+    u4 y = m->tag - tou4(getScreenY());
 
     if (!barShowing)
     {
@@ -462,7 +462,7 @@ void VVideoRec::processMessage(Message* m)
     }
     else if (barRegion.x<=x && barRegion.y<=y && (barRegion.x+barRegion.w)>=x && (barRegion.y+barRegion.h)>=y)
     {
-      int progBarXbase = barRegion.x + 300;
+      int progBarXbase = toi4(barRegion.x) + 300;
       if (myRec->hasMarks())
       {
         MarkList* markList = myRec->getMarkList();
@@ -485,10 +485,10 @@ void VVideoRec::processMessage(Message* m)
           loopMark = *i;
           if (loopMark->pos)
           {
-            posPix = 302 * loopMark->pos / lengthFrames;
-            rectangle(barRegion.x + progBarXbase + 2 + posPix, barRegion.y + 12 - 2, 3, 28, DrawStyle::DANGER);
-            if (x>=barRegion.x + progBarXbase + 2 + posPix
-                && x<=barRegion.x + progBarXbase + 2 + posPix+3
+            posPix = 302 * loopMark->pos / toi4(lengthFrames);
+            rectangle(barRegion.x + tou4(progBarXbase) + 2 + tou4(posPix), barRegion.y + 12 - 2, 3, 28, DrawStyle::DANGER);
+            if (x>=barRegion.x + tou4(progBarXbase) + 2 + tou4(posPix)
+                && x<=barRegion.x + tou4(progBarXbase) + 2 + tou4(posPix)+3
                 && y>=barRegion.y + 12 - 2
                 && y<=barRegion.y + 12 - 2+28)
             {
@@ -500,12 +500,12 @@ void VVideoRec::processMessage(Message* m)
         }
       }
 
-      if (x>=barRegion.x + progBarXbase + 24
-          && x<=barRegion.x + progBarXbase + 4 + 302
+      if (x >= barRegion.x + tou4(progBarXbase) + 24
+          && x<=barRegion.x + tou4(progBarXbase) + 4 + 302
           && y>=barRegion.y + 12 - 2
           && y<=barRegion.y + 12 - 2+28)
       {
-        int cx=x-(barRegion.x + progBarXbase + 4);
+        int cx = toi4(x) - (toi4(barRegion.x) + progBarXbase + 4);
         double percent = cx / 302. * 100.;
         player->jumpToPercent(percent);
         doBar(3);
@@ -838,7 +838,7 @@ void VVideoRec::doBar(int action_in)
     {
       char text[5];
       SNPRINTF(text, 5, "%ux", scanrate);
-      drawText(text, barRegion.x + 102, barRegion.y + 12, DrawStyle::LIGHTTEXT);
+      drawText(text, toi4(barRegion.x) + 102, toi4(barRegion.y) + 12, DrawStyle::LIGHTTEXT);
     }
   }
 
@@ -925,7 +925,7 @@ void VVideoRec::drawBarClocks()
   struct tm tms;
   LOCALTIME_R(&t, &tms);
   strftime(timeString, 19, "%H:%M", &tms);
-  drawText(timeString, barRegion.x + 624, barRegion.y + 12, DrawStyle::LIGHTTEXT);
+  drawText(timeString, toi4(barRegion.x) + 624, toi4(barRegion.y) + 12, DrawStyle::LIGHTTEXT);
 
   // Draw clocks
 #ifndef GRADIENT_DRAWING
@@ -959,7 +959,7 @@ void VVideoRec::drawBarClocks()
     logger->debug(TAG, buffer);
   }
 
-  drawText(buffer, clocksRegion.x, clocksRegion.y, DrawStyle::LIGHTTEXT);
+  drawText(buffer, toi4(clocksRegion.x), toi4(clocksRegion.y), DrawStyle::LIGHTTEXT);
 
 
 
@@ -968,26 +968,26 @@ void VVideoRec::drawBarClocks()
 
 
   // Draw progress bar
-  int progBarXbase = barRegion.x + 300;
+  int progBarXbase = toi4(barRegion.x) + 300;
 
-  rectangle(barRegion.x + progBarXbase, barRegion.y + 12, 310, 24, DrawStyle::LIGHTTEXT);
-  rectangle(barRegion.x + progBarXbase + 2, barRegion.y + 14, 306, 20, barBlue);
+  rectangle(barRegion.x + tou4(progBarXbase), barRegion.y + 12, 310, 24, DrawStyle::LIGHTTEXT);
+  rectangle(barRegion.x + tou4(progBarXbase) + 2, barRegion.y + 14, 306, 20, barBlue);
 
   if (currentFrameNum > lengthFrames) return;
   if (lengthFrames == 0) return;
 
   // Draw yellow portion
-  int progressWidth = 302 * currentFrameNum / lengthFrames;
-  rectangle(barRegion.x + progBarXbase + 4, barRegion.y + 16, progressWidth, 16, DrawStyle::SELECTHIGHLIGHT);
+  int progressWidth = toi4(302 * currentFrameNum / lengthFrames);
+  rectangle(barRegion.x + tou4(progBarXbase) + 4, barRegion.y + 16, tou4(progressWidth), 16, DrawStyle::SELECTHIGHLIGHT);
 
   if (myRec->recInfo->timerEnd > time(NULL)) // if chasing
   {
-    int nrWidth = 302 * (lengthFrames - player->getLengthFrames()) / lengthFrames;
+    int nrWidth = toi4(302 * (lengthFrames - player->getLengthFrames()) / lengthFrames);
 
     LogNT::getInstance()->debug("GVASDF", "Length Frames: {}", lengthFrames);
     LogNT::getInstance()->debug("GVASDF", "Player lf: {}", player->getLengthFrames());
     LogNT::getInstance()->debug("GVASDF", "NR WDITH: {}", nrWidth);
-    rectangle(barRegion.x + progBarXbase + 4 + 302 - nrWidth, barRegion.y + 16, nrWidth, 16, DrawStyle::RED);
+    rectangle(barRegion.x + tou4(progBarXbase) + 4 + 302 - tou4(nrWidth), barRegion.y + 16, tou4(nrWidth), 16, DrawStyle::RED);
   }
 
   int posPix;
@@ -1006,8 +1006,8 @@ void VVideoRec::drawBarClocks()
       if (loopMark->pos)
       {
         logger->debug(TAG, "Drawing mark at frame {}", loopMark->pos);
-        posPix = 302 * loopMark->pos / lengthFrames;
-        rectangle(barRegion.x + progBarXbase + 2 + posPix, barRegion.y + 12 - 2, 3, 28, DrawStyle::DANGER);
+        posPix = 302 * loopMark->pos / toi4(lengthFrames);
+        rectangle(barRegion.x + tou4(progBarXbase) + 2 + tou4(posPix), barRegion.y + 12 - 2, 3, 28, DrawStyle::DANGER);
       }
     }
   }
@@ -1017,13 +1017,13 @@ void VVideoRec::drawBarClocks()
 
     posPix = toi4(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);
+    rectangle(barRegion.x + tou4(progBarXbase) + 2 + tou4(posPix), barRegion.y + 12 - 2, 2, 2, DrawStyle::LIGHTTEXT);
+    rectangle(barRegion.x + tou4(progBarXbase) + 2 + tou4(posPix), barRegion.y + 12 + 24, 2, 2, DrawStyle::LIGHTTEXT);
 
     posPix   = toi4(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);
+    rectangle(barRegion.x + tou4(progBarXbase) + 2 + tou4(posPix), barRegion.y + 12 - 2, 2, 2, DrawStyle::LIGHTTEXT);
+    rectangle(barRegion.x + tou4(progBarXbase) + 2 + tou4(posPix), barRegion.y + 12 + 24, 2, 2, DrawStyle::LIGHTTEXT);
   }
 }
 
index f6da1cf6c50d0296f09bddcb0acb004ced97a3f3..93625c7a8b606a2e367ba6c9fdc3fa75401d0b46 100644 (file)
@@ -261,5 +261,5 @@ void WArtworkGallery::addTVMedias(TVMedias& medias, bool banner)
 void WArtworkGallery::addTVMedia(TVMediaStruct& media, bool banner)
 {
        if (media.width)
-               addPicture(media.image, media.width, media.height, banner);
+               addPicture(media.image, static_cast<float>(media.width), static_cast<float>(media.height), banner);
 }