decoder

package
v0.1.1 Latest Latest
Warning

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

Go to latest
Published: Jul 26, 2026 License: MIT Imports: 18 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func DecodeFrame

func DecodeFrame(data []byte, info streaminfo.StreamInfo) (*flac.Frame, error)

func DecodeResidual

func DecodeResidual(r *bits.Reader, blockSize, predictorOrder int) ([]int64, error)

DecodeResidual reads a FLAC residual coding block. Structural validity checks here (reserved coding method, partition math, decoded size) are FLAC-spec requirements and always return an error. The per-sample reads inside each partition are the hot path, so they use the Fast tier (no per-call error); a truncated stream in that inner loop surfaces later via Reader.Overrun() rather than aborting this function early.

func DecodeResidualInto

func DecodeResidualInto(r *bits.Reader, residual []int64, blockSize, predictorOrder int) error

func DecodeSubframe

func DecodeSubframe(r *bits.Reader, samples []int64, bitsPerSample int) error

func Decorrelate

func Decorrelate(samples [][]int64, assignment uint8)

Types

type Decoder

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

func NewDecoder

func NewDecoder(stream media.StreamInfo, cfg config.DecoderConfig, pool *registry.WorkerPool) *Decoder

NewDecoder builds a decoder. pool may be nil, in which case packets are decoded synchronously; otherwise it must be a pool this decoder is allowed to submit work to for its entire lifetime (the caller retains ownership and is responsible for closing it once every stage sharing it has finished).

func (*Decoder) Close

func (d *Decoder) Close() error

Close stops accepting further work without releasing pending frames. It does not close the pool: that is shared with other stages and owned by whoever constructed this decoder. Safe whether or not Flush ran first, and safe to call more than once.

func (*Decoder) Flush

func (d *Decoder) Flush() error

func (*Decoder) OutputReady

func (d *Decoder) OutputReady() <-chan struct{}

func (*Decoder) Prepare

func (d *Decoder) Prepare(resources registry.ResourceGrant) error

func (*Decoder) ReceiveFrame

func (d *Decoder) ReceiveFrame() (media.Frame, error)

func (*Decoder) SendPacket

func (d *Decoder) SendPacket(pkt *media.Packet) error

Jump to

Keyboard shortcuts

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