MloDecoder.h

Go to the documentation of this file.
00001 /*****************************************************************
00002 |
00003 |    Melo - Decoder API
00004 |
00005 |    Copyright 2004-2006 Axiomatic Systems LLC
00006 |
00007 |    This file is part of Melo (Melo AAC Decoder).
00008 |
00009 |    Unless you have obtained Melo under a difference license,
00010 |    this version of Melo is Melo|GPL.
00011 |    Melo|GPL is free software; you can redistribute it and/or modify
00012 |    it under the terms of the GNU General Public License as published by
00013 |    the Free Software Foundation; either version 2, or (at your option)
00014 |    any later version.
00015 |
00016 |    Melo|GPL is distributed in the hope that it will be useful,
00017 |    but WITHOUT ANY WARRANTY; without even the implied warranty of
00018 |    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
00019 |    GNU General Public License for more details.
00020 |
00021 |    You should have received a copy of the GNU General Public License
00022 |    along with Melo|GPL; see the file COPYING.  If not, write to the
00023 |    Free Software Foundation, 59 Temple Place - Suite 330, Boston, MA
00024 |    02111-1307, USA.
00025 |
00026  ****************************************************************/
00031 #ifndef _MLO_DECODER_H_
00032 #define _MLO_DECODER_H_
00033 
00039 /*----------------------------------------------------------------------
00040 |       includes
00041 +---------------------------------------------------------------------*/
00042 #include "MloFrame.h"
00043 #include "MloBitStream.h"
00044 #include "MloSampleBuffer.h"
00045 #include "MloSamplingFreq.h"
00046 
00047 /*----------------------------------------------------------------------
00048 |       types
00049 +---------------------------------------------------------------------*/
00054 typedef struct MLO_Decoder MLO_Decoder;
00055 
00059 typedef struct {
00060     MLO_Flags    flags;       
00061     MLO_Cardinal frame_count; 
00062 } MLO_DecoderStatus;
00063 
00072 typedef enum {
00073     MLO_OBJECT_TYPE_AAC_MAIN        = 1,  
00074     MLO_OBJECT_TYPE_AAC_LC          = 2,  
00075     MLO_OBJECT_TYPE_AAC_SSR         = 3,  
00076     MLO_OBJECT_TYPE_AAC_LTP         = 4,  
00077     MLO_OBJECT_TYPE_SBR             = 5,  
00078     MLO_OBJECT_TYPE_AAC_SCALABLE    = 6,  
00079     MLO_OBJECT_TYPE_TWINVQ          = 7,  
00080     MLO_OBJECT_TYPE_ER_AAC_LC       = 17, 
00081     MLO_OBJECT_TYPE_ER_AAC_LTP      = 19, 
00082     MLO_OBJECT_TYPE_ER_AAC_SCALABLE = 20, 
00083     MLO_OBJECT_TYPE_ER_TWINVQ       = 21, 
00084     MLO_OBJECT_TYPE_ER_BSAC         = 22, 
00085     MLO_OBJECT_TYPE_ER_AAC_LD       = 23, 
00086     MLO_OBJECT_TYPE_LAYER_1         = 32, 
00087     MLO_OBJECT_TYPE_LAYER_2         = 33, 
00088     MLO_OBJECT_TYPE_LAYER_3         = 34  
00089 } MLO_ObjectTypeIdentifier;
00090 
00094 typedef enum {
00095     MLO_CHANNEL_CONFIG_NONE   = 0, 
00096     MLO_CHANNEL_CONFIG_MONO   = 1, 
00097     MLO_CHANNEL_CONFIG_STEREO = 2, 
00098     MLO_CHANNEL_CONFIG_STEREO_PLUS_CENTER = 3, 
00099     MLO_CHANNEL_CONFIG_STEREO_PLUS_CENTER_PLUS_REAR_MONO = 4, 
00100     MLO_CHANNEL_CONFIG_FIVE = 5,           
00101     MLO_CHANNEL_CONFIG_FIVE_PLUS_ONE = 6,  
00102     MLO_CHANNEL_CONFIG_SEVEN_PLUS_ONE = 7, 
00103     MLO_CHANNEL_CONFIG_UNSUPPORTED
00104 } MLO_ChannelConfiguration;
00105 
00116 typedef struct {
00117     MLO_ObjectTypeIdentifier object_type;              
00118     MLO_SamplingFreq_Index   sampling_frequency_index; 
00119     MLO_ChannelConfiguration channel_configuration;    
00120     MLO_Boolean              frame_length_flag;        
00121     MLO_Boolean              depends_on_core_coder;    
00122     MLO_Boolean              core_coder_delay;         
00124     struct {
00125         MLO_Boolean              sbr_present;              
00126         MLO_ObjectTypeIdentifier object_type;              
00127         unsigned int             sampling_frequency_index; 
00128     } extension;
00129 } MLO_DecoderConfig;
00130 
00131 /*----------------------------------------------------------------------
00132 |   constants
00133 +---------------------------------------------------------------------*/
00134 #define MLO_DECODER_MAX_FRAME_SIZE 8192
00135 
00137 #define MLO_ERROR_DECODER_UNSUPPORTED_CONFIG            (MLO_ERROR_BASE_DECODER-0)
00138 
00140 #define MLO_ERROR_DECODER_INVALID_CHANNEL_CONFIGURATION (MLO_ERROR_BASE_DECODER-1)
00141 
00143 #define MLO_ERROR_DECODER_UNSUPPORTED_FORMAT            (MLO_ERROR_BASE_DECODER-2)
00144 
00146 #define MLO_ERROR_DECODER_INVALID_DATA                  (MLO_ERROR_BASE_DECODER-3)
00147 
00148 /*----------------------------------------------------------------------
00149 |   prototypes
00150 +---------------------------------------------------------------------*/
00151 #ifdef __cplusplus
00152 extern "C" {
00153 #endif /* __cplusplus */
00154 
00172 MLO_Result MLO_DecoderConfig_Parse(const unsigned char* encoded, 
00173                                    MLO_Size             encoded_size,
00174                                    MLO_DecoderConfig*   config);
00175 
00185 unsigned int MLO_DecoderConfig_GetSampleRate(const MLO_DecoderConfig* config);
00186 
00196 MLO_Cardinal MLO_DecoderConfig_GetChannelCount(const MLO_DecoderConfig* config);
00197 
00209 MLO_Result MLO_Decoder_Create(const MLO_DecoderConfig* config,
00210                               MLO_Decoder**            decoder);
00211 
00217 MLO_Result MLO_Decoder_Destroy(MLO_Decoder* decoder);
00218 
00224 MLO_Result MLO_Decoder_Reset(MLO_Decoder* decoder);
00225 
00240 MLO_Result MLO_Decoder_DecodeFrame(MLO_Decoder*       decoder,
00241                                    const MLO_Byte*    frame,
00242                                    MLO_Size           frame_size,
00243                                    MLO_SampleBuffer*  sample);
00244 
00255 MLO_Result MLO_Decoder_GetStatus(MLO_Decoder*        decoder, 
00256                                  MLO_DecoderStatus** status);
00257 
00258 #ifdef __cplusplus
00259 }
00260 #endif /* __cplusplus */
00261 
00264 #endif /* _MLO_DECODER_H_ */