• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
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 #include "DrmEngineBase.h"
18 
19 using namespace android;
20 
DrmEngineBase()21 DrmEngineBase::DrmEngineBase() {
22 
23 }
24 
~DrmEngineBase()25 DrmEngineBase::~DrmEngineBase() {
26 
27 }
28 
getConstraints(int uniqueId,const String8 * path,int action)29 DrmConstraints* DrmEngineBase::getConstraints(
30     int uniqueId, const String8* path, int action) {
31     return onGetConstraints(uniqueId, path, action);
32 }
33 
getMetadata(int uniqueId,const String8 * path)34 DrmMetadata* DrmEngineBase::getMetadata(int uniqueId, const String8* path) {
35     return onGetMetadata(uniqueId, path);
36 }
37 
initialize(int uniqueId)38 status_t DrmEngineBase::initialize(int uniqueId) {
39     return onInitialize(uniqueId);
40 }
41 
setOnInfoListener(int uniqueId,const IDrmEngine::OnInfoListener * infoListener)42 status_t DrmEngineBase::setOnInfoListener(
43     int uniqueId, const IDrmEngine::OnInfoListener* infoListener) {
44     return onSetOnInfoListener(uniqueId, infoListener);
45 }
46 
terminate(int uniqueId)47 status_t DrmEngineBase::terminate(int uniqueId) {
48     return onTerminate(uniqueId);
49 }
50 
canHandle(int uniqueId,const String8 & path)51 bool DrmEngineBase::canHandle(int uniqueId, const String8& path) {
52     return onCanHandle(uniqueId, path);
53 }
54 
processDrmInfo(int uniqueId,const DrmInfo * drmInfo)55 DrmInfoStatus* DrmEngineBase::processDrmInfo(int uniqueId, const DrmInfo* drmInfo) {
56     return onProcessDrmInfo(uniqueId, drmInfo);
57 }
58 
saveRights(int uniqueId,const DrmRights & drmRights,const String8 & rightsPath,const String8 & contentPath)59 status_t DrmEngineBase::saveRights(
60             int uniqueId, const DrmRights& drmRights,
61             const String8& rightsPath, const String8& contentPath) {
62     return onSaveRights(uniqueId, drmRights, rightsPath, contentPath);
63 }
64 
acquireDrmInfo(int uniqueId,const DrmInfoRequest * drmInfoRequest)65 DrmInfo* DrmEngineBase::acquireDrmInfo(int uniqueId, const DrmInfoRequest* drmInfoRequest) {
66     return onAcquireDrmInfo(uniqueId, drmInfoRequest);
67 }
68 
getOriginalMimeType(int uniqueId,const String8 & path,int fd)69 String8 DrmEngineBase::getOriginalMimeType(int uniqueId, const String8& path, int fd) {
70     return onGetOriginalMimeType(uniqueId, path, fd);
71 }
72 
getDrmObjectType(int uniqueId,const String8 & path,const String8 & mimeType)73 int DrmEngineBase::getDrmObjectType(int uniqueId, const String8& path, const String8& mimeType) {
74     return onGetDrmObjectType(uniqueId, path, mimeType);
75 }
76 
checkRightsStatus(int uniqueId,const String8 & path,int action)77 int DrmEngineBase::checkRightsStatus(int uniqueId, const String8& path, int action) {
78     return onCheckRightsStatus(uniqueId, path, action);
79 }
80 
consumeRights(int uniqueId,DecryptHandle * decryptHandle,int action,bool reserve)81 status_t DrmEngineBase::consumeRights(
82     int uniqueId, DecryptHandle* decryptHandle, int action, bool reserve) {
83     return onConsumeRights(uniqueId, decryptHandle, action, reserve);
84 }
85 
setPlaybackStatus(int uniqueId,DecryptHandle * decryptHandle,int playbackStatus,int64_t position)86 status_t DrmEngineBase::setPlaybackStatus(
87     int uniqueId, DecryptHandle* decryptHandle, int playbackStatus, int64_t position) {
88     return onSetPlaybackStatus(uniqueId, decryptHandle, playbackStatus, position);
89 }
90 
validateAction(int uniqueId,const String8 & path,int action,const ActionDescription & description)91 bool DrmEngineBase::validateAction(
92     int uniqueId, const String8& path,
93     int action, const ActionDescription& description) {
94     return onValidateAction(uniqueId, path, action, description);
95 }
96 
removeRights(int uniqueId,const String8 & path)97 status_t DrmEngineBase::removeRights(int uniqueId, const String8& path) {
98     return onRemoveRights(uniqueId, path);
99 }
100 
removeAllRights(int uniqueId)101 status_t DrmEngineBase::removeAllRights(int uniqueId) {
102     return onRemoveAllRights(uniqueId);
103 }
104 
openConvertSession(int uniqueId,int convertId)105 status_t DrmEngineBase::openConvertSession(int uniqueId, int convertId) {
106     return onOpenConvertSession(uniqueId, convertId);
107 }
108 
convertData(int uniqueId,int convertId,const DrmBuffer * inputData)109 DrmConvertedStatus* DrmEngineBase::convertData(
110     int uniqueId, int convertId, const DrmBuffer* inputData) {
111     return onConvertData(uniqueId, convertId, inputData);
112 }
113 
closeConvertSession(int uniqueId,int convertId)114 DrmConvertedStatus* DrmEngineBase::closeConvertSession(int uniqueId, int convertId) {
115     return onCloseConvertSession(uniqueId, convertId);
116 }
117 
getSupportInfo(int uniqueId)118 DrmSupportInfo* DrmEngineBase::getSupportInfo(int uniqueId) {
119     return onGetSupportInfo(uniqueId);
120 }
121 
openDecryptSession(int uniqueId,DecryptHandle * decryptHandle,int fd,off64_t offset,off64_t length,const char * mime)122 status_t DrmEngineBase::openDecryptSession(
123     int uniqueId, DecryptHandle* decryptHandle,
124     int fd, off64_t offset, off64_t length, const char* mime) {
125 
126     if (!mime || mime[0] == '\0') {
127         return onOpenDecryptSession(uniqueId, decryptHandle, fd, offset, length);
128     }
129 
130     return onOpenDecryptSession(uniqueId, decryptHandle, fd, offset, length, mime);
131 }
132 
openDecryptSession(int uniqueId,DecryptHandle * decryptHandle,const char * uri,const char * mime)133 status_t DrmEngineBase::openDecryptSession(
134     int uniqueId, DecryptHandle* decryptHandle,
135     const char* uri, const char* mime) {
136     if (!mime || mime[0] == '\0') {
137         return onOpenDecryptSession(uniqueId, decryptHandle, uri);
138     }
139     return onOpenDecryptSession(uniqueId, decryptHandle, uri, mime);
140 }
141 
openDecryptSession(int uniqueId,DecryptHandle * decryptHandle,const DrmBuffer & buf,const String8 & mimeType)142 status_t DrmEngineBase::openDecryptSession(int uniqueId, DecryptHandle* decryptHandle,
143         const DrmBuffer& buf, const String8& mimeType) {
144     return onOpenDecryptSession(uniqueId, decryptHandle, buf, mimeType);
145 }
146 
closeDecryptSession(int uniqueId,DecryptHandle * decryptHandle)147 status_t DrmEngineBase::closeDecryptSession(int uniqueId, DecryptHandle* decryptHandle) {
148     return onCloseDecryptSession(uniqueId, decryptHandle);
149 }
150 
initializeDecryptUnit(int uniqueId,DecryptHandle * decryptHandle,int decryptUnitId,const DrmBuffer * headerInfo)151 status_t DrmEngineBase::initializeDecryptUnit(
152     int uniqueId, DecryptHandle* decryptHandle, int decryptUnitId, const DrmBuffer* headerInfo) {
153     return onInitializeDecryptUnit(uniqueId, decryptHandle, decryptUnitId, headerInfo);
154 }
155 
decrypt(int uniqueId,DecryptHandle * decryptHandle,int decryptUnitId,const DrmBuffer * encBuffer,DrmBuffer ** decBuffer,DrmBuffer * IV)156 status_t DrmEngineBase::decrypt(
157     int uniqueId, DecryptHandle* decryptHandle, int decryptUnitId,
158     const DrmBuffer* encBuffer, DrmBuffer** decBuffer, DrmBuffer* IV) {
159     return onDecrypt(uniqueId, decryptHandle, decryptUnitId, encBuffer, decBuffer, IV);
160 }
161 
finalizeDecryptUnit(int uniqueId,DecryptHandle * decryptHandle,int decryptUnitId)162 status_t DrmEngineBase::finalizeDecryptUnit(
163     int uniqueId, DecryptHandle* decryptHandle, int decryptUnitId) {
164     return onFinalizeDecryptUnit(uniqueId, decryptHandle, decryptUnitId);
165 }
166 
pread(int uniqueId,DecryptHandle * decryptHandle,void * buffer,ssize_t numBytes,off64_t offset)167 ssize_t DrmEngineBase::pread(
168     int uniqueId, DecryptHandle* decryptHandle, void* buffer, ssize_t numBytes, off64_t offset) {
169     return onPread(uniqueId, decryptHandle, buffer, numBytes, offset);
170 }
171 
172