mpegts

package
v0.5.0 Latest Latest
Warning

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

Go to latest
Published: May 4, 2023 License: MIT Imports: 8 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 Codec added in v0.2.0

type Codec interface {
	// 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.

type CodecH265 added in v0.2.0

type CodecH265 struct{}

CodecH265 is a H265 codec.

type CodecMPEG4Audio added in v0.2.0

type CodecMPEG4Audio struct {
	mpeg4audio.Config
}

CodecMPEG4Audio is a MPEG4-Audio codec.

type CodecOpus added in v0.2.0

type CodecOpus struct {
	Channels int
}

CodecOpus is a Opus codec.

type OpusAccessUnit

type OpusAccessUnit struct {
	ControlHeader OpusControlHeader
	Frame         []byte
}

OpusAccessUnit is a MPEG-TS Opus access unit.

func (*OpusAccessUnit) Unmarshal

func (au *OpusAccessUnit) Unmarshal(buf []byte) (int, error)

Unmarshal decodes an access unit.

type OpusControlHeader

type OpusControlHeader struct {
	PayloadSize uint64
	StartTrim   uint16
	EndTrim     uint16
}

OpusControlHeader is a MPEG-TS Opus control header.

func (*OpusControlHeader) Unmarshal

func (h *OpusControlHeader) Unmarshal(buf []byte) (int, error)

Unmarshal decodes a control header.

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 {
	ES    *astits.PMTElementaryStream
	Codec Codec
}

Track is a MPEG-TS track.

func FindTracks

func FindTracks(dem *astits.Demuxer) ([]*Track, error)

FindTracks finds the tracks in a MPEG-TS stream.

type Writer

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

Writer is a MPEG-TS writer.

func NewWriter

func NewWriter(
	videoTrack *Track,
	audioTrack *Track,
) *Writer

NewWriter allocates a Writer.

func (*Writer) SetByteWriter

func (w *Writer) SetByteWriter(bw io.Writer)

SetByteWriter sets the current byte writer.

func (*Writer) WriteAAC

func (w *Writer) WriteAAC(
	pcr time.Duration,
	pts time.Duration,
	au []byte,
) error

WriteAAC writes an AAC AU.

func (*Writer) WriteH264

func (w *Writer) WriteH264(
	pcr time.Duration,
	dts time.Duration,
	pts time.Duration,
	idrPresent bool,
	nalus [][]byte,
) error

WriteH264 writes a H264 access unit.

Jump to

Keyboard shortcuts

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