opus

package
v0.0.0-...-934a8a9 Latest Latest
Warning

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

Go to latest
Published: Dec 30, 2020 License: MIT Imports: 8 Imported by: 6

Documentation

Index

Constants

This section is empty.

Variables

View Source
var FrameSizes = []float32{60, 40, 20, 10, 5, 2.5}

FrameSizes is a list of valid frame sizes for Opus encoding

Functions

This section is empty.

Types

type OggStream

type OggStream struct {
	SampleRate uint
	Channels   uint
	Bitrate    uint
	FrameSize  float32
	Complexity uint
	// contains filtered or unexported fields
}

OggStream is an encoder that takes audio samples and encodes them using the Opus audio codec into an Ogg container, using the given settings.

func (*OggStream) Decode

func (s *OggStream) Decode(oggBytes []byte) ([]byte, error)

func (*OggStream) Encode

func (s *OggStream) Encode(audio []int16) ([]byte, error)

Encode takes an array of int16 PCM samples and encodes them into the Ogg container, returning any bytes generated by doing so (could be zero if a page flush is not triggered by the encode).

func (*OggStream) EncodeBytes

func (s *OggStream) EncodeBytes(audio []byte) ([]byte, error)

EncodeBytes takes a byte array of little-endian int16 PCM samples and encodes them into the Ogg container, returning any bytes generated by doing so (could be zero if a page flush is not triggered by the encode).

func (*OggStream) Flush

func (s *OggStream) Flush() []byte

Flush attempts to flush any possible completed pages from the Ogg container if data was submitted that didn't generate new page output.

Jump to

Keyboard shortcuts

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