Documentation
¶
Overview ¶
Package mpegts proves utility functions for mpegts streams
Index ¶
Constants ¶
View Source
const ( PTS_DTS_INDICATOR_BOTH = 3 // 11 PTS_DTS_INDICATOR_ONLY_PTS = 2 // 10 PTS_DTS_INDICATOR_NONE = 0 // 00 // MaxPtsValue is the highest value the PTS can hold before it rolls over, since its a 33 bit timestamp. MaxPtsValue = (1 << 33) - 1 // 2^33 - 1 = 8589934591 = 0x1FFFFFFFF // MaxPtsTicks is the length of the complete PTS timeline. MaxPtsTicks = 1 << 33 // 2^33 = 8589934592 = 0x200000000 // Used as a sentinel values for algorithms working against PTS PtsNegativeInfinity = PTS(math.MaxUint64 - 1) //18446744073709551614 PtsPositiveInfinity = PTS(math.MaxUint64) //18446744073709551615 PtsClockRate = 90000 // UpperPtsRolloverThreshold is the threshold for a rollover on the upper end, MaxPtsValue - 30 min UpperPtsRolloverThreshold = 8427934591 // LowerPtsRolloverThreshold is the threshold for a rollover on the lower end, 30 min LowerPtsRolloverThreshold = 162000000 )
PTS constants
Variables ¶
View Source
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.") )
Functions ¶
func ComputeCRC ¶
ComputeCRC computes the CRC hash for the provided byte slice
func ExtractPCR ¶
ExtractPCR extracts a PCR time PCR is the Program Clock Reference. First 33 bits are PCR base. Next 6 bits are reserved. Final 9 bits are PCR extension.
Types ¶
type PTS ¶
type PTS uint64
PTS represents PTS time
func (PTS) DurationFrom ¶
DurationFrom returns the difference between the two pts times. This number is always positive.
func (PTS) GreaterOrEqual ¶
GreaterOrEqual returns true if the method reciever is >= the provided PTS
func (PTS) RolledOver ¶
RolledOver checks if this PTS just rollover compared to the other PTS
Directories
¶
Path | Synopsis |
---|---|
package main contains CLI utilities for testing
|
package main contains CLI utilities for testing |
Package ebp is used to detect and extract EBP information.
|
Package ebp is used to detect and extract EBP information. |
Package packet is used for reading and manipulating packets in an MPEG transport stream
|
Package packet is used for reading and manipulating packets in an MPEG transport stream |
adaptationfield
AdaptationField provides functions for accessing and reading packet adaptation fields
|
AdaptationField provides functions for accessing and reading packet adaptation fields |
Package pes contains interfaces and operations for packetized elementary stream headers.
|
Package pes contains interfaces and operations for packetized elementary stream headers. |
Package psi provides mechanisms for collecting and querying program specific information in an MPEG transport stream.
|
Package psi provides mechanisms for collecting and querying program specific information in an MPEG transport stream. |
Package scte35 is for handling scte35 splice signals
|
Package scte35 is for handling scte35 splice signals |
Click to show internal directories.
Click to hide internal directories.