ESQueue.h revision 6a63a939601645404fd98f58c19cc38ca818d99e
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 ES_QUEUE_H_ 18 19#define ES_QUEUE_H_ 20 21#include <media/stagefright/foundation/ABase.h> 22#include <utils/List.h> 23#include <utils/RefBase.h> 24 25namespace android { 26 27struct ABuffer; 28struct MetaData; 29 30struct ElementaryStreamQueue { 31 enum Mode { 32 H264, 33 AAC 34 }; 35 ElementaryStreamQueue(Mode mode); 36 37 status_t appendData(const void *data, size_t size, int64_t timeUs); 38 39 sp<ABuffer> dequeueAccessUnit(); 40 41 sp<MetaData> getFormat(); 42 43private: 44 Mode mMode; 45 46 sp<ABuffer> mBuffer; 47 List<int64_t> mTimestamps; 48 49 sp<MetaData> mFormat; 50 51 sp<ABuffer> dequeueAccessUnitH264(); 52 sp<ABuffer> dequeueAccessUnitAAC(); 53 54 static sp<MetaData> MakeAACCodecSpecificData( 55 unsigned profile, unsigned sampling_freq_index, 56 unsigned channel_configuration); 57 58 static sp<MetaData> MakeAVCCodecSpecificData( 59 const sp<ABuffer> &accessUnit); 60 61 DISALLOW_EVIL_CONSTRUCTORS(ElementaryStreamQueue); 62}; 63 64} // namespace android 65 66#endif // ES_QUEUE_H_ 67