gopus

package module
v0.0.0-...-6bec3b0 Latest Latest
Warning

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

Go to latest
Published: Apr 19, 2025 License: Unlicense Imports: 3 Imported by: 0

README

gopus152

Go bindings for Opus Codec version 1.5.2 (Apr 12, 2024) used with x86_64 talKKonnect clients.

gopus

gopus is a Go binding for the Opus audio codec. It was originally created by Tim Cooper, author of Gumble, a Mumble client implementation in Go. Gumble had gained a great popularity with the launch of talkiepi project by Daniel Chote creating an innovative headless Mumble intercom for Raspberry Pi. Soon after, another popular project influenced by Gumble and talkiepi was born. It was talKKonnect by Suvir Kumar. talKKonnect project drove the concept of headless Mumble intercoms for single board computers to a whole new level. During the development of talKKonnect, it was useful to run and test talKKonnect's on x86_64 systems in addition to ARM from single board computers.

When building Gumble-like clients and its popular forks, talkiepi and talKKonnect on ARM platforms, shared OPUS library headers and development files from Linux libopus-dev package are used. However, when building Gumble-like clients in x86_64 platforms, static libraries are used. During the build, Golang cgo tool is used to process a large number of include statements. File of a highly critical importance for successful building in x86_64 is config.h, a header library for parsing configuration options to the C compiler. This file is usually created automatically with autoconf and configure script. However, with config.h produced automatically, building is not always guaranteed to work and the header file options, need to be carefully reviewed for anything that could break the build.

In this repo, we shall try to watch gopus behavior with x86_64 builds of talKKonnect and keep it up to date with the latest Opus libraries. Gopus with Gumble, originally integrated Opus version 1.1.2 libraries back in 2016. Gopus was later updated in 2022 in talKKonnect to work with Opus version 1.3.1. A current version of Opus is 1.5.2. This gopus repository will be updated from time to time, to support latest Opus libraries, starting with version 1.5.2, to ensure talKKonnect’s can build and run on majority of x86_64 systems.

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)

func GetSamplesPerFrame

func GetSamplesPerFrame(data []byte, samplingRate int) (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