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 /** 19 @file omx_amrenc_component.h 20 OpenMax encoder component file. 21 */ 22 23 #ifndef OMX_AMRENC_COMPONENT_H_INCLUDED 24 #define OMX_AMRENC_COMPONENT_H_INCLUDED 25 26 #ifndef PV_OMXCOMPONENT_H_INCLUDED 27 #include "pv_omxcomponent.h" 28 #endif 29 30 #ifndef AMR_DEC_H_INCLUDED 31 #include "amr_enc.h" 32 #endif 33 34 35 #define INPUT_BUFFER_SIZE_AMR_ENC (320 * MAX_NUM_OUTPUT_FRAMES_PER_BUFFER) //3200 36 37 #define OUTPUT_BUFFER_SIZE_AMR_ENC (MAX_NUM_OUTPUT_FRAMES_PER_BUFFER * MAX_AMR_FRAME_SIZE) //10 * 32 = 320 38 39 #define NUMBER_INPUT_BUFFER_AMR_ENC 5 40 #define NUMBER_OUTPUT_BUFFER_AMR_ENC 2 41 42 43 #define omx_min(a, b) ((a) <= (b) ? (a) : (b)); 44 45 class OmxComponentAmrEncoderAO : public OmxComponentAudio 46 { 47 public: 48 49 OmxComponentAmrEncoderAO(); 50 ~OmxComponentAmrEncoderAO(); 51 52 53 OMX_ERRORTYPE ConstructComponent(OMX_PTR pAppData, OMX_PTR pProxy); 54 OMX_ERRORTYPE DestroyComponent(); 55 56 OMX_ERRORTYPE ComponentInit(); 57 OMX_ERRORTYPE ComponentDeInit(); 58 59 static void ComponentGetRolesOfComponent(OMX_STRING* aRoleString); 60 61 void ProcessData(); 62 63 void ProcessInBufferFlag(); 64 void SyncWithInputTimestamp(); 65 66 private: 67 68 OMX_U32 iInputFrameLength; 69 OMX_U32 iMaxNumberOutputFrames; 70 OMX_U32 iActualNumberOutputFrames; 71 72 OMX_TICKS iCurrentTimestamp; 73 OmxAmrEncoder* ipAmrEnc; 74 }; 75 76 #endif // OMX_AMRENC_COMPONENT_H_INCLUDED 77