Implemented new "Speed" parameter which allows to set initial playback
speed.
git-svn-id: svn://svn.code.sf.net/p/tigervnc/code/trunk@2514 3789f03b-4d11-0410-bbf8-ca57d06f2519
diff --git a/java/src/com/tightvnc/rfbplayer/RfbPlayer.java b/java/src/com/tightvnc/rfbplayer/RfbPlayer.java
index 55ac568..a47220a 100644
--- a/java/src/com/tightvnc/rfbplayer/RfbPlayer.java
+++ b/java/src/com/tightvnc/rfbplayer/RfbPlayer.java
@@ -60,6 +60,7 @@
String sessionURL;
long initialTimeOffset;
+ double playbackSpeed;
boolean showControls;
int deferScreenUpdates;
@@ -161,6 +162,7 @@
try {
setPaused(true);
fbsStream.setTimeOffset(initialTimeOffset);
+ fbsStream.setSpeed(playbackSpeed);
vc.processNormalProtocol();
} catch (EOFException e) {
initialTimeOffset = 0;
@@ -191,7 +193,12 @@
}
}
+ public double getSpeed() {
+ return playbackSpeed;
+ }
+
public void setSpeed(double speed) {
+ playbackSpeed = speed;
fbsStream.setSpeed(speed);
}
@@ -216,6 +223,11 @@
sessionURL = readParameter("URL", true);
initialTimeOffset = readLongParameter("Position", 0);
+ if (initialTimeOffset < 0)
+ initialTimeOffset = 0;
+ playbackSpeed = readDoubleParameter("Speed", 1.0);
+ if (playbackSpeed <= 0.0)
+ playbackSpeed = 1.0;
showControls = true;
String str = readParameter("Show Controls", false);
@@ -272,6 +284,17 @@
return result;
}
+ double readDoubleParameter(String name, double defaultValue) {
+ String str = readParameter(name, false);
+ double result = defaultValue;
+ if (str != null) {
+ try {
+ result = Double.parseDouble(str);
+ } catch (NumberFormatException e) { }
+ }
+ return result;
+ }
+
//
// fatalError() - print out a fatal error message.
//