Documentation
¶
Index ¶
Constants ¶
View Source
const BufSz = 16384 * PktSz
bufSz is the size of a read when parsing files.
View Source
const PktSz = 188
pktSz is the size of an MPEG-TS packet in bytes.
Variables ¶
This section is empty.
Functions ¶
Types ¶
type Cue ¶
type Cue struct {
InfoSection *InfoSection
Command *SpliceCommand
Descriptors []SpliceDescriptor `json:",omitempty"`
PacketData *packetData `json:",omitempty"`
}
* Cue is a SCTE35 cue.
A Cue contains:
1 InfoSection
1 SpliceCommand
0 or more Splice Descriptors
1 packetData (if parsed from MPEGTS)
*
type InfoSection ¶
type InfoSection struct {
Name string
TableID string
SectionSyntaxIndicator bool
Private bool
Reserved string
SectionLength uint16
ProtocolVersion uint8
EncryptedPacket bool
EncryptionAlgorithm uint8
PtsAdjustment float64
CwIndex string
Tier string
SpliceCommandLength uint16
SpliceCommandType uint8
DescriptorLoopLength uint16
}
InfoSection is the splice info section of the SCTE 35 cue.
type Scte35Parser ¶
type Scte35Parser struct {
Stream
}
Scte35Parser is for incorporating with another MPEGTS parser.
Usage:
import(
"fmt"
"github.com/futzu/cuei"
)
scte35parser := cuei.NewScte35Parser()
// Each time your parser/demuxer finds
// a SCTE-35 packet do something like
cue := scte35parser.Parse(aScte35Packet)
if cue != nil {
// process the Cue
fmt.Printf("%#v",cue.Command)
}
func (*Scte35Parser) Parse ¶
func (scte35p *Scte35Parser) Parse(pkt []byte) (cue *Cue)
Parse accepts a MPEGTS SCTE-35 packet as input.
If the MPEGTS SCTE-35 packet contains a complete cue message
The cue message is decoded into a Cue and returned.
If the MPEGTS SCTE-35 packet is a partial cue message
It will be stored and aggregated with the next MPEGTS SCTE-35 packet until complete.
Completed cue messages are decoded into a Cue and returned.
type SpliceCommand ¶
type SpliceCommand struct {
Name string
CommandType uint8
Identifier uint32 `json:",omitempty"`
Bites []byte `json:",omitempty"`
SpliceEventID string `json:",omitempty"`
SpliceEventCancelIndicator bool `json:",omitempty"`
OutOfNetworkIndicator bool `json:",omitempty"`
ProgramSpliceFlag bool `json:",omitempty"`
DurationFlag bool `json:",omitempty"`
BreakAutoReturn bool `json:",omitempty"`
BreakDuration float64 `json:",omitempty"`
SpliceImmediateFlag bool `json:",omitempty"`
ComponentCount uint8 `json:",omitempty"`
Components []uint8 `json:",omitempty"`
UniqueProgramID uint16 `json:",omitempty"`
AvailNum uint8 `json:",omitempty"`
AvailExpected uint8 `json:",omitempty"`
TimeSpecifiedFlag bool `json:",omitempty"`
PTS float64 `json:",omitempty"`
}
* SpliceCommand
These Splice Command types are consolidated into SpliceCommand.
0x0: Splice Null,
0x5: Splice Insert,
0x6: Time Signal,
0x7: Bandwidth Reservation,
0xff: Private,
*
type SpliceDescriptor ¶
type SpliceDescriptor struct {
Tag uint8 `json:",omitempty"`
Length uint8 `json:",omitempty"`
Identifier string `json:",omitempty"`
Name string `json:",omitempty"`
AudioComponents []audioCmpt `json:",omitempty"`
ProviderAvailID uint32 `json:",omitempty"`
PreRoll uint8 `json:",omitempty"`
DTMFCount uint8 `json:",omitempty"`
DTMFChars uint64 `json:",omitempty"`
TAISeconds uint64 `json:",omitempty"`
TAINano uint32 `json:",omitempty"`
UTCOffset uint16 `json:",omitempty"`
SegmentationEventID string `json:",omitempty"`
SegmentationEventCancelIndicator bool `json:",omitempty"`
ProgramSegmentationFlag bool `json:",omitempty"`
SegmentationDurationFlag bool `json:",omitempty"`
DeliveryNotRestrictedFlag bool `json:",omitempty"`
WebDeliveryAllowedFlag bool `json:",omitempty"`
NoRegionalBlackoutFlag bool `json:",omitempty"`
ArchiveAllowedFlag bool `json:",omitempty"`
DeviceRestrictions string `json:",omitempty"`
Components []segCmpt `json:",omitempty"`
SegmentationDuration float64 `json:",omitempty"`
SegmentationMessage string `json:",omitempty"`
SegmentationUpidType uint8 `json:",omitempty"`
SegmentationUpidLength uint8 `json:",omitempty"`
SegmentationUpid *Upid `json:",omitempty"`
SegmentationTypeID uint8 `json:",omitempty"`
SegmentNum uint8 `json:",omitempty"`
SegmentsExpected uint8 `json:",omitempty"`
SubSegmentNum uint8 `json:",omitempty"`
SubSegmentsExpected uint8 `json:",omitempty"`
}
func (*SpliceDescriptor) Decode ¶
func (dscptr *SpliceDescriptor) Decode(gob *gobs.Gob, tag uint8, length uint8)
* Decode returns a Splice Descriptor by tag.
The following Splice Descriptors are recognized.
0x0: Avail Descriptor,
0x1: DTMF Descriptor,
0x2: Segmentation Descriptor,
0x3: Time Descriptor,
0x4: Audio Descrioptor,
*
type Stream ¶
type Stream struct {
Cues []*Cue
Pids *Pids
Pid2Prgm map[uint16]uint16 // pid to program map
Pid2Type map[uint16]uint8 // pid to stream type map
Programs []uint16
Prgm2Pcr map[uint16]uint64 // program to pcr map
Prgm2Pts map[uint16]uint64 // program to pts map
// contains filtered or unexported fields
}
Stream for parsing MPEGTS for SCTE-35
func (*Stream) DecodeBytes ¶
type Upid ¶
type Upid struct {
Name string `json:",omitempty"`
UpidType uint8 `json:",omitempty"`
Value string `json:",omitempty"`
TSID uint16 `json:",omitempty"`
Reserved uint8 `json:",omitempty"`
EndOfDay uint8 `json:",omitempty"`
UniqueFor uint16 `json:",omitempty"`
ContentID []byte `json:",omitempty"`
Upids []Upid `json:",omitempty"`
FormatIdentifier string `json:",omitempty"`
PrivateData []byte `json:",omitempty"`
}
* Upid is the Struct for Segmentation Upids
These UPID types are recognized.
0x01: "Deprecated",
0x02: "Deprecated",
0x03: "AdID",
0x05: "ISAN"
0x06: "ISAN"
0x07: "TID",
0x08: "AiringID",
0x09: "ADI",
0x10: "UUID",
0x11: "ACR",
0x0a: "EIDR",
0x0b: "ATSC",
0x0c: "MPU",
0x0d: "MID",
0x0e: "ADS Info",
0x0f: "URI",
Non-standard UPID types are returned as bytes.
*
Click to show internal directories.
Click to hide internal directories.