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)
|
||||
}
|
||||
|
||||
func (c *ClientConn) CurrentColorMap() *common.ColorMap {
|
||||
return &c.ColorMap
|
||||
}
|
||||
// func (c *ClientConn) CurrentColorMap() *common.ColorMap {
|
||||
// return &c.ColorMap
|
||||
// }
|
||||
|
||||
// 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
|
||||
|
@ -175,9 +175,9 @@ func (m *MsgSetColorMapEntries) Read(c common.IClientConn, r *common.RfbReadHelp
|
||||
return nil, err
|
||||
}
|
||||
}
|
||||
cmap := c.CurrentColorMap()
|
||||
// Update the connection's color map
|
||||
cmap[result.FirstColor+i] = *color
|
||||
// cmap := c.CurrentColorMap()
|
||||
// // Update the connection's color map
|
||||
// cmap[result.FirstColor+i] = *color
|
||||
}
|
||||
r.SendMessageEnd(common.ServerMessageType(m.Type()))
|
||||
return &result, nil
|
||||
|
@ -25,6 +25,6 @@ type IServerConn interface {
|
||||
|
||||
type IClientConn interface {
|
||||
CurrentPixelFormat() *PixelFormat
|
||||
CurrentColorMap() *ColorMap
|
||||
//CurrentColorMap() *ColorMap
|
||||
Encodings() []IEncoding
|
||||
}
|
||||
|
@ -3,17 +3,25 @@ package player
|
||||
import (
|
||||
"encoding/binary"
|
||||
|
||||
"io"
|
||||
"time"
|
||||
"vncproxy/client"
|
||||
"vncproxy/common"
|
||||
|
||||
"vncproxy/logger"
|
||||
"vncproxy/server"
|
||||
)
|
||||
|
||||
type VncStreamFileReader interface {
|
||||
io.Reader
|
||||
CurrentTimestamp() int
|
||||
ReadStartSession() (*common.ServerInit, error)
|
||||
CurrentPixelFormat() *common.PixelFormat
|
||||
Encodings() []common.IEncoding
|
||||
}
|
||||
|
||||
type FBSPlayListener struct {
|
||||
Conn *server.ServerConn
|
||||
Fbs *FbsReader
|
||||
Fbs VncStreamFileReader
|
||||
serverMessageMap map[uint8]common.ServerMessage
|
||||
firstSegDone bool
|
||||
startTime int
|
||||
@ -88,7 +96,7 @@ func (h *FBSPlayListener) sendFbsMessage() {
|
||||
return
|
||||
}
|
||||
timeSinceStart := int(time.Now().UnixNano()/int64(time.Millisecond)) - h.startTime
|
||||
timeToSleep := fbs.currentTimestamp - timeSinceStart
|
||||
timeToSleep := fbs.CurrentTimestamp() - timeSinceStart
|
||||
if timeToSleep > 0 {
|
||||
time.Sleep(time.Duration(timeToSleep) * time.Millisecond)
|
||||
}
|
||||
|
@ -18,6 +18,10 @@ type FbsReader struct {
|
||||
encodings []common.IEncoding
|
||||
}
|
||||
|
||||
func (fbs *FbsReader) CurrentTimestamp() int {
|
||||
return fbs.currentTimestamp
|
||||
}
|
||||
|
||||
func (fbs *FbsReader) Read(p []byte) (n int, err error) {
|
||||
if fbs.buffer.Len() < len(p) {
|
||||
seg, err := fbs.ReadSegment()
|
||||
@ -33,7 +37,8 @@ func (fbs *FbsReader) Read(p []byte) (n int, err error) {
|
||||
}
|
||||
|
||||
func (fbs *FbsReader) CurrentPixelFormat() *common.PixelFormat { return fbs.pixelFormat }
|
||||
func (fbs *FbsReader) CurrentColorMap() *common.ColorMap { return &common.ColorMap{} }
|
||||
|
||||
//func (fbs *FbsReader) CurrentColorMap() *common.ColorMap { return &common.ColorMap{} }
|
||||
func (fbs *FbsReader) Encodings() []common.IEncoding { return fbs.encodings }
|
||||
|
||||
func NewFbsReader(fbsFile string) (*FbsReader, error) {
|
||||
|
7
todo.md
7
todo.md
@ -7,3 +7,10 @@
|
||||
* move encodings to be on the framebufferupdate message object
|
||||
* 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
|
||||
* 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