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_mpeg4_component.h 20 OpenMax decoder_component component. 21 22 */ 23 24 #ifndef OMX_MPEG4_COMPONENT_H_INCLUDED 25 #define OMX_MPEG4_COMPONENT_H_INCLUDED 26 27 #ifndef PV_OMXCOMPONENT_H_INCLUDED 28 #include "pv_omxcomponent.h" 29 #endif 30 31 #ifndef MPEG4_DEC_H_INCLUDED 32 #include "mpeg4_dec.h" 33 #endif 34 35 36 #define INPUT_BUFFER_SIZE_MP4 16000 37 // qcif size - 176*144*3/2 38 #define OUTPUT_BUFFER_SIZE_MP4 38016 39 40 #define NUMBER_INPUT_BUFFER_MP4 10 41 #define NUMBER_OUTPUT_BUFFER_MP4 2 42 43 #define MINIMUM_H263_SHORT_HEADER_SIZE 12 44 /** 45 * The structure for port Type. 46 */ 47 enum 48 { 49 MODE_H263 = 0, 50 MODE_MPEG4 51 }; 52 53 54 class OpenmaxMpeg4AO : public OmxComponentVideo 55 { 56 public: 57 58 OpenmaxMpeg4AO(); 59 ~OpenmaxMpeg4AO(); 60 61 OMX_ERRORTYPE ConstructComponent(OMX_PTR pAppData, OMX_PTR pProxy); 62 OMX_ERRORTYPE DestroyComponent(); 63 64 OMX_ERRORTYPE ComponentInit(); 65 OMX_ERRORTYPE ComponentDeInit(); 66 67 static void ComponentGetRolesOfComponent(OMX_STRING* aRoleString); 68 69 void SetDecoderMode(int); 70 void ComponentBufferMgmtWithoutMarker(); 71 void ProcessData(); 72 void DecodeWithoutMarker(); 73 void DecodeWithMarker(); 74 75 OMX_ERRORTYPE GetConfig( 76 OMX_IN OMX_HANDLETYPE hComponent, 77 OMX_IN OMX_INDEXTYPE nIndex, 78 OMX_INOUT OMX_PTR pComponentConfigStructure); 79 80 OMX_ERRORTYPE ReAllocatePartialAssemblyBuffers(OMX_BUFFERHEADERTYPE* aInputBufferHdr); 81 82 private: 83 84 OMX_BOOL DecodeH263Header(OMX_U8* aInputBuffer, OMX_U32* aBufferSize); 85 86 void ReadBits(OMX_U8* aStream, uint8 aNumBits, uint32* aOutData); 87 88 OMX_BOOL iUseExtTimestamp; 89 Mpeg4Decoder_OMX* ipMpegDecoderObject; 90 OMX_S32 iDecMode; 91 92 //Parameters required for H.263 source format parsing 93 OMX_U32 iH263DataBitPos; 94 OMX_U32 iH263BitPos; 95 OMX_U32 iH263BitBuf; 96 }; 97 98 99 100 101 #endif // OMX_MPEG4_COMPONENT_H_INCLUDED 102