mpegts

package
v1.1.1 Latest Latest
Warning

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

Go to latest
Published: Sep 2, 2023 License: MIT Imports: 12 Imported by: 81

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 added in v1.0.0

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

BufferedReader is a buffered reader optimized for MPEG-TS.

func NewBufferedReader added in v1.0.0

func NewBufferedReader(r io.Reader) *BufferedReader

NewBufferedReader allocates a BufferedReader.

func (*BufferedReader) Read added in v1.0.0

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

Read implements io.Reader.

type Codec added in v0.2.0

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

Codec is a MPEG-TS codec.

type CodecH264 added in v0.2.0

type CodecH264 struct{}

CodecH264 is a H264 codec.

func (CodecH264) IsVideo added in v1.0.0

func (CodecH264) IsVideo() bool

IsVideo implements Codec.

type CodecH265 added in v0.2.0

type CodecH265 struct{}

CodecH265 is a H265 codec.

func (CodecH265) IsVideo added in v1.0.0

func (CodecH265) IsVideo() bool

IsVideo implements Codec.

type CodecMPEG1Audio added in v1.0.0

type CodecMPEG1Audio struct{}

CodecMPEG1Audio is a MPEG-1 Audio codec.

func (CodecMPEG1Audio) IsVideo added in v1.0.0

func (CodecMPEG1Audio) IsVideo() bool

IsVideo implements Codec.

type CodecMPEG4Audio added in v0.2.0

type CodecMPEG4Audio struct {
	mpeg4audio.Config
}

CodecMPEG4Audio is a MPEG-4 Audio codec.

func (CodecMPEG4Audio) IsVideo added in v1.0.0

func (CodecMPEG4Audio) IsVideo() bool

IsVideo implements Codec.

type CodecMPEG4Video added in v1.1.0

type CodecMPEG4Video struct{}

CodecMPEG4Video is a MPEG-4 Video codec.

func (CodecMPEG4Video) IsVideo added in v1.1.0

func (CodecMPEG4Video) IsVideo() bool

IsVideo implements Codec.

type CodecOpus added in v0.2.0

type CodecOpus struct {
	ChannelCount int
}

CodecOpus is a Opus codec.

func (CodecOpus) IsVideo added in v1.0.0

func (CodecOpus) IsVideo() bool

IsVideo implements Codec.

type Reader added in v0.7.0

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

Reader is a MPEG-TS reader.

func NewReader added in v0.7.0

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

NewReader allocates a Reader.

func (*Reader) OnDataH26x added in v0.7.0

func (r *Reader) OnDataH26x(track *Track, cb ReaderOnDataH26xFunc)

OnDataH26x sets a callback that is called when data from an H26x track is received.

func (*Reader) OnDataMPEG1Audio added in v1.0.0

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 added in v0.7.0

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) OnDataMPEG4Video added in v1.1.0

func (r *Reader) OnDataMPEG4Video(track *Track, cb ReaderOnDataMPEG4VideoFunc)

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

func (*Reader) OnDataOpus added in v0.7.0

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 added in v1.0.0

func (r *Reader) OnDecodeError(cb ReaderOnDecodeErrorFunc)

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

func (*Reader) Read added in v0.7.0

func (r *Reader) Read() error

Read reads data.

func (*Reader) Tracks added in v0.7.0

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

Tracks returns detected tracks.

type ReaderOnDataH26xFunc added in v1.0.0

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

ReaderOnDataH26xFunc is the prototype of the callback passed to OnDataH26x.

type ReaderOnDataMPEG1AudioFunc added in v1.0.0

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

ReaderOnDataMPEG1AudioFunc is the prototype of the callback passed to OnDataMPEG1Audio.

type ReaderOnDataMPEG4AudioFunc added in v1.0.0

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

ReaderOnDataMPEG4AudioFunc is the prototype of the callback passed to OnDataMPEG4Audio.

type ReaderOnDataMPEG4VideoFunc added in v1.1.0

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

ReaderOnDataMPEG4VideoFunc is the prototype of the callback passed to OnDataMPEG4Video.

type ReaderOnDataOpusFunc added in v1.0.0

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

ReaderOnDataOpusFunc is the prototype of the callback passed to OnDataOpus.

type ReaderOnDecodeErrorFunc added in v1.0.0

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

func NewTimeDecoder(start int64) *TimeDecoder

NewTimeDecoder allocates a TimeDecoder.

func (*TimeDecoder) Decode

func (d *TimeDecoder) Decode(ts int64) time.Duration

Decode decodes a MPEG-TS timestamp.

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 {
	// contains filtered or unexported fields
}

Writer is a MPEG-TS writer.

func NewWriter

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

NewWriter allocates a Writer.

func (*Writer) WriteH26x added in v0.7.0

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

WriteH26x writes a H26x access unit.

func (*Writer) WriteMPEG1Audio added in v1.0.0

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

WriteMPEG1Audio writes MPEG-1 Audio packets.

func (*Writer) WriteMPEG4Audio added in v0.7.0

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

WriteMPEG4Audio writes MPEG-4 Audio access units.

func (*Writer) WriteMPEG4Video added in v1.1.0

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

WriteMPEG4Video writes a MPEG-4 Video frame.

func (*Writer) WriteOpus added in v1.0.0

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