blob: cf1b9fbfe181723a6aa93c2b975abb2ac8ca8998 [file] [log] [blame]
Marco Nelissenb2487f02015-09-01 13:23:23 -07001/*
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 Nelissena3214692016-05-06 10:57:20 -070022#include <media/stagefright/DataSource.h>
Marco Nelissenb2487f02015-09-01 13:23:23 -070023
24namespace android {
25
26class MetaData;
Chong Zhang9dbe9a52017-01-03 11:35:15 -080027namespace media {
28class ICas;
29};
30using namespace media;
Marco Nelissenb2487f02015-09-01 13:23:23 -070031
32class IMediaExtractor : public IInterface {
33public:
34 DECLARE_META_INTERFACE(MediaExtractor);
35
36 virtual size_t countTracks() = 0;
37 virtual sp<IMediaSource> getTrack(size_t index) = 0;
38
39 enum GetTrackMetaDataFlags {
40 kIncludeExtensiveMetaData = 1
41 };
42 virtual sp<MetaData> getTrackMetaData(
43 size_t index, uint32_t flags = 0) = 0;
44
45 // Return container specific meta-data. The default implementation
46 // returns an empty metadata object.
47 virtual sp<MetaData> getMetaData() = 0;
48
Ray Essickba13b7b2017-02-07 10:03:18 -080049 virtual status_t getMetrics(Parcel *reply) = 0;
50
Marco Nelissenb2487f02015-09-01 13:23:23 -070051 enum Flags {
52 CAN_SEEK_BACKWARD = 1, // the "seek 10secs back button"
53 CAN_SEEK_FORWARD = 2, // the "seek 10secs forward button"
54 CAN_PAUSE = 4,
55 CAN_SEEK = 8, // the "seek bar"
56 };
57
58 // If subclasses do _not_ override this, the default is
59 // CAN_SEEK_BACKWARD | CAN_SEEK_FORWARD | CAN_SEEK | CAN_PAUSE
60 virtual uint32_t flags() const = 0;
61
62 // for DRM
Marco Nelissenb2487f02015-09-01 13:23:23 -070063 virtual char* getDrmTrackInfo(size_t trackID, int *len) = 0;
Chong Zhang9dbe9a52017-01-03 11:35:15 -080064
65 virtual status_t setMediaCas(const sp<ICas> &cas) = 0;
66
Marco Nelissenb2487f02015-09-01 13:23:23 -070067 virtual void setUID(uid_t uid) = 0;
68
69 virtual const char * name() = 0;
70};
71
72
73class BnMediaExtractor: public BnInterface<IMediaExtractor>
74{
75public:
76 virtual status_t onTransact(uint32_t code, const Parcel& data, Parcel* reply,
77 uint32_t flags = 0);
78};
79
Marco Nelissen69d3d8a2016-03-07 13:20:01 -080080void registerMediaExtractor(
81 const sp<IMediaExtractor> &extractor,
Marco Nelissena3214692016-05-06 10:57:20 -070082 const sp<DataSource> &source,
Marco Nelissen69d3d8a2016-03-07 13:20:01 -080083 const char *mime);
84
85void registerMediaSource(
86 const sp<IMediaExtractor> &extractor,
87 const sp<IMediaSource> &source);
88
89status_t dumpExtractors(int fd, const Vector<String16>& args);
90
Marco Nelissenb2487f02015-09-01 13:23:23 -070091
92} // namespace android
93
94#endif // IMEDIA_EXTRACTOR_BASE_H_