Skip to content

Commit 4c3c478

Browse files
authored
Merge pull request #92 from alextarasov1/packet-create
Packet switch to receivers, packet modification
2 parents b075ace + 24ebf98 commit 4c3c478

6 files changed

+1831
-0
lines changed

errors.go

+17
Original file line numberDiff line numberDiff line change
@@ -27,14 +27,28 @@ package gots
2727
import "errors"
2828

2929
var (
30+
// ErrBadSyncByte is returned when the sync byte (first byte of packet) is not valid
31+
ErrBadSyncByte = errors.New("sync byte is not valid")
3032
// ErrUnrecognizedEbpType is returned if the EBP cannot be parsed
3133
ErrUnrecognizedEbpType = errors.New("unrecognized EBP")
3234
// ErrNoEBP is returned when an attempt is made to extract an EBP from a packet that does not contain one
3335
ErrNoEBP = errors.New("packet does not contain EBP")
3436
// ErrInvalidPacketLength denotes an packet length that is not packet.PacketSize bytes in length
3537
ErrInvalidPacketLength = errors.New("invalid packet length")
38+
// ErrInvalidTSCFlag is returned when the transport scrambling control bit is set to the bit reserved by the specification
39+
ErrInvalidTSCFlag = errors.New("invalid transport scrambling control option.")
40+
// ErrInvalidAFCFlag is returned when the adaptation field control bits dont have a payload or an adaptation field
41+
ErrInvalidAFCFlag = errors.New("invalid packet length")
3642
// ErrNoPayload denotes that the attempted operation is not valid on a packet with no payload
3743
ErrNoPayload = errors.New("packet does not contain payload")
44+
// ErrNoAdaptationField is returned if the adaptation field cannot be accessed or does not exist.
45+
ErrNoAdaptationField = errors.New("packet does not contain an adaptation field")
46+
// ErrAdaptationFieldTooLarge is returned if the adaptation field is too large to be put in a packet.
47+
ErrAdaptationFieldTooLarge = errors.New("adaptation field is too large and cannot shrink")
48+
// ErrAdaptationFieldCannotGrow is returned if the adaptation field will overwrite the payload if it grows.
49+
ErrAdaptationFieldCannotGrow = errors.New("adaptation field cannot cannot grow beyond its allocated length")
50+
// ErrAdaptationFieldZeroLength is returned if the adaptation field is empty and only used for stuffing.
51+
ErrAdaptationFieldZeroLength = errors.New("adaptation field is empty")
3852
// ErrNoPrivateTransportData is returned when an attempt is made to access private transport data when none exists
3953
ErrNoPrivateTransportData = errors.New("adaptation field has no private transport data")
4054
// ErrNoSplicePoint is returned when an attempt to access a splice countdown and no splice point exists
@@ -43,6 +57,9 @@ var (
4357
ErrNoPCR = errors.New("adaptation field has no Program Clock Reference")
4458
// ErrNoOPCR is returned when an attempt is made to access an adaptation field OPCR that does not exist
4559
ErrNoOPCR = errors.New("adaptation field has no Original Program Clock Reference")
60+
// ErrNoAdaptationFieldExtension is returned when an attempt is made to access adaptation field's
61+
// Adaptation Field Extension when it does not exist
62+
ErrNoAdaptationFieldExtension = errors.New("adaptation field has no Adaptation Field Extension")
4663
// ErrPATNotFound is returned when expected PAT packet is not found when
4764
// reading TS packets.
4865
ErrPATNotFound = errors.New("No PAT was found while reading TS")

0 commit comments

Comments
 (0)