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 WVM_EXTRACTOR_H_ 18 19 #define WVM_EXTRACTOR_H_ 20 21 #include <media/stagefright/MediaExtractor.h> 22 #include <utils/Errors.h> 23 24 namespace android { 25 26 class DataSource; 27 28 class WVMLoadableExtractor : public MediaExtractor { 29 public: 30 WVMLoadableExtractor() {} 31 virtual ~WVMLoadableExtractor() {} 32 33 virtual int64_t getCachedDurationUs(status_t *finalStatus) = 0; 34 virtual void setAdaptiveStreamingMode(bool adaptive) = 0; 35 }; 36 37 class WVMExtractor : public MediaExtractor { 38 public: 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 46 // 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 61 protected: 62 virtual ~WVMExtractor(); 63 64 private: 65 sp<DataSource> mDataSource; 66 sp<WVMLoadableExtractor> mImpl; 67 68 WVMExtractor(const WVMExtractor &); 69 WVMExtractor &operator=(const WVMExtractor &); 70 }; 71 72 } // namespace android 73 74 #endif // DRM_EXTRACTOR_H_ 75 76