Home | History | Annotate | Download | only in include
      1 /*
      2  * Copyright (C) 2012 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 FRAGMENTED_MP4_EXTRACTOR_H_
     18 
     19 #define FRAGMENTED_MP4_EXTRACTOR_H_
     20 
     21 #include "include/FragmentedMP4Parser.h"
     22 
     23 #include <media/stagefright/MediaExtractor.h>
     24 #include <utils/Vector.h>
     25 #include <utils/String8.h>
     26 
     27 namespace android {
     28 
     29 struct AMessage;
     30 class DataSource;
     31 class SampleTable;
     32 class String8;
     33 
     34 class FragmentedMP4Extractor : public MediaExtractor {
     35 public:
     36     // Extractor assumes ownership of "source".
     37     FragmentedMP4Extractor(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     virtual sp<MetaData> getMetaData();
     43     virtual uint32_t flags() const;
     44 
     45 protected:
     46     virtual ~FragmentedMP4Extractor();
     47 
     48 private:
     49     sp<ALooper> mLooper;
     50     sp<FragmentedMP4Parser> mParser;
     51     sp<DataSource> mDataSource;
     52     status_t mInitCheck;
     53     size_t mAudioTrackIndex;
     54     size_t mTrackCount;
     55 
     56     sp<MetaData> mFileMetaData;
     57 
     58     Vector<uint32_t> mPath;
     59 
     60     FragmentedMP4Extractor(const FragmentedMP4Extractor &);
     61     FragmentedMP4Extractor &operator=(const FragmentedMP4Extractor &);
     62 };
     63 
     64 bool SniffFragmentedMP4(
     65         const sp<DataSource> &source, String8 *mimeType, float *confidence,
     66         sp<AMessage> *);
     67 
     68 }  // namespace android
     69 
     70 #endif  // MPEG4_EXTRACTOR_H_
     71