DrmPassthruPlugIn.h revision 27ed8ad2db653f6ac07dcf8bcc05e2409c8bb024
1/*
2 * Copyright (C) 2010 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 __DRM_PASSTHRU_PLUGIN_H__
18#define __DRM_PASSTHRU_PLUGIN_H__
19
20#include <DrmEngineBase.h>
21
22namespace android {
23
24class DrmPassthruPlugIn : public DrmEngineBase {
25
26public:
27    DrmPassthruPlugIn();
28    virtual ~DrmPassthruPlugIn();
29
30protected:
31    DrmConstraints* onGetConstraints(int uniqueId, const String8* path, int action);
32
33    status_t onInitialize(int uniqueId);
34
35    status_t onSetOnInfoListener(int uniqueId, const IDrmEngine::OnInfoListener* infoListener);
36
37    status_t onTerminate(int uniqueId);
38
39    bool onCanHandle(int uniqueId, const String8& path);
40
41    DrmInfoStatus* onProcessDrmInfo(int uniqueId, const DrmInfo* drmInfo);
42
43    void onSaveRights(int uniqueId, const DrmRights& drmRights,
44            const String8& rightsPath, const String8& contentPath);
45
46    DrmInfo* onAcquireDrmInfo(int uniqueId, const DrmInfoRequest* drmInfoRequest);
47
48    String8 onGetOriginalMimeType(int uniqueId, const String8& path);
49
50    int onGetDrmObjectType(int uniqueId, const String8& path, const String8& mimeType);
51
52    int onCheckRightsStatus(int uniqueId, const String8& path, int action);
53
54    void onConsumeRights(int uniqueId, DecryptHandle* decryptHandle, int action, bool reserve);
55
56    void onSetPlaybackStatus(
57            int uniqueId, DecryptHandle* decryptHandle, int playbackStatus, int position);
58
59    bool onValidateAction(
60            int uniqueId, const String8& path, int action, const ActionDescription& description);
61
62    void onRemoveRights(int uniqueId, const String8& path);
63
64    void onRemoveAllRights(int uniqueId);
65
66    void onOpenConvertSession(int uniqueId, int convertId);
67
68    DrmConvertedStatus* onConvertData(int uniqueId, int convertId, const DrmBuffer* inputData);
69
70    DrmConvertedStatus* onCloseConvertSession(int uniqueId, int convertId);
71
72    DrmSupportInfo* onGetSupportInfo(int uniqueId);
73
74    status_t onOpenDecryptSession(
75            int uniqueId, DecryptHandle* decryptHandle, int fd, int offset, int length);
76
77    void onCloseDecryptSession(int uniqueId, DecryptHandle* decryptHandle);
78
79     void onInitializeDecryptUnit(int uniqueId, DecryptHandle* decryptHandle,
80            int decryptUnitId, const DrmBuffer* headerInfo);
81
82     status_t onDecrypt(int uniqueId, DecryptHandle* decryptHandle,
83            int decryptUnitId, const DrmBuffer* encBuffer, DrmBuffer** decBuffer);
84
85     void onFinalizeDecryptUnit(int uniqueId, DecryptHandle* decryptHandle, int decryptUnitId);
86
87    ssize_t onPread(int uniqueId, DecryptHandle* decryptHandle,
88            void* buffer, ssize_t numBytes, off_t offset);
89
90private:
91    DecryptHandle* openDecryptSessionImpl();
92};
93
94};
95
96#endif /* __DRM_PASSTHRU_PLUGIN_H__ */
97
98