tsparser

package
v0.0.0-...-aa0c5a1 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Aug 24, 2014 License: BSD-3-Clause Imports: 5 Imported by: 0

Documentation

Index

Constants

View Source
const (
	PacketSize          = 188
	BufferedPacketCount = 5
	BufferSize          = PacketSize * BufferedPacketCount

	SyncByte byte = 0x47
)

Variables

View Source
var (
	ErrInvalidPointer  = errors.New("Invalid value of pointer_field")
	ErrPacketScrambled = errors.New("Scrambled")
	ErrPacketDropped   = errors.New("Detected dropping packet")
)
View Source
var (
	ErrInvalidTableLength   = errors.New("Invalid table length")
	ErrInvalidSectionLength = errors.New("Invalid value of section_length")
)

Functions

func AsUint32

func AsUint32(data []byte) (n uint32)

func CheckCRC32

func CheckCRC32(payload []byte) bool

Types

type Descriptor

type Descriptor []byte

func ParseDescriptor

func ParseDescriptor(data []byte) (d Descriptor, length int)

func ParseDescriptors

func ParseDescriptors(data []byte) []Descriptor

func (Descriptor) Length

func (d Descriptor) Length() uint8

func (Descriptor) Payload

func (d Descriptor) Payload() []byte

func (Descriptor) Tag

func (d Descriptor) Tag() DescriptorTag

type DescriptorTag

type DescriptorTag uint8

type PID

type PID uint16

type PIDSlice

type PIDSlice []PID

func (PIDSlice) Len

func (pids PIDSlice) Len() int

func (PIDSlice) Less

func (pids PIDSlice) Less(i, j int) bool

func (PIDSlice) Search

func (pids PIDSlice) Search(pid PID) int

func (PIDSlice) Swap

func (pids PIDSlice) Swap(i, j int)

type Packet

type Packet []byte

func (Packet) AdaptationField

func (p Packet) AdaptationField() []byte

func (Packet) HasAdaptationField

func (p Packet) HasAdaptationField() bool

func (Packet) HasPayload

func (p Packet) HasPayload() bool

func (Packet) PID

func (p Packet) PID() PID

func (Packet) Payload

func (p Packet) Payload() []byte

type PacketFilter

type PacketFilter struct {
	// contains filtered or unexported fields
}

func NewPacketFilter

func NewPacketFilter(s PacketStream, pids ...PID) *PacketFilter

func (*PacketFilter) Bytes

func (f *PacketFilter) Bytes() []byte

func (*PacketFilter) Packet

func (f *PacketFilter) Packet() Packet

func (*PacketFilter) Scan

func (f *PacketFilter) Scan() bool

type PacketScanner

type PacketScanner struct {
	// contains filtered or unexported fields
}

func NewPacketScanner

func NewPacketScanner(r io.Reader, logger *log.Logger) *PacketScanner

func (*PacketScanner) Bytes

func (s *PacketScanner) Bytes() []byte

func (*PacketScanner) Packet

func (s *PacketScanner) Packet() Packet

func (*PacketScanner) Scan

func (s *PacketScanner) Scan() bool

type PacketStream

type PacketStream interface {
	Scan() bool
	Packet() Packet
}

type ProgramAssociationSection

type ProgramAssociationSection struct {
	// contains filtered or unexported fields
}

func ParseProgramAssociationSection

func ParseProgramAssociationSection(table Table) *ProgramAssociationSection

func (*ProgramAssociationSection) NetworkPID

func (s *ProgramAssociationSection) NetworkPID() PID

func (*ProgramAssociationSection) ProgramMap

func (s *ProgramAssociationSection) ProgramMap() map[uint16]PID

type Table

type Table []byte

func (Table) CRC32

func (t Table) CRC32() uint32

func (Table) CheckCRC

func (t Table) CheckCRC() bool

func (Table) CurrentNextIndicator

func (t Table) CurrentNextIndicator() bool

func (Table) Data

func (t Table) Data() []byte

func (Table) LastSectionNumber

func (t Table) LastSectionNumber() uint8

func (Table) PrivateIndicator

func (t Table) PrivateIndicator() bool

func (Table) SectionLength

func (t Table) SectionLength() int

func (Table) SectionNumber

func (t Table) SectionNumber() uint8

func (Table) SectionSyntaxIndicator

func (t Table) SectionSyntaxIndicator() bool

func (Table) TableId

func (t Table) TableId() TableId

func (Table) TableIdExtension

func (t Table) TableIdExtension() uint16

func (Table) VersionNumber

func (t Table) VersionNumber() uint8

type TableId

type TableId uint8
const (
	ProgramAssociationTable TableId = 0x00
)

type TableScanner

type TableScanner struct {
	// contains filtered or unexported fields
}

func NewTableScanner

func NewTableScanner(s PacketStream, l *log.Logger) *TableScanner

func (*TableScanner) Scan

func (s *TableScanner) Scan() bool

func (*TableScanner) Table

func (s *TableScanner) Table() Table

type TableStream

type TableStream interface {
	Scan() bool
	Table() Table
}

Directories

Path Synopsis

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL