From 41d616a1fbe21b047619e68c690e878653a78330 Mon Sep 17 00:00:00 2001 From: Chris Tallon Date: Sun, 11 Jun 2006 20:18:59 +0000 Subject: [PATCH] Major switch to frame number navigation --- player.cc | 41 ++++++++++++-------- player.h | 11 +++--- readme.win | 105 +++++++++++++++++++++++++++++++++++++++++++++++++++ video.cc | 6 +++ video.h | 1 + vvideorec.cc | 41 ++++++++------------ 6 files changed, 158 insertions(+), 47 deletions(-) create mode 100644 readme.win diff --git a/player.cc b/player.cc index 82c28f3..66a31d1 100644 --- a/player.cc +++ b/player.cc @@ -39,8 +39,8 @@ Player::Player(MessageQueue* messageQueue, bool tIsRecording, bool tIsRadio) feedPosition = 0; feedMode = MODE_NORMAL; lastRescan = 0; - startTS = 0; - endTS = 0; +// startTS = 0; +// endTS = 0; videoStartup = false; preBuffering = false; @@ -146,24 +146,31 @@ 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); } +*/ -ULLONG Player::getPositionTS() // used internall (skip fw/bw) +ULONG Player::getLengthFrames() { - if (startup) return 0ULL; - long long currentTS = video->getCurrentTimestamp() - startTS; - if (currentTS < 0) currentTS += 8589934592ULL; - return (ULLONG)currentTS; + return lengthFrames; +} + +ULONG Player::getCurrentFrameNum() +{ + if (startup) return 0; + return demuxer->getFrameNumFromPTS(video->getCurrentTimestamp()); } // ----------------------------------- Externally called events @@ -433,21 +440,21 @@ void Player::toggleFastBackwardInt() void Player::skipForwardInt(int seconds) { logger->log("Player", Log::DEBUG, "SKIP FORWARD %i SECONDS", seconds); - restartAt(getPositionTS() + (seconds * 90000)); + restartAtFrame(getCurrentFrameNum() + (seconds * video->getFPS())); } void Player::skipBackwardInt(int seconds) { logger->log("Player", Log::DEBUG, "SKIP BACKWARD %i SECONDS", seconds); - long long newTimeCode = getPositionTS() - (seconds * 90000); - if (newTimeCode < 0) newTimeCode = 0; - restartAt(newTimeCode); + long newFrameNum = getCurrentFrameNum() + (seconds * video->getFPS()); + if (newFrameNum < 0) newFrameNum = 0; + restartAt(newFrameNum); } void Player::jumpToPercentInt(int percent) { logger->log("Player", Log::DEBUG, "JUMP TO %i%%", percent); - ULONG newFrame = (ULONG)(((float)percent / 100) * lengthFrames); + ULONG newFrame = percent * lengthFrames / 100; restartAtFrame(newFrame); } @@ -538,6 +545,7 @@ void Player::restartAtFrame(ULONG newFrame) fbwd = false; } +/* void Player::setStartTS(UINT dataInBuffer) { #ifndef NEW_DEMUXER @@ -561,7 +569,9 @@ void Player::setStartTS(UINT dataInBuffer) startTS=0; #endif } +*/ +/* void Player::setEndTS() { logger->log("Player", Log::DEBUG, "Setting end TS"); @@ -578,6 +588,7 @@ void Player::setEndTS() #endif logger->log("Player", Log::DEBUG, "Set end TS"); } +*/ void Player::doConnectionLost() { @@ -664,7 +675,7 @@ void Player::threadMethod() if (!vdr->isConnected()) { doConnectionLost(); return; } logger->log("Player", Log::DEBUG, "Rescanned and reset length: %llu", lengthBytes); lastRescan = time(NULL); - setEndTS(); +// setEndTS(); } if (lengthBytes) // is playing a recording @@ -712,9 +723,9 @@ void Player::threadMethod() demuxer->setAudioStream(a_stream); logger->log("Player", Log::DEBUG, "Startup Audio stream chosen %x", a_stream); - setStartTS(thisRead); +// setStartTS(thisRead); - if (isRecording) setEndTS(); +// if (isRecording) setEndTS(); startup = false; } diff --git a/player.h b/player.h index 96e599e..cf25d4e 100644 --- a/player.h +++ b/player.h @@ -64,9 +64,10 @@ class Player : public Thread_TYPE, public Callback bool isPaused() { return paused; } bool isFfwd() { return ffwd; } bool isFbwd() { return fbwd; } - ULLONG getPositionTS(); - ULLONG getEndTS(); - hmsf getEndHMSF(); + ULONG getCurrentFrameNum(); + ULONG getLengthFrames(); +// ULLONG getEndTS(); +// hmsf getEndHMSF(); void call(void*); // for callback interface @@ -89,7 +90,6 @@ class Player : public Thread_TYPE, public Callback void skipForwardInt(int seconds); void skipBackwardInt(int seconds); - void setStartTS(UINT dataInBuffer); void setEndTS(); void doConnectionLost(); void restartAt(ULLONG timeCode); @@ -118,8 +118,7 @@ class Player : public Thread_TYPE, public Callback void lock(); void unLock(); - ULLONG startTS; - ULLONG endTS; +// ULLONG endTS; ULLONG lengthBytes; ULONG lengthFrames; ULLONG feedPosition; diff --git a/readme.win b/readme.win new file mode 100644 index 0000000..d487b4c --- /dev/null +++ b/readme.win @@ -0,0 +1,105 @@ +Readme For Windows Port of Vomp-Client +====================================== + +This file contains notes regarding the Windows port of Vomp. +Please read it carefully. + +License and Homepage +==================== + +The source code of vomp client is released under the General Public License (GPL). +For further information consult the vomp homepage: +http://www.loggytronic.com +or vomp on SourceForge (including the source code on cvs): +http://sourceforge.net/projects/vomp + +Requirements +============ + +The vomp client on Windows requires: + +* Windows 2000 or later +* A DirectShow MPEG2 decoder, which supports Video Mixing Renderer 9 (VMR-9), + mostly included within DVD software player +* A network connection to the vompserver computer + +Compatibility List for MPEG2 Decoders +===================================== + +Compatible MPEG2 decoders: +* Cyberlink PowerDVD 6 + +Incompatible MPEG2 decoders: +* Cyperlink PowerDVD 4 + +This list will be extended, please report success or failure with your decoder +at the forum at http://www.loggytronic.com . + +Remote Control Buttons Reference +================================ + +This table shows the Hauppauge MediaMVP remote control buttons and their +corresponding Windows keyboard assignments: + +MediaMVP Button | Keyboard Shortcut +----------------*------------------ +VOLUMEUP | F10 +VOLUMEDOWN | F9 +CHANNELUP | "+", Ctrl+"+", Page down +CHANNELDOWN | Insert, Ctrl+Insert, Page up +0 | 0 +1 | 1 +2 | 2 +3 | 3 +4 | 4 +5 | 5 +6 | 6 +7 | 7 +8 | 8 +9 | 9 +POWER | Esc, Alt+F4 +GO | j +BACK | Backspace +MENU | m +RED | r +GREEN | g +YELLOW | y +BLUE | b +MUTE | F8 +RADIO | Not implemented +REVERSE | Not implemented (Can work on Remote Controls) +PLAY | Shift + P +FORWARD | Shift + F +RECORD | Ctrl + R +STOP | Ctrl + S +PAUSE | Ctrl + P +SKIPBACK | Ctrl + B +SKIPFORWARD | Ctrl + F +OK | Space, Return +FULL | Not implemented +TV | Not implemented +VIDEOS | Not implemented +MUSIC | Not implemented +PICTURES | Not implemented +GUIDE | Not implemented +UP | UP +DOWN | DOWN +LEFT | LEFT +RIGHT | RIGHT +PREVCHANNEL | Not implemented +STAR | * +HASH | Not implemented + +(Note: Remote Controls for Windows should work also for most buttons, +but this is an yet untested feature.) + +Usage +===== +Start the client executable and enjoy, you should not have to configure +anything if you met the requirements above. + +Firewall +======== +If vomp for Windows stops at "Locating server" or "Connecting to VDR", +please configure your firewall so that vomp for windows can communicate +with the vompserver on port 3024 (UDP and TCP). diff --git a/video.cc b/video.cc index d01bbf1..3cbb603 100644 --- a/video.cc +++ b/video.cc @@ -74,3 +74,9 @@ hmsf Video::framesToHMSF(ULONG frames) } return ret; } + +UINT Video::getFPS() +{ + if (format == NTSC) return 30; + else return 25; +} diff --git a/video.h b/video.h index 7f54b95..660e3e9 100644 --- a/video.h +++ b/video.h @@ -85,6 +85,7 @@ class Video: public DrainTarget UCHAR getTVsize() { return tvsize; } hmsf framesToHMSF(ULONG frames); + UINT getFPS(); // Video formats - AV_SET_VID_DISP_FMT const static UCHAR NTSC = 0; diff --git a/vvideorec.cc b/vvideorec.cc index 6c5b9e4..5c1db86 100644 --- a/vvideorec.cc +++ b/vvideorec.cc @@ -82,7 +82,7 @@ VVideoRec::VVideoRec(Recording* rec) VVideoRec::~VVideoRec() { if (playing) stopPlay(); - Video::getInstance()->setDefaultAspect(); + video->setDefaultAspect(); timers->cancelTimer(this, 1); timers->cancelTimer(this, 2); @@ -127,7 +127,7 @@ void VVideoRec::go(ULLONG startPosition) VInfo* vi = new VInfo(); vi->create(400, 150); - if (Video::getInstance()->getFormat() == Video::PAL) + if (video->getFormat() == Video::PAL) vi->setScreenPos(170, 200); else vi->setScreenPos(160, 150); @@ -379,30 +379,19 @@ void VVideoRec::drawBarClocks() rectangle(clocksRegion, barBlue); - ULONG currentTS = (player->getPositionTS() / 90000); - int chours = currentTS / 3600; - int cminutes = (currentTS - (chours * 3600)) / 60; - int cseconds = currentTS - (chours * 3600) - (cminutes * 60); + ULONG currentFrameNum = player->getCurrentFrameNum(); + ULONG lengthFrames = player->getLengthFrames(); - ULONG endTS = (player->getEndTS() / 90000); -// int ehours = endTS / 3600; -// int eminutes = (endTS - (ehours * 3600)) / 60; -// int eseconds = endTS - (ehours * 3600) - (eminutes * 60); - - hmsf endHMSF = player->getEndHMSF(); + hmsf currentFrameHMSF = video->framesToHMSF(currentFrameNum); + hmsf lengthHMSF = video->framesToHMSF(lengthFrames); char buffer[100]; - if ((currentTS > 95441) // it's at the 33bit rollover point where the calc doesn't work because of the 1s diff - // between demuxer values and video chip return values ... ? - || (!endTS) ) // No values yet - { - strcpy(buffer, "-:--:-- / -:--:--"); - } - else - { - SNPRINTF(buffer, 99, "%01i:%02i:%02i / %01i:%02i:%02i", chours, cminutes, cseconds, endHMSF.hours, endHMSF.minutes, endHMSF.seconds); +// strcpy(buffer, "-:--:-- / -:--:--"); +// else +// { + SNPRINTF(buffer, 99, "%01i:%02i:%02i / %01i:%02i:%02i", currentFrameHMSF.hours, currentFrameHMSF.minutes, currentFrameHMSF.seconds, lengthHMSF.hours, lengthHMSF.minutes, lengthHMSF.seconds); logger->log("VVideoRec", Log::DEBUG, buffer); - } +// } drawText(buffer, clocksRegion.x, clocksRegion.y, Colour::LIGHTTEXT); @@ -411,9 +400,9 @@ void VVideoRec::drawBarClocks() rectangle(barRegion.x + 350, barRegion.y + 12, 310, 24, Colour::LIGHTTEXT); rectangle(barRegion.x + 352, barRegion.y + 14, 306, 20, barBlue); - if ((currentTS > 95441) || (!endTS)) return; // No values yet +// if ((currentTS > 95441) || (!endTS)) return; // No values yet - double progress01 = (double)currentTS / (double)endTS; + double progress01 = (double)currentFrameNum / (double)lengthFrames; // total width of bar = 302 int progressWidth = (int)(302 * progress01); @@ -423,13 +412,13 @@ void VVideoRec::drawBarClocks() double pos01; int posPix; - pos01 = (double)startMargin / (double)endTS; + pos01 = ((double)startMargin * video->getFPS()) / 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); - pos01 = (double)(endTS - endMargin) / (double)endTS; + pos01 = lengthFrames - (endMargin * video->getFPS()) / lengthFrames; posPix = (int)(302 * pos01); rectangle(barRegion.x + 352 + posPix, barRegion.y + 12 - 2, 2, 2, Colour::LIGHTTEXT); -- 2.39.5