aimitakeshi | 27ed8ad | 2010-07-29 10:12:27 +0900 | [diff] [blame] | 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 | |
| 21 | DrmEngineBase::DrmEngineBase() { |
| 22 | |
| 23 | } |
| 24 | |
| 25 | DrmEngineBase::~DrmEngineBase() { |
| 26 | |
| 27 | } |
| 28 | |
| 29 | DrmConstraints* DrmEngineBase::getConstraints( |
| 30 | int uniqueId, const String8* path, int action) { |
| 31 | return onGetConstraints(uniqueId, path, action); |
| 32 | } |
| 33 | |
| 34 | status_t DrmEngineBase::initialize(int uniqueId) { |
| 35 | return onInitialize(uniqueId); |
| 36 | } |
| 37 | |
| 38 | status_t DrmEngineBase::setOnInfoListener( |
| 39 | int uniqueId, const IDrmEngine::OnInfoListener* infoListener) { |
| 40 | return onSetOnInfoListener(uniqueId, infoListener); |
| 41 | } |
| 42 | |
| 43 | status_t DrmEngineBase::terminate(int uniqueId) { |
| 44 | return onTerminate(uniqueId); |
| 45 | } |
| 46 | |
| 47 | bool DrmEngineBase::canHandle(int uniqueId, const String8& path) { |
| 48 | return onCanHandle(uniqueId, path); |
| 49 | } |
| 50 | |
| 51 | DrmInfoStatus* DrmEngineBase::processDrmInfo(int uniqueId, const DrmInfo* drmInfo) { |
| 52 | return onProcessDrmInfo(uniqueId, drmInfo); |
| 53 | } |
| 54 | |
Takeshi Aimi | 2272ee2 | 2010-09-20 23:40:41 +0900 | [diff] [blame^] | 55 | status_t DrmEngineBase::saveRights( |
aimitakeshi | 27ed8ad | 2010-07-29 10:12:27 +0900 | [diff] [blame] | 56 | int uniqueId, const DrmRights& drmRights, |
| 57 | const String8& rightsPath, const String8& contentPath) { |
| 58 | return onSaveRights(uniqueId, drmRights, rightsPath, contentPath); |
| 59 | } |
| 60 | |
| 61 | DrmInfo* DrmEngineBase::acquireDrmInfo(int uniqueId, const DrmInfoRequest* drmInfoRequest) { |
| 62 | return onAcquireDrmInfo(uniqueId, drmInfoRequest); |
| 63 | } |
| 64 | |
| 65 | String8 DrmEngineBase::getOriginalMimeType(int uniqueId, const String8& path) { |
| 66 | return onGetOriginalMimeType(uniqueId, path); |
| 67 | } |
| 68 | |
| 69 | int DrmEngineBase::getDrmObjectType(int uniqueId, const String8& path, const String8& mimeType) { |
| 70 | return onGetDrmObjectType(uniqueId, path, mimeType); |
| 71 | } |
| 72 | |
| 73 | int DrmEngineBase::checkRightsStatus(int uniqueId, const String8& path, int action) { |
| 74 | return onCheckRightsStatus(uniqueId, path, action); |
| 75 | } |
| 76 | |
Takeshi Aimi | 2272ee2 | 2010-09-20 23:40:41 +0900 | [diff] [blame^] | 77 | status_t DrmEngineBase::consumeRights( |
aimitakeshi | 27ed8ad | 2010-07-29 10:12:27 +0900 | [diff] [blame] | 78 | int uniqueId, DecryptHandle* decryptHandle, int action, bool reserve) { |
Takeshi Aimi | 2272ee2 | 2010-09-20 23:40:41 +0900 | [diff] [blame^] | 79 | return onConsumeRights(uniqueId, decryptHandle, action, reserve); |
aimitakeshi | 27ed8ad | 2010-07-29 10:12:27 +0900 | [diff] [blame] | 80 | } |
| 81 | |
Takeshi Aimi | 2272ee2 | 2010-09-20 23:40:41 +0900 | [diff] [blame^] | 82 | status_t DrmEngineBase::setPlaybackStatus( |
aimitakeshi | 27ed8ad | 2010-07-29 10:12:27 +0900 | [diff] [blame] | 83 | int uniqueId, DecryptHandle* decryptHandle, int playbackStatus, int position) { |
Takeshi Aimi | 2272ee2 | 2010-09-20 23:40:41 +0900 | [diff] [blame^] | 84 | return onSetPlaybackStatus(uniqueId, decryptHandle, playbackStatus, position); |
aimitakeshi | 27ed8ad | 2010-07-29 10:12:27 +0900 | [diff] [blame] | 85 | } |
| 86 | |
| 87 | bool DrmEngineBase::validateAction( |
| 88 | int uniqueId, const String8& path, |
| 89 | int action, const ActionDescription& description) { |
| 90 | return onValidateAction(uniqueId, path, action, description); |
| 91 | } |
| 92 | |
Takeshi Aimi | 2272ee2 | 2010-09-20 23:40:41 +0900 | [diff] [blame^] | 93 | status_t DrmEngineBase::removeRights(int uniqueId, const String8& path) { |
| 94 | return onRemoveRights(uniqueId, path); |
aimitakeshi | 27ed8ad | 2010-07-29 10:12:27 +0900 | [diff] [blame] | 95 | } |
| 96 | |
Takeshi Aimi | 2272ee2 | 2010-09-20 23:40:41 +0900 | [diff] [blame^] | 97 | status_t DrmEngineBase::removeAllRights(int uniqueId) { |
| 98 | return onRemoveAllRights(uniqueId); |
aimitakeshi | 27ed8ad | 2010-07-29 10:12:27 +0900 | [diff] [blame] | 99 | } |
| 100 | |
Takeshi Aimi | 2272ee2 | 2010-09-20 23:40:41 +0900 | [diff] [blame^] | 101 | status_t DrmEngineBase::openConvertSession(int uniqueId, int convertId) { |
| 102 | return onOpenConvertSession(uniqueId, convertId); |
aimitakeshi | 27ed8ad | 2010-07-29 10:12:27 +0900 | [diff] [blame] | 103 | } |
| 104 | |
| 105 | DrmConvertedStatus* DrmEngineBase::convertData( |
| 106 | int uniqueId, int convertId, const DrmBuffer* inputData) { |
| 107 | return onConvertData(uniqueId, convertId, inputData); |
| 108 | } |
| 109 | |
| 110 | DrmConvertedStatus* DrmEngineBase::closeConvertSession(int uniqueId, int convertId) { |
| 111 | return onCloseConvertSession(uniqueId, convertId); |
| 112 | } |
| 113 | |
| 114 | DrmSupportInfo* DrmEngineBase::getSupportInfo(int uniqueId) { |
| 115 | return onGetSupportInfo(uniqueId); |
| 116 | } |
| 117 | |
| 118 | status_t DrmEngineBase::openDecryptSession( |
| 119 | int uniqueId, DecryptHandle* decryptHandle, int fd, int offset, int length) { |
| 120 | return onOpenDecryptSession(uniqueId, decryptHandle, fd, offset, length); |
| 121 | } |
| 122 | |
Takeshi Aimi | 2272ee2 | 2010-09-20 23:40:41 +0900 | [diff] [blame^] | 123 | status_t DrmEngineBase::closeDecryptSession(int uniqueId, DecryptHandle* decryptHandle) { |
| 124 | return onCloseDecryptSession(uniqueId, decryptHandle); |
aimitakeshi | 27ed8ad | 2010-07-29 10:12:27 +0900 | [diff] [blame] | 125 | } |
| 126 | |
Takeshi Aimi | 2272ee2 | 2010-09-20 23:40:41 +0900 | [diff] [blame^] | 127 | status_t DrmEngineBase::initializeDecryptUnit( |
aimitakeshi | 27ed8ad | 2010-07-29 10:12:27 +0900 | [diff] [blame] | 128 | int uniqueId, DecryptHandle* decryptHandle, int decryptUnitId, const DrmBuffer* headerInfo) { |
Takeshi Aimi | 2272ee2 | 2010-09-20 23:40:41 +0900 | [diff] [blame^] | 129 | return onInitializeDecryptUnit(uniqueId, decryptHandle, decryptUnitId, headerInfo); |
aimitakeshi | 27ed8ad | 2010-07-29 10:12:27 +0900 | [diff] [blame] | 130 | } |
| 131 | |
| 132 | status_t DrmEngineBase::decrypt( |
| 133 | int uniqueId, DecryptHandle* decryptHandle, int decryptUnitId, |
Takeshi Aimi | 2272ee2 | 2010-09-20 23:40:41 +0900 | [diff] [blame^] | 134 | const DrmBuffer* encBuffer, DrmBuffer** decBuffer, DrmBuffer* IV) { |
| 135 | return onDecrypt(uniqueId, decryptHandle, decryptUnitId, encBuffer, decBuffer, IV); |
aimitakeshi | 27ed8ad | 2010-07-29 10:12:27 +0900 | [diff] [blame] | 136 | } |
| 137 | |
Takeshi Aimi | 2272ee2 | 2010-09-20 23:40:41 +0900 | [diff] [blame^] | 138 | status_t DrmEngineBase::finalizeDecryptUnit( |
aimitakeshi | 27ed8ad | 2010-07-29 10:12:27 +0900 | [diff] [blame] | 139 | int uniqueId, DecryptHandle* decryptHandle, int decryptUnitId) { |
Takeshi Aimi | 2272ee2 | 2010-09-20 23:40:41 +0900 | [diff] [blame^] | 140 | return onFinalizeDecryptUnit(uniqueId, decryptHandle, decryptUnitId); |
aimitakeshi | 27ed8ad | 2010-07-29 10:12:27 +0900 | [diff] [blame] | 141 | } |
| 142 | |
| 143 | ssize_t DrmEngineBase::pread( |
| 144 | int uniqueId, DecryptHandle* decryptHandle, void* buffer, ssize_t numBytes, off_t offset) { |
| 145 | return onPread(uniqueId, decryptHandle, buffer, numBytes, offset); |
| 146 | } |
| 147 | |