Mercurial > hg > Applications > TreeVNC
annotate src/main/java/com/glavsoft/rfb/encoding/decoder/ZRLEESender.java @ 500:6609174beafe
fix subencoding
author | oshiro |
---|---|
date | Sun, 17 Feb 2019 17:55:25 +0900 |
parents | 8d95d64c33bf |
children | 1646be890954 |
rev | line source |
---|---|
26
73b13bc335c2
add ZRLEESender.java, NullRenderer.java and NullRepaintController.java
one
parents:
diff
changeset
|
1 package com.glavsoft.rfb.encoding.decoder; |
73b13bc335c2
add ZRLEESender.java, NullRenderer.java and NullRepaintController.java
one
parents:
diff
changeset
|
2 |
232
6ee4cdca104c
send value of port and localhost in checkdelay framebufferupdate, and get this.
oc
parents:
207
diff
changeset
|
3 import java.io.UnsupportedEncodingException; |
6ee4cdca104c
send value of port and localhost in checkdelay framebufferupdate, and get this.
oc
parents:
207
diff
changeset
|
4 |
207 | 5 import jp.ac.u_ryukyu.treevnc.TreeRFBProto; |
26
73b13bc335c2
add ZRLEESender.java, NullRenderer.java and NullRepaintController.java
one
parents:
diff
changeset
|
6 |
73b13bc335c2
add ZRLEESender.java, NullRenderer.java and NullRepaintController.java
one
parents:
diff
changeset
|
7 import com.glavsoft.drawing.Renderer; |
73b13bc335c2
add ZRLEESender.java, NullRenderer.java and NullRepaintController.java
one
parents:
diff
changeset
|
8 import com.glavsoft.exceptions.TransportException; |
73b13bc335c2
add ZRLEESender.java, NullRenderer.java and NullRepaintController.java
one
parents:
diff
changeset
|
9 import com.glavsoft.rfb.encoding.EncodingType; |
73b13bc335c2
add ZRLEESender.java, NullRenderer.java and NullRepaintController.java
one
parents:
diff
changeset
|
10 import com.glavsoft.transport.Reader; |
73b13bc335c2
add ZRLEESender.java, NullRenderer.java and NullRepaintController.java
one
parents:
diff
changeset
|
11 |
73b13bc335c2
add ZRLEESender.java, NullRenderer.java and NullRepaintController.java
one
parents:
diff
changeset
|
12 public class ZRLEESender extends Decoder { |
66 | 13 |
239 | 14 private TreeRFBProto rfb; |
26
73b13bc335c2
add ZRLEESender.java, NullRenderer.java and NullRepaintController.java
one
parents:
diff
changeset
|
15 |
239 | 16 public ZRLEESender(TreeRFBProto rfb) { |
17 this.rfb = rfb; | |
18 } | |
66 | 19 |
239 | 20 public ZRLEESender() { |
21 } | |
66 | 22 |
239 | 23 @Override |
24 public void decode(Reader reader, Renderer renderer, | |
275 | 25 FramebufferUpdateRectangle rect) throws TransportException, UnsupportedEncodingException { |
239 | 26 // TreeVNC handling |
185 | 27 int dataLen = getZrleLength(rect, reader); |
189 | 28 reader.reset(); |
239 | 29 if (rfb.hasViewer()) { |
30 ZRLEDecoder decoder = new ZRLEDecoder(); | |
381 | 31 if (rect.getEncodingType() == EncodingType.ZRLE) { |
32 // ReadSendData convert ZRLE to ZRLEE | |
33 // unzipped data in the bytes | |
500 | 34 byte[] bytes = new byte[rect.width * rect.height * renderer.getBytesPerPixel()]; |
264 | 35 rfb.readSendData(dataLen, reader, bytes, rect); |
498 | 36 decoder.decode1(renderer, rect, bytes, 0, rfb); |
239 | 37 return; |
381 | 38 } else { |
39 // no reencoding is required | |
40 // readSend does not peform unzip, do the fullrecoding | |
264 | 41 rfb.readSendData(dataLen, reader, null, rect); |
380 | 42 reader.reset(); |
414
3af5f4af2d63
Send data size for checkDelay
Tatsuki IHA <e125716@ie.u-ryukyu.ac.jp>
parents:
381
diff
changeset
|
43 if (rect.getEncodingType() == EncodingType.CHECK_DELAY) { |
3af5f4af2d63
Send data size for checkDelay
Tatsuki IHA <e125716@ie.u-ryukyu.ac.jp>
parents:
381
diff
changeset
|
44 reader.skip(24); |
3af5f4af2d63
Send data size for checkDelay
Tatsuki IHA <e125716@ie.u-ryukyu.ac.jp>
parents:
381
diff
changeset
|
45 } else { |
3af5f4af2d63
Send data size for checkDelay
Tatsuki IHA <e125716@ie.u-ryukyu.ac.jp>
parents:
381
diff
changeset
|
46 reader.skip(16); |
3af5f4af2d63
Send data size for checkDelay
Tatsuki IHA <e125716@ie.u-ryukyu.ac.jp>
parents:
381
diff
changeset
|
47 } |
239 | 48 decoder.decode(reader, renderer, rect); |
49 return; | |
50 } | |
51 } | |
498 | 52 byte[] bytes = new byte[dataLen]; |
380 | 53 rfb.readSendData(dataLen, reader, bytes, rect); |
239 | 54 } |
26
73b13bc335c2
add ZRLEESender.java, NullRenderer.java and NullRepaintController.java
one
parents:
diff
changeset
|
55 |
239 | 56 private int getZrleLength(FramebufferUpdateRectangle rect, Reader reader) |
57 throws TransportException { | |
58 int zrleLength = 0; | |
59 if (rect.getEncodingType() == EncodingType.ZRLE | |
60 || rect.getEncodingType() == EncodingType.ZRLEE | |
414
3af5f4af2d63
Send data size for checkDelay
Tatsuki IHA <e125716@ie.u-ryukyu.ac.jp>
parents:
381
diff
changeset
|
61 || rect.getEncodingType() == EncodingType.ZLIB || rect.getEncodingType() == EncodingType.CHECK_DELAY) { |
239 | 62 zrleLength = reader.readInt32(); |
63 } | |
414
3af5f4af2d63
Send data size for checkDelay
Tatsuki IHA <e125716@ie.u-ryukyu.ac.jp>
parents:
381
diff
changeset
|
64 if (rect.getEncodingType() == EncodingType.CHECK_DELAY) { |
415
5c3635d6ab3c
Send Check_Delay packet if checkDelay flag is true
Tatsuki IHA <e125716@ie.u-ryukyu.ac.jp>
parents:
414
diff
changeset
|
65 // plus time byte |
5c3635d6ab3c
Send Check_Delay packet if checkDelay flag is true
Tatsuki IHA <e125716@ie.u-ryukyu.ac.jp>
parents:
414
diff
changeset
|
66 return zrleLength + 20 + 8; |
414
3af5f4af2d63
Send data size for checkDelay
Tatsuki IHA <e125716@ie.u-ryukyu.ac.jp>
parents:
381
diff
changeset
|
67 } |
239 | 68 return zrleLength + 20; |
69 } | |
66 | 70 |
26
73b13bc335c2
add ZRLEESender.java, NullRenderer.java and NullRepaintController.java
one
parents:
diff
changeset
|
71 } |