SoftMPEG4.h revision 269a355679fce6a71523faeefc2ff575abbd1a8e
1/* 2 * Copyright (C) 2011 The Android Open Source Project 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 express or implied. 13 * See the License for the specific language governing permissions and 14 * limitations under the License. 15 */ 16 17#ifndef SOFT_MPEG4_H_ 18 19#define SOFT_MPEG4_H_ 20 21#include "SimpleSoftOMXComponent.h" 22#include <utils/KeyedVector.h> 23 24struct tagvideoDecControls; 25 26namespace android { 27 28struct SoftMPEG4 : public SimpleSoftOMXComponent { 29 SoftMPEG4(const char *name, 30 const OMX_CALLBACKTYPE *callbacks, 31 OMX_PTR appData, 32 OMX_COMPONENTTYPE **component); 33 34protected: 35 virtual ~SoftMPEG4(); 36 37 virtual OMX_ERRORTYPE internalGetParameter( 38 OMX_INDEXTYPE index, OMX_PTR params); 39 40 virtual OMX_ERRORTYPE internalSetParameter( 41 OMX_INDEXTYPE index, const OMX_PTR params); 42 43 virtual OMX_ERRORTYPE getConfig(OMX_INDEXTYPE index, OMX_PTR params); 44 45 virtual void onQueueFilled(OMX_U32 portIndex); 46 virtual void onPortFlushCompleted(OMX_U32 portIndex); 47 virtual void onPortEnableCompleted(OMX_U32 portIndex, bool enabled); 48 virtual void onReset(); 49 50private: 51 enum { 52 kNumInputBuffers = 4, 53 kNumOutputBuffers = 2, 54 }; 55 56 enum { 57 MODE_MPEG4, 58 MODE_H263, 59 60 } mMode; 61 62 tagvideoDecControls *mHandle; 63 64 size_t mInputBufferCount; 65 66 int32_t mWidth, mHeight; 67 int32_t mCropLeft, mCropTop, mCropRight, mCropBottom; 68 69 bool mSignalledError; 70 bool mInitialized; 71 bool mFramesConfigured; 72 73 int32_t mNumSamplesOutput; 74 int32_t mPvTime; 75 KeyedVector<int32_t, OMX_TICKS> mPvToOmxTimeMap; 76 77 enum { 78 NONE, 79 AWAITING_DISABLED, 80 AWAITING_ENABLED 81 } mOutputPortSettingsChange; 82 83 void initPorts(); 84 status_t initDecoder(); 85 86 void updatePortDefinitions(); 87 bool portSettingsChanged(); 88 89 DISALLOW_EVIL_CONSTRUCTORS(SoftMPEG4); 90}; 91 92} // namespace android 93 94#endif // SOFT_MPEG4_H_ 95 96 97