gopus

package module
v0.0.0-...-1ee02d4 Latest Latest
Warning

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

Go to latest
Published: May 1, 2021 License: Unlicense Imports: 3 Imported by: 77

README

gopus

gopus is a Go binding for the Opus audio codec.

Documentation

Requirements

  • cgo
  • opus development library (only on platforms where the shared library is used)

License

Public domain

Author

Tim Cooper (tim.cooper@layeh.com)

Documentation

Index

Constants

View Source
const (
	BitrateMaximum = C.gopus_bitrate_max
)

Variables

View Source
var (
	ErrBadArgument   = errors.New("bad argument")
	ErrSmallBuffer   = errors.New("buffer is too small")
	ErrInternal      = errors.New("internal error")
	ErrInvalidPacket = errors.New("invalid packet")
	ErrUnimplemented = errors.New("unimplemented")
	ErrInvalidState  = errors.New("invalid state")
	ErrAllocFail     = errors.New("allocation failed")
	ErrUnknown       = errors.New("unknown error")
)

Functions

func CountFrames

func CountFrames(data []byte) (int, error)

Types

type Decoder

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

func NewDecoder

func NewDecoder(sampleRate, channels int) (*Decoder, error)

func (*Decoder) Decode

func (d *Decoder) Decode(data []byte, frameSize int, fec bool) ([]int16, error)

func (*Decoder) ResetState

func (d *Decoder) ResetState()

type Encoder

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

func NewEncoder

func NewEncoder(sampleRate, channels int, application Application) (*Encoder, error)

func (*Encoder) Application

func (e *Encoder) Application() Application

func (*Encoder) Bitrate

func (e *Encoder) Bitrate() int

func (*Encoder) Encode

func (e *Encoder) Encode(pcm []int16, frameSize, maxDataBytes int) ([]byte, error)

func (*Encoder) ResetState

func (e *Encoder) ResetState()

func (*Encoder) SetApplication

func (e *Encoder) SetApplication(application Application)

func (*Encoder) SetBitrate

func (e *Encoder) SetBitrate(bitrate int)

func (*Encoder) SetVbr

func (e *Encoder) SetVbr(vbr bool)

Jump to

Keyboard shortcuts

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