From 8ddd8fbfad1fc7d74600c77b4c5486449e927b22 Mon Sep 17 00:00:00 2001 From: Chris Tallon Date: Wed, 14 Jun 2006 23:17:29 +0000 Subject: [PATCH] Clock on recplayer bar. code deletions from player --- player.cc | 95 ---------------------------------------------------- player.h | 3 -- vvideorec.cc | 35 +++++++++++++------ 3 files changed, 25 insertions(+), 108 deletions(-) diff --git a/player.cc b/player.cc index ad51549..c68eca1 100644 --- a/player.cc +++ b/player.cc @@ -154,22 +154,6 @@ void Player::setLengthFrames(ULONG length) logger->log("Player", Log::DEBUG, "Player has received length frames of %lu", lengthFrames); } -/* -ULLONG Player::getEndTS() // FIXME delme - used only by bar clocks until current frame code is done -{ - long long rendTS = endTS - startTS; - if (rendTS < 0) rendTS += 8589934592ULL; - return (ULLONG)rendTS; -} -*/ - -/* -hmsf Player::getEndHMSF() -{ - return video->framesToHMSF(lengthFrames); -} -*/ - ULONG Player::getLengthFrames() { return lengthFrames; @@ -494,40 +478,6 @@ void Player::unLock() #endif } -/* -void Player::restartAt(ULLONG timecode) -{ - if (paused) togglePauseInt(); - if (ffwd) toggleFastForwardInt(); - - ULONG wantedFrameNumber = video->timecodeToFrameNumber(timecode); - ULLONG newPosition = VDR::getInstance()->positionFromFrameNumber(wantedFrameNumber); - if (!VDR::getInstance()->isConnected()) { doConnectionLost(); return; } - logger->log("Player", Log::DEBUG, "wantedframe %i feedpos %llu goto %llu", wantedFrameNumber, feedPosition, newPosition); - - vfeed.stop(); - afeed.stop(); - threadStop(); - video->stop(); - video->reset(); - audio->reset(); - demuxer->flush(); - if (!isRadio) demuxer->seek(); - feedPosition = newPosition; - demuxer->setFrameNum(wantedFrameNumber); - videoStartup = true; - afeed.start(); - vfeed.start(); - threadStart(); - audio->play(); - video->sync(); - audio->sync(); - audio->systemMuteOff(); - audio->doMuting(); - fbwd = false; -} -*/ - void Player::restartAtFrame(ULONG newFrame) { if (paused) togglePauseInt(); @@ -559,51 +509,6 @@ void Player::restartAtFrame(ULONG newFrame) fbwd = false; } -/* -void Player::setStartTS(UINT dataInBuffer) -{ -#ifndef NEW_DEMUXER - if (isRecording && feedPosition) // (feedPosition != 0) - { - // FIXME find out how much data need to get to find a TS - // Need to get the actual start of the recording - - UINT thisRead; - UCHAR* tempBuffer = VDR::getInstance()->getBlock(0, 100000, &thisRead); - if (!tempBuffer && !VDR::getInstance()->isConnected()) { doConnectionLost(); return; } - if (!tempBuffer) return; - if (thisRead) demuxer->findVideoPTS(tempBuffer, thisRead, &startTS); - free(tempBuffer); - } - else - { - demuxer->findVideoPTS(threadBuffer, dataInBuffer, &startTS); - } -#else - startTS=0; -#endif -} -*/ - -/* -void Player::setEndTS() -{ - logger->log("Player", Log::DEBUG, "Setting end TS"); -#ifndef NEW_DEMUXER - UINT thisRead; - UCHAR* tempBuffer = VDR::getInstance()->getBlock((lengthBytes - 100000), 100000, &thisRead); - if (!tempBuffer && !VDR::getInstance()->isConnected()) { doConnectionLost(); return; } - if (!tempBuffer) return; - if (thisRead) demuxer->findVideoPTS(tempBuffer, thisRead, &endTS); - free(tempBuffer); - #else //The replacement code relias completely on VDRs timecode and not the pts - endTS=video->frameNumberToTimecode( - VDR::getInstance()->frameNumberFromPosition((lengthBytes - 100000))); - #endif - logger->log("Player", Log::DEBUG, "Set end TS"); -} -*/ - void Player::doConnectionLost() { Message* m = new Message(); diff --git a/player.h b/player.h index 92d3efa..59826bb 100644 --- a/player.h +++ b/player.h @@ -66,8 +66,6 @@ class Player : public Thread_TYPE, public Callback bool isFbwd() { return fbwd; } ULONG getCurrentFrameNum(); ULONG getLengthFrames(); -// ULLONG getEndTS(); -// hmsf getEndHMSF(); void call(void*); // for callback interface @@ -92,7 +90,6 @@ class Player : public Thread_TYPE, public Callback void setEndTS(); void doConnectionLost(); -// void restartAt(ULLONG timeCode); void restartAtFrame(ULONG newFrame); MessageQueue* commandMessageQueue; diff --git a/vvideorec.cc b/vvideorec.cc index 55cca71..6dd80cd 100644 --- a/vvideorec.cc +++ b/vvideorec.cc @@ -69,7 +69,7 @@ VVideoRec::VVideoRec(Recording* rec) barRegion.w = video->getScreenWidth(); barRegion.h = 66; - clocksRegion.x = barRegion.x + 160; + clocksRegion.x = barRegion.x + 140; clocksRegion.y = barRegion.y + 12; clocksRegion.w = 170; clocksRegion.h = surface->getFontHeight(); @@ -395,18 +395,33 @@ void VVideoRec::drawBarClocks() drawText(buffer, clocksRegion.x, clocksRegion.y, Colour::LIGHTTEXT); - // Draw progress bar - rectangle(barRegion.x + 350, barRegion.y + 12, 310, 24, Colour::LIGHTTEXT); - rectangle(barRegion.x + 352, barRegion.y + 14, 306, 20, barBlue); + // Draw clock + // Blank the area first + rectangle(barRegion.x + 624, barRegion.y + 12, 60, 30, barBlue); + char timeString[20]; + time_t t; + time(&t); + struct tm* tms = localtime(&t); + strftime(timeString, 19, "%H:%M", tms); + drawText(timeString, barRegion.x + 624, barRegion.y + 12, Colour::LIGHTTEXT); + + + + + + + // Draw progress bar + int progBarXbase = barRegion.x + 300; -// if ((currentTS > 95441) || (!endTS)) return; // No values yet + rectangle(barRegion.x + progBarXbase, barRegion.y + 12, 310, 24, Colour::LIGHTTEXT); + rectangle(barRegion.x + progBarXbase + 2, barRegion.y + 14, 306, 20, barBlue); double progress01 = (double)currentFrameNum / (double)lengthFrames; // total width of bar = 302 int progressWidth = (int)(302 * progress01); - rectangle(barRegion.x + 354, barRegion.y + 16, progressWidth, 16, Colour::SELECTHIGHLIGHT); + rectangle(barRegion.x + progBarXbase + 4, barRegion.y + 16, progressWidth, 16, Colour::SELECTHIGHLIGHT); // Now calc position for start margin blips double pos01; @@ -415,14 +430,14 @@ void VVideoRec::drawBarClocks() pos01 = (startMargin * video->getFPS()) / (double)lengthFrames; posPix = (int)(302 * pos01); - rectangle(barRegion.x + 352 + posPix, barRegion.y + 12 - 2, 2, 2, Colour::LIGHTTEXT); - rectangle(barRegion.x + 352 + posPix, barRegion.y + 12 + 24, 2, 2, Colour::LIGHTTEXT); + rectangle(barRegion.x + progBarXbase + 2 + posPix, barRegion.y + 12 - 2, 2, 2, Colour::LIGHTTEXT); + rectangle(barRegion.x + progBarXbase + 2 + posPix, barRegion.y + 12 + 24, 2, 2, Colour::LIGHTTEXT); pos01 = (lengthFrames - (endMargin * video->getFPS())) / (double)lengthFrames; posPix = (int)(302 * pos01); - rectangle(barRegion.x + 352 + posPix, barRegion.y + 12 - 2, 2, 2, Colour::LIGHTTEXT); - rectangle(barRegion.x + 352 + posPix, barRegion.y + 12 + 24, 2, 2, Colour::LIGHTTEXT); + rectangle(barRegion.x + progBarXbase + 2 + posPix, barRegion.y + 12 - 2, 2, 2, Colour::LIGHTTEXT); + rectangle(barRegion.x + progBarXbase + 2 + posPix, barRegion.y + 12 + 24, 2, 2, Colour::LIGHTTEXT); } void VVideoRec::removeBar() -- 2.39.2