1 /* 2 * Copyright (C) 2009 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 MP3_DECODER_H_ 18 19 #define MP3_DECODER_H_ 20 21 #include <media/stagefright/MediaSource.h> 22 23 struct tPVMP3DecoderExternal; 24 25 namespace android { 26 27 struct MediaBufferGroup; 28 29 struct MP3Decoder : public MediaSource { 30 MP3Decoder(const sp<MediaSource> &source); 31 32 virtual status_t start(MetaData *params); 33 virtual status_t stop(); 34 35 virtual sp<MetaData> getFormat(); 36 37 virtual status_t read( 38 MediaBuffer **buffer, const ReadOptions *options); 39 40 protected: 41 virtual ~MP3Decoder(); 42 43 private: 44 sp<MediaSource> mSource; 45 sp<MetaData> mMeta; 46 int32_t mNumChannels; 47 48 bool mStarted; 49 50 MediaBufferGroup *mBufferGroup; 51 52 tPVMP3DecoderExternal *mConfig; 53 void *mDecoderBuf; 54 int64_t mAnchorTimeUs; 55 int64_t mNumFramesOutput; 56 57 MediaBuffer *mInputBuffer; 58 59 void init(); 60 61 MP3Decoder(const MP3Decoder &); 62 MP3Decoder &operator=(const MP3Decoder &); 63 }; 64 65 } // namespace android 66 67 #endif // MP3_DECODER_H_ 68