SoftAMR.h revision d94e716af0e49d775f0c0c4f36dd2c136ba5f2b2
1bbba88cb1bdc34705d1477208990a06904c022e7Andreas Huber/* 2bbba88cb1bdc34705d1477208990a06904c022e7Andreas Huber * Copyright (C) 2011 The Android Open Source Project 3bbba88cb1bdc34705d1477208990a06904c022e7Andreas Huber * 4bbba88cb1bdc34705d1477208990a06904c022e7Andreas Huber * Licensed under the Apache License, Version 2.0 (the "License"); 5bbba88cb1bdc34705d1477208990a06904c022e7Andreas Huber * you may not use this file except in compliance with the License. 6bbba88cb1bdc34705d1477208990a06904c022e7Andreas Huber * You may obtain a copy of the License at 7bbba88cb1bdc34705d1477208990a06904c022e7Andreas Huber * 8bbba88cb1bdc34705d1477208990a06904c022e7Andreas Huber * http://www.apache.org/licenses/LICENSE-2.0 9bbba88cb1bdc34705d1477208990a06904c022e7Andreas Huber * 10bbba88cb1bdc34705d1477208990a06904c022e7Andreas Huber * Unless required by applicable law or agreed to in writing, software 11bbba88cb1bdc34705d1477208990a06904c022e7Andreas Huber * distributed under the License is distributed on an "AS IS" BASIS, 12bbba88cb1bdc34705d1477208990a06904c022e7Andreas Huber * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13bbba88cb1bdc34705d1477208990a06904c022e7Andreas Huber * See the License for the specific language governing permissions and 14bbba88cb1bdc34705d1477208990a06904c022e7Andreas Huber * limitations under the License. 15bbba88cb1bdc34705d1477208990a06904c022e7Andreas Huber */ 16bbba88cb1bdc34705d1477208990a06904c022e7Andreas Huber 17bbba88cb1bdc34705d1477208990a06904c022e7Andreas Huber#ifndef SOFT_AMR_H_ 18bbba88cb1bdc34705d1477208990a06904c022e7Andreas Huber 19bbba88cb1bdc34705d1477208990a06904c022e7Andreas Huber#define SOFT_AMR_H_ 20bbba88cb1bdc34705d1477208990a06904c022e7Andreas Huber 21bbba88cb1bdc34705d1477208990a06904c022e7Andreas Huber#include "SimpleSoftOMXComponent.h" 22bbba88cb1bdc34705d1477208990a06904c022e7Andreas Huber 23bbba88cb1bdc34705d1477208990a06904c022e7Andreas Hubernamespace android { 24bbba88cb1bdc34705d1477208990a06904c022e7Andreas Huber 25bbba88cb1bdc34705d1477208990a06904c022e7Andreas Huberstruct SoftAMR : public SimpleSoftOMXComponent { 26bbba88cb1bdc34705d1477208990a06904c022e7Andreas Huber SoftAMR(const char *name, 27bbba88cb1bdc34705d1477208990a06904c022e7Andreas Huber const OMX_CALLBACKTYPE *callbacks, 28bbba88cb1bdc34705d1477208990a06904c022e7Andreas Huber OMX_PTR appData, 29bbba88cb1bdc34705d1477208990a06904c022e7Andreas Huber OMX_COMPONENTTYPE **component); 30bbba88cb1bdc34705d1477208990a06904c022e7Andreas Huber 31bbba88cb1bdc34705d1477208990a06904c022e7Andreas Huberprotected: 32bbba88cb1bdc34705d1477208990a06904c022e7Andreas Huber virtual ~SoftAMR(); 33bbba88cb1bdc34705d1477208990a06904c022e7Andreas Huber 34bbba88cb1bdc34705d1477208990a06904c022e7Andreas Huber virtual OMX_ERRORTYPE internalGetParameter( 35bbba88cb1bdc34705d1477208990a06904c022e7Andreas Huber OMX_INDEXTYPE index, OMX_PTR params); 36bbba88cb1bdc34705d1477208990a06904c022e7Andreas Huber 37bbba88cb1bdc34705d1477208990a06904c022e7Andreas Huber virtual OMX_ERRORTYPE internalSetParameter( 38bbba88cb1bdc34705d1477208990a06904c022e7Andreas Huber OMX_INDEXTYPE index, const OMX_PTR params); 39bbba88cb1bdc34705d1477208990a06904c022e7Andreas Huber 40bbba88cb1bdc34705d1477208990a06904c022e7Andreas Huber virtual void onQueueFilled(OMX_U32 portIndex); 41bbba88cb1bdc34705d1477208990a06904c022e7Andreas Huber virtual void onPortFlushCompleted(OMX_U32 portIndex); 42bbba88cb1bdc34705d1477208990a06904c022e7Andreas Huber virtual void onPortEnableCompleted(OMX_U32 portIndex, bool enabled); 43d94e716af0e49d775f0c0c4f36dd2c136ba5f2b2Andreas Huber virtual void onReset(); 44bbba88cb1bdc34705d1477208990a06904c022e7Andreas Huber 45bbba88cb1bdc34705d1477208990a06904c022e7Andreas Huberprivate: 46bbba88cb1bdc34705d1477208990a06904c022e7Andreas Huber enum { 47bbba88cb1bdc34705d1477208990a06904c022e7Andreas Huber kNumBuffers = 4, 48bbba88cb1bdc34705d1477208990a06904c022e7Andreas Huber kSampleRateNB = 8000, 49bbba88cb1bdc34705d1477208990a06904c022e7Andreas Huber kSampleRateWB = 16000, 50bbba88cb1bdc34705d1477208990a06904c022e7Andreas Huber kNumSamplesPerFrameNB = 160, 51bbba88cb1bdc34705d1477208990a06904c022e7Andreas Huber kNumSamplesPerFrameWB = 320, 52bbba88cb1bdc34705d1477208990a06904c022e7Andreas Huber }; 53bbba88cb1bdc34705d1477208990a06904c022e7Andreas Huber 54bbba88cb1bdc34705d1477208990a06904c022e7Andreas Huber enum { 55bbba88cb1bdc34705d1477208990a06904c022e7Andreas Huber MODE_NARROW, 56bbba88cb1bdc34705d1477208990a06904c022e7Andreas Huber MODE_WIDE 57bbba88cb1bdc34705d1477208990a06904c022e7Andreas Huber 58bbba88cb1bdc34705d1477208990a06904c022e7Andreas Huber } mMode; 59bbba88cb1bdc34705d1477208990a06904c022e7Andreas Huber 60bbba88cb1bdc34705d1477208990a06904c022e7Andreas Huber void *mState; 61bbba88cb1bdc34705d1477208990a06904c022e7Andreas Huber void *mDecoderBuf; 62bbba88cb1bdc34705d1477208990a06904c022e7Andreas Huber int16_t *mDecoderCookie; 63bbba88cb1bdc34705d1477208990a06904c022e7Andreas Huber 64bbba88cb1bdc34705d1477208990a06904c022e7Andreas Huber size_t mInputBufferCount; 65bbba88cb1bdc34705d1477208990a06904c022e7Andreas Huber int64_t mAnchorTimeUs; 66bbba88cb1bdc34705d1477208990a06904c022e7Andreas Huber int64_t mNumSamplesOutput; 67bbba88cb1bdc34705d1477208990a06904c022e7Andreas Huber 68bbba88cb1bdc34705d1477208990a06904c022e7Andreas Huber bool mSignalledError; 69bbba88cb1bdc34705d1477208990a06904c022e7Andreas Huber 70bbba88cb1bdc34705d1477208990a06904c022e7Andreas Huber enum { 71bbba88cb1bdc34705d1477208990a06904c022e7Andreas Huber NONE, 72bbba88cb1bdc34705d1477208990a06904c022e7Andreas Huber AWAITING_DISABLED, 73bbba88cb1bdc34705d1477208990a06904c022e7Andreas Huber AWAITING_ENABLED 74bbba88cb1bdc34705d1477208990a06904c022e7Andreas Huber } mOutputPortSettingsChange; 75bbba88cb1bdc34705d1477208990a06904c022e7Andreas Huber 76bbba88cb1bdc34705d1477208990a06904c022e7Andreas Huber int16_t mInputSampleBuffer[477]; 77bbba88cb1bdc34705d1477208990a06904c022e7Andreas Huber 78bbba88cb1bdc34705d1477208990a06904c022e7Andreas Huber void initPorts(); 79bbba88cb1bdc34705d1477208990a06904c022e7Andreas Huber status_t initDecoder(); 80bbba88cb1bdc34705d1477208990a06904c022e7Andreas Huber bool isConfigured() const; 81bbba88cb1bdc34705d1477208990a06904c022e7Andreas Huber 82bbba88cb1bdc34705d1477208990a06904c022e7Andreas Huber DISALLOW_EVIL_CONSTRUCTORS(SoftAMR); 83bbba88cb1bdc34705d1477208990a06904c022e7Andreas Huber}; 84bbba88cb1bdc34705d1477208990a06904c022e7Andreas Huber 85bbba88cb1bdc34705d1477208990a06904c022e7Andreas Huber} // namespace android 86bbba88cb1bdc34705d1477208990a06904c022e7Andreas Huber 87bbba88cb1bdc34705d1477208990a06904c022e7Andreas Huber#endif // SOFT_AMR_H_ 88bbba88cb1bdc34705d1477208990a06904c022e7Andreas Huber 89