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 <media/IMediaExtractor.h>
21 #include <media/MediaExtractor.h>
22 #include <media/stagefright/foundation/ABase.h>
23 
24 namespace android {
25 
26 class MediaAnalyticsItem;
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 const char * name();
45 
46 private:
47     MediaExtractor *mExtractor;
48     sp<DataSource> mSource;
49     sp<RefBase> mExtractorPlugin;
50 
51     MediaAnalyticsItem *mAnalyticsItem;
52 
53     explicit RemoteMediaExtractor(
54             MediaExtractor *extractor,
55             const sp<DataSource> &source,
56             const sp<RefBase> &plugin);
57 
58     DISALLOW_EVIL_CONSTRUCTORS(RemoteMediaExtractor);
59 };
60 
61 }  // namespace android
62 
63 #endif  // REMOTE_MEDIA_EXTRACTOR_H_
64