opus

package
v1.0.0-rc.1 Latest Latest
Warning

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

Go to latest
Published: Nov 29, 2026 License: MIT Imports: 6 Imported by: 0 modules, 0 packages

The first number is the count of modules that contain a package that imports this one. The module count is a better indicator of popularity than the package count. A module with 100 importing packages is counted only once instead of 100 times, reflecting the fact that the choice to use the package was likely made only once, not 100 times.
A '?' means that the value hasn't been computed yet.

Documentation

Overview

Package opus decodes elementary Opus packets to borrowed planar PCM.

Index

Constants

This section is empty.

Variables

View Source
var (
	ErrMalformed   = errors.New("malformed Opus data")
	ErrUnsupported = errors.New("unsupported Opus format")
)

Functions

This section is empty.

Types

type Decoder

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

Decoder decodes a single Opus elementary stream to 48 kHz Float32 PCM. A Decoder is used by one goroutine at a time. The caller applies trimming from the container timeline.

func NewDecoder

func NewDecoder(head []byte) (*Decoder, error)

NewDecoder uses the OpusHead identification header, supplied by a Matroska track as CodecPrivate.

func (*Decoder) Decode

func (d *Decoder) Decode(packet []byte) (audio.Buffer[float32], error)

Decode returns Float32 planes valid until the next call. A decode error leaves the stream terminal because later packets may depend on its state.

func (*Decoder) PCMFormat

func (d *Decoder) PCMFormat() audio.Format

func (*Decoder) PreSkip

func (d *Decoder) PreSkip() int64

PreSkip reports the OpusHead delay at the output sample rate. The caller applies the container's delay once, even when both headers carry it.

Directories

Path Synopsis
Package opus provides a Opus Audio Codec RFC 6716 implementation
Package opus provides a Opus Audio Codec RFC 6716 implementation
internal/bitdepth
Package bitdepth provides utilities to convert between different audio bitdepths
Package bitdepth provides utilities to convert between different audio bitdepths
internal/celt
Package celt implements the MDCT layer of the Opus decoder.
Package celt implements the MDCT layer of the Opus decoder.
internal/rangecoding
Package rangecoding provides a Range coder for the Opus bitstream
Package rangecoding provides a Range coder for the Opus bitstream
internal/resample/silk
Package silkresample ports the RFC 6716 SILK resampler.
Package silkresample ports the RFC 6716 SILK resampler.
internal/silk
Package silk provides a Silk coder
Package silk provides a Silk coder
internal/slicetools
Package slicetools provides shared helpers for reusing scratch slices.
Package slicetools provides shared helpers for reusing scratch slices.

Jump to

Keyboard shortcuts

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