blob: fa20b842a1a36c71d34bc2bf8b81737ed7faec25 [file] [log] [blame]
Andreas Huber072f5242010-05-20 14:56:53 -07001/*
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 MATROSKA_EXTRACTOR_H_
18
19#define MATROSKA_EXTRACTOR_H_
20
21#include <media/stagefright/MediaExtractor.h>
22#include <utils/Vector.h>
23
24namespace mkvparser {
25struct Segment;
26};
27
28namespace android {
29
Andreas Huberefdd0882010-08-25 11:09:41 -070030struct AMessage;
Andreas Huber072f5242010-05-20 14:56:53 -070031class String8;
32
33struct DataSourceReader;
34struct MatroskaSource;
35
36struct MatroskaExtractor : public MediaExtractor {
37 MatroskaExtractor(const sp<DataSource> &source);
38
39 virtual size_t countTracks();
40
41 virtual sp<MediaSource> getTrack(size_t index);
42
43 virtual sp<MetaData> getTrackMetaData(
44 size_t index, uint32_t flags);
45
46 virtual sp<MetaData> getMetaData();
47
48protected:
49 virtual ~MatroskaExtractor();
50
51private:
52 friend struct MatroskaSource;
53
54 struct TrackInfo {
55 unsigned long mTrackNum;
56 sp<MetaData> mMeta;
57 };
58 Vector<TrackInfo> mTracks;
59
60 sp<DataSource> mDataSource;
61 DataSourceReader *mReader;
62 mkvparser::Segment *mSegment;
Andreas Huber6bdf2ed2010-05-25 13:35:02 -070063 bool mExtractedThumbnails;
Andreas Huber072f5242010-05-20 14:56:53 -070064
65 void addTracks();
Andreas Huber6bdf2ed2010-05-25 13:35:02 -070066 void findThumbnails();
Andreas Huber072f5242010-05-20 14:56:53 -070067
68 MatroskaExtractor(const MatroskaExtractor &);
69 MatroskaExtractor &operator=(const MatroskaExtractor &);
70};
71
72bool SniffMatroska(
Andreas Huberefdd0882010-08-25 11:09:41 -070073 const sp<DataSource> &source, String8 *mimeType, float *confidence,
74 sp<AMessage> *);
Andreas Huber072f5242010-05-20 14:56:53 -070075
76} // namespace android
77
78#endif // MATROSKA_EXTRACTOR_H_