Home | History | Annotate | Download | only in include
      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 MPEG2_TS_EXTRACTOR_H_
     18 
     19 #define MPEG2_TS_EXTRACTOR_H_
     20 
     21 #include <media/stagefright/foundation/ABase.h>
     22 #include <media/stagefright/MediaExtractor.h>
     23 #include <utils/threads.h>
     24 #include <utils/Vector.h>
     25 
     26 namespace android {
     27 
     28 struct AMessage;
     29 struct AnotherPacketSource;
     30 struct ATSParser;
     31 struct DataSource;
     32 struct MPEG2TSSource;
     33 struct String8;
     34 struct LiveSession;
     35 
     36 struct MPEG2TSExtractor : public MediaExtractor {
     37     MPEG2TSExtractor(const sp<DataSource> &source);
     38 
     39     virtual size_t countTracks();
     40     virtual sp<MediaSource> getTrack(size_t index);
     41     virtual sp<MetaData> getTrackMetaData(size_t index, uint32_t flags);
     42 
     43     virtual sp<MetaData> getMetaData();
     44 
     45     virtual uint32_t flags() const;
     46 
     47     void setLiveSession(const sp<LiveSession> &liveSession);
     48     void seekTo(int64_t seekTimeUs);
     49 
     50 private:
     51     friend struct MPEG2TSSource;
     52 
     53     mutable Mutex mLock;
     54 
     55     sp<DataSource> mDataSource;
     56     sp<LiveSession> mLiveSession;
     57 
     58     sp<ATSParser> mParser;
     59 
     60     Vector<sp<AnotherPacketSource> > mSourceImpls;
     61 
     62     off64_t mOffset;
     63 
     64     void init();
     65     status_t feedMore();
     66 
     67     DISALLOW_EVIL_CONSTRUCTORS(MPEG2TSExtractor);
     68 };
     69 
     70 bool SniffMPEG2TS(
     71         const sp<DataSource> &source, String8 *mimeType, float *confidence,
     72         sp<AMessage> *);
     73 
     74 }  // namespace android
     75 
     76 #endif  // MPEG2_TS_EXTRACTOR_H_
     77