mpegts

package
v2.4.1 Latest Latest
Warning

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

Go to latest
Published: Aug 8, 2025 License: MIT Imports: 14 Imported by: 55

Documentation

Overview

Package mpegts contains MPEG-TS utilities.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type BufferedReader deprecated

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

BufferedReader is a buffered reader optimized for MPEG-TS.

Deprecated: not needed anymore.

func NewBufferedReader deprecated

func NewBufferedReader(r io.Reader) *BufferedReader

NewBufferedReader allocates a BufferedReader.

Deprecated: not needed anymore.

func (*BufferedReader) Read

func (r *BufferedReader) Read(p []byte) (int, error)

Read implements io.Reader.

type Codec

type Codec interface {
	IsVideo() bool
	// contains filtered or unexported methods
}

Codec is a MPEG-TS codec.

type CodecAC3

type CodecAC3 struct {
	SampleRate   int
	ChannelCount int
}

CodecAC3 is an AC-3 codec. Specification: ISO 13818-1

func (CodecAC3) IsVideo

func (CodecAC3) IsVideo() bool

IsVideo implements Codec.

type CodecDVBSubtitle added in v2.4.1

type CodecDVBSubtitle struct {
	Items []*astits.DescriptorSubtitlingItem
}

CodecDVBSubtitle is a DVB Subtitle codec. Specification: ISO 13818-1 Specification: ETSI EN 300 743 Specification: ETSI EN 300 468

func (CodecDVBSubtitle) IsVideo added in v2.4.1

func (CodecDVBSubtitle) IsVideo() bool

IsVideo implements Codec.

type CodecH264

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

CodecH264 is a H264 codec. Specification: ISO 13818-1

func (CodecH264) IsVideo

func (CodecH264) IsVideo() bool

IsVideo implements Codec.

type CodecH265

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

CodecH265 is a H265 codec. Specification: ISO 13818-1

func (CodecH265) IsVideo

func (CodecH265) IsVideo() bool

IsVideo implements Codec.

type CodecKLV added in v2.3.0

type CodecKLV struct {
	Synchronous bool
}

CodecKLV is a KLV codec. Specification: MISB ST 1402

func (CodecKLV) IsVideo added in v2.3.0

func (CodecKLV) IsVideo() bool

IsVideo implements Codec.

type CodecMPEG1Audio

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

CodecMPEG1Audio is a MPEG-1 Audio codec. Specification: ISO 13818-1

func (CodecMPEG1Audio) IsVideo

func (CodecMPEG1Audio) IsVideo() bool

IsVideo implements Codec.

type CodecMPEG1Video

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

CodecMPEG1Video is a MPEG-1/2 Video codec. Specification: ISO 13818-1

func (CodecMPEG1Video) IsVideo

func (CodecMPEG1Video) IsVideo() bool

IsVideo implements Codec.

type CodecMPEG4Audio

type CodecMPEG4Audio struct {
	mpeg4audio.Config
}

CodecMPEG4Audio is a MPEG-4 Audio codec. Specification: ISO 13818-1

func (CodecMPEG4Audio) IsVideo

func (CodecMPEG4Audio) IsVideo() bool

IsVideo implements Codec.

type CodecMPEG4AudioLATM added in v2.4.0

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

CodecMPEG4AudioLATM is a MPEG-4 Audio LATM codec. Specification: ISO 13818-1

func (CodecMPEG4AudioLATM) IsVideo added in v2.4.0

func (CodecMPEG4AudioLATM) IsVideo() bool

IsVideo implements Codec.

type CodecMPEG4Video

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

CodecMPEG4Video is a MPEG-4 Video codec. Specification: ISO 13818-1

func (CodecMPEG4Video) IsVideo

func (CodecMPEG4Video) IsVideo() bool

IsVideo implements Codec.

type CodecOpus

type CodecOpus struct {
	ChannelCount int
}

CodecOpus is a Opus codec. Specification: ETSI TS Opus 0.1.3-draft

func (CodecOpus) IsVideo

func (CodecOpus) IsVideo() bool

IsVideo implements Codec.

type CodecUnsupported

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

CodecUnsupported is an unsupported codec.

func (CodecUnsupported) IsVideo

func (CodecUnsupported) IsVideo() bool

IsVideo implements Codec.

type Reader

type Reader struct {
	R io.Reader
	// contains filtered or unexported fields
}

Reader is a MPEG-TS reader.

func NewReader deprecated

func NewReader(br io.Reader) (*Reader, error)

NewReader allocates a Reader.

Deprecated: replaced by Reader.Initialize.

func (*Reader) Initialize added in v2.1.0

func (r *Reader) Initialize() error

Initialize initializes a Reader.

func (*Reader) OnDataAC3

func (r *Reader) OnDataAC3(track *Track, cb ReaderOnDataAC3Func)

OnDataAC3 sets a callback that is called when data from an AC-3 track is received.

func (*Reader) OnDataDVBSubtitle added in v2.4.1

func (r *Reader) OnDataDVBSubtitle(track *Track, cb ReaderOnDataDVBSubtitleFunc)

OnDataDVBSubtitle sets a callback that is called when data from a DVB subtitle track is received.

func (*Reader) OnDataH264

func (r *Reader) OnDataH264(track *Track, cb ReaderOnDataH264Func)

OnDataH264 sets a callback that is called when data from an H264 track is received.

func (*Reader) OnDataH265

func (r *Reader) OnDataH265(track *Track, cb ReaderOnDataH265Func)

OnDataH265 sets a callback that is called when data from an H265 track is received.

func (*Reader) OnDataKLV added in v2.3.0

func (r *Reader) OnDataKLV(track *Track, cb ReaderOnDataKLVFunc)

OnDataKLV sets a callback that is called when data from a KLV track is received.

func (*Reader) OnDataMPEG1Audio

func (r *Reader) OnDataMPEG1Audio(track *Track, cb ReaderOnDataMPEG1AudioFunc)

OnDataMPEG1Audio sets a callback that is called when data from an MPEG-1 Audio track is received.

func (*Reader) OnDataMPEG4Audio

func (r *Reader) OnDataMPEG4Audio(track *Track, cb ReaderOnDataMPEG4AudioFunc)

OnDataMPEG4Audio sets a callback that is called when data from an MPEG-4 Audio track is received.

func (*Reader) OnDataMPEG4AudioLATM added in v2.4.0

func (r *Reader) OnDataMPEG4AudioLATM(track *Track, cb ReaderOnDataMPEG4AudioLATMFunc)

OnDataMPEG4AudioLATM sets a callback that is called when data from an MPEG-4 Audio LATM track is received.

func (*Reader) OnDataMPEGxVideo

func (r *Reader) OnDataMPEGxVideo(track *Track, cb ReaderOnDataMPEGxVideoFunc)

OnDataMPEGxVideo sets a callback that is called when data from an MPEG-1/2/4 Video track is received.

func (*Reader) OnDataOpus

func (r *Reader) OnDataOpus(track *Track, cb ReaderOnDataOpusFunc)

OnDataOpus sets a callback that is called when data from an Opus track is received.

func (*Reader) OnDecodeError

func (r *Reader) OnDecodeError(cb ReaderOnDecodeErrorFunc)

OnDecodeError sets a callback that is called when a non-fatal decode error occurs.

func (*Reader) Read

func (r *Reader) Read() error

Read reads data.

func (*Reader) Tracks

func (r *Reader) Tracks() []*Track

Tracks returns detected tracks.

type ReaderOnDataAC3Func

type ReaderOnDataAC3Func func(pts int64, frame []byte) error

ReaderOnDataAC3Func is the prototype of the callback passed to OnDataAC3.

type ReaderOnDataDVBSubtitleFunc added in v2.4.1

type ReaderOnDataDVBSubtitleFunc func(pts int64, data []byte) error

ReaderOnDataDVBSubtitleFunc is the prototype of the callback passed to OnDataDVBSubtitle.

type ReaderOnDataH264Func

type ReaderOnDataH264Func func(pts int64, dts int64, au [][]byte) error

ReaderOnDataH264Func is the prototype of the callback passed to OnDataH264.

type ReaderOnDataH265Func

type ReaderOnDataH265Func func(pts int64, dts int64, au [][]byte) error

ReaderOnDataH265Func is the prototype of the callback passed to OnDataH265.

type ReaderOnDataKLVFunc added in v2.3.0

type ReaderOnDataKLVFunc func(pts int64, data []byte) error

ReaderOnDataKLVFunc is the prototype of the callback passed to OnDataKLV.

type ReaderOnDataMPEG1AudioFunc

type ReaderOnDataMPEG1AudioFunc func(pts int64, frames [][]byte) error

ReaderOnDataMPEG1AudioFunc is the prototype of the callback passed to OnDataMPEG1Audio.

type ReaderOnDataMPEG4AudioFunc

type ReaderOnDataMPEG4AudioFunc func(pts int64, aus [][]byte) error

ReaderOnDataMPEG4AudioFunc is the prototype of the callback passed to OnDataMPEG4Audio.

type ReaderOnDataMPEG4AudioLATMFunc added in v2.4.0

type ReaderOnDataMPEG4AudioLATMFunc func(pts int64, els [][]byte) error

ReaderOnDataMPEG4AudioLATMFunc is the prototype of the callback passed to OnDataMPEG4AudioLATM.

type ReaderOnDataMPEGxVideoFunc

type ReaderOnDataMPEGxVideoFunc func(pts int64, frame []byte) error

ReaderOnDataMPEGxVideoFunc is the prototype of the callback passed to OnDataMPEGxVideo.

type ReaderOnDataOpusFunc

type ReaderOnDataOpusFunc func(pts int64, packets [][]byte) error

ReaderOnDataOpusFunc is the prototype of the callback passed to OnDataOpus.

type ReaderOnDecodeErrorFunc

type ReaderOnDecodeErrorFunc func(err error)

ReaderOnDecodeErrorFunc is the prototype of the callback passed to OnDecodeError.

type TimeDecoder

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

TimeDecoder is a MPEG-TS timestamp decoder.

func NewTimeDecoder deprecated

func NewTimeDecoder() *TimeDecoder

NewTimeDecoder allocates a TimeDecoder.

Deprecated: replaced by TimeDecoder.Initialize().

func (*TimeDecoder) Decode

func (d *TimeDecoder) Decode(ts int64) int64

Decode decodes a MPEG-TS timestamp.

func (*TimeDecoder) Initialize added in v2.1.0

func (d *TimeDecoder) Initialize()

Initialize initializes a TimeDecoder.

type Track

type Track struct {
	PID   uint16
	Codec Codec
	// contains filtered or unexported fields
}

Track is a MPEG-TS track.

type Writer

type Writer struct {
	W      io.Writer
	Tracks []*Track
	// contains filtered or unexported fields
}

Writer is a MPEG-TS writer.

func NewWriter deprecated

func NewWriter(
	bw io.Writer,
	tracks []*Track,
) *Writer

NewWriter allocates a Writer.

Deprecated: replaced by Writer.Initialize().

func (*Writer) Initialize added in v2.1.0

func (w *Writer) Initialize() error

Initialize initializes a Writer.

func (*Writer) WriteAC3

func (w *Writer) WriteAC3(
	track *Track,
	pts int64,
	frame []byte,
) error

WriteAC3 writes a AC-3 frame.

func (*Writer) WriteDVBSubtitle added in v2.4.1

func (w *Writer) WriteDVBSubtitle(
	track *Track,
	pts int64,
	data []byte,
) error

WriteDVBSubtitle writes DVB subtitle data.

func (*Writer) WriteH264

func (w *Writer) WriteH264(
	track *Track,
	pts int64,
	dts int64,
	au [][]byte,
) error

WriteH264 writes a H264 access unit.

func (*Writer) WriteH265

func (w *Writer) WriteH265(
	track *Track,
	pts int64,
	dts int64,
	au [][]byte,
) error

WriteH265 writes a H265 access unit.

func (*Writer) WriteKLV added in v2.3.0

func (w *Writer) WriteKLV(
	track *Track,
	pts int64,
	unit []byte,
) error

WriteKLV writes a KLV unit.

func (*Writer) WriteMPEG1Audio

func (w *Writer) WriteMPEG1Audio(
	track *Track,
	pts int64,
	frames [][]byte,
) error

WriteMPEG1Audio writes MPEG-1 Audio packets.

func (*Writer) WriteMPEG1Video

func (w *Writer) WriteMPEG1Video(
	track *Track,
	pts int64,
	frame []byte,
) error

WriteMPEG1Video writes a MPEG-1/2 Video frame.

func (*Writer) WriteMPEG4Audio

func (w *Writer) WriteMPEG4Audio(
	track *Track,
	pts int64,
	aus [][]byte,
) error

WriteMPEG4Audio writes MPEG-4 Audio access units.

func (*Writer) WriteMPEG4AudioLATM added in v2.4.0

func (w *Writer) WriteMPEG4AudioLATM(
	track *Track,
	pts int64,
	els [][]byte,
) error

WriteMPEG4AudioLATM writes MPEG-4 Audio LATM audioMuxElements.

func (*Writer) WriteMPEG4Video

func (w *Writer) WriteMPEG4Video(
	track *Track,
	pts int64,
	frame []byte,
) error

WriteMPEG4Video writes a MPEG-4 Video frame.

func (*Writer) WriteOpus

func (w *Writer) WriteOpus(
	track *Track,
	pts int64,
	packets [][]byte,
) error

WriteOpus writes Opus packets.

Jump to

Keyboard shortcuts

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