From b73c33323664febf84c7ab5b1973a0db462b338b Mon Sep 17 00:00:00 2001 From: Chris Tallon Date: Sun, 11 Jun 2006 16:00:48 +0000 Subject: [PATCH] Jump to percent now uses frames --- player.cc | 34 ++++++++++++++++++++++++++++++++-- player.h | 1 + 2 files changed, 33 insertions(+), 2 deletions(-) diff --git a/player.cc b/player.cc index 2409bba..3b76c3b 100644 --- a/player.cc +++ b/player.cc @@ -446,8 +446,8 @@ void Player::skipBackwardInt(int seconds) void Player::jumpToPercentInt(int percent) { logger->log("Player", Log::DEBUG, "JUMP TO %i%%", percent); - ULLONG newTimeCode = (ULLONG)(getEndTS() * ((float)percent / 100)); - restartAt(newTimeCode); + ULONG newFrame = (ULONG)(((float)percent / 100) * lengthFrames); + restartAtFrame(newFrame); } @@ -505,6 +505,36 @@ void Player::restartAt(ULLONG timecode) fbwd = false; } +void Player::restartAtFrame(ULONG newFrame) +{ + if (paused) togglePauseInt(); + if (ffwd) toggleFastForwardInt(); + + ULLONG newPosition = VDR::getInstance()->positionFromFrameNumber(newFrame); + if (!VDR::getInstance()->isConnected()) { doConnectionLost(); return; } + logger->log("Player", Log::DEBUG, "wantedframe %i feedpos %llu goto %llu", newFrame, feedPosition, newPosition); + + vfeed.stop(); + afeed.stop(); + threadStop(); + video->stop(); + video->reset(); + audio->reset(); + demuxer->flush(); + if (!isRadio) demuxer->seek(); + feedPosition = newPosition; + videoStartup = true; + afeed.start(); + vfeed.start(); + threadStart(); + audio->play(); + video->sync(); + audio->sync(); + audio->systemMuteOff(); + audio->doMuting(); + fbwd = false; +} + void Player::setStartTS(UINT dataInBuffer) { #ifndef NEW_DEMUXER diff --git a/player.h b/player.h index 23a79e3..96e599e 100644 --- a/player.h +++ b/player.h @@ -93,6 +93,7 @@ class Player : public Thread_TYPE, public Callback void setEndTS(); void doConnectionLost(); void restartAt(ULLONG timeCode); + void restartAtFrame(ULONG newFrame); MessageQueue* commandMessageQueue; Log* logger; -- 2.39.5