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-ca57d06f2519tags/v0.0.90
@@ -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())); | |||
} |
@@ -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; |
@@ -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 | |||
=============== | |||
@@ -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; |