From 11284d5c821281b389ea7265beb3263627452e9f Mon Sep 17 00:00:00 2001 From: Chris Tallon Date: Sun, 14 Aug 2022 17:38:48 +0000 Subject: [PATCH] CWFs --- src/colour.h | 4 +-- src/playerradiolive.cc | 12 ++++---- src/vvideorec.cc | 64 +++++++++++++++++++++--------------------- src/wpictureview.cc | 2 +- 4 files changed, 41 insertions(+), 41 deletions(-) diff --git a/src/colour.h b/src/colour.h index 9122f1b..ceadff7 100644 --- a/src/colour.h +++ b/src/colour.h @@ -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; diff --git a/src/playerradiolive.cc b/src/playerradiolive.cc index f7ded9b..5f11f5c 100644 --- a/src/playerradiolive.cc +++ b/src/playerradiolive.cc @@ -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(s.data), s.len); + /*int a =*/ demuxer->put(static_cast(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); diff --git a/src/vvideorec.cc b/src/vvideorec.cc index ebeba5f..b7410ea 100644 --- a/src/vvideorec.cc +++ b/src/vvideorec.cc @@ -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); } } diff --git a/src/wpictureview.cc b/src/wpictureview.cc index f6da1cf..93625c7 100644 --- a/src/wpictureview.cc +++ b/src/wpictureview.cc @@ -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(media.width), static_cast(media.height), banner); } -- 2.39.2