From 70e677c94a086ec934cf0f89c1f46bdd5f999c73 Mon Sep 17 00:00:00 2001 From: Chris Tallon Date: Fri, 24 Apr 2020 17:06:16 +0100 Subject: [PATCH] 31 CWFs --- region.h | 3 +++ util.cc | 4 ++-- vepgsummary.cc | 6 +++--- vvideorec.cc | 31 +++++++++++++++---------------- vvideorec.h | 2 +- 5 files changed, 24 insertions(+), 22 deletions(-) diff --git a/region.h b/region.h index ee66709..94b93f7 100644 --- 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 f46afdf..550de1f 100644 --- a/util.cc +++ b/util.cc @@ -43,8 +43,8 @@ std::string tp2str(const std::chrono::time_point& tp) auto tms = std::chrono::time_point_cast(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(c / 1000); // when are we going longlong for time_t ? + int ttm = static_cast(c % 1000); auto stm = std::localtime(&tt); std::stringstream ss; ss << std::put_time(stm, "%T") << "." << std::setfill('0') << std::setw(3) << ttm; diff --git a/vepgsummary.cc b/vepgsummary.cc index 42fb17e..a3e5e80 100644 --- a/vepgsummary.cc +++ b/vepgsummary.cc @@ -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(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(boxRed.getWidth()) >= x) && + (boxRed.getY() <= y) && (boxRed.getY() + static_cast(boxRed.getHeight()) >= y)) { BoxStack::getInstance()->handleCommand(Input::RED); cancel = false; } diff --git a/vvideorec.cc b/vvideorec.cc index ebc076e..e64c88e 100644 --- a/vvideorec.cc +++ b/vvideorec.cc @@ -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(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((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((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(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(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(region.framewidth + 1); + float scaley = 576.f / static_cast(region.frameheight + 1); + r.x = static_cast(floor(scalex * static_cast(r.x))); + r.y = static_cast(floor(scaley * static_cast(r.y))); + r.w = static_cast(ceil(scalex * static_cast(r.w)) + 1.f); + r.h = static_cast(ceil(scaley * static_cast(r.h)) + 1.f); rectangle(r, transparent); boxstack->update(this, &r); diff --git a/vvideorec.h b/vvideorec.h index 2a68ee6..a5a6535 100644 --- a/vvideorec.h +++ b/vvideorec.h @@ -73,7 +73,7 @@ class VVideoRec : public Boxx, public TimerReceiver, public OSDReceiver DrawStyle transparent; DrawStyle barBlue; - UCHAR videoMode; + int videoMode; void toggleChopSides(); bool playing{}; -- 2.39.2