fdkaac

package module
v0.0.0-...-c56d1bb Latest Latest
Warning

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

Go to latest
Published: May 2, 2022 License: MIT Imports: 5 Imported by: 0

README

go-fdkaac

Golang binding for lib-fdkaac(https://github.com/mstorsjo/fdk-aac)

Only decoders available.

Usage

Fdkaac Installation required beforehand.

$ go get -d github.com/IzumiSy/go-fdkaac

-d option is almost always required to avoid errors on installation of gcc on your machine.

Docker image of fdkaac is available for source of multi-stage build.

COPY --from=ghcr.io/izumisy/fdkaac:latest /fdkaac-include /usr/include/fdk-aac
COPY --from=ghcr.io/izumisy/fdkaac:latest /fdkaac-lib /usr/lib/fdk-aac

Installation

Earthly is required if you don't want to install build tools on your local.

$ git clone https://github.com/IzumiSy/go-fdkaac
$ sudo earthly +install # Linux only
Build manually and install locally
$ apt install build-essential autoconf libtool
$ cd fdkaac-lib
$ ./autogen.sh
$ ./configure --prefix=/usr
$ make
$ make install

Tests

$ earthly +test

# or just run go test (fdkaac installation on local required beforehand)
$ GO111MODULE=off go test ./...

Documentation

Overview

The aac decoder, to decode the encoded aac frame to PCM samples.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type AacDecoder

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

func NewAacDecoder

func NewAacDecoder() *AacDecoder

func (*AacDecoder) AacNumChannels

func (v *AacDecoder) AacNumChannels() int

The number of audio channels after AAC core processing (before PS or MPS processing).

CAUTION: This are not the final number of output channels!

@remark Decoder internal members.

func (*AacDecoder) AacSampleRate

func (v *AacDecoder) AacSampleRate() int

sampling rate in Hz without SBR (from configuration info). @remark Decoder internal members.

func (*AacDecoder) AacSamplesPerFrame

func (v *AacDecoder) AacSamplesPerFrame() int

Samples per frame for the AAC core (from ASC).

1024 or 960 for AAC-LC
512 or 480 for AAC-LD and AAC-ELD

@remark Decoder internal members.

func (*AacDecoder) AudioObjectType

func (v *AacDecoder) AudioObjectType() int

Audio Object Type (from ASC): is set to the appropriate value for MPEG-2 bitstreams (e. g. 2 for AAC-LC). @remark Decoder internal members.

func (*AacDecoder) Bitrate

func (v *AacDecoder) Bitrate() int

Instantaneous bit rate. @remark Decoder internal members.

func (*AacDecoder) ChannelConfig

func (v *AacDecoder) ChannelConfig() int

Channel configuration (0: PCE defined, 1: mono, 2: stereo, ... @remark Decoder internal members.

func (*AacDecoder) Close

func (v *AacDecoder) Close() error

De-allocate all resources of an AAC decoder instance.

func (*AacDecoder) Decode

func (v *AacDecoder) Decode(frame []byte, dst io.Writer) error

Decode one audio frame. @param the frame contains encoded aac frame, optional can be nil. @eturn when pcm is nil, should fill more bytes and decode again.

func (*AacDecoder) ExtensionAudioObjectType

func (v *AacDecoder) ExtensionAudioObjectType() int

Extension Audio Object Type (from ASC) @remark Decoder internal members.

func (*AacDecoder) ExtensionSamplingRate

func (v *AacDecoder) ExtensionSamplingRate() int

Extension sampling rate in Hz (from ASC) @remark Decoder internal members.

func (*AacDecoder) FrameSize

func (v *AacDecoder) FrameSize() int

The frame size of the decoded PCM audio signal.

1024 or 960 for AAC-LC
2048 or 1920 for HE-AAC (v2)
512 or 480 for AAC-LD and AAC-ELD

@remark The only really relevant ones for the user.

func (*AacDecoder) InitAdts

func (v *AacDecoder) InitAdts() (err error)

Open the decoder in ADTS mode without ASC, we never know the stream info util got the first frame, because the codec info is insert at begin of each frame. @remark The frame to Decode() is muxed in ADTS format.

func (*AacDecoder) InitRaw

func (v *AacDecoder) InitRaw(asc []byte) (err error)

Open the decoder in RAW mode with ASC. For example, the FLV audio payload is a SequenceHeader(ASC) or RAW AAC data, user can init the decoder with ASC and decode the raw data. @remark user should never get the info util decode one frame.

func (*AacDecoder) NumBadAccessUnits

func (v *AacDecoder) NumBadAccessUnits() int

This is the number of total access units that were considered with errors from numTotalBytes. @remark Statistics.

func (*AacDecoder) NumBadBytes

func (v *AacDecoder) NumBadBytes() int

This is the number of total bytes that were considered with errors from numTotalBytes. @remark Statistics.

func (*AacDecoder) NumChannels

func (v *AacDecoder) NumChannels() int

The number of output audio channels in the decoded and interleaved PCM audio signal. @remark The only really relevant ones for the user.

func (*AacDecoder) NumLostAccessUnits

func (v *AacDecoder) NumLostAccessUnits() int

This integer will reflect the estimated amount of lost access units in case aacDecoder_DecodeFrame() returns AAC_DEC_TRANSPORT_SYNC_ERROR. It will be < 0 if the estimation failed. @remark Statistics.

func (*AacDecoder) NumTotalAccessUnits

func (v *AacDecoder) NumTotalAccessUnits() int

This is the number of total access units that have passed through the decoder. @remark Statistics.

func (*AacDecoder) NumTotalBytes

func (v *AacDecoder) NumTotalBytes() int

This is the number of total bytes that have passed through the decoder. @remark Statistics.

func (*AacDecoder) Profile

func (v *AacDecoder) Profile() int

MPEG-2 profile (from file header) (-1: not applicable (e. g. MPEG-4)). @remark Decoder internal members.

func (*AacDecoder) SampleBits

func (v *AacDecoder) SampleBits() int

The bits of a sample, the fdk aac always use 16bits sample.

func (*AacDecoder) SampleRate

func (v *AacDecoder) SampleRate() int

The samplerate in Hz of the fully decoded PCM audio signal (after SBR processing). @remark The only really relevant ones for the user.

Jump to

Keyboard shortcuts

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