Home | History | Annotate | Download | only in mpeg2ts
      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 
     25 namespace android {
     26 
     27 struct ABuffer;
     28 struct MetaData;
     29 
     30 struct 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     void clear();
     39 
     40     sp<ABuffer> dequeueAccessUnit();
     41 
     42     sp<MetaData> getFormat();
     43 
     44 private:
     45     Mode mMode;
     46 
     47     sp<ABuffer> mBuffer;
     48     List<int64_t> mTimestamps;
     49 
     50     sp<MetaData> mFormat;
     51 
     52     sp<ABuffer> dequeueAccessUnitH264();
     53     sp<ABuffer> dequeueAccessUnitAAC();
     54 
     55     static sp<MetaData> MakeAACCodecSpecificData(
     56             unsigned profile, unsigned sampling_freq_index,
     57             unsigned channel_configuration);
     58 
     59     DISALLOW_EVIL_CONSTRUCTORS(ElementaryStreamQueue);
     60 };
     61 
     62 }  // namespace android
     63 
     64 #endif  // ES_QUEUE_H_
     65