FAAC - ISO/MPEG 2/4 AAC Encoder Library version 1.0
(www.audiocoding.com)

Contents

  • Scope
  • Interface description
  • Usage
  • Calling sequence
  • Function reference
  • Initialization / De-initialization
  • faacEncOpen()
  • faacEncClose()
  • Encoder configuration
  • faacEncGetCurrentConfiguration()
  • faacEncSetConfiguration()
  • Encoding functions
  • faacEncEncode()
  • Data structures reference
  • faacEncConfiguration
  • Scope

    This document describes the interface and usage of the FAAC - ISO/MPEG 2/4 AAC Encoder Library Developed for the Freeware Advanced Audio Coding project.

    Interface description

    The ISO/MPEG 2/4 AAC Encoder Library provides a high-level interface for encoding MPEG2 and MPEG4 ISO AAC files. The following header file is provided for usage in C/C++ programs:

    faac.h: function prototypes

    The encoder core resides in a statically linkable library called libfaac.lib (Microsoft Windows) or libfaac.a (UNIX). There are various example programs that show how to use the library.

    Usage

    Calling sequence

    For encoding AAC bitstreams the following calling sequence is mandatory:
  • Call faacEncOpen() for every encoder instance you need.
  • To set encoder options, call faacEncGetCurrentConfiguration(), change the parameters in the structure accessible by the returned pointer and then call faacEncSetConfiguration().
  • As long as there are still samples left to encode, call faacEncEncode() to encode the data. The encoder returns the bitstream data in a client-supplied buffer.
  • Once you call faacEncEncode() with zero samples of input the flushing process is initiated; afterwards you may call faacEncEncode() with zero samples input only.
    faacEncEncode() will continue to write out data until all audio samples have been encoded.
  • Once faacEncEncode() has returned with zero bytes written, call faacEncClose() to destroy this encoder instance.
  • Function reference

    Initialization / De-initialization

    faacEncOpen()
    Prototype
    faacEncHandle FAACAPI faacEncOpen
    (
    unsigned long sampleRate,
    unsigned int numChannels,
    unsigned long *inputSamples,
    unsigned long *maxOutputBytes
    );
    Description
    Open and initialize one instance of the encoder.
    Parameters
    
  • sampleRate The samplerate of the encoder input data.
  • numChannels The number of channels of the encoder input data.
  • inputSamples Receives the total number of samples that should be fed to faacEncEncode() in each call.
  • maxOutputBytes Receives the maximum number of bytes that can be in the output buffer after a call to faacEncEncode(). Return value An initialized encoder handle. If anything goes wrong NULL is returned.
  • faacEncClose()
    Prototype
    void FAACAPI faacEncClose
    (
    faacEncHandle hEncoder
    );
    Description
    Closes an encoder instance.
    Parameters
    
  • hEncoder An encoder handle returned by faacEncOpen().
  • Encoder configuration

    faacEncGetCurrentConfiguration()
    Prototype
    faacEncConfigurationPtr FAACAPI
    faacEncGetCurrentConfiguration
    (
    faacEncHandle hEncoder
    );
    Description
    Get a pointer to a structure describing the current encoder
    configuration. You may change this structure and feed it into
    faacEncSetConfiguration().
    
    faacEncSetConfiguration()
    Prototype
    int FAACAPI faacEncSetConfiguration
    (
    faacDecHandle hDecoder,
    faacEncConfigurationPtr config
    );
    Description
    Set a new encoder configuration. See
    faacEncGetCurrentConfiguration().
    


    Copyright © 2001,2003
    AudioCoding.com. All rights reserved.