add new encodings
Signed-off-by: Vasiliy Tolstov <v.tolstov@selfip.ru>
This commit is contained in:
parent
37dfb236de
commit
a0f8168a6c
@ -36,6 +36,7 @@ const (
|
|||||||
EncJPEGQualityLevelPseudo2 EncodingType = -31
|
EncJPEGQualityLevelPseudo2 EncodingType = -31
|
||||||
EncJPEGQualityLevelPseudo1 EncodingType = -32
|
EncJPEGQualityLevelPseudo1 EncodingType = -32
|
||||||
EncColorPseudo EncodingType = -239
|
EncColorPseudo EncodingType = -239
|
||||||
|
EncXCursorPseudo EncodingType = -240
|
||||||
EncDesktopSizePseudo EncodingType = -223
|
EncDesktopSizePseudo EncodingType = -223
|
||||||
EncLastRectPseudo EncodingType = -224
|
EncLastRectPseudo EncodingType = -224
|
||||||
EncCompressionLevel10 EncodingType = -247
|
EncCompressionLevel10 EncodingType = -247
|
||||||
@ -51,6 +52,7 @@ const (
|
|||||||
EncQEMUPointerMotionChangePseudo EncodingType = -257
|
EncQEMUPointerMotionChangePseudo EncodingType = -257
|
||||||
EncQEMUExtendedKeyEventPseudo EncodingType = -258
|
EncQEMUExtendedKeyEventPseudo EncodingType = -258
|
||||||
EncTightPng EncodingType = -260
|
EncTightPng EncodingType = -260
|
||||||
|
EncDesktopNamePseudo EncodingType = -307
|
||||||
EncExtendedDesktopSizePseudo EncodingType = -308
|
EncExtendedDesktopSizePseudo EncodingType = -308
|
||||||
EncXvpPseudo EncodingType = -309
|
EncXvpPseudo EncodingType = -309
|
||||||
EncFencePseudo EncodingType = -312
|
EncFencePseudo EncodingType = -312
|
||||||
|
35
encoding_desktopname.go
Normal file
35
encoding_desktopname.go
Normal file
@ -0,0 +1,35 @@
|
|||||||
|
package vnc
|
||||||
|
|
||||||
|
import "encoding/binary"
|
||||||
|
|
||||||
|
// DesktopNamePseudoEncoding represents a desktop size message from the server.
|
||||||
|
type DesktopNamePseudoEncoding struct {
|
||||||
|
Name []byte
|
||||||
|
}
|
||||||
|
|
||||||
|
func (*DesktopNamePseudoEncoding) Type() EncodingType { return EncDesktopNamePseudo }
|
||||||
|
|
||||||
|
// Read implements the Encoding interface.
|
||||||
|
func (enc *DesktopNamePseudoEncoding) Read(c Conn, rect *Rectangle) error {
|
||||||
|
var length uint32
|
||||||
|
if err := binary.Read(c, binary.BigEndian, &length); err != nil {
|
||||||
|
return err
|
||||||
|
}
|
||||||
|
name := make([]byte, length)
|
||||||
|
if err := binary.Read(c, binary.BigEndian, &name); err != nil {
|
||||||
|
return err
|
||||||
|
}
|
||||||
|
enc.Name = name
|
||||||
|
return nil
|
||||||
|
}
|
||||||
|
|
||||||
|
func (enc *DesktopNamePseudoEncoding) Write(c Conn, rect *Rectangle) error {
|
||||||
|
if err := binary.Write(c, binary.BigEndian, uint32(len(enc.Name))); err != nil {
|
||||||
|
return err
|
||||||
|
}
|
||||||
|
if err := binary.Write(c, binary.BigEndian, enc.Name); err != nil {
|
||||||
|
return err
|
||||||
|
}
|
||||||
|
|
||||||
|
return c.Flush()
|
||||||
|
}
|
85
encoding_xcursor.go
Normal file
85
encoding_xcursor.go
Normal file
@ -0,0 +1,85 @@
|
|||||||
|
package vnc
|
||||||
|
|
||||||
|
import (
|
||||||
|
"encoding/binary"
|
||||||
|
"math"
|
||||||
|
)
|
||||||
|
|
||||||
|
type XCursorPseudoEncoding struct {
|
||||||
|
PrimaryR uint8
|
||||||
|
PrimaryG uint8
|
||||||
|
PrimaryB uint8
|
||||||
|
SecondaryR uint8
|
||||||
|
SecondaryG uint8
|
||||||
|
SecondaryB uint8
|
||||||
|
Bitmap []byte
|
||||||
|
Bitmask []byte
|
||||||
|
}
|
||||||
|
|
||||||
|
func (*XCursorPseudoEncoding) Type() EncodingType { return EncXCursorPseudo }
|
||||||
|
|
||||||
|
// Read implements the Encoding interface.
|
||||||
|
func (enc *XCursorPseudoEncoding) Read(c Conn, rect *Rectangle) error {
|
||||||
|
if err := binary.Read(c, binary.BigEndian, &enc.PrimaryR); err != nil {
|
||||||
|
return err
|
||||||
|
}
|
||||||
|
if err := binary.Read(c, binary.BigEndian, &enc.PrimaryG); err != nil {
|
||||||
|
return err
|
||||||
|
}
|
||||||
|
if err := binary.Read(c, binary.BigEndian, &enc.PrimaryB); err != nil {
|
||||||
|
return err
|
||||||
|
}
|
||||||
|
if err := binary.Read(c, binary.BigEndian, &enc.SecondaryR); err != nil {
|
||||||
|
return err
|
||||||
|
}
|
||||||
|
if err := binary.Read(c, binary.BigEndian, &enc.SecondaryG); err != nil {
|
||||||
|
return err
|
||||||
|
}
|
||||||
|
if err := binary.Read(c, binary.BigEndian, &enc.SecondaryB); err != nil {
|
||||||
|
return err
|
||||||
|
}
|
||||||
|
|
||||||
|
bitmapsize := int(math.Floor((float64(rect.Width)+7)/8) * float64(rect.Height))
|
||||||
|
bitmasksize := int(math.Floor((float64(rect.Width)+7)/8) * float64(rect.Height))
|
||||||
|
|
||||||
|
enc.Bitmap = make([]byte, bitmapsize)
|
||||||
|
enc.Bitmask = make([]byte, bitmasksize)
|
||||||
|
if err := binary.Read(c, binary.BigEndian, &enc.Bitmap); err != nil {
|
||||||
|
return err
|
||||||
|
}
|
||||||
|
if err := binary.Read(c, binary.BigEndian, &enc.Bitmask); err != nil {
|
||||||
|
return err
|
||||||
|
}
|
||||||
|
|
||||||
|
return nil
|
||||||
|
}
|
||||||
|
|
||||||
|
func (enc *XCursorPseudoEncoding) Write(c Conn, rect *Rectangle) error {
|
||||||
|
if err := binary.Write(c, binary.BigEndian, enc.PrimaryR); err != nil {
|
||||||
|
return err
|
||||||
|
}
|
||||||
|
if err := binary.Write(c, binary.BigEndian, enc.PrimaryG); err != nil {
|
||||||
|
return err
|
||||||
|
}
|
||||||
|
if err := binary.Write(c, binary.BigEndian, enc.PrimaryB); err != nil {
|
||||||
|
return err
|
||||||
|
}
|
||||||
|
if err := binary.Write(c, binary.BigEndian, enc.SecondaryR); err != nil {
|
||||||
|
return err
|
||||||
|
}
|
||||||
|
if err := binary.Write(c, binary.BigEndian, enc.SecondaryG); err != nil {
|
||||||
|
return err
|
||||||
|
}
|
||||||
|
if err := binary.Write(c, binary.BigEndian, enc.SecondaryB); err != nil {
|
||||||
|
return err
|
||||||
|
}
|
||||||
|
|
||||||
|
if err := binary.Write(c, binary.BigEndian, enc.Bitmap); err != nil {
|
||||||
|
return err
|
||||||
|
}
|
||||||
|
if err := binary.Write(c, binary.BigEndian, enc.Bitmask); err != nil {
|
||||||
|
return err
|
||||||
|
}
|
||||||
|
|
||||||
|
return nil
|
||||||
|
}
|
@ -4,7 +4,7 @@ package vnc
|
|||||||
|
|
||||||
import "fmt"
|
import "fmt"
|
||||||
|
|
||||||
const _EncodingType_name = "EncContinuousUpdatesPseudoEncFencePseudoEncClientRedirectEncXvpPseudoEncExtendedDesktopSizePseudoEncTightPngEncQEMUExtendedKeyEventPseudoEncQEMUPointerMotionChangePseudoEncCompressionLevel1EncCompressionLevel2EncCompressionLevel3EncCompressionLevel4EncCompressionLevel5EncCompressionLevel6EncCompressionLevel7EncCompressionLevel8EncCompressionLevel9EncCompressionLevel10EncColorPseudoEncLastRectPseudoEncDesktopSizePseudoEncJPEGQualityLevelPseudo1EncJPEGQualityLevelPseudo2EncJPEGQualityLevelPseudo3EncJPEGQualityLevelPseudo4EncJPEGQualityLevelPseudo5EncJPEGQualityLevelPseudo6EncJPEGQualityLevelPseudo7EncJPEGQualityLevelPseudo8EncJPEGQualityLevelPseudo9EncJPEGQualityLevelPseudo10EncRawEncCopyRectEncRREEncCoRREEncHextileEncZlibEncTightEncZlibHexEncUltra1EncUltra2EncTRLEEncZRLEEncJPEGEncJRLE"
|
const _EncodingType_name = "EncContinuousUpdatesPseudoEncFencePseudoEncClientRedirectEncXvpPseudoEncExtendedDesktopSizePseudoEncDesktopNamePseudoEncTightPngEncQEMUExtendedKeyEventPseudoEncQEMUPointerMotionChangePseudoEncCompressionLevel1EncCompressionLevel2EncCompressionLevel3EncCompressionLevel4EncCompressionLevel5EncCompressionLevel6EncCompressionLevel7EncCompressionLevel8EncCompressionLevel9EncCompressionLevel10EncXCursorPseudoEncColorPseudoEncLastRectPseudoEncDesktopSizePseudoEncJPEGQualityLevelPseudo1EncJPEGQualityLevelPseudo2EncJPEGQualityLevelPseudo3EncJPEGQualityLevelPseudo4EncJPEGQualityLevelPseudo5EncJPEGQualityLevelPseudo6EncJPEGQualityLevelPseudo7EncJPEGQualityLevelPseudo8EncJPEGQualityLevelPseudo9EncJPEGQualityLevelPseudo10EncRawEncCopyRectEncRREEncCoRREEncHextileEncZlibEncTightEncZlibHexEncUltra1EncUltra2EncTRLEEncZRLEEncJPEGEncJRLE"
|
||||||
|
|
||||||
var _EncodingType_map = map[EncodingType]string{
|
var _EncodingType_map = map[EncodingType]string{
|
||||||
-313: _EncodingType_name[0:26],
|
-313: _EncodingType_name[0:26],
|
||||||
@ -12,46 +12,48 @@ var _EncodingType_map = map[EncodingType]string{
|
|||||||
-311: _EncodingType_name[40:57],
|
-311: _EncodingType_name[40:57],
|
||||||
-309: _EncodingType_name[57:69],
|
-309: _EncodingType_name[57:69],
|
||||||
-308: _EncodingType_name[69:97],
|
-308: _EncodingType_name[69:97],
|
||||||
-260: _EncodingType_name[97:108],
|
-307: _EncodingType_name[97:117],
|
||||||
-258: _EncodingType_name[108:137],
|
-260: _EncodingType_name[117:128],
|
||||||
-257: _EncodingType_name[137:169],
|
-258: _EncodingType_name[128:157],
|
||||||
-256: _EncodingType_name[169:189],
|
-257: _EncodingType_name[157:189],
|
||||||
-255: _EncodingType_name[189:209],
|
-256: _EncodingType_name[189:209],
|
||||||
-254: _EncodingType_name[209:229],
|
-255: _EncodingType_name[209:229],
|
||||||
-253: _EncodingType_name[229:249],
|
-254: _EncodingType_name[229:249],
|
||||||
-252: _EncodingType_name[249:269],
|
-253: _EncodingType_name[249:269],
|
||||||
-251: _EncodingType_name[269:289],
|
-252: _EncodingType_name[269:289],
|
||||||
-250: _EncodingType_name[289:309],
|
-251: _EncodingType_name[289:309],
|
||||||
-249: _EncodingType_name[309:329],
|
-250: _EncodingType_name[309:329],
|
||||||
-248: _EncodingType_name[329:349],
|
-249: _EncodingType_name[329:349],
|
||||||
-247: _EncodingType_name[349:370],
|
-248: _EncodingType_name[349:369],
|
||||||
-239: _EncodingType_name[370:384],
|
-247: _EncodingType_name[369:390],
|
||||||
-224: _EncodingType_name[384:401],
|
-240: _EncodingType_name[390:406],
|
||||||
-223: _EncodingType_name[401:421],
|
-239: _EncodingType_name[406:420],
|
||||||
-32: _EncodingType_name[421:447],
|
-224: _EncodingType_name[420:437],
|
||||||
-31: _EncodingType_name[447:473],
|
-223: _EncodingType_name[437:457],
|
||||||
-30: _EncodingType_name[473:499],
|
-32: _EncodingType_name[457:483],
|
||||||
-29: _EncodingType_name[499:525],
|
-31: _EncodingType_name[483:509],
|
||||||
-28: _EncodingType_name[525:551],
|
-30: _EncodingType_name[509:535],
|
||||||
-27: _EncodingType_name[551:577],
|
-29: _EncodingType_name[535:561],
|
||||||
-26: _EncodingType_name[577:603],
|
-28: _EncodingType_name[561:587],
|
||||||
-25: _EncodingType_name[603:629],
|
-27: _EncodingType_name[587:613],
|
||||||
-24: _EncodingType_name[629:655],
|
-26: _EncodingType_name[613:639],
|
||||||
-23: _EncodingType_name[655:682],
|
-25: _EncodingType_name[639:665],
|
||||||
0: _EncodingType_name[682:688],
|
-24: _EncodingType_name[665:691],
|
||||||
1: _EncodingType_name[688:699],
|
-23: _EncodingType_name[691:718],
|
||||||
2: _EncodingType_name[699:705],
|
0: _EncodingType_name[718:724],
|
||||||
4: _EncodingType_name[705:713],
|
1: _EncodingType_name[724:735],
|
||||||
5: _EncodingType_name[713:723],
|
2: _EncodingType_name[735:741],
|
||||||
6: _EncodingType_name[723:730],
|
4: _EncodingType_name[741:749],
|
||||||
7: _EncodingType_name[730:738],
|
5: _EncodingType_name[749:759],
|
||||||
8: _EncodingType_name[738:748],
|
6: _EncodingType_name[759:766],
|
||||||
9: _EncodingType_name[748:757],
|
7: _EncodingType_name[766:774],
|
||||||
10: _EncodingType_name[757:766],
|
8: _EncodingType_name[774:784],
|
||||||
15: _EncodingType_name[766:773],
|
9: _EncodingType_name[784:793],
|
||||||
16: _EncodingType_name[773:780],
|
10: _EncodingType_name[793:802],
|
||||||
21: _EncodingType_name[780:787],
|
15: _EncodingType_name[802:809],
|
||||||
22: _EncodingType_name[787:794],
|
16: _EncodingType_name[809:816],
|
||||||
|
21: _EncodingType_name[816:823],
|
||||||
|
22: _EncodingType_name[823:830],
|
||||||
}
|
}
|
||||||
|
|
||||||
func (i EncodingType) String() string {
|
func (i EncodingType) String() string {
|
||||||
|
Loading…
Reference in New Issue
Block a user