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_Avc_component.h 20 OpenMax decoder_component component. 21 22 */ 23 24 #ifndef OMX_AVC_COMPONENT_H_INCLUDED 25 #define OMX_AVC_COMPONENT_H_INCLUDED 26 27 #ifndef PV_OMXCOMPONENT_H_INCLUDED 28 #include "pv_omxcomponent.h" 29 #endif 30 31 #ifndef AVC_DEC_H_INCLUDED 32 #include "avc_dec.h" 33 #endif 34 35 #if (defined(TEST_FULL_AVC_FRAME_MODE) || defined(TEST_FULL_AVC_FRAME_MODE_SC)) 36 #define INPUT_BUFFER_SIZE_AVC (2000 * MAX_NAL_PER_FRAME) 37 #else 38 #define INPUT_BUFFER_SIZE_AVC 2000 39 #undef MAX_NAL_PER_FRAME 40 #define MAX_NAL_PER_FRAME 1 /* this component doesn't need to suppoart more than 1 NAL per frame in this mode, so overwrite default */ 41 #endif 42 43 #define NAL_START_CODE_SIZE 4 44 45 //qcif - output 176*144*3/2 46 #define OUTPUT_BUFFER_SIZE_AVC 38016 47 48 #define NUMBER_INPUT_BUFFER_AVC 10 49 #define NUMBER_OUTPUT_BUFFER_AVC 2 50 51 52 class OpenmaxAvcAO : public OmxComponentVideo 53 { 54 public: 55 56 OpenmaxAvcAO(); 57 ~OpenmaxAvcAO(); 58 59 OMX_ERRORTYPE ConstructComponent(OMX_PTR pAppData, OMX_PTR pProxy); 60 OMX_ERRORTYPE DestroyComponent(); 61 62 OMX_ERRORTYPE ComponentInit(); 63 OMX_ERRORTYPE ComponentDeInit(); 64 65 static void ComponentGetRolesOfComponent(OMX_STRING* aRoleString); 66 67 void ComponentBufferMgmtWithoutMarker(); 68 OMX_BOOL ParseFullAVCFramesIntoNALs(OMX_BUFFERHEADERTYPE* aInputBuffer); 69 void ProcessData(); 70 void DecodeWithoutMarker(); 71 void DecodeWithMarker(); 72 void ResetComponent(); 73 OMX_ERRORTYPE GetConfig( 74 OMX_IN OMX_HANDLETYPE hComponent, 75 OMX_IN OMX_INDEXTYPE nIndex, 76 OMX_INOUT OMX_PTR pComponentConfigStructure); 77 78 79 private: 80 81 AvcDecoder_OMX* ipAvcDec; 82 OMX_BOOL iDecodeReturn; 83 84 // variables for "frame" mode i.e. iOMXComponentNeedsFullAVCFrames is turned on 85 OMX_U32 iNALSizeArray[MAX_NAL_PER_FRAME]; // 100 should be more than enough NALs per frame 86 OMX_U32 iCurrNAL; 87 OMX_U32 iNumNALs; 88 OMX_U32 iNALOffset; 89 }; 90 91 92 93 #endif // OMX_AVC_COMPONENT_H_INCLUDED 94