14b3913a3e43d3180b21d77cc2f717b446350354fAndreas Huber/* 24b3913a3e43d3180b21d77cc2f717b446350354fAndreas Huber * Copyright (C) 2011 The Android Open Source Project 34b3913a3e43d3180b21d77cc2f717b446350354fAndreas Huber * 44b3913a3e43d3180b21d77cc2f717b446350354fAndreas Huber * Licensed under the Apache License, Version 2.0 (the "License"); 54b3913a3e43d3180b21d77cc2f717b446350354fAndreas Huber * you may not use this file except in compliance with the License. 64b3913a3e43d3180b21d77cc2f717b446350354fAndreas Huber * You may obtain a copy of the License at 74b3913a3e43d3180b21d77cc2f717b446350354fAndreas Huber * 84b3913a3e43d3180b21d77cc2f717b446350354fAndreas Huber * http://www.apache.org/licenses/LICENSE-2.0 94b3913a3e43d3180b21d77cc2f717b446350354fAndreas Huber * 104b3913a3e43d3180b21d77cc2f717b446350354fAndreas Huber * Unless required by applicable law or agreed to in writing, software 114b3913a3e43d3180b21d77cc2f717b446350354fAndreas Huber * distributed under the License is distributed on an "AS IS" BASIS, 124b3913a3e43d3180b21d77cc2f717b446350354fAndreas Huber * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 134b3913a3e43d3180b21d77cc2f717b446350354fAndreas Huber * See the License for the specific language governing permissions and 144b3913a3e43d3180b21d77cc2f717b446350354fAndreas Huber * limitations under the License. 154b3913a3e43d3180b21d77cc2f717b446350354fAndreas Huber */ 164b3913a3e43d3180b21d77cc2f717b446350354fAndreas Huber 174b3913a3e43d3180b21d77cc2f717b446350354fAndreas Huber#ifndef SOFT_MP3_H_ 184b3913a3e43d3180b21d77cc2f717b446350354fAndreas Huber 194b3913a3e43d3180b21d77cc2f717b446350354fAndreas Huber#define SOFT_MP3_H_ 204b3913a3e43d3180b21d77cc2f717b446350354fAndreas Huber 214b3913a3e43d3180b21d77cc2f717b446350354fAndreas Huber#include "SimpleSoftOMXComponent.h" 224b3913a3e43d3180b21d77cc2f717b446350354fAndreas Huber 234b3913a3e43d3180b21d77cc2f717b446350354fAndreas Huberstruct tPVMP3DecoderExternal; 244b3913a3e43d3180b21d77cc2f717b446350354fAndreas Huber 254b3913a3e43d3180b21d77cc2f717b446350354fAndreas Hubernamespace android { 264b3913a3e43d3180b21d77cc2f717b446350354fAndreas Huber 274b3913a3e43d3180b21d77cc2f717b446350354fAndreas Huberstruct SoftMP3 : public SimpleSoftOMXComponent { 284b3913a3e43d3180b21d77cc2f717b446350354fAndreas Huber SoftMP3(const char *name, 294b3913a3e43d3180b21d77cc2f717b446350354fAndreas Huber const OMX_CALLBACKTYPE *callbacks, 304b3913a3e43d3180b21d77cc2f717b446350354fAndreas Huber OMX_PTR appData, 314b3913a3e43d3180b21d77cc2f717b446350354fAndreas Huber OMX_COMPONENTTYPE **component); 324b3913a3e43d3180b21d77cc2f717b446350354fAndreas Huber 334b3913a3e43d3180b21d77cc2f717b446350354fAndreas Huberprotected: 344b3913a3e43d3180b21d77cc2f717b446350354fAndreas Huber virtual ~SoftMP3(); 354b3913a3e43d3180b21d77cc2f717b446350354fAndreas Huber 364b3913a3e43d3180b21d77cc2f717b446350354fAndreas Huber virtual OMX_ERRORTYPE internalGetParameter( 374b3913a3e43d3180b21d77cc2f717b446350354fAndreas Huber OMX_INDEXTYPE index, OMX_PTR params); 384b3913a3e43d3180b21d77cc2f717b446350354fAndreas Huber 394b3913a3e43d3180b21d77cc2f717b446350354fAndreas Huber virtual OMX_ERRORTYPE internalSetParameter( 404b3913a3e43d3180b21d77cc2f717b446350354fAndreas Huber OMX_INDEXTYPE index, const OMX_PTR params); 414b3913a3e43d3180b21d77cc2f717b446350354fAndreas Huber 424b3913a3e43d3180b21d77cc2f717b446350354fAndreas Huber virtual void onQueueFilled(OMX_U32 portIndex); 434b3913a3e43d3180b21d77cc2f717b446350354fAndreas Huber virtual void onPortFlushCompleted(OMX_U32 portIndex); 444b3913a3e43d3180b21d77cc2f717b446350354fAndreas Huber virtual void onPortEnableCompleted(OMX_U32 portIndex, bool enabled); 454b3913a3e43d3180b21d77cc2f717b446350354fAndreas Huber 464b3913a3e43d3180b21d77cc2f717b446350354fAndreas Huberprivate: 474b3913a3e43d3180b21d77cc2f717b446350354fAndreas Huber enum { 484b3913a3e43d3180b21d77cc2f717b446350354fAndreas Huber kNumBuffers = 4, 494b3913a3e43d3180b21d77cc2f717b446350354fAndreas Huber kOutputBufferSize = 4608 * 2 504b3913a3e43d3180b21d77cc2f717b446350354fAndreas Huber }; 514b3913a3e43d3180b21d77cc2f717b446350354fAndreas Huber 524b3913a3e43d3180b21d77cc2f717b446350354fAndreas Huber tPVMP3DecoderExternal *mConfig; 534b3913a3e43d3180b21d77cc2f717b446350354fAndreas Huber void *mDecoderBuf; 544b3913a3e43d3180b21d77cc2f717b446350354fAndreas Huber int64_t mAnchorTimeUs; 554b3913a3e43d3180b21d77cc2f717b446350354fAndreas Huber int64_t mNumFramesOutput; 564b3913a3e43d3180b21d77cc2f717b446350354fAndreas Huber 574b3913a3e43d3180b21d77cc2f717b446350354fAndreas Huber int32_t mNumChannels; 584b3913a3e43d3180b21d77cc2f717b446350354fAndreas Huber int32_t mSamplingRate; 594b3913a3e43d3180b21d77cc2f717b446350354fAndreas Huber 604b3913a3e43d3180b21d77cc2f717b446350354fAndreas Huber bool mConfigured; 614b3913a3e43d3180b21d77cc2f717b446350354fAndreas Huber 624b3913a3e43d3180b21d77cc2f717b446350354fAndreas Huber bool mSignalledError; 634b3913a3e43d3180b21d77cc2f717b446350354fAndreas Huber 644b3913a3e43d3180b21d77cc2f717b446350354fAndreas Huber enum { 654b3913a3e43d3180b21d77cc2f717b446350354fAndreas Huber NONE, 664b3913a3e43d3180b21d77cc2f717b446350354fAndreas Huber AWAITING_DISABLED, 674b3913a3e43d3180b21d77cc2f717b446350354fAndreas Huber AWAITING_ENABLED 684b3913a3e43d3180b21d77cc2f717b446350354fAndreas Huber } mOutputPortSettingsChange; 694b3913a3e43d3180b21d77cc2f717b446350354fAndreas Huber 704b3913a3e43d3180b21d77cc2f717b446350354fAndreas Huber void initPorts(); 714b3913a3e43d3180b21d77cc2f717b446350354fAndreas Huber void initDecoder(); 724b3913a3e43d3180b21d77cc2f717b446350354fAndreas Huber 734b3913a3e43d3180b21d77cc2f717b446350354fAndreas Huber DISALLOW_EVIL_CONSTRUCTORS(SoftMP3); 744b3913a3e43d3180b21d77cc2f717b446350354fAndreas Huber}; 754b3913a3e43d3180b21d77cc2f717b446350354fAndreas Huber 764b3913a3e43d3180b21d77cc2f717b446350354fAndreas Huber} // namespace android 774b3913a3e43d3180b21d77cc2f717b446350354fAndreas Huber 784b3913a3e43d3180b21d77cc2f717b446350354fAndreas Huber#endif // SOFT_MP3_H_ 794b3913a3e43d3180b21d77cc2f717b446350354fAndreas Huber 804b3913a3e43d3180b21d77cc2f717b446350354fAndreas Huber 81