mirror of
https://github.com/amitbet/vncproxy.git
synced 2025-04-27 10:50:47 +00:00
starting to create a new file format
This commit is contained in:
parent
e06ad806db
commit
7852f11ceb
@ -116,9 +116,9 @@ func (c *ClientConn) Read(bytes []byte) (n int, err error) {
|
|||||||
return c.conn.Read(bytes)
|
return c.conn.Read(bytes)
|
||||||
}
|
}
|
||||||
|
|
||||||
func (c *ClientConn) CurrentColorMap() *common.ColorMap {
|
// func (c *ClientConn) CurrentColorMap() *common.ColorMap {
|
||||||
return &c.ColorMap
|
// return &c.ColorMap
|
||||||
}
|
// }
|
||||||
|
|
||||||
// CutText tells the server that the client has new text in its cut buffer.
|
// CutText tells the server that the client has new text in its cut buffer.
|
||||||
// The text string MUST only contain Latin-1 characters. This encoding
|
// The text string MUST only contain Latin-1 characters. This encoding
|
||||||
|
@ -175,9 +175,9 @@ func (m *MsgSetColorMapEntries) Read(c common.IClientConn, r *common.RfbReadHelp
|
|||||||
return nil, err
|
return nil, err
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
cmap := c.CurrentColorMap()
|
// cmap := c.CurrentColorMap()
|
||||||
// Update the connection's color map
|
// // Update the connection's color map
|
||||||
cmap[result.FirstColor+i] = *color
|
// cmap[result.FirstColor+i] = *color
|
||||||
}
|
}
|
||||||
r.SendMessageEnd(common.ServerMessageType(m.Type()))
|
r.SendMessageEnd(common.ServerMessageType(m.Type()))
|
||||||
return &result, nil
|
return &result, nil
|
||||||
|
@ -25,6 +25,6 @@ type IServerConn interface {
|
|||||||
|
|
||||||
type IClientConn interface {
|
type IClientConn interface {
|
||||||
CurrentPixelFormat() *PixelFormat
|
CurrentPixelFormat() *PixelFormat
|
||||||
CurrentColorMap() *ColorMap
|
//CurrentColorMap() *ColorMap
|
||||||
Encodings() []IEncoding
|
Encodings() []IEncoding
|
||||||
}
|
}
|
||||||
|
@ -3,17 +3,25 @@ package player
|
|||||||
import (
|
import (
|
||||||
"encoding/binary"
|
"encoding/binary"
|
||||||
|
|
||||||
|
"io"
|
||||||
"time"
|
"time"
|
||||||
"vncproxy/client"
|
"vncproxy/client"
|
||||||
"vncproxy/common"
|
"vncproxy/common"
|
||||||
|
|
||||||
"vncproxy/logger"
|
"vncproxy/logger"
|
||||||
"vncproxy/server"
|
"vncproxy/server"
|
||||||
)
|
)
|
||||||
|
|
||||||
|
type VncStreamFileReader interface {
|
||||||
|
io.Reader
|
||||||
|
CurrentTimestamp() int
|
||||||
|
ReadStartSession() (*common.ServerInit, error)
|
||||||
|
CurrentPixelFormat() *common.PixelFormat
|
||||||
|
Encodings() []common.IEncoding
|
||||||
|
}
|
||||||
|
|
||||||
type FBSPlayListener struct {
|
type FBSPlayListener struct {
|
||||||
Conn *server.ServerConn
|
Conn *server.ServerConn
|
||||||
Fbs *FbsReader
|
Fbs VncStreamFileReader
|
||||||
serverMessageMap map[uint8]common.ServerMessage
|
serverMessageMap map[uint8]common.ServerMessage
|
||||||
firstSegDone bool
|
firstSegDone bool
|
||||||
startTime int
|
startTime int
|
||||||
@ -88,7 +96,7 @@ func (h *FBSPlayListener) sendFbsMessage() {
|
|||||||
return
|
return
|
||||||
}
|
}
|
||||||
timeSinceStart := int(time.Now().UnixNano()/int64(time.Millisecond)) - h.startTime
|
timeSinceStart := int(time.Now().UnixNano()/int64(time.Millisecond)) - h.startTime
|
||||||
timeToSleep := fbs.currentTimestamp - timeSinceStart
|
timeToSleep := fbs.CurrentTimestamp() - timeSinceStart
|
||||||
if timeToSleep > 0 {
|
if timeToSleep > 0 {
|
||||||
time.Sleep(time.Duration(timeToSleep) * time.Millisecond)
|
time.Sleep(time.Duration(timeToSleep) * time.Millisecond)
|
||||||
}
|
}
|
||||||
|
@ -18,6 +18,10 @@ type FbsReader struct {
|
|||||||
encodings []common.IEncoding
|
encodings []common.IEncoding
|
||||||
}
|
}
|
||||||
|
|
||||||
|
func (fbs *FbsReader) CurrentTimestamp() int {
|
||||||
|
return fbs.currentTimestamp
|
||||||
|
}
|
||||||
|
|
||||||
func (fbs *FbsReader) Read(p []byte) (n int, err error) {
|
func (fbs *FbsReader) Read(p []byte) (n int, err error) {
|
||||||
if fbs.buffer.Len() < len(p) {
|
if fbs.buffer.Len() < len(p) {
|
||||||
seg, err := fbs.ReadSegment()
|
seg, err := fbs.ReadSegment()
|
||||||
@ -33,8 +37,9 @@ func (fbs *FbsReader) Read(p []byte) (n int, err error) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
func (fbs *FbsReader) CurrentPixelFormat() *common.PixelFormat { return fbs.pixelFormat }
|
func (fbs *FbsReader) CurrentPixelFormat() *common.PixelFormat { return fbs.pixelFormat }
|
||||||
func (fbs *FbsReader) CurrentColorMap() *common.ColorMap { return &common.ColorMap{} }
|
|
||||||
func (fbs *FbsReader) Encodings() []common.IEncoding { return fbs.encodings }
|
//func (fbs *FbsReader) CurrentColorMap() *common.ColorMap { return &common.ColorMap{} }
|
||||||
|
func (fbs *FbsReader) Encodings() []common.IEncoding { return fbs.encodings }
|
||||||
|
|
||||||
func NewFbsReader(fbsFile string) (*FbsReader, error) {
|
func NewFbsReader(fbsFile string) (*FbsReader, error) {
|
||||||
|
|
||||||
|
9
todo.md
9
todo.md
@ -6,4 +6,11 @@
|
|||||||
* code stuff:
|
* code stuff:
|
||||||
* move encodings to be on the framebufferupdate message object
|
* move encodings to be on the framebufferupdate message object
|
||||||
* clear all messages read functions from updating stuff, move modification logic to another listener
|
* clear all messages read functions from updating stuff, move modification logic to another listener
|
||||||
* message read function should accept only an io.Reader, move read helper logic (readuint8) to an actual helper class
|
* message read function should accept only an io.Reader, move read helper logic (readuint8) to an actual helper class
|
||||||
|
* new recording format:
|
||||||
|
* rfb extension
|
||||||
|
* save FBResponse messages with additional fields
|
||||||
|
* timestamp
|
||||||
|
* is incremental
|
||||||
|
* size (bytes)
|
||||||
|
* have a header which contains an index of messages, holding timestamps & file positions for seeking
|
||||||
|
Loading…
Reference in New Issue
Block a user