AnotherPacketSource.h revision bff07d0b22a5ee2d9f044f6cb5e4be1532017ab0
1/* 2 * Copyright (C) 2010 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 ANOTHER_PACKET_SOURCE_H_ 18 19#define ANOTHER_PACKET_SOURCE_H_ 20 21#include <media/stagefright/foundation/ABase.h> 22#include <media/stagefright/MediaSource.h> 23#include <utils/threads.h> 24#include <utils/List.h> 25 26namespace android { 27 28struct ABuffer; 29 30struct AnotherPacketSource : public MediaSource { 31 AnotherPacketSource(const sp<MetaData> &meta); 32 33 virtual status_t start(MetaData *params = NULL); 34 virtual status_t stop(); 35 virtual sp<MetaData> getFormat(); 36 37 virtual status_t read( 38 MediaBuffer **buffer, const ReadOptions *options = NULL); 39 40 bool hasBufferAvailable(status_t *finalResult); 41 42 void queueAccessUnit(const sp<ABuffer> &buffer); 43 void queueDiscontinuity(); 44 void signalEOS(status_t result); 45 46 void clear(); 47 48protected: 49 virtual ~AnotherPacketSource(); 50 51private: 52 Mutex mLock; 53 Condition mCondition; 54 55 sp<MetaData> mFormat; 56 List<sp<ABuffer> > mBuffers; 57 status_t mEOSResult; 58 59 DISALLOW_EVIL_CONSTRUCTORS(AnotherPacketSource); 60}; 61 62 63} // namespace android 64 65#endif // ANOTHER_PACKET_SOURCE_H_ 66