Decoder API


Data Structures

struct  MLO_DecoderStatus
 Represents the status of an MLO_Decoder object. More...
struct  MLO_DecoderConfig
 Detailed decoder configuration information. More...

Defines

#define MLO_DECODER_MAX_FRAME_SIZE   8192
#define MLO_ERROR_DECODER_UNSUPPORTED_CONFIG   (MLO_ERROR_BASE_DECODER-0)
 Error: the configuration or encoding is not supported by this implementation.
#define MLO_ERROR_DECODER_INVALID_CHANNEL_CONFIGURATION   (MLO_ERROR_BASE_DECODER-1)
 Error: an invalid channel configuration was encountered.
#define MLO_ERROR_DECODER_UNSUPPORTED_FORMAT   (MLO_ERROR_BASE_DECODER-2)
 Error: the format or encoding is not supported by this implementation.
#define MLO_ERROR_DECODER_INVALID_DATA   (MLO_ERROR_BASE_DECODER-3)
 Error: invalid data.

Typedefs

typedef MLO_Decoder MLO_Decoder
 Decoder object [opaque data structure].

Enumerations

enum  MLO_ObjectTypeIdentifier {
  MLO_OBJECT_TYPE_AAC_MAIN = 1,
  MLO_OBJECT_TYPE_AAC_LC = 2,
  MLO_OBJECT_TYPE_AAC_SSR = 3,
  MLO_OBJECT_TYPE_AAC_LTP = 4,
  MLO_OBJECT_TYPE_SBR = 5,
  MLO_OBJECT_TYPE_AAC_SCALABLE = 6,
  MLO_OBJECT_TYPE_TWINVQ = 7,
  MLO_OBJECT_TYPE_ER_AAC_LC = 17,
  MLO_OBJECT_TYPE_ER_AAC_LTP = 19,
  MLO_OBJECT_TYPE_ER_AAC_SCALABLE = 20,
  MLO_OBJECT_TYPE_ER_TWINVQ = 21,
  MLO_OBJECT_TYPE_ER_BSAC = 22,
  MLO_OBJECT_TYPE_ER_AAC_LD = 23,
  MLO_OBJECT_TYPE_LAYER_1 = 32,
  MLO_OBJECT_TYPE_LAYER_2 = 33,
  MLO_OBJECT_TYPE_LAYER_3 = 34
}
 Enumeration of object type identifiers. More...
enum  MLO_ChannelConfiguration {
  MLO_CHANNEL_CONFIG_NONE = 0,
  MLO_CHANNEL_CONFIG_MONO = 1,
  MLO_CHANNEL_CONFIG_STEREO = 2,
  MLO_CHANNEL_CONFIG_STEREO_PLUS_CENTER = 3,
  MLO_CHANNEL_CONFIG_STEREO_PLUS_CENTER_PLUS_REAR_MONO = 4,
  MLO_CHANNEL_CONFIG_FIVE = 5,
  MLO_CHANNEL_CONFIG_FIVE_PLUS_ONE = 6,
  MLO_CHANNEL_CONFIG_SEVEN_PLUS_ONE = 7,
  MLO_CHANNEL_CONFIG_UNSUPPORTED
}
 Channel configuration for multichannel audio buffers. More...

Functions

MLO_Result MLO_DecoderConfig_Parse (const unsigned char *encoded, MLO_Size encoded_size, MLO_DecoderConfig *config)
 Parse an array of bytes containing the DecoderSpecificInfo field of a DecoderConfigDescriptor descriptor.
unsigned int MLO_DecoderConfig_GetSampleRate (const MLO_DecoderConfig *config)
 Returns the value of the sample rate expressed in an MLO_DecoderConfig struct.
MLO_Cardinal MLO_DecoderConfig_GetChannelCount (const MLO_DecoderConfig *config)
 Returns the number of audio channels expressed in an MLO_DecoderConfig struct.
MLO_Result MLO_Decoder_Create (const MLO_DecoderConfig *config, MLO_Decoder **decoder)
 Create a new MLO_Decoder object.
MLO_Result MLO_Decoder_Destroy (MLO_Decoder *decoder)
 Destroy an MLO_Decoder object and free the resources associated with it.
MLO_Result MLO_Decoder_Reset (MLO_Decoder *decoder)
 Reset the internal state of an MLO_Decoder object.
MLO_Result MLO_Decoder_DecodeFrame (MLO_Decoder *decoder, const MLO_Byte *frame, MLO_Size frame_size, MLO_SampleBuffer *sample)
 Decode a single audio frame.
MLO_Result MLO_Decoder_GetStatus (MLO_Decoder *decoder, MLO_DecoderStatus **status)
 Return the current status of an MLO_Decoder object.

Typedef Documentation

typedef struct MLO_Decoder MLO_Decoder

Decoder object [opaque data structure].

An MLO_Decoder object is used to decode AAC audio frames.


Enumeration Type Documentation

enum MLO_ChannelConfiguration

Channel configuration for multichannel audio buffers.

Enumerator:
MLO_CHANNEL_CONFIG_NONE  No channel (not used).
MLO_CHANNEL_CONFIG_MONO  Mono (single audio channel).
MLO_CHANNEL_CONFIG_STEREO  Stereo (Two audio channels).
MLO_CHANNEL_CONFIG_STEREO_PLUS_CENTER  Stereo plus one center channel.
MLO_CHANNEL_CONFIG_STEREO_PLUS_CENTER_PLUS_REAR_MONO  Stereo plus one center and one read channel.
MLO_CHANNEL_CONFIG_FIVE  Five channels.
MLO_CHANNEL_CONFIG_FIVE_PLUS_ONE  Five channels plus one low frequency channel.
MLO_CHANNEL_CONFIG_SEVEN_PLUS_ONE  Seven channels plus one low frequency channel.

enum MLO_ObjectTypeIdentifier

Enumeration of object type identifiers.

Object type identifiers identify which of the many possible codecs and codec profiles an encoded stream carries. This library only supports the AAC Low Complexity profile, but other object type identifiers are included here for information. These identifiers are defined in: 14496-3 1.5.1.1

Enumerator:
MLO_OBJECT_TYPE_AAC_MAIN  AAC Main Profile.
MLO_OBJECT_TYPE_AAC_LC  AAC Low Complexity.
MLO_OBJECT_TYPE_AAC_SSR  AAC Scalable Sample Rate.
MLO_OBJECT_TYPE_AAC_LTP  AAC Long Term Prediction.
MLO_OBJECT_TYPE_SBR  Spectral Band Replication.
MLO_OBJECT_TYPE_AAC_SCALABLE  AAC Scalable.
MLO_OBJECT_TYPE_TWINVQ  Twin VQ.
MLO_OBJECT_TYPE_ER_AAC_LC  Error Resilient AAC Low Complexity.
MLO_OBJECT_TYPE_ER_AAC_LTP  Error Resilient AAC Long Term Prediction.
MLO_OBJECT_TYPE_ER_AAC_SCALABLE  Error Resilient AAC Scalable.
MLO_OBJECT_TYPE_ER_TWINVQ  Error Resilient Twin VQ.
MLO_OBJECT_TYPE_ER_BSAC  Error Resilient Bit Sliced Arithmetic Coding.
MLO_OBJECT_TYPE_ER_AAC_LD  Error Resilient AAC Low Delay.
MLO_OBJECT_TYPE_LAYER_1  MPEG Layer 1.
MLO_OBJECT_TYPE_LAYER_2  MPEG Layer 2.
MLO_OBJECT_TYPE_LAYER_3  MPEG Layer 3.


Function Documentation

MLO_Result MLO_Decoder_Create ( const MLO_DecoderConfig config,
MLO_Decoder **  decoder 
)

Create a new MLO_Decoder object.

Parameters:
config Pointer to an MLO_DecoderConfig expressing the configuration parameters of the decoder object to create.
decoder Pointer to a pointer to an MLO_Decoder object where the pointer to the newly created object will be returned.
Returns:
MLO_SUCCESS is the decoder object was successfully created, or an error code if it could not.

MLO_Result MLO_Decoder_DecodeFrame ( MLO_Decoder decoder,
const MLO_Byte *  frame,
MLO_Size  frame_size,
MLO_SampleBuffer sample 
)

Decode a single audio frame.

Parameters:
decoder Pointer to an MLO_Decoder object.
frame Pointer to an array of bytes containing a frame of AAC compressed audio data. The caller must ensure that this array of bytes contains at least one entire AAC frame.
frame_size Size in bytes of the AAC frame data.
sample Pointer to an MLO_SampleBuffer object encapsulating the information about the decoded audio buffer will be returned.
Returns:
MLO_SUCCESS if the frame could be decoded, or an error code if it could not.

MLO_Result MLO_Decoder_Destroy ( MLO_Decoder decoder  ) 

Destroy an MLO_Decoder object and free the resources associated with it.

Parameters:
decoder Pointer to the decoder object to destroy.

MLO_Result MLO_Decoder_GetStatus ( MLO_Decoder decoder,
MLO_DecoderStatus **  status 
)

Return the current status of an MLO_Decoder object.

Parameters:
decoder Pointer to the MLO_Decoder object of which the status will be returned.
status Pointer to a pointer where a pointer to an MLO_DecoderStatus struct will be returned. The caller must be aware that the information pointed to by this pointer cannot no longer be used after the next call to any of the MLO_Decoder functions.

MLO_Result MLO_Decoder_Reset ( MLO_Decoder decoder  ) 

Reset the internal state of an MLO_Decoder object.

This flushed all internal buffers and returns the decoder to a state equivalent to the state of a newly created object.

MLO_Cardinal MLO_DecoderConfig_GetChannelCount ( const MLO_DecoderConfig config  ) 

Returns the number of audio channels expressed in an MLO_DecoderConfig struct.

Parameters:
config Pointer to an MLO_DecoderConfig struct of which the number of audio channels should be returned.
Returns:
Number of audio channels.

unsigned int MLO_DecoderConfig_GetSampleRate ( const MLO_DecoderConfig config  ) 

Returns the value of the sample rate expressed in an MLO_DecoderConfig struct.

Parameters:
config Pointer to an MLO_DecoderConfig struct of which the sample rate should be returned.
Returns:
Sample rate in Hz.

MLO_Result MLO_DecoderConfig_Parse ( const unsigned char *  encoded,
MLO_Size  encoded_size,
MLO_DecoderConfig config 
)

Parse an array of bytes containing the DecoderSpecificInfo field of a DecoderConfigDescriptor descriptor.

The information contained in this DecoderSpecificInfo field is returned in the fields of a MLO_DecoderConfig structure. See 14496-1, subpart 2, p 2.6.6 for details.

Parameters:
encoded Pointer to an array of bytes with the encoded DecoderSpecificInfo field.
encoded_size Size in bytes of the byte array pointed to by the encoded parameter.
config Pointer to an MLO_DecoderConfig struct in which the parsed information will be returned.
Returns:
MLO_SUCCESS if the encoded bytes could be successfully parsed, or an error code if they could not.