blob: deecd2543a922de4b83c201fb7d88cba3e44cc4f [file] [log] [blame]
Gloria Wangc2c22e72010-11-01 15:53:16 -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 WVM_EXTRACTOR_H_
18
19#define WVM_EXTRACTOR_H_
20
21#include <media/stagefright/MediaExtractor.h>
Andreas Huber77d8dc22011-04-21 10:06:43 -070022#include <utils/Errors.h>
Gloria Wangc2c22e72010-11-01 15:53:16 -070023
24namespace android {
25
26class DataSource;
27
Jeffrey Tinker82646412011-05-21 18:19:17 -070028class WVMLoadableExtractor : public MediaExtractor {
29public:
30 WVMLoadableExtractor() {}
31 virtual ~WVMLoadableExtractor() {}
32
33 virtual int64_t getCachedDurationUs(status_t *finalStatus) = 0;
34 virtual void setAdaptiveStreamingMode(bool adaptive) = 0;
35};
36
Gloria Wangc2c22e72010-11-01 15:53:16 -070037class WVMExtractor : public MediaExtractor {
38public:
39 WVMExtractor(const sp<DataSource> &source);
40
41 virtual size_t countTracks();
42 virtual sp<MediaSource> getTrack(size_t index);
43 virtual sp<MetaData> getTrackMetaData(size_t index, uint32_t flags);
44 virtual sp<MetaData> getMetaData();
45
Andreas Huber77d8dc22011-04-21 10:06:43 -070046 // Return the amount of data cached from the current
47 // playback positiion (in us).
48 // While more data is still being fetched *finalStatus == OK,
49 // Once fetching is completed (no more data available), *finalStatus != OK
50 // If fetching completed normally (i.e. reached EOS instead of IO error)
51 // *finalStatus == ERROR_END_OF_STREAM
52 int64_t getCachedDurationUs(status_t *finalStatus);
53
54 // Set to use adaptive streaming mode by the WV component.
55 // If adaptive == true, adaptive streaming mode will be used.
56 // Default mode is non-adaptive streaming mode.
57 // Should set to use adaptive streaming mode only if widevine:// protocol
58 // is used.
59 void setAdaptiveStreamingMode(bool adaptive);
60
Gloria Wangc2c22e72010-11-01 15:53:16 -070061protected:
62 virtual ~WVMExtractor();
63
64private:
65 sp<DataSource> mDataSource;
Jeffrey Tinker82646412011-05-21 18:19:17 -070066 sp<WVMLoadableExtractor> mImpl;
Gloria Wangc2c22e72010-11-01 15:53:16 -070067
68 WVMExtractor(const WVMExtractor &);
69 WVMExtractor &operator=(const WVMExtractor &);
Gloria Wangc2c22e72010-11-01 15:53:16 -070070};
71
Gloria Wangc2c22e72010-11-01 15:53:16 -070072} // namespace android
73
74#endif // DRM_EXTRACTOR_H_
75