Home | History | Annotate | Download | only in include
      1 /* ------------------------------------------------------------------
      2  * Copyright (C) 1998-2009 PacketVideo
      3  *
      4  * Licensed under the Apache License, Version 2.0 (the "License");
      5  * you may not use this file except in compliance with the License.
      6  * You may obtain a copy of the License at
      7  *
      8  *      http://www.apache.org/licenses/LICENSE-2.0
      9  *
     10  * Unless required by applicable law or agreed to in writing, software
     11  * distributed under the License is distributed on an "AS IS" BASIS,
     12  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either
     13  * express or implied.
     14  * See the License for the specific language governing permissions
     15  * and limitations under the License.
     16  * -------------------------------------------------------------------
     17  */
     18 /*! \file   decoder_aac.h
     19  *  \brief  Header file for the AAC MDF wrapper
     20  *
     21  */
     22 
     23 #ifndef __DECODER_AAC_H
     24 #define __DECODER_AAC_H
     25 
     26 #ifndef OSCL_MEM_H_INCLUDED
     27 #include "oscl_mem.h"
     28 #endif
     29 
     30 #include "oscl_base.h"
     31 #include "pvmp4audiodecoder_api.h"
     32 
     33 #include "e_tmp4audioobjecttype.h"
     34 extern Int PVMP4SetAudioConfig(tPVMP4AudioDecoderExternal *pExt, void *pMem, Int upsamplingFactor, Int samp_rate, Int num_ch, tMP4AudioObjectType audioObjectType);
     35 
     36 /*!
     37  *  \brief  number of samples per frame (decoded frames)
     38  */
     39 
     40 #define KAAC_NUM_SAMPLES_PER_FRAME      1024
     41 #define KAAC_MAX_STREAMING_BUFFER_SIZE  (PVMP4AUDIODECODER_INBUFSIZE * 1)
     42 
     43 #define KCAI_CODEC_NO_MEMORY -1
     44 #define KCAI_CODEC_INIT_FAILURE -2
     45 
     46 
     47 
     48 /*!
     49  *  \class  CDecoder_AAC "include/decoder_aac.h"
     50  *  \brief  AAC Decoder class
     51  */
     52 
     53 
     54 // CDecoder_AAC
     55 class CDecoder_AAC
     56 {
     57     public:
     58         OSCL_IMPORT_REF void ConstructL();
     59         OSCL_IMPORT_REF static CDecoder_AAC *NewL();
     60         OSCL_IMPORT_REF ~CDecoder_AAC();
     61 
     62         OSCL_IMPORT_REF int32 StartL(tPVMP4AudioDecoderExternal * pExt,
     63                                      uint8  num_channels,
     64                                      bool aAllocateInputBuffer = false,
     65                                      bool aAllocateOutputBuffer = false,
     66                                      Int  upsamplingFactor = 1,
     67                                      Int  samp_rate = 44100,
     68                                      tMP4AudioObjectType  audioObjectType = MP4AUDIO_AAC_LC
     69                                     );
     70 
     71         OSCL_IMPORT_REF int32 StartL(tPVMP4AudioDecoderExternal * pExt,
     72                                      uint8  num_channels,
     73                                      bool aAllocateInputBuffer = false,
     74                                      bool aAllocateOutputBuffer = false,
     75                                      bool aAacplusEnabler = true
     76                                     );
     77         OSCL_IMPORT_REF int32 ExecuteL(tPVMP4AudioDecoderExternal * pExt);
     78         OSCL_IMPORT_REF void ResetDecoderL(void);
     79         OSCL_IMPORT_REF void StopL(void);
     80 
     81         OSCL_IMPORT_REF void TerminateDecoderL();
     82         OSCL_IMPORT_REF int32 RetrieveDecodedStreamTypeL(tPVMP4AudioDecoderExternal * pExt);
     83 
     84         OSCL_IMPORT_REF void DisableSbrDecodingL(tPVMP4AudioDecoderExternal * pExt);
     85 
     86     private:
     87         // number of samples per frame per channel (decoded)
     88         uint32 iNumSamplesPerFrame;
     89         bool iFirstFrame;
     90         uint8 *pMem;
     91 
     92         bool iAllocateInputBuffer;
     93         bool iAllocateOutputBuffer;
     94 
     95         uint8* iInputBuf;
     96         int16* iOutputBuf;
     97 };
     98 
     99 
    100 #endif
    101 
    102