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 19using namespace android; 20 21DrmEngineBase::DrmEngineBase() { 22 23} 24 25DrmEngineBase::~DrmEngineBase() { 26 27} 28 29DrmConstraints* DrmEngineBase::getConstraints( 30 int uniqueId, const String8* path, int action) { 31 return onGetConstraints(uniqueId, path, action); 32} 33 34DrmMetadata* DrmEngineBase::getMetadata(int uniqueId, const String8* path) { 35 return onGetMetadata(uniqueId, path); 36} 37 38status_t DrmEngineBase::initialize(int uniqueId) { 39 return onInitialize(uniqueId); 40} 41 42status_t DrmEngineBase::setOnInfoListener( 43 int uniqueId, const IDrmEngine::OnInfoListener* infoListener) { 44 return onSetOnInfoListener(uniqueId, infoListener); 45} 46 47status_t DrmEngineBase::terminate(int uniqueId) { 48 return onTerminate(uniqueId); 49} 50 51bool DrmEngineBase::canHandle(int uniqueId, const String8& path) { 52 return onCanHandle(uniqueId, path); 53} 54 55DrmInfoStatus* DrmEngineBase::processDrmInfo(int uniqueId, const DrmInfo* drmInfo) { 56 return onProcessDrmInfo(uniqueId, drmInfo); 57} 58 59status_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 65DrmInfo* DrmEngineBase::acquireDrmInfo(int uniqueId, const DrmInfoRequest* drmInfoRequest) { 66 return onAcquireDrmInfo(uniqueId, drmInfoRequest); 67} 68 69String8 DrmEngineBase::getOriginalMimeType(int uniqueId, const String8& path, int fd) { 70 return onGetOriginalMimeType(uniqueId, path, fd); 71} 72 73int DrmEngineBase::getDrmObjectType(int uniqueId, const String8& path, const String8& mimeType) { 74 return onGetDrmObjectType(uniqueId, path, mimeType); 75} 76 77int DrmEngineBase::checkRightsStatus(int uniqueId, const String8& path, int action) { 78 return onCheckRightsStatus(uniqueId, path, action); 79} 80 81status_t DrmEngineBase::consumeRights( 82 int uniqueId, DecryptHandle* decryptHandle, int action, bool reserve) { 83 return onConsumeRights(uniqueId, decryptHandle, action, reserve); 84} 85 86status_t DrmEngineBase::setPlaybackStatus( 87 int uniqueId, DecryptHandle* decryptHandle, int playbackStatus, int64_t position) { 88 return onSetPlaybackStatus(uniqueId, decryptHandle, playbackStatus, position); 89} 90 91bool DrmEngineBase::validateAction( 92 int uniqueId, const String8& path, 93 int action, const ActionDescription& description) { 94 return onValidateAction(uniqueId, path, action, description); 95} 96 97status_t DrmEngineBase::removeRights(int uniqueId, const String8& path) { 98 return onRemoveRights(uniqueId, path); 99} 100 101status_t DrmEngineBase::removeAllRights(int uniqueId) { 102 return onRemoveAllRights(uniqueId); 103} 104 105status_t DrmEngineBase::openConvertSession(int uniqueId, int convertId) { 106 return onOpenConvertSession(uniqueId, convertId); 107} 108 109DrmConvertedStatus* DrmEngineBase::convertData( 110 int uniqueId, int convertId, const DrmBuffer* inputData) { 111 return onConvertData(uniqueId, convertId, inputData); 112} 113 114DrmConvertedStatus* DrmEngineBase::closeConvertSession(int uniqueId, int convertId) { 115 return onCloseConvertSession(uniqueId, convertId); 116} 117 118DrmSupportInfo* DrmEngineBase::getSupportInfo(int uniqueId) { 119 return onGetSupportInfo(uniqueId); 120} 121 122status_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 133status_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 142status_t DrmEngineBase::openDecryptSession(int uniqueId, DecryptHandle* decryptHandle, 143 const DrmBuffer& buf, const String8& mimeType) { 144 return onOpenDecryptSession(uniqueId, decryptHandle, buf, mimeType); 145} 146 147status_t DrmEngineBase::closeDecryptSession(int uniqueId, DecryptHandle* decryptHandle) { 148 return onCloseDecryptSession(uniqueId, decryptHandle); 149} 150 151status_t DrmEngineBase::initializeDecryptUnit( 152 int uniqueId, DecryptHandle* decryptHandle, int decryptUnitId, const DrmBuffer* headerInfo) { 153 return onInitializeDecryptUnit(uniqueId, decryptHandle, decryptUnitId, headerInfo); 154} 155 156status_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 162status_t DrmEngineBase::finalizeDecryptUnit( 163 int uniqueId, DecryptHandle* decryptHandle, int decryptUnitId) { 164 return onFinalizeDecryptUnit(uniqueId, decryptHandle, decryptUnitId); 165} 166 167ssize_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