diff options
author | Constantin Kaplinsky <const@tightvnc.com> | 2002-05-30 14:19:02 +0000 |
---|---|---|
committer | Constantin Kaplinsky <const@tightvnc.com> | 2002-05-30 14:19:02 +0000 |
commit | 972c25718c13f963dbd1d4ce6a885f3e66f2931f (patch) | |
tree | 34b23cddd46c757f81156acd1afa8b9258ea4ad7 /java | |
parent | 52c48242bd5bbcb058835d0f0207b65486a50cc0 (diff) | |
download | tigervnc-972c25718c13f963dbd1d4ce6a885f3e66f2931f.tar.gz tigervnc-972c25718c13f963dbd1d4ce6a885f3e66f2931f.zip |
Added support for new "Position" parameter.
Fixed a NullPointerException with "Show Controls"="no".
Documented all supported parameters.
git-svn-id: svn://svn.code.sf.net/p/tigervnc/code/trunk@2512 3789f03b-4d11-0410-bbf8-ca57d06f2519
Diffstat (limited to 'java')
-rw-r--r-- | java/src/com/tightvnc/rfbplayer/ButtonPanel.java | 3 | ||||
-rw-r--r-- | java/src/com/tightvnc/rfbplayer/FbsInputStream.java | 2 | ||||
-rw-r--r-- | java/src/com/tightvnc/rfbplayer/README | 57 | ||||
-rw-r--r-- | java/src/com/tightvnc/rfbplayer/RfbPlayer.java | 21 |
4 files changed, 70 insertions, 13 deletions
diff --git a/java/src/com/tightvnc/rfbplayer/ButtonPanel.java b/java/src/com/tightvnc/rfbplayer/ButtonPanel.java index cbfffc9c..7a1e8884 100644 --- a/java/src/com/tightvnc/rfbplayer/ButtonPanel.java +++ b/java/src/com/tightvnc/rfbplayer/ButtonPanel.java @@ -64,7 +64,6 @@ class ButtonPanel extends Panel implements ActionListener { posText.setEditable(false); } playButton.setEnabled(true); - player.setPaused(paused); } public void setPos(int pos) { @@ -86,7 +85,7 @@ class ButtonPanel extends Panel implements ActionListener { public void actionPerformed(ActionEvent evt) { if (evt.getSource() == playButton) { - setPaused(playButton.getLabel().equals("Pause")); + player.setPaused(playButton.getLabel().equals("Pause")); } else if (evt.getSource() == posText) { player.setPos(Integer.parseInt(posText.getText())); } diff --git a/java/src/com/tightvnc/rfbplayer/FbsInputStream.java b/java/src/com/tightvnc/rfbplayer/FbsInputStream.java index f5aeb2de..d47953ab 100644 --- a/java/src/com/tightvnc/rfbplayer/FbsInputStream.java +++ b/java/src/com/tightvnc/rfbplayer/FbsInputStream.java @@ -116,7 +116,7 @@ class FbsInputStream extends InputStream { return timeOffset; } - public synchronized void setTimeOffset(int pos) + public synchronized void setTimeOffset(long pos) { // FIXME: Seeking works only in paused mode. paused = true; diff --git a/java/src/com/tightvnc/rfbplayer/README b/java/src/com/tightvnc/rfbplayer/README index 4a3a72ea..1661652d 100644 --- a/java/src/com/tightvnc/rfbplayer/README +++ b/java/src/com/tightvnc/rfbplayer/README @@ -2,14 +2,63 @@ RFB Session Player 0.7.0 ======================== -RFB Session Player is a Java application/applet for playing back RFB -session files in FBS format saved by such programs as VNC Reflector or -rfbproxy. +RFB Session Player is a Java application/applet for playing back RFB session +files in FBS format saved by such programs as VNC Reflector or rfbproxy. -Usage: java RfbPlayer URL file:test.fbs +Usage: java RfbPlayer URL file:test.fbs position 5000 java RfbPlayer URL http://remote.host/sessions/test.fbs +Applet Parameters +================= + +--> "URL" + + Value: URL of the session file to play. + Default: none (required parameter). + + This parameter tells the player which session file to play. Please note + that if the player operates as an unsigned applet, it is able to play + only files from the host where the applet was loaded from. It's a usual + JVM security limitation. + +--> "Position" + + Value: time in milliseconds. + Default: 0. + + Set initial time position in the session file, in milliseconds. + +--> "Open new window" (applicable only in the applet mode) + + Values: "Yes", "No". + Default: "No". + + Operate in a separate window. This makes possible resizing the desktop, + and adds scroll bars when necessary. If the server supports variable + desktop size, the window will resize automatically when remote desktop + size changes. + +--> "Show controls" + + Values: "Yes", "No". + Default: "Yes". + + Set to "No" if you want to get rid of the control panel at the top. + Please note that hiding the panel in current version makes playback + impossible. :-) + +--> "Defer screen updates" + + Value: time in milliseconds. + Default: "20". + + When updating the desktop contents after reading each update, schedule + repaint within the specified number of milliseconds. Small delay helps to + coalesce several small updates into one drawing operation, improving CPU + usage. Set this parameter to 0 to disable deferred updates. + + Licensing Terms =============== diff --git a/java/src/com/tightvnc/rfbplayer/RfbPlayer.java b/java/src/com/tightvnc/rfbplayer/RfbPlayer.java index 099148b4..0d870060 100644 --- a/java/src/com/tightvnc/rfbplayer/RfbPlayer.java +++ b/java/src/com/tightvnc/rfbplayer/RfbPlayer.java @@ -59,6 +59,7 @@ public class RfbPlayer extends java.applet.Applet VncCanvas vc; String sessionURL; + long initialTimeOffset; boolean showControls; int deferScreenUpdates; @@ -158,9 +159,11 @@ public class RfbPlayer extends java.applet.Applet while (true) { try { - buttonPanel.setPaused(true); + setPaused(true); + fbsStream.setTimeOffset(initialTimeOffset); vc.processNormalProtocol(); } catch (EOFException e) { + initialTimeOffset = 0; fbsStream.close(); fbsStream = new FbsInputStream(url.openStream()); rfb.newInputStream(fbsStream); @@ -177,6 +180,8 @@ public class RfbPlayer extends java.applet.Applet } public void setPaused(boolean paused) { + if (showControls) + buttonPanel.setPaused(paused); if (fbsStream != null) { if (paused) { fbsStream.pausePlayback(); @@ -191,7 +196,8 @@ public class RfbPlayer extends java.applet.Applet } public void updatePos() { - buttonPanel.setPos((int)(fbsStream.getTimeOffset() / 1000)); + if (showControls) + buttonPanel.setPos((int)(fbsStream.getTimeOffset() / 1000)); } // @@ -204,6 +210,7 @@ public class RfbPlayer extends java.applet.Applet public void readParameters() { sessionURL = readParameter("URL", true); + initialTimeOffset = readLongParameter("Position", 0); showControls = true; String str = readParameter("Show Controls", false); @@ -217,7 +224,9 @@ public class RfbPlayer extends java.applet.Applet } // Fine tuning options. - deferScreenUpdates = readIntParameter("Defer screen updates", 20); + deferScreenUpdates = (int)readLongParameter("Defer screen updates", 20); + if (deferScreenUpdates < 0) + deferScreenUpdates = 0; // Just in case. } public String readParameter(String name, boolean required) { @@ -247,12 +256,12 @@ public class RfbPlayer extends java.applet.Applet return null; } - int readIntParameter(String name, int defaultValue) { + long readLongParameter(String name, long defaultValue) { String str = readParameter(name, false); - int result = defaultValue; + long result = defaultValue; if (str != null) { try { - result = Integer.parseInt(str); + result = Long.parseLong(str); } catch (NumberFormatException e) { } } return result; |