| Marco Nelissen | b2487f0 | 2015-09-01 13:23:23 -0700 | [diff] [blame] | 1 | /* | 
|  | 2 | * Copyright (C) 2009 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 IMEDIA_EXTRACTOR_BASE_H_ | 
|  | 18 |  | 
|  | 19 | #define IMEDIA_EXTRACTOR_BASE_H_ | 
|  | 20 |  | 
|  | 21 | #include <media/IMediaSource.h> | 
| Marco Nelissen | a321469 | 2016-05-06 10:57:20 -0700 | [diff] [blame] | 22 | #include <media/stagefright/DataSource.h> | 
| Marco Nelissen | b2487f0 | 2015-09-01 13:23:23 -0700 | [diff] [blame] | 23 |  | 
|  | 24 | namespace android { | 
|  | 25 |  | 
|  | 26 | class MetaData; | 
|  | 27 |  | 
|  | 28 | class IMediaExtractor : public IInterface { | 
|  | 29 | public: | 
|  | 30 | DECLARE_META_INTERFACE(MediaExtractor); | 
|  | 31 |  | 
|  | 32 | virtual size_t countTracks() = 0; | 
|  | 33 | virtual sp<IMediaSource> getTrack(size_t index) = 0; | 
|  | 34 |  | 
|  | 35 | enum GetTrackMetaDataFlags { | 
|  | 36 | kIncludeExtensiveMetaData = 1 | 
|  | 37 | }; | 
|  | 38 | virtual sp<MetaData> getTrackMetaData( | 
|  | 39 | size_t index, uint32_t flags = 0) = 0; | 
|  | 40 |  | 
|  | 41 | // Return container specific meta-data. The default implementation | 
|  | 42 | // returns an empty metadata object. | 
|  | 43 | virtual sp<MetaData> getMetaData() = 0; | 
|  | 44 |  | 
|  | 45 | enum Flags { | 
|  | 46 | CAN_SEEK_BACKWARD  = 1,  // the "seek 10secs back button" | 
|  | 47 | CAN_SEEK_FORWARD   = 2,  // the "seek 10secs forward button" | 
|  | 48 | CAN_PAUSE          = 4, | 
|  | 49 | CAN_SEEK           = 8,  // the "seek bar" | 
|  | 50 | }; | 
|  | 51 |  | 
|  | 52 | // If subclasses do _not_ override this, the default is | 
|  | 53 | // CAN_SEEK_BACKWARD | CAN_SEEK_FORWARD | CAN_SEEK | CAN_PAUSE | 
|  | 54 | virtual uint32_t flags() const = 0; | 
|  | 55 |  | 
|  | 56 | // for DRM | 
|  | 57 | virtual void setDrmFlag(bool flag) = 0; | 
|  | 58 | virtual bool getDrmFlag() = 0; | 
|  | 59 | virtual char* getDrmTrackInfo(size_t trackID, int *len)  = 0; | 
|  | 60 | virtual void setUID(uid_t uid)  = 0; | 
|  | 61 |  | 
|  | 62 | virtual const char * name() = 0; | 
|  | 63 | }; | 
|  | 64 |  | 
|  | 65 |  | 
|  | 66 | class BnMediaExtractor: public BnInterface<IMediaExtractor> | 
|  | 67 | { | 
|  | 68 | public: | 
|  | 69 | virtual status_t    onTransact(uint32_t code, const Parcel& data, Parcel* reply, | 
|  | 70 | uint32_t flags = 0); | 
|  | 71 | }; | 
|  | 72 |  | 
| Marco Nelissen | 69d3d8a | 2016-03-07 13:20:01 -0800 | [diff] [blame] | 73 | void registerMediaExtractor( | 
|  | 74 | const sp<IMediaExtractor> &extractor, | 
| Marco Nelissen | a321469 | 2016-05-06 10:57:20 -0700 | [diff] [blame] | 75 | const sp<DataSource> &source, | 
| Marco Nelissen | 69d3d8a | 2016-03-07 13:20:01 -0800 | [diff] [blame] | 76 | const char *mime); | 
|  | 77 |  | 
|  | 78 | void registerMediaSource( | 
|  | 79 | const sp<IMediaExtractor> &extractor, | 
|  | 80 | const sp<IMediaSource> &source); | 
|  | 81 |  | 
|  | 82 | status_t dumpExtractors(int fd, const Vector<String16>& args); | 
|  | 83 |  | 
| Marco Nelissen | b2487f0 | 2015-09-01 13:23:23 -0700 | [diff] [blame] | 84 |  | 
|  | 85 | }  // namespace android | 
|  | 86 |  | 
|  | 87 | #endif  // IMEDIA_EXTRACTOR_BASE_H_ |