packet

package
v1.0.0 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Jul 2, 2023 License: MIT Imports: 5 Imported by: 0

Documentation

Index

Constants

View Source
const (
	AsynPacketMagic uint32 = 0x6173796E
	FEED            uint32 = 0x66656564 //These contain CMSampleBufs which contain raw h264 Nalus
	TJMP            uint32 = 0x746A6D70
	SRAT            uint32 = 0x73726174 //CMTimebaseSetRateAndAnchorTime https://developer.apple.com/documentation/coremedia/cmtimebase?language=objc
	SPRP            uint32 = 0x73707270 // Set Property
	TBAS            uint32 = 0x74626173 //TimeBase https://developer.apple.com/library/archive/qa/qa1643/_index.html
	RELS            uint32 = 0x72656C73
	HPD1            uint32 = 0x68706431 //hpd1 - 1dph | For specifying/requesting the video format
	HPA1            uint32 = 0x68706131 //hpa1 - 1aph | For specifying/requesting the audio format
	NEED            uint32 = 0x6E656564 //need - deen
	EAT             uint32 = 0x65617421 //contains audio sbufs
	HPD0            uint32 = 0x68706430
	HPA0            uint32 = 0x68706130
)

Async Packet types

View Source
const (
	PingPacketMagic uint32 = 0x70696E67
	PingLength      uint32 = 16
	PingHeader      uint64 = 0x0000000100000000
)

Constants for creating a Ping packet

View Source
const (
	SyncPacketMagic  uint32 = 0x73796E63
	ReplyPacketMagic uint32 = 0x72706C79
	TIME             uint32 = 0x74696D65
	CWPA             uint32 = 0x63777061
	AFMT             uint32 = 0x61666D74
	CVRP             uint32 = 0x63767270
	CLOK             uint32 = 0x636C6F6B
	OG               uint32 = 0x676F2120
	SKEW             uint32 = 0x736B6577
	STOP             uint32 = 0x73746F70
)

Different Sync Packet Magic Markers

Variables

This section is empty.

Functions

func AsynNeedPacketBytes

func AsynNeedPacketBytes(clockRef CFTypeID) []byte

AsynNeedPacketBytes can be used to create the NEED message as soon as the clockRef from SYNC CVRP has been received.

func CreateHpa1DeviceInfoDict

func CreateHpa1DeviceInfoDict() coremedia.StringKeyDict

CreateHpa1DeviceInfoDict creates a dict.StringKeyDict that needs to be sent to the device before receiving a feed

func CreateHpd1DeviceInfoDict

func CreateHpd1DeviceInfoDict() coremedia.StringKeyDict

CreateHpd1DeviceInfoDict creates a dict.StringKeyDict that needs to be sent to the device before receiving a feed

func NewAsynHPA0

func NewAsynHPA0(clockRef uint64) []byte

NewAsynHPA0 creates the bytes needed for stopping audio streaming

func NewAsynHPD0

func NewAsynHPD0() []byte

NewAsynHPD0 creates the bytes needed for stopping video streaming

func NewAsynHpa1Packet

func NewAsynHpa1Packet(stringKeyDict coremedia.StringKeyDict, clockRef CFTypeID) []byte

NewAsynHpa1Packet creates a []byte containing a valid ASYN packet with the Hpa1 dictionary

func NewAsynHpd1Packet

func NewAsynHpd1Packet(stringKeyDict coremedia.StringKeyDict) []byte

NewAsynHpd1Packet creates a []byte containing a valid ASYN packet with the Hpd1 dictionary

func NewPingPacketAsBytes

func NewPingPacketAsBytes() []byte

NewPingPacketAsBytes generates a new default Ping packet

Types

type AsynCmSampleBufPacket

type AsynCmSampleBufPacket struct {
	ClockRef    CFTypeID
	CMSampleBuf coremedia.CMSampleBuffer
}

AsynCmSampleBufPacket contains a CMSampleBuffer with audio or video data

func NewAsynCmSampleBufPacketFromBytes

func NewAsynCmSampleBufPacketFromBytes(data []byte) (AsynCmSampleBufPacket, error)

NewAsynCmSampleBufPacketFromBytes parses a new AsynCmSampleBufPacket from bytes

func (AsynCmSampleBufPacket) String

func (sp AsynCmSampleBufPacket) String() string

type AsynRelsPacket

type AsynRelsPacket struct {
	ClockRef CFTypeID
}

AsynRelsPacket tells us that a clock was released

func NewAsynRelsPacketFromBytes

func NewAsynRelsPacketFromBytes(data []byte) (AsynRelsPacket, error)

NewAsynRelsPacketFromBytes creates a new AsynRelsPacket from bytes

func (AsynRelsPacket) String

func (sp AsynRelsPacket) String() string

type AsynSprpPacket

type AsynSprpPacket struct {
	ClockRef CFTypeID
	Property coremedia.StringKeyEntry
}

AsynSprpPacket seems to be a set property packet sent by the device.

func NewAsynSprpPacketFromBytes

func NewAsynSprpPacketFromBytes(data []byte) (AsynSprpPacket, error)

NewAsynSprpPacketFromBytes creates a new AsynSprpPacket from bytes

func (AsynSprpPacket) String

func (sp AsynSprpPacket) String() string

type AsynSratPacket

type AsynSratPacket struct {
	ClockRef CFTypeID
	Rate1    float32
	Rate2    float32
	Time     coremedia.CMTime
}

AsynSratPacket is probably related to AVPlayer.SetRate somehow. I dont know exactly what everything means here

func NewAsynSratPacketFromBytes

func NewAsynSratPacketFromBytes(data []byte) (AsynSratPacket, error)

NewAsynSratPacketFromBytes parses a new AsynSratPacket from bytes

func (AsynSratPacket) String

func (sp AsynSratPacket) String() string

type AsynTbasPacket

type AsynTbasPacket struct {
	ClockRef     CFTypeID
	SomeOtherRef CFTypeID
}

AsynTbasPacket contains info about a new Timebase. I do not know what the other reference is used for.

func NewAsynTbasPacketFromBytes

func NewAsynTbasPacketFromBytes(data []byte) (AsynTbasPacket, error)

NewAsynTbasPacketFromBytes parses a AsynTbasPacket from bytes.

func (AsynTbasPacket) String

func (sp AsynTbasPacket) String() string

type AsynTjmpPacket

type AsynTjmpPacket struct {
	ClockRef CFTypeID
	Unknown  []byte
}

AsynTjmpPacket contains the data from a TJMP packet. I think this is a notification sent by the device about changing a TimeBase. I do not know what the last bytes are for currently.

func NewAsynTjmpPacketFromBytes

func NewAsynTjmpPacketFromBytes(data []byte) (AsynTjmpPacket, error)

NewAsynTjmpPacketFromBytes parses a new AsynTjmpPacket from byte array

func (AsynTjmpPacket) String

func (sp AsynTjmpPacket) String() string

type CFTypeID

type CFTypeID = uint64

CFTypeID is just a type alias for uint64 but I think it is closer to what is happening on MAC/iOS

const EmptyCFType CFTypeID = 1

EmptyCFType is a CFTypeId of 0x1

func ParseAsynHeader

func ParseAsynHeader(data []byte, messagemagic uint32) ([]byte, CFTypeID, error)

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

func ParseSyncHeader

func ParseSyncHeader(data []byte, messagemagic uint32) ([]byte, CFTypeID, uint64, error)

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

type SyncAfmtPacket

type SyncAfmtPacket struct {
	ClockRef                    CFTypeID
	CorrelationID               uint64
	AudioStreamBasicDescription coremedia.AudioStreamBasicDescription
}

SyncAfmtPacket contains what I think is information about the audio format

func NewSyncAfmtPacketFromBytes

func NewSyncAfmtPacketFromBytes(data []byte) (SyncAfmtPacket, error)

NewSyncAfmtPacketFromBytes parses a new AsynFmtPacket from byte array

func (SyncAfmtPacket) NewReply

func (sp SyncAfmtPacket) NewReply() []byte

NewReply returns a []byte containing a correct reploy for afmt

func (SyncAfmtPacket) String

func (sp SyncAfmtPacket) String() string

type SyncClokPacket

type SyncClokPacket struct {
	ClockRef      CFTypeID
	CorrelationID uint64
}

SyncClokPacket contains a decoded Clok packet from the device

func NewSyncClokPacketFromBytes

func NewSyncClokPacketFromBytes(data []byte) (SyncClokPacket, error)

NewSyncClokPacketFromBytes parses a SynClokPacket from bytes

func (SyncClokPacket) NewReply

func (sp SyncClokPacket) NewReply(clockRef CFTypeID) []byte

NewReply creates a RPLY message containing the given clockRef and serializes it into a []byte

func (SyncClokPacket) String

func (sp SyncClokPacket) String() string

type SyncCvrpPacket

type SyncCvrpPacket struct {
	ClockRef       CFTypeID
	CorrelationID  uint64
	DeviceClockRef CFTypeID
	Payload        coremedia.StringKeyDict
}

SyncCvrpPacket contains all info from a CVRP packet sent by the device

func NewSyncCvrpPacketFromBytes

func NewSyncCvrpPacketFromBytes(data []byte) (SyncCvrpPacket, error)

NewSyncCvrpPacketFromBytes parses a SyncCvrpPacket from a []byte

func (SyncCvrpPacket) NewReply

func (sp SyncCvrpPacket) NewReply(clockRef CFTypeID) []byte

NewReply creates a RPLY packet containing the given clockRef and serializes it to a []byte

func (SyncCvrpPacket) String

func (sp SyncCvrpPacket) String() string

type SyncCwpaPacket

type SyncCwpaPacket struct {
	ClockRef       CFTypeID
	CorrelationID  uint64
	DeviceClockRef CFTypeID
}

SyncCwpaPacket contains all info from a CWPA packet sent by the device

func NewSyncCwpaPacketFromBytes

func NewSyncCwpaPacketFromBytes(data []byte) (SyncCwpaPacket, error)

NewSyncCwpaPacketFromBytes parses a SyncCwpaPacket from a []byte

func (SyncCwpaPacket) NewReply

func (sp SyncCwpaPacket) NewReply(clockRef CFTypeID) []byte

NewReply creates a RPLY packet containing the given clockRef and serializes it to a []byte

func (SyncCwpaPacket) String

func (sp SyncCwpaPacket) String() string

type SyncOgPacket

type SyncOgPacket struct {
	ClockRef      CFTypeID
	CorrelationID uint64
	Unknown       uint32
}

SyncOgPacket represents the OG Message. I do not know what these messages mean.

func NewSyncOgPacketFromBytes

func NewSyncOgPacketFromBytes(data []byte) (SyncOgPacket, error)

NewSyncOgPacketFromBytes parses a SyncOgPacket form bytes assuming it starts with SYNC magic and has the correct length.

func (SyncOgPacket) NewReply

func (sp SyncOgPacket) NewReply() []byte

NewReply returns a []byte containing the default reply for a SyncOgPacket

func (SyncOgPacket) String

func (sp SyncOgPacket) String() string

type SyncSkewPacket

type SyncSkewPacket struct {
	ClockRef      CFTypeID
	CorrelationID uint64
}

SyncSkewPacket requests us to reply with the current skew value

func NewSyncSkewPacketFromBytes

func NewSyncSkewPacketFromBytes(data []byte) (SyncSkewPacket, error)

NewSyncSkewPacketFromBytes parses a SyncSkewPacket from bytes

func (SyncSkewPacket) NewReply

func (sp SyncSkewPacket) NewReply(skew float64) []byte

NewReply creates a byte array containing the given skew

func (SyncSkewPacket) String

func (sp SyncSkewPacket) String() string

type SyncStopPacket

type SyncStopPacket struct {
	ClockRef      CFTypeID
	CorrelationID uint64
}

SyncStopPacket requests us to stop our clock

func NewSyncStopPacketFromBytes

func NewSyncStopPacketFromBytes(data []byte) (SyncStopPacket, error)

NewSyncStopPacketFromBytes parses a SyncStopPacket from bytes

func (SyncStopPacket) NewReply

func (sp SyncStopPacket) NewReply() []byte

NewReply creates a byte array containing the given skew

func (SyncStopPacket) String

func (sp SyncStopPacket) String() string

type SyncTimePacket

type SyncTimePacket struct {
	ClockRef      CFTypeID
	CorrelationID uint64
}

SyncTimePacket contains the data from a decoded Time Packet sent by the device

func NewSyncTimePacketFromBytes

func NewSyncTimePacketFromBytes(data []byte) (SyncTimePacket, error)

NewSyncTimePacketFromBytes parses a SyncTimePacket from bytes

func (SyncTimePacket) NewReply

func (sp SyncTimePacket) NewReply(time coremedia.CMTime) ([]byte, error)

NewReply creates a RPLY packet containing the given CMTime and serializes it to a []byte

func (SyncTimePacket) String

func (sp SyncTimePacket) String() string

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL