opus

package
v0.1.1 Latest Latest
Warning

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

Go to latest
Published: Sep 7, 2026 License: Apache-2.0 Imports: 10 Imported by: 7

Documentation

Index

Constants

View Source
const (
	SDPNameOnly = "opus"
	SDPName     = SDPNameOnly + "/48000/2"
)

Variables

This section is empty.

Functions

func Encode

func Encode(w Writer, channels int, logger logger.Logger) (media.PCM16Writer, error)

func EncodeWith

func EncodeWith(w Writer, channels int, opts EncodeOptions, logger logger.Logger) (media.PCM16Writer, error)

func NewWebmWriter

func NewWebmWriter(w io.WriteCloser, sampleRate int, channels int, sampleDur time.Duration) media.WriteCloser[Sample]

Types

type EncodeOptions

type EncodeOptions struct {
	// Bitrate is the target encoder bitrate in bits/sec (e.g. 24000). 0 = auto.
	Bitrate int
	// Complexity is the encoder computational complexity 1-10. 0 = default.
	Complexity int
	// FEC enables in-band Forward Error Correction.
	FEC bool
	// PacketLossPercent is the expected packet loss 0-100, used to tune FEC.
	PacketLossPercent int
}

EncodeOptions tunes the Opus encoder. Zero values keep libopus defaults.

type Sample

type Sample []byte

func (Sample) CopyTo

func (s Sample) CopyTo(dst []byte) (int, error)

func (Sample) Size

func (s Sample) Size() int

type Writer

type Writer = media.WriteCloser[Sample]

func Decode

func Decode(w media.PCM16Writer, targetChannels int, logger logger.Logger) (Writer, error)

Jump to

Keyboard shortcuts

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