diff options
author | Constantin Kaplinsky <const@tightvnc.com> | 2008-06-23 13:34:36 +0000 |
---|---|---|
committer | Constantin Kaplinsky <const@tightvnc.com> | 2008-06-23 13:34:36 +0000 |
commit | 2c0d2d17d1d4e85530a13740d70cd0c6326d8459 (patch) | |
tree | 77dd33fbe21e5b0f63fd6ce5d94988aa09f97828 | |
parent | b29bb7506d2419096c8e2081814908ec43634607 (diff) | |
download | tigervnc-2c0d2d17d1d4e85530a13740d70cd0c6326d8459.tar.gz tigervnc-2c0d2d17d1d4e85530a13740d70cd0c6326d8459.zip |
[Development] Using index-driven positioning when seeking forward over more than 10 seconds.
git-svn-id: svn://svn.code.sf.net/p/tigervnc/code/trunk@2621 3789f03b-4d11-0410-bbf8-ca57d06f2519
-rw-r--r-- | java/src/com/tightvnc/rfbplayer/FbsInputStream.java | 17 | ||||
-rw-r--r-- | java/src/com/tightvnc/rfbplayer/RfbPlayer.java | 5 |
2 files changed, 12 insertions, 10 deletions
diff --git a/java/src/com/tightvnc/rfbplayer/FbsInputStream.java b/java/src/com/tightvnc/rfbplayer/FbsInputStream.java index db02a1dd..2077bc5a 100644 --- a/java/src/com/tightvnc/rfbplayer/FbsInputStream.java +++ b/java/src/com/tightvnc/rfbplayer/FbsInputStream.java @@ -33,7 +33,7 @@ class FbsInputStream extends InputStream { protected long startTime; protected long timeOffset; protected long seekOffset; - protected boolean seekBackwards; + protected boolean farSeeking; protected boolean paused; protected boolean isQuitting = false; protected double playbackSpeed; @@ -101,7 +101,7 @@ class FbsInputStream extends InputStream { startTime = System.currentTimeMillis() - timeOffset; this.timeOffset = timeOffset; seekOffset = -1; - seekBackwards = false; + farSeeking = false; paused = false; playbackSpeed = 1.0; @@ -147,7 +147,7 @@ class FbsInputStream extends InputStream { startTime = -1; timeOffset = 0; seekOffset = -1; - seekBackwards = false; + farSeeking = false; paused = false; playbackSpeed = 1.0; @@ -169,8 +169,9 @@ class FbsInputStream extends InputStream { public synchronized void setTimeOffset(long pos) { seekOffset = (long)(pos / playbackSpeed); - if (seekOffset < timeOffset) { - seekBackwards = true; + long minJumpForwardOffset = timeOffset + (long)(10000 / playbackSpeed); + if (seekOffset < timeOffset || seekOffset > minJumpForwardOffset) { + farSeeking = true; } notify(); } @@ -216,9 +217,9 @@ class FbsInputStream extends InputStream { // Methods for internal use. // private synchronized boolean fillBuffer() throws IOException { - // The reading thread should be interrupted on backward seeking. - if (seekBackwards) - throw new EOFException("[REWIND]"); + // The reading thread should be interrupted on far seeking. + if (farSeeking) + throw new EOFException("[JUMP]"); // Just wait unless we are performing playback OR seeking. waitWhilePaused(); diff --git a/java/src/com/tightvnc/rfbplayer/RfbPlayer.java b/java/src/com/tightvnc/rfbplayer/RfbPlayer.java index 85d067d1..6cdd386f 100644 --- a/java/src/com/tightvnc/rfbplayer/RfbPlayer.java +++ b/java/src/com/tightvnc/rfbplayer/RfbPlayer.java @@ -180,8 +180,9 @@ public class RfbPlayer extends java.applet.Applet vc.processNormalProtocol(); } catch (EOFException e) { long newTimeOffset; - if (e.getMessage() != null && e.getMessage().equals("[REWIND]")) { - // A special type of EOFException allowing us to seek backwards. + if (e.getMessage() != null && e.getMessage().equals("[JUMP]")) { + // A special type of EOFException allowing us to close FBS stream + // and then re-open it for jumping to a different time offset. newTimeOffset = fbs.getSeekOffset(); autoPlay = !fbs.isPaused(); } else { |