-
Notifications
You must be signed in to change notification settings - Fork 88
/
errors.go
115 lines (108 loc) · 8.03 KB
/
errors.go
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
/*
MIT License
Copyright 2016 Comcast Cable Communications Management, LLC
Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
in the Software without restriction, including without limitation the rights
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
copies of the Software, and to permit persons to whom the Software is
furnished to do so, subject to the following conditions:
The above copyright notice and this permission notice shall be included in all
copies or substantial portions of the Software.
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
SOFTWARE.
*/
package gots
import "errors"
var (
// ErrBadSyncByte is returned when the sync byte (first byte of packet) is not valid
ErrBadSyncByte = errors.New("sync byte is not valid")
// ErrUnrecognizedEbpType is returned if the EBP cannot be parsed
ErrUnrecognizedEbpType = errors.New("unrecognized EBP")
// ErrNoEBP is returned when an attempt is made to extract an EBP from a packet that does not contain one
ErrNoEBP = errors.New("packet does not contain EBP")
// ErrNoEBPData is returned when an attempt is made to extract an EBP data that does not contain one
ErrNoEBPData = errors.New("empty data provided to EBP parser")
// ErrInvalidEBPLength is returned when an attempt is made to extract an EBP from a packet that contains an invalid amount of data
ErrInvalidEBPLength = errors.New("invalid EBP data length")
// ErrInvalidPacketLength denotes an packet length that is not packet.PacketSize bytes in length
ErrInvalidPacketLength = errors.New("invalid packet length")
// ErrInvalidTSCFlag is returned when the transport scrambling control bit is set to the bit reserved by the specification
ErrInvalidTSCFlag = errors.New("invalid transport scrambling control option.")
// ErrInvalidAFCFlag is returned when the adaptation field control bits dont have a payload or an adaptation field
ErrInvalidAFCFlag = errors.New("invalid packet length")
// ErrNoPayload denotes that the attempted operation is not valid on a packet with no payload
ErrNoPayload = errors.New("packet does not contain payload")
// ErrNoAdaptationField is returned if the adaptation field cannot be accessed or does not exist.
ErrNoAdaptationField = errors.New("packet does not contain an adaptation field")
// ErrAdaptationFieldTooLarge is returned if the adaptation field is too large to be put in a packet.
ErrAdaptationFieldTooLarge = errors.New("adaptation field is too large and cannot shrink")
// ErrAdaptationFieldCannotGrow is returned if the adaptation field will overwrite the payload if it grows.
ErrAdaptationFieldCannotGrow = errors.New("adaptation field cannot cannot grow beyond its allocated length")
// ErrAdaptationFieldZeroLength is returned if the adaptation field is empty and only used for stuffing.
ErrAdaptationFieldZeroLength = errors.New("adaptation field is empty")
// ErrNoPrivateTransportData is returned when an attempt is made to access private transport data when none exists
ErrNoPrivateTransportData = errors.New("adaptation field has no private transport data")
// ErrNoSplicePoint is returned when an attempt to access a splice countdown and no splice point exists
ErrNoSplicePoint = errors.New("adaptation field has no splice point")
// ErrNoPCR is returned when an attempt is made to access adaptation field PRC that does not exist
ErrNoPCR = errors.New("adaptation field has no Program Clock Reference")
// ErrNoOPCR is returned when an attempt is made to access an adaptation field OPCR that does not exist
ErrNoOPCR = errors.New("adaptation field has no Original Program Clock Reference")
// ErrNoAdaptationFieldExtension is returned when an attempt is made to access adaptation field's
// Adaptation Field Extension when it does not exist
ErrNoAdaptationFieldExtension = errors.New("adaptation field has no Adaptation Field Extension")
// ErrPATNotFound is returned when expected PAT packet is not found when
// reading TS packets.
ErrPATNotFound = errors.New("No PAT was found while reading TS")
// ErrPMTNotFound is returned when expected PMT packet(s) are not found when
// reading TS packets.
ErrPMTNotFound = errors.New("No PMT was found while reading TS")
// ErrPMTParse is returned when malformed PMT data is present
ErrPMTParse = errors.New("PMT malformed.")
// ErrParsePMTDescriptor is returned when a PMT descriptor cannot be parsed
ErrParsePMTDescriptor = errors.New("unable to parse PMT descriptor")
// ErrInvalidPATLength is returned when a PAT cannot be parsed because there are not enough bytes
ErrInvalidPATLength = errors.New("too few bytes to parse PAT")
// ErrNoPayloadUnitStartIndicator should be returned when a packet is expected to have a PUSI and does not.
ErrNoPayloadUnitStartIndicator = errors.New("packet does not have payload unit start indicator")
// ErrUnknownTableID is returned when PSI is parsed with an unknown table id
ErrUnknownTableID = errors.New("Unknown table id received")
// ErrTableHeaderShort is returned when a PSI table header is too short to parse
ErrShortPayload = errors.New("provided data is too short to parse")
// ErrInvalidSCTE35Length is returned when a SCTE35 cue cannot be parsed because there are not enough bytes
ErrInvalidSCTE35Length = errors.New("too few bytes to parse SCTE35")
// ErrSCTE35EncryptionUnsupported is returned when a scte35 cue cannot be parsed because it is encrypted
ErrSCTE35EncryptionUnsupported = errors.New("SCTE35 is encrypted, which is not supported")
// ErrSCTE35UnsupportedSpliceCommand is returned when a SCTE35 cue
// cannot be parsed because the command type is not supported
ErrSCTE35UnsupportedSpliceCommand = errors.New("SCTE35 cue can't be parsed because only time_signal with a pts value and splice_null commands are supported")
// ErrSCTE35InvalidDescriptorID is returned when a segmentation descriptor is found with an id that is not CUEI
ErrSCTE35InvalidDescriptorID = errors.New("SCTE35 segmentation descriptor has a id that is not \"CUEI\"")
// ErrSCTE35DuplicateSignal is returned when a duplicate or equivalent descriptor is received by state
ErrSCTE35DuplicateDescriptor = errors.New("Duplicate or equivalent descriptor received by scte35.State")
// ErrSCTE35InvalidDescriptor is returned when a descriptor is invalid given the current state (i.e. a ProgramResumption received when no it breakaway)
ErrSCTE35InvalidDescriptor = errors.New("Invalid descriptor given the current state")
// ErrSCTE35MissingOut is returned when an in descriptor is received by state with no matching out
ErrSCTE35MissingOut = errors.New("In descriptor received with no matching out")
// ErrSCTE35DescriptorNotFound is returned when a descriptor is closed that's not in the open list
ErrSCTE35DescriptorNotFound = errors.New("Cannot close descriptor that's not in the open list")
// ErrNilPAT is returned when a PAT is passed into a function for which it cannot be nil.
ErrNilPAT = errors.New("Nil PAT not allowed here.")
// ErrSyncByteNotFound is returned when a packet sync byte could not be found
// when reading.
ErrSyncByteNotFound = errors.New("Sync-byte not found.")
// ErrVSSSignalIdNotFound is returned when we do not find SignalID in the VSS signal's MID.
ErrVSSSignalIdNotFound = errors.New("VSS Signal ID not found in the VSS signal received.")
// ErrPIDNotInPMT
ErrPIDNotInPMT = errors.New("PID(s) %d not found in PMT.")
// ErrDone signals an accumulator is done accumulating
ErrAccumulatorDone = errors.New("Accumulation is complete.")
// ErrInvalidState should be unreachable but is returned if the accumulator has reached an invalid state
ErrAccumulatorInvalidState = errors.New("Accumulator is in an invalid state.")
)