]> git.vomp.tv Git - vompclient-marten.git/commitdiff
Jump to percent now uses frames
authorChris Tallon <chris@vomp.tv>
Sun, 11 Jun 2006 16:00:48 +0000 (16:00 +0000)
committerChris Tallon <chris@vomp.tv>
Sun, 11 Jun 2006 16:00:48 +0000 (16:00 +0000)
player.cc
player.h

index 2409bbad99811e7620d218167987bc66e4a831ca..3b76c3bfa791cbcb0adb5563327428cbb76aaa98 100644 (file)
--- 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
index 23a79e3a40c31d89a4832f873b1b7a527c16804b..96e599e0a15c1bfe8a64b9cb98bf6abe0a364557 100644 (file)
--- 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;