internal

package
v0.3.0 Latest Latest
Warning

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

Go to latest
Published: Oct 14, 2025 License: MIT Imports: 26 Imported by: 0

Documentation

Index

Constants

View Source
const (
	PacketSize = 188
	PtsWrap    = 1 << 33
	PcrWrap    = PtsWrap * 300
	TimeScale  = 90000
)
View Source
const (
	ANC_REGISTERED_IDENTIFIER = 0x56414E43
	ANC_DESCRIPTOR_TAG        = 0xC4
)

Variables

View Source
var SMPTE291Map = map[SMPTE291Identifier]string{
	{0x41, 0x05}: "AFD and Bar Data",
	{0x41, 0x06}: "Pan and Scan Information",
	{0x41, 0x07}: "ANSI/SCTE 104 messages",
	{0x41, 0x08}: "DVB/SCTE VBI data",
	{0x43, 0x01}: "Inter Station Control Packet Data",
	{0x43, 0x02}: "OP-47 SDP - Subtitling Data",
	{0x43, 0x03}: "OP-47 Multi Packet ANC Data",
	{0x45, 0x01}: "Audio Metadata (Single Program)",
	{0x45, 0x02}: "Audio Metadata Ch 01/02",
	{0x45, 0x03}: "Audio Metadata Ch 03/04",
	{0x45, 0x04}: "Audio Metadata Ch 05/06",
	{0x45, 0x05}: "Audio Metadata Ch 07/08",
	{0x45, 0x06}: "Audio Metadata Ch 09/10",
	{0x45, 0x07}: "Audio Metadata Ch 11/12",
	{0x45, 0x08}: "Audio Metadata Ch 13/14",
	{0x45, 0x09}: "Audio Metadata Ch 15/16",
	{0x50, 0x01}: "WSS - Wide Screen Signaling",
	{0x50, 0x30}: "User Defined",
	{0x50, 0x49}: "User Defined",
	{0x60, 0x60}: "ATC - Ancillary Timecode",
	{0x61, 0x01}: "EIA 708B Data mapping into VANC space",
	{0x61, 0x02}: "EIA 608 Data mapping into VANC space",
	{0x62, 0x01}: "DTV Program Description",
	{0x62, 0x02}: "DTV Data Broadcast",
	{0x62, 0x03}: "VBI Data",
}

Functions

func AddPTS added in v0.1.1

func AddPTS(p1, p2 int64) int64

func CalculateSteps added in v0.1.1

func CalculateSteps(timestamps []int64) []int64

func Execute added in v0.1.1

func Execute(w io.Writer, o Options, inFile string, function RunableFunc) error

func ExtractES added in v0.3.0

func ExtractES(ctx context.Context, textWriter io.Writer, esWriter io.Writer, f io.Reader, o Options) error

ExtractES extracts elementary stream from a TS file

func FilterPids added in v0.3.0

func FilterPids(ctx context.Context, textWriter io.Writer, tsWriter io.Writer, f io.Reader, o Options) error

func GetDifferenceOfTwoSlices added in v0.3.0

func GetDifferenceOfTwoSlices(s1 []int, s2 []int) []int

Return a set that contains those elements of s1 that are NOT in s2

func GetIntersectionOfTwoSlices added in v0.3.0

func GetIntersectionOfTwoSlices(s1 []int, s2 []int) []int

Return a set that contains those elements of s1 that are also in s2

func GetVersion

func GetVersion() string

GetVersion - get version and also commitHash and commitDate if inserted via Makefile

func IsTwoSlicesOverlapping added in v0.3.0

func IsTwoSlicesOverlapping(s1 []int, s2 []int) bool

Check if two sets contain same elements

func OpenFileAndAppend added in v0.3.0

func OpenFileAndAppend(file string) (*os.File, error)

func ParseAll added in v0.2.0

func ParseAll(ctx context.Context, w io.Writer, f io.Reader, o Options) error

func ParseInfo added in v0.2.0

func ParseInfo(ctx context.Context, w io.Writer, f io.Reader, o Options) error

func ParsePacketToPAT added in v0.3.0

func ParsePacketToPAT(pkt *packet.Packet) (pat psi.PAT, e error)

func ParsePidsFromString added in v0.3.0

func ParsePidsFromString(input string) []int

func ParseSCTE35 added in v0.3.0

func ParseSCTE35(ctx context.Context, w io.Writer, f io.Reader, o Options) error

func ParseSMPTE2038 added in v0.3.0

func ParseSMPTE2038(jp *JsonPrinter, d *astits.DemuxerData, o Options)

func ReadPMTPackets added in v0.3.0

func ReadPMTPackets(r io.Reader, pid int) ([]packet.Packet, psi.PMT, error)

func RemoveFileIfExists added in v0.3.0

func RemoveFileIfExists(file string) error

func SignedPTSDiff added in v0.1.1

func SignedPTSDiff(p2, p1 int64) int64

func ToSdtInfo added in v0.1.1

func ToSdtInfo(sdt *astits.SDTData) sdtInfo

func UnsignedPTSDiff added in v0.1.1

func UnsignedPTSDiff(p2, p1 int64) int64

func WritePacket added in v0.3.0

func WritePacket(pkt *packet.Packet, w io.Writer) error

Types

type AvcPS added in v0.2.0

type AvcPS struct {
	Statistics StreamStatistics
	// contains filtered or unexported fields
}

func ParseAVCPES added in v0.2.0

func ParseAVCPES(jp *JsonPrinter, d *astits.DemuxerData, ps *AvcPS, o Options) (*AvcPS, error)

type ElementaryStreamInfo added in v0.1.1

type ElementaryStreamInfo struct {
	PID   uint16 `json:"pid"`
	Codec string `json:"codec"`
	Type  string `json:"type"`
}

func ParseAstitsElementaryStreamInfo added in v0.3.0

func ParseAstitsElementaryStreamInfo(es *astits.PMTElementaryStream) *ElementaryStreamInfo

func ParseElementaryStreamInfo added in v0.3.0

func ParseElementaryStreamInfo(es psi.PmtElementaryStream) *ElementaryStreamInfo

type HevcPS added in v0.2.0

type HevcPS struct {
	Statistics StreamStatistics
	// contains filtered or unexported fields
}

func ParseHEVCPES added in v0.2.0

func ParseHEVCPES(jp *JsonPrinter, d *astits.DemuxerData, ps *HevcPS, o Options) (*HevcPS, error)

type JsonPrinter added in v0.1.1

type JsonPrinter struct {
	W        io.Writer
	Indent   bool
	AccError error
}

func (*JsonPrinter) Error added in v0.1.1

func (p *JsonPrinter) Error() error

func (*JsonPrinter) Print added in v0.1.1

func (p *JsonPrinter) Print(data any, show bool)

func (*JsonPrinter) PrintFilter added in v0.3.0

func (p *JsonPrinter) PrintFilter(s PidFilterStatistics, show bool)

func (*JsonPrinter) PrintPS added in v0.1.1

func (jp *JsonPrinter) PrintPS(pid uint16, psKind string, nr uint32, ps []byte, details any, verbose bool, show bool)

func (*JsonPrinter) PrintSdtInfo added in v0.1.1

func (p *JsonPrinter) PrintSdtInfo(sdt *astits.SDTData, show bool)

func (*JsonPrinter) PrintStatistics added in v0.1.1

func (p *JsonPrinter) PrintStatistics(s StreamStatistics, show bool)

type NaluData added in v0.1.1

type NaluData struct {
	Type string `json:"type"`
	Len  int    `json:"len"`
	Data any    `json:"data,omitempty"`
}

type NaluFrameData added in v0.1.1

type NaluFrameData struct {
	PID     uint16     `json:"pid"`
	RAI     bool       `json:"rai"`
	PTS     int64      `json:"pts"`
	DTS     int64      `json:"dts,omitempty"`
	ImgType string     `json:"imgType,omitempty"`
	NALUS   []NaluData `json:"nalus,omitempty"`
}

type OptionParseFunc added in v0.1.1

type OptionParseFunc func() Options

type Options added in v0.1.1

type Options struct {
	MaxNrPictures  int
	Version        bool
	Indent         bool
	ShowStreamInfo bool
	ShowService    bool
	ShowPS         bool
	VerbosePSInfo  bool
	ShowNALU       bool
	ShowSEIDetails bool
	ShowSMPTE2038  bool
	ShowSCTE35     bool
	ShowStatistics bool
	FilterPids     bool
	PidsToDrop     string
	OutPutTo       string
	WaitForPS      bool // Wait for parameter sets (SPS/PPS) before printing NAL units
	ExtractPID     int  // PID to extract for elementary stream extraction (0 = first video PID)
}

func CreateFullOptions added in v0.1.1

func CreateFullOptions(max int) Options

func ParseParams added in v0.1.1

func ParseParams(function OptionParseFunc) (o Options, inFile string)

type PidFilterStatistics added in v0.3.0

type PidFilterStatistics struct {
	PidsToDrop       []int   `json:"pidsToDrop"`
	TotalPackets     uint32  `json:"total"`
	FilteredPackets  uint32  `json:"filtered"`
	PacketsBeforePAT uint32  `json:"packetBeforePAT"`
	Percentage       float32 `json:"percentage"`
}

type PsInfo added in v0.1.1

type PsInfo struct {
	PID          uint16 `json:"pid"`
	ParameterSet string `json:"parameterSet"`
	Nr           uint32 `json:"nr"`
	Hex          string `json:"hex"`
	Length       int    `json:"length"`
	Details      any    `json:"details,omitempty"`
}

type RunableFunc added in v0.1.1

type RunableFunc func(ctx context.Context, w io.Writer, f io.Reader, o Options) error

type SCTE35Info added in v0.3.0

type SCTE35Info struct {
	PID           uint16                   `json:"pid"`
	SpliceCommand SpliceCommand            `json:"spliceCommand"`
	SegDesc       []SegmentationDescriptor `json:"segmentationDes,omitempty"`
}

type SMPTE291Identifier added in v0.3.0

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

didMap maps SMPTE-20348 [did] values registered by SMPTE [dids]: https://smpte-ra.org/smpte-ancillary-data-smpte-st-291

type SegmentationDescriptor added in v0.3.0

type SegmentationDescriptor struct {
	SegmentNumber uint8  `json:"segmentNumber"`
	EventId       uint32 `json:"eventId"`
	Type          string `json:"type"`
	Duration      uint64 `json:"duration,omitempty"`
}

type SeiOut added in v0.2.0

type SeiOut struct {
	Msg     string `json:"msg"`
	Payload any    `json:"payload,omitempty"`
}

type SpliceCommand added in v0.3.0

type SpliceCommand struct {
	Type      string `json:"type"`
	EventId   uint32 `json:"eventId"`
	PTS       uint64 `json:"pts"`
	Duration  uint64 `json:"duration,omitempty"`
	Out       bool   `json:"outOfNetwork,omitempty"`
	Immediate bool   `json:"immediate,omitempty"`
}

type StreamStatistics added in v0.1.1

type StreamStatistics struct {
	Type       string  `json:"streamType"`
	Pid        uint16  `json:"pid"`
	FrameRate  float64 `json:"frameRate"`
	TimeStamps []int64 `json:"-"`
	MaxStep    int64   `json:"maxStep,omitempty"`
	MinStep    int64   `json:"minStep,omitempty"`
	AvgStep    int64   `json:"avgStep,omitempty"`
	// RAI-markers
	RAIPTS         []int64 `json:"-"`
	IDRPTS         []int64 `json:"-"`
	RAIGOPDuration int64   `json:"RAIGoPDuration,omitempty"`
	IDRGOPDuration int64   `json:"IDRGoPDuration,omitempty"`
	// Errors
	Errors []string `json:"errors,omitempty"`
}

Jump to

Keyboard shortcuts

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