1 /* 2 * Copyright 2017, 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 REMOTE_MEDIA_EXTRACTOR_H_ 18 #define REMOTE_MEDIA_EXTRACTOR_H_ 19 20 #include <android/IMediaExtractor.h> 21 #include <media/MediaMetricsItem.h> 22 #include <media/stagefright/MediaExtractor.h> 23 #include <media/stagefright/foundation/ABase.h> 24 25 namespace android { 26 27 28 // IMediaExtractor wrapper to the MediaExtractor. 29 class RemoteMediaExtractor : public BnMediaExtractor { 30 public: 31 static sp<IMediaExtractor> wrap( 32 MediaExtractor *extractor, 33 const sp<DataSource> &source, 34 const sp<RefBase> &plugin); 35 36 virtual ~RemoteMediaExtractor(); 37 virtual size_t countTracks(); 38 virtual sp<IMediaSource> getTrack(size_t index); 39 virtual sp<MetaData> getTrackMetaData(size_t index, uint32_t flags = 0); 40 virtual sp<MetaData> getMetaData(); 41 virtual status_t getMetrics(Parcel *reply); 42 virtual uint32_t flags() const; 43 virtual status_t setMediaCas(const HInterfaceToken &casToken); 44 virtual String8 name(); 45 virtual status_t setEntryPoint(EntryPoint entryPoint); 46 virtual status_t setLogSessionId(const String8& logSessionId); 47 48 private: 49 MediaExtractor *mExtractor; 50 sp<DataSource> mSource; 51 sp<RefBase> mExtractorPlugin; 52 53 mediametrics::Item *mMetricsItem; 54 55 explicit RemoteMediaExtractor( 56 MediaExtractor *extractor, 57 const sp<DataSource> &source, 58 const sp<RefBase> &plugin); 59 60 DISALLOW_EVIL_CONSTRUCTORS(RemoteMediaExtractor); 61 }; 62 63 } // namespace android 64 65 #endif // REMOTE_MEDIA_EXTRACTOR_H_ 66