1dcd25efb46c41c8d24a0a9cf61fb57f84149709eGloria Wang/*
2dcd25efb46c41c8d24a0a9cf61fb57f84149709eGloria Wang * Copyright (C) 2010 The Android Open Source Project
3dcd25efb46c41c8d24a0a9cf61fb57f84149709eGloria Wang *
4dcd25efb46c41c8d24a0a9cf61fb57f84149709eGloria Wang * Licensed under the Apache License, Version 2.0 (the "License");
5dcd25efb46c41c8d24a0a9cf61fb57f84149709eGloria Wang * you may not use this file except in compliance with the License.
6dcd25efb46c41c8d24a0a9cf61fb57f84149709eGloria Wang * You may obtain a copy of the License at
7dcd25efb46c41c8d24a0a9cf61fb57f84149709eGloria Wang *
8dcd25efb46c41c8d24a0a9cf61fb57f84149709eGloria Wang *      http://www.apache.org/licenses/LICENSE-2.0
9dcd25efb46c41c8d24a0a9cf61fb57f84149709eGloria Wang *
10dcd25efb46c41c8d24a0a9cf61fb57f84149709eGloria Wang * Unless required by applicable law or agreed to in writing, software
11dcd25efb46c41c8d24a0a9cf61fb57f84149709eGloria Wang * distributed under the License is distributed on an "AS IS" BASIS,
12dcd25efb46c41c8d24a0a9cf61fb57f84149709eGloria Wang * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13dcd25efb46c41c8d24a0a9cf61fb57f84149709eGloria Wang * See the License for the specific language governing permissions and
14dcd25efb46c41c8d24a0a9cf61fb57f84149709eGloria Wang * limitations under the License.
15dcd25efb46c41c8d24a0a9cf61fb57f84149709eGloria Wang */
16dcd25efb46c41c8d24a0a9cf61fb57f84149709eGloria Wang
17dcd25efb46c41c8d24a0a9cf61fb57f84149709eGloria Wang#ifndef DRM_EXTRACTOR_H_
18dcd25efb46c41c8d24a0a9cf61fb57f84149709eGloria Wang
19dcd25efb46c41c8d24a0a9cf61fb57f84149709eGloria Wang#define DRM_EXTRACTOR_H_
20dcd25efb46c41c8d24a0a9cf61fb57f84149709eGloria Wang
21b2487f03f12dcafdb801fc0007c8df8412397f44Marco Nelissen#include <media/IMediaSource.h>
22dcd25efb46c41c8d24a0a9cf61fb57f84149709eGloria Wang#include <media/stagefright/MediaExtractor.h>
23dcd25efb46c41c8d24a0a9cf61fb57f84149709eGloria Wang#include <drm/DrmManagerClient.h>
24dcd25efb46c41c8d24a0a9cf61fb57f84149709eGloria Wang
25dcd25efb46c41c8d24a0a9cf61fb57f84149709eGloria Wangnamespace android {
26dcd25efb46c41c8d24a0a9cf61fb57f84149709eGloria Wang
27a9741a9232c81eaf59179acef91f5be46c42264eGloria Wangstruct AMessage;
28dcd25efb46c41c8d24a0a9cf61fb57f84149709eGloria Wangclass DataSource;
29dcd25efb46c41c8d24a0a9cf61fb57f84149709eGloria Wangclass SampleTable;
30dcd25efb46c41c8d24a0a9cf61fb57f84149709eGloria Wangclass String8;
31dcd25efb46c41c8d24a0a9cf61fb57f84149709eGloria Wangclass DecryptHandle;
32dcd25efb46c41c8d24a0a9cf61fb57f84149709eGloria Wang
33dcd25efb46c41c8d24a0a9cf61fb57f84149709eGloria Wangclass DRMExtractor : public MediaExtractor {
34dcd25efb46c41c8d24a0a9cf61fb57f84149709eGloria Wangpublic:
35dcd25efb46c41c8d24a0a9cf61fb57f84149709eGloria Wang    DRMExtractor(const sp<DataSource> &source, const char *mime);
36dcd25efb46c41c8d24a0a9cf61fb57f84149709eGloria Wang
37dcd25efb46c41c8d24a0a9cf61fb57f84149709eGloria Wang    virtual size_t countTracks();
38b2487f03f12dcafdb801fc0007c8df8412397f44Marco Nelissen    virtual sp<IMediaSource> getTrack(size_t index);
39dcd25efb46c41c8d24a0a9cf61fb57f84149709eGloria Wang    virtual sp<MetaData> getTrackMetaData(size_t index, uint32_t flags);
40dcd25efb46c41c8d24a0a9cf61fb57f84149709eGloria Wang    virtual sp<MetaData> getMetaData();
41a48a51c056198a778755cbed52884dc30b74ac0aMarco Nelissen    virtual const char * name() { return "DRMExtractor"; }
42dcd25efb46c41c8d24a0a9cf61fb57f84149709eGloria Wang
43dcd25efb46c41c8d24a0a9cf61fb57f84149709eGloria Wangprotected:
44dcd25efb46c41c8d24a0a9cf61fb57f84149709eGloria Wang    virtual ~DRMExtractor();
45dcd25efb46c41c8d24a0a9cf61fb57f84149709eGloria Wang
46dcd25efb46c41c8d24a0a9cf61fb57f84149709eGloria Wangprivate:
47dcd25efb46c41c8d24a0a9cf61fb57f84149709eGloria Wang    sp<DataSource> mDataSource;
48dcd25efb46c41c8d24a0a9cf61fb57f84149709eGloria Wang
49b2487f03f12dcafdb801fc0007c8df8412397f44Marco Nelissen    sp<IMediaExtractor> mOriginalExtractor;
50b5ce361d19e69fe156f7188c9ee0f4734b259874Gloria Wang    sp<DecryptHandle> mDecryptHandle;
51889b340ec736a9d3e3e690256d305cc8740f0c4bGloria Wang    DrmManagerClient* mDrmManagerClient;
52dcd25efb46c41c8d24a0a9cf61fb57f84149709eGloria Wang
53dcd25efb46c41c8d24a0a9cf61fb57f84149709eGloria Wang    DRMExtractor(const DRMExtractor &);
54dcd25efb46c41c8d24a0a9cf61fb57f84149709eGloria Wang    DRMExtractor &operator=(const DRMExtractor &);
55dcd25efb46c41c8d24a0a9cf61fb57f84149709eGloria Wang};
56dcd25efb46c41c8d24a0a9cf61fb57f84149709eGloria Wang
57dcd25efb46c41c8d24a0a9cf61fb57f84149709eGloria Wangbool SniffDRM(
58a9741a9232c81eaf59179acef91f5be46c42264eGloria Wang        const sp<DataSource> &source, String8 *mimeType, float *confidence,
59a9741a9232c81eaf59179acef91f5be46c42264eGloria Wang            sp<AMessage> *);
60dcd25efb46c41c8d24a0a9cf61fb57f84149709eGloria Wang
61dcd25efb46c41c8d24a0a9cf61fb57f84149709eGloria Wang}  // namespace android
62dcd25efb46c41c8d24a0a9cf61fb57f84149709eGloria Wang
63dcd25efb46c41c8d24a0a9cf61fb57f84149709eGloria Wang#endif  // DRM_EXTRACTOR_H_
64dcd25efb46c41c8d24a0a9cf61fb57f84149709eGloria Wang
65