1 /* 2 * Copyright (C) 2012 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_GSM_H_ 18 19 #define SOFT_GSM_H_ 20 21 #include <media/stagefright/omx/SimpleSoftOMXComponent.h> 22 23 #include "gsm.h" 24 25 namespace android { 26 27 struct SoftGSM : public SimpleSoftOMXComponent { 28 SoftGSM(const char *name, 29 const OMX_CALLBACKTYPE *callbacks, 30 OMX_PTR appData, 31 OMX_COMPONENTTYPE **component); 32 33 protected: 34 virtual ~SoftGSM(); 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 void onQueueFilled(OMX_U32 portIndex); 43 44 virtual void onPortFlushCompleted(OMX_U32 portIndex); 45 virtual void onReset(); 46 47 private: 48 enum { 49 kNumBuffers = 4, 50 kMaxNumSamplesPerFrame = 16384, 51 }; 52 53 bool mSignalledError; 54 gsm mGsm; 55 56 void initPorts(); 57 58 static int DecodeGSM(gsm handle, int16_t *out, uint8_t *in, size_t inSize); 59 60 DISALLOW_EVIL_CONSTRUCTORS(SoftGSM); 61 }; 62 63 } // namespace android 64 65 #endif // SOFT_GSM_H_ 66 67