Documentation
¶
Index ¶
Examples ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type Command ¶
type Command struct { Name string CommandType uint8 PrivateBytes []byte `json:",omitempty"` Identifier uint32 `json:",omitempty"` SpliceEventID uint32 `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"` UniqueProgramID uint16 `json:",omitempty"` AvailNum uint8 `json:",omitempty"` AvailExpected uint8 `json:",omitempty"` TimeSpecifiedFlag bool `json:",omitempty"` PTS float64 `json:",omitempty"` }
Command
These Splice Command types are consolidated into Command. 0x0: Splice Null, 0x5: Splice Insert, 0x6: Time Signal, 0x7: Bandwidth Reservation, 0xff: Private,
type Cue ¶
type Cue struct { InfoSection *InfoSection Command *Command Dll uint16 `json:"DescriptorLoopLength"` Descriptors []Descriptor `json:",omitempty"` PacketData *packetData `json:",omitempty"` Crc32 uint32 }
Cue is a SCTE35 cue.
A Cue contains:
1 InfoSection 1 Command 1 Dll Descriptor loop length 0 or more Splice Descriptors 1 Crc32 0 or 1 packetData (if parsed from MPEGTS)
func Json2Cue ¶
Take a JSON string and return a *Cue
Example ¶
package main import ( "github.com/futzu/cuei" ) func main() { js := `{ "InfoSection": { "Name": "Splice Info Section", "TableID": "0xfc", "SectionSyntaxIndicator": false, "Private": false, "Reserved": "0x3", "SectionLength": 42, "ProtocolVersion": 0, "EncryptedPacket": false, "EncryptionAlgorithm": 0, "PtsAdjustment": 0, "CwIndex": "0xff", "Tier": "0xfff", "CommandLength": 15, "CommandType": 5 }, "Command": { "Name": "Splice Insert", "CommandType": 5, "SpliceEventID": 5690, "OutOfNetworkIndicator": true, "ProgramSpliceFlag": true, "TimeSpecifiedFlag": true, "PTS": 23683.480033 }, "DescriptorLoopLength": 10, "Descriptors": [ { "Length": 8, "Identifier": "CUEI", "Name": "Avail Descriptor" } ], "Crc32": 3608566905 } ` cue := cuei.Json2Cue(js) cue.Encode() cue.Show() }
Output:
func NewCue ¶
func NewCue() *Cue
initialize and return a *Cue
Example ¶
package main import ( "github.com/futzu/cuei" ) func main() { data := "/DCtAAAAAAAAAP/wBQb+Tq9DwQCXAixDVUVJCUvhcH+fAR1QQ1IxXzEyMTYyMTE0MDBXQUJDUkFDSEFFTFJBWSEBAQIsQ1VFSQlL4W9/nwEdUENSMV8xMjE2MjExNDAwV0FCQ1JBQ0hBRUxSQVkRAQECGUNVRUkJTBwVf58BClRLUlIxNjA4NEEQAQECHkNVRUkJTBwWf98AA3clYAEKVEtSUjE2MDg0QSABAdHBXYA=" cue := cuei.NewCue() cue.Decode(data) cue.Show() }
Output:
func (*Cue) AdjustPts ¶
AdjustPts adds seconds to cue.InfoSection.PtsAdjustment
Example ¶
package main import ( "fmt" "github.com/futzu/cuei" ) func main() { data := "/DAWAAAAAAAAAP/wBQb+AKmKxwAACzuu2Q==" cue := cuei.NewCue() cue.Decode(data) cue.Show() // Change cue.InfoSection.PtsAdjustment and re-encode cue to bytes cue.AdjustPts(33.333) cue.Show() fmt.Println("Was", data) fmt.Println("Is", cue.Encode2B64()) }
Output:
func (*Cue) Decode ¶
Decode takes Cue data as []byte, base64 or hex string.
Example ¶
package main import ( "github.com/futzu/cuei" ) func main() { data := "/DAWAAAAAAAAAP/wBQb+AKmKxwAACzuu2Q==" cue := cuei.NewCue() cue.Decode(data) cue.Show() }
Output:
func (*Cue) Encode ¶
Encode Cue currently works for Splice Inserts and Time Signals
Example ¶
package main import ( "fmt" "github.com/futzu/cuei" ) func main() { data := "/DAWAAAAAAAAAP/wBQb+AKmKxwAACzuu2Q==" cue := cuei.NewCue() cue.Decode(data) fmt.Println(cue.Encode()) }
Output:
func (*Cue) Encode2B64 ¶
Encode2B64 Encodes cue and returns Base64 string
Example ¶
package main import ( "fmt" "github.com/futzu/cuei" ) func main() { data := "/DAWAAAAAAAAAP/wBQb+AKmKxwAACzuu2Q==" cue := cuei.NewCue() cue.Decode(data) fmt.Println(cue.Encode2B64()) }
Output:
func (*Cue) Encode2Hex ¶
Encode2Hex encodes cue and returns as a hex string
Example ¶
package main import ( "fmt" "github.com/futzu/cuei" ) func main() { data := "/DAWAAAAAAAAAP/wBQb+AKmKxwAACzuu2Q==" cue := cuei.NewCue() cue.Decode(data) fmt.Println(cue.Encode2Hex()) cue.Decode(cue.Encode2Hex()) cue.Show() }
Output:
type Descriptor ¶
type Descriptor 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 (*Descriptor) Decode ¶
func (dscptr *Descriptor) Decode(bd *bitDecoder, 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,
*
func (*Descriptor) Encode ¶
func (dscptr *Descriptor) Encode(be *bitEncoder)
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 CommandLength uint16 CommandType uint8 }
InfoSection is the splice info section of the SCTE 35 cue.
func (*InfoSection) Decode ¶
func (infosec *InfoSection) Decode(bd *bitDecoder) bool
Decode Splice Info Section values.
func (*InfoSection) Encode ¶
func (infosec *InfoSection) Encode() []byte
Encode Splice Info Section Encodes the InfoSection variables to bytes.
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 Quiet bool // Don't call Cue.Show() when a Cue is found. // contains filtered or unexported fields }
Stream for parsing MPEGTS for SCTE-35
func (*Stream) DecodeBytes ¶
DecodeBytes Parses a chunk of mpegts bytes for SCTE-35
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
Non-standard UPID types are returned as bytes.