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 AMR_ENC_H_INCLUDED 19 #define AMR_ENC_H_INCLUDED 20 21 #ifndef OSCL_MEM_H_INCLUDED 22 #include "oscl_mem.h" 23 #endif 24 25 #ifndef OMX_Component_h 26 #include "OMX_Component.h" 27 #endif 28 29 #ifndef GSMAMR_ENCODER_H_INCLUDED 30 #include "gsmamr_encoder_wrapper.h" 31 #endif 32 33 #ifndef PVMF_FORMAT_TYPE_H_INCLUDED 34 #include "pvmf_format_type.h" 35 #endif 36 37 38 39 // frame length is 20 milliseconds i.e. 20000 omx ticks/microseconds 40 #define AMR_FRAME_LENGTH_IN_TIMESTAMP 20000 41 #define MAX_AMR_FRAME_SIZE 32 42 #define MAX_NUM_OUTPUT_FRAMES_PER_BUFFER 10 43 44 45 class OmxAmrEncoder 46 { 47 public: 48 OmxAmrEncoder(); 49 50 OMX_BOOL AmrEncInit(OMX_AUDIO_PARAM_PCMMODETYPE aPcmMode, 51 OMX_AUDIO_PARAM_AMRTYPE aAmrParam, 52 OMX_U32* aInputFrameLength, 53 OMX_U32* aMaxNumberOutputFrames); 54 55 void AmrEncDeinit(); 56 57 OMX_BOOL AmrEncodeFrame(OMX_U8* aOutputBuffer, 58 OMX_U32* aOutputLength, 59 OMX_U8* aInBuffer, 60 OMX_U32 aInBufSize, 61 OMX_TICKS aInTimeStamp, 62 OMX_TICKS* aOutTimeStamp); 63 64 65 66 67 68 private: 69 70 //Codec and encoder settings 71 CPvGsmAmrEncoder* ipGsmEncoder; 72 TEncodeProperties* ipEncProps; 73 74 //Encoding Settings parameters 75 76 int32* ipSizeArrayForOutputFrames; 77 uint32 iNextStartTime; 78 uint32 iMaxNumOutputFramesPerBuffer; 79 uint32 iOneInputFrameLength; 80 uint32 iMaxInputSize; 81 PVMFFormatType iOutputFormat; 82 83 OMX_S32 iAmrInitFlag; 84 85 }; 86 87 88 89 #endif //#ifndef AMR_ENC_H_INCLUDED 90 91