summaryrefslogtreecommitdiffstats
path: root/java/src/com/tightvnc/rfbplayer
diff options
context:
space:
mode:
authorConstantin Kaplinsky <const@tightvnc.com>2008-06-20 20:12:22 +0000
committerConstantin Kaplinsky <const@tightvnc.com>2008-06-20 20:12:22 +0000
commitd3a2df1f9777a3d02819a40ef2e4b18604e61649 (patch)
tree8d4d1dd6158493a704f7afa7ac847d1adfbc0e39 /java/src/com/tightvnc/rfbplayer
parent1c2865f5fbc98f697a7e466f8adfa98b76bb8f0b (diff)
downloadtigervnc-d3a2df1f9777a3d02819a40ef2e4b18604e61649.tar.gz
tigervnc-d3a2df1f9777a3d02819a40ef2e4b18604e61649.zip
[Development] Loading the keyframe data, using HTTP Range headers to load only the desired part of the .fbk file. In this revision, the data then cannot be parsed correctly because RfbProto expects RFB initialization sequence which is absent in keyframes.
git-svn-id: svn://svn.code.sf.net/p/tigervnc/code/trunk@2609 3789f03b-4d11-0410-bbf8-ca57d06f2519
Diffstat (limited to 'java/src/com/tightvnc/rfbplayer')
-rw-r--r--java/src/com/tightvnc/rfbplayer/FbsConnection.java29
-rw-r--r--java/src/com/tightvnc/rfbplayer/FbsInputStream.java4
2 files changed, 30 insertions, 3 deletions
diff --git a/java/src/com/tightvnc/rfbplayer/FbsConnection.java b/java/src/com/tightvnc/rfbplayer/FbsConnection.java
index f53e5557..20b01544 100644
--- a/java/src/com/tightvnc/rfbplayer/FbsConnection.java
+++ b/java/src/com/tightvnc/rfbplayer/FbsConnection.java
@@ -191,7 +191,34 @@ public class FbsConnection {
*/
private FbsInputStream openFbsFile(FbsEntryPoint entryPoint)
throws IOException {
- return null;
+
+ // Make sure the protocol is HTTP.
+ if (!fbkURL.getProtocol().equalsIgnoreCase("http") ||
+ !fbsURL.getProtocol().equalsIgnoreCase("http")) {
+ return null;
+ }
+
+ // Prepare URLConnection to the right part of the .fbk file.
+ URLConnection fbkConn = fbkURL.openConnection();
+ long firstByteOffset = entryPoint.key_fpos;
+ long lastByteOffset = entryPoint.key_fpos + entryPoint.key_size - 1;
+ String rangeSpec = "bytes=" + firstByteOffset + "-" + lastByteOffset;
+ System.err.println("Range: " + rangeSpec);
+ fbkConn.setRequestProperty("Range", rangeSpec);
+ fbkConn.connect();
+ DataInputStream is = new DataInputStream(fbkConn.getInputStream());
+
+ // Load keyframe data from the .fbk file.
+ int keyDataSize = is.readInt();
+ byte[] keyData = new byte[keyDataSize];
+ is.readFully(keyData);
+ is.close();
+
+ // Open the FBS stream.
+ URLConnection fbsConn = fbsURL.openConnection();
+ fbsConn.connect();
+ return new FbsInputStream(fbsConn.getInputStream(), entryPoint.timestamp,
+ keyData, entryPoint.fbs_skip);
}
}
diff --git a/java/src/com/tightvnc/rfbplayer/FbsInputStream.java b/java/src/com/tightvnc/rfbplayer/FbsInputStream.java
index 68bf8de2..db02a1dd 100644
--- a/java/src/com/tightvnc/rfbplayer/FbsInputStream.java
+++ b/java/src/com/tightvnc/rfbplayer/FbsInputStream.java
@@ -43,7 +43,7 @@ class FbsInputStream extends InputStream {
protected int bufferPos;
/** The number of bytes to skip in the beginning of the next data block. */
- protected int nextBlockOffset;
+ protected long nextBlockOffset;
protected Observer obs;
@@ -95,7 +95,7 @@ class FbsInputStream extends InputStream {
* from <code>in</code>.
*/
FbsInputStream(InputStream in, long timeOffset, byte[] buffer,
- int nextBlockOffset) {
+ long nextBlockOffset) {
this.in = in;
startTime = System.currentTimeMillis() - timeOffset;