blob: aec5959d8215314ad8a2a91c2c7f560bf53d9b3c [file] [log] [blame]
aimitakeshi27ed8ad2010-07-29 10:12:27 +09001/*
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
Takeshi Aimi34738462010-11-16 13:56:11 +090034DrmMetadata* DrmEngineBase::getMetadata(int uniqueId, const String8* path) {
35 return onGetMetadata(uniqueId, path);
36}
37
aimitakeshi27ed8ad2010-07-29 10:12:27 +090038status_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
Takeshi Aimi2272ee22010-09-20 23:40:41 +090059status_t DrmEngineBase::saveRights(
aimitakeshi27ed8ad2010-07-29 10:12:27 +090060 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
James Dongbf5b3b22012-07-30 17:57:39 -070069String8 DrmEngineBase::getOriginalMimeType(int uniqueId, const String8& path, int fd) {
70 return onGetOriginalMimeType(uniqueId, path, fd);
aimitakeshi27ed8ad2010-07-29 10:12:27 +090071}
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
Takeshi Aimi2272ee22010-09-20 23:40:41 +090081status_t DrmEngineBase::consumeRights(
Jeff Tinker5d49bef2018-10-03 23:01:09 -070082 int uniqueId, sp<DecryptHandle>& decryptHandle, int action, bool reserve) {
Takeshi Aimi2272ee22010-09-20 23:40:41 +090083 return onConsumeRights(uniqueId, decryptHandle, action, reserve);
aimitakeshi27ed8ad2010-07-29 10:12:27 +090084}
85
Takeshi Aimi2272ee22010-09-20 23:40:41 +090086status_t DrmEngineBase::setPlaybackStatus(
Jeff Tinker5d49bef2018-10-03 23:01:09 -070087 int uniqueId, sp<DecryptHandle>& decryptHandle, int playbackStatus, int64_t position) {
Takeshi Aimi2272ee22010-09-20 23:40:41 +090088 return onSetPlaybackStatus(uniqueId, decryptHandle, playbackStatus, position);
aimitakeshi27ed8ad2010-07-29 10:12:27 +090089}
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
Takeshi Aimi2272ee22010-09-20 23:40:41 +090097status_t DrmEngineBase::removeRights(int uniqueId, const String8& path) {
98 return onRemoveRights(uniqueId, path);
aimitakeshi27ed8ad2010-07-29 10:12:27 +090099}
100
Takeshi Aimi2272ee22010-09-20 23:40:41 +0900101status_t DrmEngineBase::removeAllRights(int uniqueId) {
102 return onRemoveAllRights(uniqueId);
aimitakeshi27ed8ad2010-07-29 10:12:27 +0900103}
104
Takeshi Aimi2272ee22010-09-20 23:40:41 +0900105status_t DrmEngineBase::openConvertSession(int uniqueId, int convertId) {
106 return onOpenConvertSession(uniqueId, convertId);
aimitakeshi27ed8ad2010-07-29 10:12:27 +0900107}
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(
Jeff Tinker5d49bef2018-10-03 23:01:09 -0700123 int uniqueId, sp<DecryptHandle>& decryptHandle,
James Dong9d2f3862012-01-10 08:24:37 -0800124 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);
aimitakeshi27ed8ad2010-07-29 10:12:27 +0900131}
132
Takeshi Aimie943f842010-10-08 23:05:49 +0900133status_t DrmEngineBase::openDecryptSession(
Jeff Tinker5d49bef2018-10-03 23:01:09 -0700134 int uniqueId, sp<DecryptHandle>& decryptHandle,
James Dong9d2f3862012-01-10 08:24:37 -0800135 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);
Takeshi Aimie943f842010-10-08 23:05:49 +0900140}
141
Jeff Tinker5d49bef2018-10-03 23:01:09 -0700142status_t DrmEngineBase::openDecryptSession(int uniqueId, sp<DecryptHandle>& decryptHandle,
Kei Takahashicba7b322012-01-18 17:10:19 +0900143 const DrmBuffer& buf, const String8& mimeType) {
144 return onOpenDecryptSession(uniqueId, decryptHandle, buf, mimeType);
145}
146
Jeff Tinker5d49bef2018-10-03 23:01:09 -0700147status_t DrmEngineBase::closeDecryptSession(int uniqueId, sp<DecryptHandle>& decryptHandle) {
Takeshi Aimi2272ee22010-09-20 23:40:41 +0900148 return onCloseDecryptSession(uniqueId, decryptHandle);
aimitakeshi27ed8ad2010-07-29 10:12:27 +0900149}
150
Takeshi Aimi2272ee22010-09-20 23:40:41 +0900151status_t DrmEngineBase::initializeDecryptUnit(
Jeff Tinker5d49bef2018-10-03 23:01:09 -0700152 int uniqueId, sp<DecryptHandle>& decryptHandle, int decryptUnitId, const DrmBuffer* headerInfo) {
Takeshi Aimi2272ee22010-09-20 23:40:41 +0900153 return onInitializeDecryptUnit(uniqueId, decryptHandle, decryptUnitId, headerInfo);
aimitakeshi27ed8ad2010-07-29 10:12:27 +0900154}
155
156status_t DrmEngineBase::decrypt(
Jeff Tinker5d49bef2018-10-03 23:01:09 -0700157 int uniqueId, sp<DecryptHandle>& decryptHandle, int decryptUnitId,
Takeshi Aimi2272ee22010-09-20 23:40:41 +0900158 const DrmBuffer* encBuffer, DrmBuffer** decBuffer, DrmBuffer* IV) {
159 return onDecrypt(uniqueId, decryptHandle, decryptUnitId, encBuffer, decBuffer, IV);
aimitakeshi27ed8ad2010-07-29 10:12:27 +0900160}
161
Takeshi Aimi2272ee22010-09-20 23:40:41 +0900162status_t DrmEngineBase::finalizeDecryptUnit(
Jeff Tinker5d49bef2018-10-03 23:01:09 -0700163 int uniqueId, sp<DecryptHandle>& decryptHandle, int decryptUnitId) {
Takeshi Aimi2272ee22010-09-20 23:40:41 +0900164 return onFinalizeDecryptUnit(uniqueId, decryptHandle, decryptUnitId);
aimitakeshi27ed8ad2010-07-29 10:12:27 +0900165}
166
167ssize_t DrmEngineBase::pread(
Jeff Tinker5d49bef2018-10-03 23:01:09 -0700168 int uniqueId, sp<DecryptHandle>& decryptHandle, void* buffer, ssize_t numBytes, off64_t offset) {
aimitakeshi27ed8ad2010-07-29 10:12:27 +0900169 return onPread(uniqueId, decryptHandle, buffer, numBytes, offset);
170}
171