faac

package module
v0.0.0-...-8e68242 Latest Latest
Warning

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

Go to latest
Published: Oct 26, 2014 License: GPL-3.0 Imports: 4 Imported by: 1

README

Go FAAC

Go binding for libfaac. See AudioCoding.com for more info about FAAC.

Usage

sampleRate := 48000
channelCount := 2

faacEncoder := faac.Open(sampleRate, channelCount)
config := faac.EncoderConfiguration{
	BitRate:     48000,
	InputFormat: faac.InputFloat,
}

err := faacEncoder.SetConfiguration(&config)
if err != nil {
   // ...
}

encodedBytes = faacEncoder.OutputBuffer()
var interleavedFloats = []float

// fill interleavedFloats for floats between +/- 32768.0
// len(interleavedFloats) must be (less than) faacEncoder.InputSamples()
// ...

encodedByteCount := faacEncoder.EncodeFloats(
	interleavedFloats,
	encodedBytes)

if encodedByteCount > 0 {
	writer.write encoder.encodedBytes[0:encodedByteCount]
}

faacEncoder.Close()

Documentation

Index

Constants

View Source
const (
	InputFloat  = int(C.FAAC_INPUT_FLOAT)
	Input16bits = int(C.FAAC_INPUT_16BIT)
	Input32bits = int(C.FAAC_INPUT_32BIT)

	Main = int(C.MAIN)
)

Variables

This section is empty.

Functions

This section is empty.

Types

type Encoder

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

func Open

func Open(sampleRate int, channelCount int) *Encoder

func (*Encoder) Close

func (encoder *Encoder) Close()

func (*Encoder) Configuration

func (encoder *Encoder) Configuration() *EncoderConfiguration

func (*Encoder) EncodeBytes

func (encoder *Encoder) EncodeBytes(samples []byte, output []byte) int

func (*Encoder) EncodeFloats

func (encoder *Encoder) EncodeFloats(samples []float32, output []byte) int

func (*Encoder) InputSamples

func (encoder *Encoder) InputSamples() int

func (*Encoder) MaxOutputBytes

func (encoder *Encoder) MaxOutputBytes() int

func (*Encoder) OutputBuffer

func (encoder *Encoder) OutputBuffer() []byte

func (*Encoder) SetConfiguration

func (encoder *Encoder) SetConfiguration(configuration *EncoderConfiguration) error

type EncoderConfiguration

type EncoderConfiguration struct {
	// QuantizerQuality int
	BitRate     int
	InputFormat int
	ObjectType  int
	UseLFE      bool
}

Jump to

Keyboard shortcuts

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