SoftMPEG4.h revision d94e716af0e49d775f0c0c4f36dd2c136ba5f2b2
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 23struct tagvideoDecControls; 24 25namespace android { 26 27struct SoftMPEG4 : public SimpleSoftOMXComponent { 28 SoftMPEG4(const char *name, 29 const OMX_CALLBACKTYPE *callbacks, 30 OMX_PTR appData, 31 OMX_COMPONENTTYPE **component); 32 33protected: 34 virtual ~SoftMPEG4(); 35 36 virtual OMX_ERRORTYPE internalGetParameter( 37 OMX_INDEXTYPE index, OMX_PTR params); 38 39 virtual OMX_ERRORTYPE internalSetParameter( 40 OMX_INDEXTYPE index, const OMX_PTR params); 41 42 virtual OMX_ERRORTYPE getConfig(OMX_INDEXTYPE index, OMX_PTR params); 43 44 virtual void onQueueFilled(OMX_U32 portIndex); 45 virtual void onPortFlushCompleted(OMX_U32 portIndex); 46 virtual void onPortEnableCompleted(OMX_U32 portIndex, bool enabled); 47 virtual void onReset(); 48 49private: 50 enum { 51 kNumInputBuffers = 4, 52 kNumOutputBuffers = 2, 53 }; 54 55 enum { 56 MODE_MPEG4, 57 MODE_H263, 58 59 } mMode; 60 61 tagvideoDecControls *mHandle; 62 63 size_t mInputBufferCount; 64 65 int32_t mWidth, mHeight; 66 int32_t mCropLeft, mCropTop, mCropRight, mCropBottom; 67 68 bool mSignalledError; 69 bool mInitialized; 70 bool mFramesConfigured; 71 72 int32_t mNumSamplesOutput; 73 74 enum { 75 NONE, 76 AWAITING_DISABLED, 77 AWAITING_ENABLED 78 } mOutputPortSettingsChange; 79 80 void initPorts(); 81 status_t initDecoder(); 82 83 void updatePortDefinitions(); 84 bool portSettingsChanged(); 85 86 DISALLOW_EVIL_CONSTRUCTORS(SoftMPEG4); 87}; 88 89} // namespace android 90 91#endif // SOFT_MPEG4_H_ 92 93 94