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_VORBIS_H_ 18 19 #define SOFT_VORBIS_H_ 20 21 #include "SimpleSoftOMXComponent.h" 22 23 struct vorbis_dsp_state; 24 struct vorbis_info; 25 26 namespace android { 27 28 struct SoftVorbis : public SimpleSoftOMXComponent { 29 SoftVorbis(const char *name, 30 const OMX_CALLBACKTYPE *callbacks, 31 OMX_PTR appData, 32 OMX_COMPONENTTYPE **component); 33 34 protected: 35 virtual ~SoftVorbis(); 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 void onQueueFilled(OMX_U32 portIndex); 44 virtual void onPortFlushCompleted(OMX_U32 portIndex); 45 virtual void onPortEnableCompleted(OMX_U32 portIndex, bool enabled); 46 47 private: 48 enum { 49 kNumBuffers = 4, 50 kMaxNumSamplesPerBuffer = 8192 * 2 51 }; 52 53 size_t mInputBufferCount; 54 55 vorbis_dsp_state *mState; 56 vorbis_info *mVi; 57 58 int64_t mAnchorTimeUs; 59 int64_t mNumFramesOutput; 60 int32_t mNumFramesLeftOnPage; 61 62 enum { 63 NONE, 64 AWAITING_DISABLED, 65 AWAITING_ENABLED 66 } mOutputPortSettingsChange; 67 68 void initPorts(); 69 status_t initDecoder(); 70 bool isConfigured() const; 71 72 DISALLOW_EVIL_CONSTRUCTORS(SoftVorbis); 73 }; 74 75 } // namespace android 76 77 #endif // SOFT_VORBIS_H_ 78 79