summaryrefslogtreecommitdiffstats
path: root/drm/libdrmframework
diff options
context:
space:
mode:
Diffstat (limited to 'drm/libdrmframework')
-rw-r--r--drm/libdrmframework/DrmManagerClientImpl.cpp16
-rw-r--r--drm/libdrmframework/plugins/forward-lock/FwdLockEngine/include/FwdLockEngine.h32
-rw-r--r--drm/libdrmframework/plugins/forward-lock/FwdLockEngine/src/FwdLockEngine.cpp56
-rw-r--r--drm/libdrmframework/plugins/passthru/include/DrmPassthruPlugIn.h24
-rw-r--r--drm/libdrmframework/plugins/passthru/src/DrmPassthruPlugIn.cpp31
5 files changed, 81 insertions, 78 deletions
diff --git a/drm/libdrmframework/DrmManagerClientImpl.cpp b/drm/libdrmframework/DrmManagerClientImpl.cpp
index c047eb13b1..b0a441b556 100644
--- a/drm/libdrmframework/DrmManagerClientImpl.cpp
+++ b/drm/libdrmframework/DrmManagerClientImpl.cpp
@@ -183,7 +183,7 @@ status_t DrmManagerClientImpl::consumeRights(
status_t status = DRM_ERROR_UNKNOWN;
if (NULL != decryptHandle.get()) {
status = getDrmManagerService()->consumeRights(
- uniqueId, decryptHandle.get(), action, reserve);
+ uniqueId, decryptHandle, action, reserve);
}
return status;
}
@@ -194,7 +194,7 @@ status_t DrmManagerClientImpl::setPlaybackStatus(
status_t status = DRM_ERROR_UNKNOWN;
if (NULL != decryptHandle.get()) {
status = getDrmManagerService()->setPlaybackStatus(
- uniqueId, decryptHandle.get(), playbackStatus, position);
+ uniqueId, decryptHandle, playbackStatus, position);
}
return status;
}
@@ -267,7 +267,7 @@ sp<DecryptHandle> DrmManagerClientImpl::openDecryptSession(
sp<DecryptHandle> DrmManagerClientImpl::openDecryptSession(
int uniqueId, const char* uri, const char* mime) {
- DecryptHandle* handle = NULL;
+ sp<DecryptHandle> handle;
if (NULL != uri) {
handle = getDrmManagerService()->openDecryptSession(uniqueId, uri, mime);
}
@@ -284,7 +284,7 @@ status_t DrmManagerClientImpl::closeDecryptSession(
status_t status = DRM_ERROR_UNKNOWN;
if (NULL != decryptHandle.get()) {
status = getDrmManagerService()->closeDecryptSession(
- uniqueId, decryptHandle.get());
+ uniqueId, decryptHandle);
}
return status;
}
@@ -295,7 +295,7 @@ status_t DrmManagerClientImpl::initializeDecryptUnit(
status_t status = DRM_ERROR_UNKNOWN;
if ((NULL != decryptHandle.get()) && (NULL != headerInfo)) {
status = getDrmManagerService()->initializeDecryptUnit(
- uniqueId, decryptHandle.get(), decryptUnitId, headerInfo);
+ uniqueId, decryptHandle, decryptUnitId, headerInfo);
}
return status;
}
@@ -308,7 +308,7 @@ status_t DrmManagerClientImpl::decrypt(
if ((NULL != decryptHandle.get()) && (NULL != encBuffer)
&& (NULL != decBuffer) && (NULL != *decBuffer)) {
status = getDrmManagerService()->decrypt(
- uniqueId, decryptHandle.get(), decryptUnitId,
+ uniqueId, decryptHandle, decryptUnitId,
encBuffer, decBuffer, IV);
}
return status;
@@ -319,7 +319,7 @@ status_t DrmManagerClientImpl::finalizeDecryptUnit(
status_t status = DRM_ERROR_UNKNOWN;
if (NULL != decryptHandle.get()) {
status = getDrmManagerService()->finalizeDecryptUnit(
- uniqueId, decryptHandle.get(), decryptUnitId);
+ uniqueId, decryptHandle, decryptUnitId);
}
return status;
}
@@ -329,7 +329,7 @@ ssize_t DrmManagerClientImpl::pread(int uniqueId, sp<DecryptHandle> &decryptHand
ssize_t retCode = INVALID_VALUE;
if ((NULL != decryptHandle.get()) && (NULL != buffer) && (0 < numBytes)) {
retCode = getDrmManagerService()->pread(
- uniqueId, decryptHandle.get(), buffer, numBytes, offset);
+ uniqueId, decryptHandle, buffer, numBytes, offset);
}
return retCode;
}
diff --git a/drm/libdrmframework/plugins/forward-lock/FwdLockEngine/include/FwdLockEngine.h b/drm/libdrmframework/plugins/forward-lock/FwdLockEngine/include/FwdLockEngine.h
index a571b3aa1f..b62ddb9296 100644
--- a/drm/libdrmframework/plugins/forward-lock/FwdLockEngine/include/FwdLockEngine.h
+++ b/drm/libdrmframework/plugins/forward-lock/FwdLockEngine/include/FwdLockEngine.h
@@ -198,7 +198,7 @@ int onCheckRightsStatus(int uniqueId,
* Returns DRM_NO_ERROR for success, DRM_ERROR_UNKNOWN for failure
*/
status_t onConsumeRights(int uniqueId,
- DecryptHandle* decryptHandle,
+ sp<DecryptHandle>& decryptHandle,
int action,
bool reserve);
@@ -215,12 +215,12 @@ status_t onConsumeRights(int uniqueId,
*/
#ifdef USE_64BIT_DRM_API
status_t onSetPlaybackStatus(int uniqueId,
- DecryptHandle* decryptHandle,
+ sp<DecryptHandle>& decryptHandle,
int playbackStatus,
int64_t position);
#else
status_t onSetPlaybackStatus(int uniqueId,
- DecryptHandle* decryptHandle,
+ sp<DecryptHandle>& decryptHandle,
int playbackStatus,
int position);
#endif
@@ -330,11 +330,11 @@ DrmSupportInfo* onGetSupportInfo(int uniqueId);
*/
#ifdef USE_64BIT_DRM_API
status_t onOpenDecryptSession(int uniqueId,
- DecryptHandle* decryptHandle,
+ sp<DecryptHandle>& decryptHandle,
int fd, off64_t offset, off64_t length);
#else
status_t onOpenDecryptSession(int uniqueId,
- DecryptHandle* decryptHandle,
+ sp<DecryptHandle>& decryptHandle,
int fd, int offset, int length);
#endif
@@ -348,7 +348,7 @@ status_t onOpenDecryptSession(int uniqueId,
* DRM_ERROR_CANNOT_HANDLE for failure and DRM_NO_ERROR for success
*/
status_t onOpenDecryptSession(int uniqueId,
- DecryptHandle* decryptHandle,
+ sp<DecryptHandle>& decryptHandle,
const char* uri);
/**
@@ -360,7 +360,7 @@ status_t onOpenDecryptSession(int uniqueId,
* Returns DRM_NO_ERROR for success, DRM_ERROR_UNKNOWN for failure
*/
status_t onCloseDecryptSession(int uniqueId,
- DecryptHandle* decryptHandle);
+ sp<DecryptHandle>& decryptHandle);
/**
* Initialize decryption for the given unit of the protected content.
@@ -373,7 +373,7 @@ status_t onCloseDecryptSession(int uniqueId,
* DRM_ERROR_CANNOT_HANDLE for failure and DRM_NO_ERROR for success
*/
status_t onInitializeDecryptUnit(int uniqueId,
- DecryptHandle* decryptHandle,
+ sp<DecryptHandle>& decryptHandle,
int decryptUnitId,
const DrmBuffer* headerInfo);
@@ -394,7 +394,7 @@ status_t onInitializeDecryptUnit(int uniqueId,
* DRM_ERROR_DECRYPT for failure.
*/
status_t onDecrypt(int uniqueId,
- DecryptHandle* decryptHandle,
+ sp<DecryptHandle>& decryptHandle,
int decryptUnitId,
const DrmBuffer* encBuffer,
DrmBuffer** decBuffer);
@@ -416,7 +416,7 @@ status_t onDecrypt(int uniqueId,
* DRM_ERROR_SESSION_NOT_OPENED, DRM_ERROR_DECRYPT_UNIT_NOT_INITIALIZED,
* DRM_ERROR_DECRYPT for failure.
*/
-status_t onDecrypt(int uniqueId, DecryptHandle* decryptHandle,
+status_t onDecrypt(int uniqueId, sp<DecryptHandle>& decryptHandle,
int decryptUnitId, const DrmBuffer* encBuffer,
DrmBuffer** decBuffer, DrmBuffer* IV);
@@ -430,7 +430,7 @@ status_t onDecrypt(int uniqueId, DecryptHandle* decryptHandle,
* DRM_ERROR_CANNOT_HANDLE for failure and DRM_NO_ERROR for success
*/
status_t onFinalizeDecryptUnit(int uniqueId,
- DecryptHandle* decryptHandle,
+ sp<DecryptHandle>& decryptHandle,
int decryptUnitId);
/**
@@ -445,7 +445,7 @@ status_t onFinalizeDecryptUnit(int uniqueId,
* @retval -1 Failure.
*/
ssize_t onRead(int uniqueId,
- DecryptHandle* decryptHandle,
+ sp<DecryptHandle>& decryptHandle,
void* pBuffer,
int numBytes);
@@ -463,12 +463,12 @@ ssize_t onRead(int uniqueId,
*/
#ifdef USE_64BIT_DRM_API
off64_t onLseek(int uniqueId,
- DecryptHandle* decryptHandle,
+ sp<DecryptHandle>& decryptHandle,
off64_t offset,
int whence);
#else
off_t onLseek(int uniqueId,
- DecryptHandle* decryptHandle,
+ sp<DecryptHandle>& decryptHandle,
off_t offset,
int whence);
#endif
@@ -486,13 +486,13 @@ off_t onLseek(int uniqueId,
*/
#ifdef USE_64BIT_DRM_API
ssize_t onPread(int uniqueId,
- DecryptHandle* decryptHandle,
+ sp<DecryptHandle>& decryptHandle,
void* buffer,
ssize_t numBytes,
off64_t offset);
#else
ssize_t onPread(int uniqueId,
- DecryptHandle* decryptHandle,
+ sp<DecryptHandle>& decryptHandle,
void* buffer,
ssize_t numBytes,
off_t offset);
diff --git a/drm/libdrmframework/plugins/forward-lock/FwdLockEngine/src/FwdLockEngine.cpp b/drm/libdrmframework/plugins/forward-lock/FwdLockEngine/src/FwdLockEngine.cpp
index 73eea89249..769de0c801 100644
--- a/drm/libdrmframework/plugins/forward-lock/FwdLockEngine/src/FwdLockEngine.cpp
+++ b/drm/libdrmframework/plugins/forward-lock/FwdLockEngine/src/FwdLockEngine.cpp
@@ -294,7 +294,7 @@ int FwdLockEngine::onCheckRightsStatus(int uniqueId,
}
status_t FwdLockEngine::onConsumeRights(int /* uniqueId */,
- DecryptHandle* /* decryptHandle */,
+ sp<DecryptHandle>& /* decryptHandle */,
int /* action */,
bool /* reserve */) {
// No rights consumption
@@ -372,11 +372,13 @@ status_t FwdLockEngine::onRemoveAllRights(int /* uniqueId */) {
}
#ifdef USE_64BIT_DRM_API
-status_t FwdLockEngine::onSetPlaybackStatus(int /* uniqueId */, DecryptHandle* /* decryptHandle */,
- int /* playbackStatus */, int64_t /* position */) {
+status_t FwdLockEngine::onSetPlaybackStatus(int /* uniqueId */,
+ sp<DecryptHandle>& /* decryptHandle */, int /* playbackStatus */,
+ int64_t /* position */) {
#else
-status_t FwdLockEngine::onSetPlaybackStatus(int /* uniqueId */, DecryptHandle* /* decryptHandle */,
- int /* playbackStatus */, int /* position */) {
+status_t FwdLockEngine::onSetPlaybackStatus(int /* uniqueId */,
+ sp<DecryptHandle>& /* decryptHandle */,
+ int /* playbackStatus */, int /* position */) {
#endif
// Not used
LOG_VERBOSE("FwdLockEngine::onSetPlaybackStatus");
@@ -470,13 +472,13 @@ DrmConvertedStatus* FwdLockEngine::onCloseConvertSession(int /* uniqueId */,
#ifdef USE_64BIT_DRM_API
status_t FwdLockEngine::onOpenDecryptSession(int /* uniqueId */,
- DecryptHandle* decryptHandle,
+ sp<DecryptHandle>& decryptHandle,
int fd,
off64_t offset,
off64_t /* length */) {
#else
status_t FwdLockEngine::onOpenDecryptSession(int /* uniqueId */,
- DecryptHandle* decryptHandle,
+ sp<DecryptHandle>& decryptHandle,
int fd,
int offset,
int /* length */) {
@@ -487,7 +489,7 @@ status_t FwdLockEngine::onOpenDecryptSession(int /* uniqueId */,
LOG_VERBOSE("FwdLockEngine::onOpenDecryptSession");
if ((-1 < fd) &&
- (NULL != decryptHandle) &&
+ (NULL != decryptHandle.get()) &&
(!decodeSessionMap.isCreated(decryptHandle->decryptId))) {
fileDesc = dup(fd);
} else {
@@ -533,12 +535,12 @@ status_t FwdLockEngine::onOpenDecryptSession(int /* uniqueId */,
}
status_t FwdLockEngine::onOpenDecryptSession(int uniqueId,
- DecryptHandle* decryptHandle,
+ sp<DecryptHandle>& decryptHandle,
const char* uri) {
status_t result = DRM_ERROR_CANNOT_HANDLE;
const char fileTag [] = "file://";
- if (NULL != decryptHandle && NULL != uri && strlen(uri) > sizeof(fileTag)) {
+ if (NULL != decryptHandle.get() && NULL != uri && strlen(uri) > sizeof(fileTag)) {
String8 uriTag = String8(uri);
uriTag.toLower();
@@ -562,11 +564,11 @@ status_t FwdLockEngine::onOpenDecryptSession(int uniqueId,
}
status_t FwdLockEngine::onCloseDecryptSession(int /* uniqueId */,
- DecryptHandle* decryptHandle) {
+ sp<DecryptHandle>& decryptHandle) {
status_t result = DRM_ERROR_UNKNOWN;
LOG_VERBOSE("FwdLockEngine::onCloseDecryptSession");
- if (NULL != decryptHandle && decodeSessionMap.isCreated(decryptHandle->decryptId)) {
+ if (NULL != decryptHandle.get() && decodeSessionMap.isCreated(decryptHandle->decryptId)) {
DecodeSession* session = decodeSessionMap.getValue(decryptHandle->decryptId);
if (NULL != session && session->fileDesc > -1) {
FwdLockFile_detach(session->fileDesc);
@@ -576,7 +578,7 @@ status_t FwdLockEngine::onCloseDecryptSession(int /* uniqueId */,
}
}
- if (NULL != decryptHandle) {
+ if (NULL != decryptHandle.get()) {
if (NULL != decryptHandle->decryptInfo) {
delete decryptHandle->decryptInfo;
decryptHandle->decryptInfo = NULL;
@@ -584,9 +586,7 @@ status_t FwdLockEngine::onCloseDecryptSession(int /* uniqueId */,
decryptHandle->copyControlVector.clear();
decryptHandle->extendedData.clear();
-
- delete decryptHandle;
- decryptHandle = NULL;
+ decryptHandle.clear();
}
LOG_VERBOSE("FwdLockEngine::onCloseDecryptSession Exit");
@@ -594,7 +594,7 @@ status_t FwdLockEngine::onCloseDecryptSession(int /* uniqueId */,
}
status_t FwdLockEngine::onInitializeDecryptUnit(int /* uniqueId */,
- DecryptHandle* /* decryptHandle */,
+ sp<DecryptHandle>& /* decryptHandle */,
int /* decryptUnitId */,
const DrmBuffer* /* headerInfo */) {
ALOGE("FwdLockEngine::onInitializeDecryptUnit is not supported for this DRM scheme");
@@ -603,7 +603,7 @@ status_t FwdLockEngine::onInitializeDecryptUnit(int /* uniqueId */,
status_t FwdLockEngine::onDecrypt(
int /* uniqueId */,
- DecryptHandle* /* decryptHandle */,
+ sp<DecryptHandle>& /* decryptHandle */,
int /* decryptUnitId */,
const DrmBuffer* /* encBuffer */,
DrmBuffer** /* decBuffer */,
@@ -613,7 +613,7 @@ status_t FwdLockEngine::onDecrypt(
}
status_t FwdLockEngine::onDecrypt(int /* uniqueId */,
- DecryptHandle* /* decryptHandle */,
+ sp<DecryptHandle>& /* decryptHandle */,
int /* decryptUnitId */,
const DrmBuffer* /* encBuffer */,
DrmBuffer** /* decBuffer */) {
@@ -622,19 +622,19 @@ status_t FwdLockEngine::onDecrypt(int /* uniqueId */,
}
status_t FwdLockEngine::onFinalizeDecryptUnit(int /* uniqueId */,
- DecryptHandle* /* decryptHandle */,
+ sp<DecryptHandle>& /* decryptHandle */,
int /* decryptUnitId */) {
ALOGE("FwdLockEngine::onFinalizeDecryptUnit is not supported for this DRM scheme");
return DRM_ERROR_UNKNOWN;
}
ssize_t FwdLockEngine::onRead(int /* uniqueId */,
- DecryptHandle* decryptHandle,
+ sp<DecryptHandle>& decryptHandle,
void* buffer,
int numBytes) {
ssize_t size = -1;
- if (NULL != decryptHandle &&
+ if (NULL != decryptHandle.get() &&
decodeSessionMap.isCreated(decryptHandle->decryptId) &&
NULL != buffer &&
numBytes > -1) {
@@ -654,15 +654,15 @@ ssize_t FwdLockEngine::onRead(int /* uniqueId */,
}
#ifdef USE_64BIT_DRM_API
-off64_t FwdLockEngine::onLseek(int /* uniqueId */, DecryptHandle* decryptHandle,
+off64_t FwdLockEngine::onLseek(int /* uniqueId */, sp<DecryptHandle>& decryptHandle,
off64_t offset, int whence) {
#else
-off_t FwdLockEngine::onLseek(int /* uniqueId */, DecryptHandle* decryptHandle,
+off_t FwdLockEngine::onLseek(int /* uniqueId */, sp<DecryptHandle>& decryptHandle,
off_t offset, int whence) {
#endif
off_t offval = -1;
- if (NULL != decryptHandle && decodeSessionMap.isCreated(decryptHandle->decryptId)) {
+ if (NULL != decryptHandle.get() && decodeSessionMap.isCreated(decryptHandle->decryptId)) {
DecodeSession* session = decodeSessionMap.getValue(decryptHandle->decryptId);
if (NULL != session && session->fileDesc > -1) {
offval = FwdLockFile_lseek(session->fileDesc, offset, whence);
@@ -675,13 +675,13 @@ off_t FwdLockEngine::onLseek(int /* uniqueId */, DecryptHandle* decryptHandle,
#ifdef USE_64BIT_DRM_API
ssize_t FwdLockEngine::onPread(int uniqueId,
- DecryptHandle* decryptHandle,
+ sp<DecryptHandle>& decryptHandle,
void* buffer,
ssize_t numBytes,
off64_t offset) {
#else
ssize_t FwdLockEngine::onPread(int uniqueId,
- DecryptHandle* decryptHandle,
+ sp<DecryptHandle>& decryptHandle,
void* buffer,
ssize_t numBytes,
off_t offset) {
@@ -690,7 +690,7 @@ ssize_t FwdLockEngine::onPread(int uniqueId,
DecodeSession* decoderSession = NULL;
- if ((NULL != decryptHandle) &&
+ if ((NULL != decryptHandle.get()) &&
(NULL != (decoderSession = decodeSessionMap.getValue(decryptHandle->decryptId))) &&
(NULL != buffer) &&
(numBytes > -1) &&
diff --git a/drm/libdrmframework/plugins/passthru/include/DrmPassthruPlugIn.h b/drm/libdrmframework/plugins/passthru/include/DrmPassthruPlugIn.h
index 7b66dc7dbd..4ab52729a3 100644
--- a/drm/libdrmframework/plugins/passthru/include/DrmPassthruPlugIn.h
+++ b/drm/libdrmframework/plugins/passthru/include/DrmPassthruPlugIn.h
@@ -53,10 +53,11 @@ protected:
int onCheckRightsStatus(int uniqueId, const String8& path, int action);
- status_t onConsumeRights(int uniqueId, DecryptHandle* decryptHandle, int action, bool reserve);
+ status_t onConsumeRights(int uniqueId, sp<DecryptHandle>& decryptHandle,
+ int action, bool reserve);
status_t onSetPlaybackStatus(
- int uniqueId, DecryptHandle* decryptHandle, int playbackStatus, int64_t position);
+ int uniqueId, sp<DecryptHandle>& decryptHandle, int playbackStatus, int64_t position);
bool onValidateAction(
int uniqueId, const String8& path, int action, const ActionDescription& description);
@@ -74,26 +75,25 @@ protected:
DrmSupportInfo* onGetSupportInfo(int uniqueId);
status_t onOpenDecryptSession(
- int uniqueId, DecryptHandle* decryptHandle, int fd, off64_t offset, off64_t length);
+ int uniqueId, sp<DecryptHandle>& decryptHandle, int fd, off64_t offset,
+ off64_t length);
status_t onOpenDecryptSession(
- int uniqueId, DecryptHandle* decryptHandle, const char* uri);
+ int uniqueId, sp<DecryptHandle>& decryptHandle, const char* uri);
- status_t onCloseDecryptSession(int uniqueId, DecryptHandle* decryptHandle);
+ status_t onCloseDecryptSession(int uniqueId, sp<DecryptHandle>& decryptHandle);
- status_t onInitializeDecryptUnit(int uniqueId, DecryptHandle* decryptHandle,
+ status_t onInitializeDecryptUnit(int uniqueId, sp<DecryptHandle>& decryptHandle,
int decryptUnitId, const DrmBuffer* headerInfo);
- status_t onDecrypt(int uniqueId, DecryptHandle* decryptHandle, int decryptUnitId,
+ status_t onDecrypt(int uniqueId, sp<DecryptHandle>& decryptHandle, int decryptUnitId,
const DrmBuffer* encBuffer, DrmBuffer** decBuffer, DrmBuffer* IV);
- status_t onFinalizeDecryptUnit(int uniqueId, DecryptHandle* decryptHandle, int decryptUnitId);
+ status_t onFinalizeDecryptUnit(int uniqueId, sp<DecryptHandle>& decryptHandle,
+ int decryptUnitId);
- ssize_t onPread(int uniqueId, DecryptHandle* decryptHandle,
+ ssize_t onPread(int uniqueId, sp<DecryptHandle>& decryptHandle,
void* buffer, ssize_t numBytes, off64_t offset);
-
-private:
- DecryptHandle* openDecryptSessionImpl();
};
};
diff --git a/drm/libdrmframework/plugins/passthru/src/DrmPassthruPlugIn.cpp b/drm/libdrmframework/plugins/passthru/src/DrmPassthruPlugIn.cpp
index d7f2d287c0..0fa34786db 100644
--- a/drm/libdrmframework/plugins/passthru/src/DrmPassthruPlugIn.cpp
+++ b/drm/libdrmframework/plugins/passthru/src/DrmPassthruPlugIn.cpp
@@ -183,13 +183,13 @@ int DrmPassthruPlugIn::onCheckRightsStatus(int uniqueId, const String8& /*path*/
}
status_t DrmPassthruPlugIn::onConsumeRights(int uniqueId,
- DecryptHandle* /*decryptHandle*/, int /*action*/, bool /*reserve*/) {
+ sp<DecryptHandle>& /*decryptHandle*/, int /*action*/, bool /*reserve*/) {
ALOGV("DrmPassthruPlugIn::onConsumeRights() : %d", uniqueId);
return DRM_NO_ERROR;
}
status_t DrmPassthruPlugIn::onSetPlaybackStatus(int uniqueId,
- DecryptHandle* /*decryptHandle*/, int /*playbackStatus*/, int64_t /*position*/) {
+ sp<DecryptHandle>& /*decryptHandle*/, int /*playbackStatus*/, int64_t /*position*/) {
ALOGV("DrmPassthruPlugIn::onSetPlaybackStatus() : %d", uniqueId);
return DRM_NO_ERROR;
}
@@ -236,7 +236,8 @@ DrmConvertedStatus* DrmPassthruPlugIn::onCloseConvertSession(int uniqueId, int /
}
status_t DrmPassthruPlugIn::onOpenDecryptSession(
- int uniqueId, DecryptHandle* decryptHandle, int /*fd*/, off64_t /*offset*/, off64_t /*length*/) {
+ int uniqueId, sp<DecryptHandle>& decryptHandle, int /*fd*/, off64_t /*offset*/,
+ off64_t /*length*/) {
ALOGV("DrmPassthruPlugIn::onOpenDecryptSession() : %d", uniqueId);
#ifdef ENABLE_PASSTHRU_DECRYPTION
@@ -246,36 +247,38 @@ status_t DrmPassthruPlugIn::onOpenDecryptSession(
decryptHandle->decryptInfo = NULL;
return DRM_NO_ERROR;
#else
- (void)(decryptHandle); // unused
+ (void)(decryptHandle.get()); // unused
#endif
return DRM_ERROR_CANNOT_HANDLE;
}
status_t DrmPassthruPlugIn::onOpenDecryptSession(
- int /*uniqueId*/, DecryptHandle* /*decryptHandle*/, const char* /*uri*/) {
+ int /*uniqueId*/, sp<DecryptHandle>& /*decryptHandle*/, const char* /*uri*/) {
return DRM_ERROR_CANNOT_HANDLE;
}
-status_t DrmPassthruPlugIn::onCloseDecryptSession(int uniqueId, DecryptHandle* decryptHandle) {
+status_t DrmPassthruPlugIn::onCloseDecryptSession(int uniqueId, sp<DecryptHandle>& decryptHandle) {
ALOGV("DrmPassthruPlugIn::onCloseDecryptSession() : %d", uniqueId);
- if (NULL != decryptHandle) {
+ if (NULL != decryptHandle.get()) {
if (NULL != decryptHandle->decryptInfo) {
delete decryptHandle->decryptInfo; decryptHandle->decryptInfo = NULL;
}
- delete decryptHandle; decryptHandle = NULL;
+ decryptHandle.clear();
}
return DRM_NO_ERROR;
}
-status_t DrmPassthruPlugIn::onInitializeDecryptUnit(int uniqueId, DecryptHandle* /*decryptHandle*/,
- int /*decryptUnitId*/, const DrmBuffer* /*headerInfo*/) {
+status_t DrmPassthruPlugIn::onInitializeDecryptUnit(int uniqueId,
+ sp<DecryptHandle>& /*decryptHandle*/,
+ int /*decryptUnitId*/, const DrmBuffer* /*headerInfo*/) {
ALOGV("DrmPassthruPlugIn::onInitializeDecryptUnit() : %d", uniqueId);
return DRM_NO_ERROR;
}
-status_t DrmPassthruPlugIn::onDecrypt(int uniqueId, DecryptHandle* /*decryptHandle*/,
- int /*decryptUnitId*/, const DrmBuffer* encBuffer, DrmBuffer** decBuffer, DrmBuffer* /*IV*/) {
+status_t DrmPassthruPlugIn::onDecrypt(int uniqueId, sp<DecryptHandle>& /*decryptHandle*/,
+ int /*decryptUnitId*/, const DrmBuffer* encBuffer, DrmBuffer** decBuffer,
+ DrmBuffer* /*IV*/) {
ALOGV("DrmPassthruPlugIn::onDecrypt() : %d", uniqueId);
/**
* As a workaround implementation passthru would copy the given
@@ -296,12 +299,12 @@ status_t DrmPassthruPlugIn::onDecrypt(int uniqueId, DecryptHandle* /*decryptHand
}
status_t DrmPassthruPlugIn::onFinalizeDecryptUnit(
- int uniqueId, DecryptHandle* /*decryptHandle*/, int /*decryptUnitId*/) {
+ int uniqueId, sp<DecryptHandle>& /*decryptHandle*/, int /*decryptUnitId*/) {
ALOGV("DrmPassthruPlugIn::onFinalizeDecryptUnit() : %d", uniqueId);
return DRM_NO_ERROR;
}
-ssize_t DrmPassthruPlugIn::onPread(int uniqueId, DecryptHandle* /*decryptHandle*/,
+ssize_t DrmPassthruPlugIn::onPread(int uniqueId, sp<DecryptHandle>& /*decryptHandle*/,
void* /*buffer*/, ssize_t /*numBytes*/, off64_t /*offset*/) {
ALOGV("DrmPassthruPlugIn::onPread() : %d", uniqueId);
return 0;