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 #ifndef AAC_DEC_H_INCLUDED 19 #define AAC_DEC_H_INCLUDED 20 21 #ifndef OSCL_BASE_H_INCLUDED 22 #include "oscl_base.h" 23 #endif 24 25 #ifndef OMX_Component_h 26 #include "OMX_Component.h" 27 #endif 28 29 #ifndef OSCL_MEM_H_INCLUDED 30 #include "oscl_mem.h" 31 #endif 32 33 #ifndef PVMP4AUDIODECODER_API_H 34 #include "pvmp4audiodecoder_api.h" 35 #endif 36 37 #define AACDEC_PCM_FRAME_SAMPLE_SIZE 1024 // 1024 samples 38 39 class OmxAacDecoder 40 { 41 public: 42 OmxAacDecoder(); 43 44 OMX_BOOL AacDecInit(OMX_U32 aDesiredChannels); 45 46 void AacDecDeinit(); 47 48 Int AacDecodeFrames(OMX_S16* aOutputBuffer, 49 OMX_U32* aOutputLength, OMX_U8** aInBuffer, 50 OMX_U32* aInBufSize, OMX_S32* aIsFirstBuffer, 51 OMX_AUDIO_PARAM_PCMMODETYPE* aAudioPcmParam, 52 OMX_AUDIO_PARAM_AACPROFILETYPE* aAudioAacParam, 53 OMX_U32* aSamplesPerFrame, OMX_BOOL* aResizeFlag); 54 55 void UpdateAACPlusEnabled(OMX_BOOL flag); 56 57 void ResetDecoder(); // for repositioning 58 59 OMX_S32 iAacInitFlag; 60 OMX_S32 iInputUsedLength; 61 62 private: 63 64 Int RetrieveDecodedStreamType(); 65 66 void* ipMem; 67 tPVMP4AudioDecoderExternal iExt; 68 OMX_U32 iNumOfChannels; 69 OMX_U32 iMemReq; 70 OMX_S32 iConfigUpSamplingFactor; 71 72 }; 73 74 75 76 #endif //#ifndef AVC_DEC_H_INCLUDED 77 78