Documentation ¶
Index ¶
Examples ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
Types ¶
type Command ¶
type Command struct { Name string CommandType uint8 PrivateBytes []byte Identifier uint32 SpliceEventID uint32 SpliceEventCancelIndicator bool EventIDComplianceFlag bool OutOfNetworkIndicator bool ProgramSpliceFlag bool DurationFlag bool BreakAutoReturn bool BreakDuration float64 SpliceImmediateFlag bool UniqueProgramID uint16 AvailNum uint8 AvailExpected uint8 TimeSpecifiedFlag bool PTS float64 }
func (*Command) MarshalJSON ¶ added in v1.1.91
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 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 ¶ added in v1.1.51
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 ¶ added in v1.1.71
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) fmt.Println("Before calling Cue.AdjustPts") fmt.Println(data) cue.InfoSection.Show() fmt.Println() // Change cue.InfoSection.PtsAdjustment and re-encode cue to bytes cue.AdjustPts(33.333) fmt.Println("After calling Cue.AdjustPts") fmt.Println(cue.Encode2B64()) cue.InfoSection.Show() }
Output:
func (*Cue) Decode ¶
Decode takes Cue data as []byte, base64 or 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.Decode() parses data and populate the fields in the Cue.") cue.Show() fmt.Println("\n\nCue values can be accessed via dot notiation,") cue.Command.PTS = 987.654321 fmt.Printf("cue.Command.PTS = %v\n", cue.Command.PTS) }
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 ¶ added in v1.1.75
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 ¶ added in v1.1.75
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() cue.Command.Show() }
Output:
func (*Cue) Show ¶
func (cue *Cue) Show()
Show display SCTE-35 data as JSON.
Example ¶
package main import ( "github.com/futzu/cuei" ) func main() { data := "/DAWAAAAAAAAAP/wBQb+AKmKxwAACzuu2Q==" cue := cuei.NewCue() cue.Decode(data) cue.Show() }
Output:
type Descriptor ¶
type Descriptor struct { Tag uint8 Length uint8 Identifier string Name string ProviderAvailID uint32 AudioComponents []audioCmpt PreRoll uint8 DTMFCount uint8 DTMFChars uint64 TAISeconds uint64 TAINano uint32 UTCOffset uint16 SegmentationEventID string SegmentationEventCancelIndicator bool SegmentationEventIDComplianceIndicator bool ProgramSegmentationFlag bool SegmentationDurationFlag bool DeliveryNotRestrictedFlag bool WebDeliveryAllowedFlag bool NoRegionalBlackoutFlag bool ArchiveAllowedFlag bool DeviceRestrictions string SegmentationDuration float64 SegmentationMessage string SegmentationUpidType uint8 SegmentationUpidLength uint8 SegmentationUpid *Upid SegmentationTypeID uint8 SegmentNum uint8 SegmentsExpected uint8 SubSegmentNum uint8 SubSegmentsExpected uint8 }
*
Descriptor is the combination of all the descriptors this is to maintain dot notation in the Cue struct.
*
func (*Descriptor) Json ¶ added in v1.1.81
func (dscptr *Descriptor) Json() string
Return Descriptor as JSON
func (*Descriptor) MarshalJSON ¶ added in v1.1.91
func (dscptr *Descriptor) MarshalJSON() ([]byte, error)
* Custom MarshalJSON Marshal a Descriptor into 0x0: AvailDescriptor, 0x1: DTMFDescriptor, 0x2: SegmentationDescriptor or just return the Descriptor
*
func (*Descriptor) Show ¶ added in v1.1.81
func (dscptr *Descriptor) Show()
Print Descriptor as JSON
type InfoSection ¶
type InfoSection struct { Name string TableID string SectionSyntaxIndicator bool Private bool SapType uint8 SapDetails 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) Json ¶ added in v1.1.83
func (infosec *InfoSection) Json() string
Return InfoSection as JSON
func (*InfoSection) Show ¶ added in v1.1.83
func (infosec *InfoSection) Show()
Print InfoSection as JSON
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 ¶ added in v1.1.51
DecodeBytes Parses a chunk of mpegts bytes for SCTE-35
type Upid ¶ added in v1.1.53
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.