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