mpegts

package
v1.0.1 Latest Latest
Warning

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

Go to latest
Published: Nov 22, 2023 License: MIT Imports: 13 Imported by: 4

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

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

BufferedReader is a buffered reader optimized for MPEG-TS.

func NewBufferedReader

func NewBufferedReader(r io.Reader) *BufferedReader

NewBufferedReader allocates a BufferedReader.

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.

func (CodecAC3) IsVideo

func (CodecAC3) IsVideo() bool

IsVideo implements Codec.

type CodecH264

type CodecH264 struct{}

CodecH264 is a H264 codec.

func (CodecH264) IsVideo

func (CodecH264) IsVideo() bool

IsVideo implements Codec.

type CodecH265

type CodecH265 struct{}

CodecH265 is a H265 codec.

func (CodecH265) IsVideo

func (CodecH265) IsVideo() bool

IsVideo implements Codec.

type CodecMPEG1Audio

type CodecMPEG1Audio struct{}

CodecMPEG1Audio is a MPEG-1 Audio codec.

func (CodecMPEG1Audio) IsVideo

func (CodecMPEG1Audio) IsVideo() bool

IsVideo implements Codec.

type CodecMPEG1Video

type CodecMPEG1Video struct{}

CodecMPEG1Video is a MPEG-1/2 Video codec.

func (CodecMPEG1Video) IsVideo

func (CodecMPEG1Video) IsVideo() bool

IsVideo implements Codec.

type CodecMPEG4Audio

type CodecMPEG4Audio struct {
	mpeg4audio.Config
}

CodecMPEG4Audio is a MPEG-4 Audio codec.

func (CodecMPEG4Audio) IsVideo

func (CodecMPEG4Audio) IsVideo() bool

IsVideo implements Codec.

type CodecMPEG4Video

type CodecMPEG4Video struct{}

CodecMPEG4Video is a MPEG-4 Video codec.

func (CodecMPEG4Video) IsVideo

func (CodecMPEG4Video) IsVideo() bool

IsVideo implements Codec.

type CodecOpus

type CodecOpus struct {
	ChannelCount int
}

CodecOpus is a Opus codec.

func (CodecOpus) IsVideo

func (CodecOpus) IsVideo() bool

IsVideo implements Codec.

type Reader

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

Reader is a MPEG-TS reader.

func NewReader

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

NewReader allocates 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) OnDataH26x

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

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) 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 ReaderOnDataH26xFunc

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

ReaderOnDataH26xFunc is the prototype of the callback passed to OnDataH26x.

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 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

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) WriteAC3

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

WriteAC3 writes a AC-3 frame.

func (*Writer) WriteH26x

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

WriteH26x writes a H26x access 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) 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