MCPcopy Create free account
hub / github.com/danielpaulus/quicktime_video_hack / ParseSyncHeader

Function ParseSyncHeader

screencapture/packet/util.go:18–25  ·  view source on GitHub ↗

ParseSyncHeader checks for the SYNC magic and the given messagemagic and then returns the remainingBytes starting after the messagemagic so after 16 bytes, the clockRef, correlationID and an error is the packet is not SYNC or if the messagemagic is wrong

(data []byte, messagemagic uint32)

Source from the content-addressed store, hash-verified

16//the remainingBytes starting after the messagemagic so after 16 bytes, the clockRef, correlationID and an error
17//is the packet is not SYNC or if the messagemagic is wrong
18func ParseSyncHeader(data []byte, messagemagic uint32) ([]byte, CFTypeID, uint64, error) {
19 remainingBytes, clockRef, err := parseHeader(data, SyncPacketMagic, messagemagic)
20 if err != nil {
21 return data, 0, 0, err
22 }
23 correlationID := binary.LittleEndian.Uint64(remainingBytes)
24 return remainingBytes[8:], clockRef, correlationID, err
25}
26
27func parseHeader(data []byte, packetmagic uint32, messagemagic uint32) ([]byte, CFTypeID, error) {
28 magic := binary.LittleEndian.Uint32(data)

Callers 9

TestParseSyncHeaderFunction · 0.92
NewSyncOgPacketFromBytesFunction · 0.85

Calls 1

parseHeaderFunction · 0.85

Tested by 1

TestParseSyncHeaderFunction · 0.74