Loading drm/common/IDrmManagerService.cpp +48 −0 Original line number Diff line number Diff line Loading @@ -33,6 +33,7 @@ #include "IDrmManagerService.h" #define INVALID_BUFFER_LENGTH (-1) #define MAX_BINDER_TRANSACTION_SIZE ((1*1024*1024)-(4096*2)) using namespace android; Loading @@ -43,6 +44,26 @@ static void writeDecryptHandleToParcelData( data->writeString8(handle->mimeType); data->writeInt32(handle->decryptApiType); data->writeInt32(handle->status); int size = handle->copyControlVector.size(); data->writeInt32(size); for (int i = 0; i < size; i++) { data->writeInt32(handle->copyControlVector.keyAt(i)); data->writeInt32(handle->copyControlVector.valueAt(i)); } size = handle->extendedData.size(); data->writeInt32(size); for (int i = 0; i < size; i++) { data->writeString8(handle->extendedData.keyAt(i)); data->writeString8(handle->extendedData.valueAt(i)); } if (NULL != handle->decryptInfo) { data->writeInt32(handle->decryptInfo->decryptBufferLength); } else { data->writeInt32(INVALID_BUFFER_LENGTH); } } static void readDecryptHandleFromParcelData( Loading @@ -55,12 +76,39 @@ static void readDecryptHandleFromParcelData( handle->mimeType = data.readString8(); handle->decryptApiType = data.readInt32(); handle->status = data.readInt32(); int size = data.readInt32(); for (int i = 0; i < size; i++) { DrmCopyControl key = (DrmCopyControl)data.readInt32(); int value = data.readInt32(); handle->copyControlVector.add(key, value); } size = data.readInt32(); for (int i = 0; i < size; i++) { String8 key = data.readString8(); String8 value = data.readString8(); handle->extendedData.add(key, value); } handle->decryptInfo = NULL; const int bufferLen = data.readInt32(); if (INVALID_BUFFER_LENGTH != bufferLen) { handle->decryptInfo = new DecryptInfo(); handle->decryptInfo->decryptBufferLength = bufferLen; } } static void clearDecryptHandle(sp<DecryptHandle> &handle) { if (handle == NULL) { return; } if (handle->decryptInfo) { delete handle->decryptInfo; handle->decryptInfo = NULL; } handle->copyControlVector.clear(); handle->extendedData.clear(); } int BpDrmManagerService::addUniqueId(bool isNative) { Loading drm/libdrmframework/plugins/forward-lock/FwdLockEngine/src/FwdLockEngine.cpp +8 −0 Original line number Diff line number Diff line Loading @@ -512,6 +512,7 @@ status_t FwdLockEngine::onOpenDecryptSession(int /* uniqueId */, decryptHandle->mimeType = MimeTypeUtil::convertMimeType(contentType); decryptHandle->decryptApiType = DecryptApiType::CONTAINER_BASED; decryptHandle->status = RightsStatus::RIGHTS_VALID; decryptHandle->decryptInfo = NULL; result = DRM_NO_ERROR; } else { if (retVal && NULL != decodeSession) { Loading Loading @@ -578,6 +579,13 @@ status_t FwdLockEngine::onCloseDecryptSession(int /* uniqueId */, } if (NULL != decryptHandle.get()) { if (NULL != decryptHandle->decryptInfo) { delete decryptHandle->decryptInfo; decryptHandle->decryptInfo = NULL; } decryptHandle->copyControlVector.clear(); decryptHandle->extendedData.clear(); decryptHandle.clear(); } Loading drm/libdrmframework/plugins/passthru/src/DrmPassthruPlugIn.cpp +4 −0 Original line number Diff line number Diff line Loading @@ -244,6 +244,7 @@ status_t DrmPassthruPlugIn::onOpenDecryptSession( decryptHandle->mimeType = String8("video/passthru"); decryptHandle->decryptApiType = DecryptApiType::ELEMENTARY_STREAM_BASED; decryptHandle->status = DRM_NO_ERROR; decryptHandle->decryptInfo = NULL; return DRM_NO_ERROR; #else (void)(decryptHandle.get()); // unused Loading @@ -260,6 +261,9 @@ status_t DrmPassthruPlugIn::onOpenDecryptSession( status_t DrmPassthruPlugIn::onCloseDecryptSession(int uniqueId, sp<DecryptHandle>& decryptHandle) { ALOGV("DrmPassthruPlugIn::onCloseDecryptSession() : %d", uniqueId); if (NULL != decryptHandle.get()) { if (NULL != decryptHandle->decryptInfo) { delete decryptHandle->decryptInfo; decryptHandle->decryptInfo = NULL; } decryptHandle.clear(); } return DRM_NO_ERROR; Loading include/drm/drm_framework_common.h +45 −1 Original line number Diff line number Diff line Loading @@ -48,6 +48,17 @@ enum { DRM_NO_ERROR = NO_ERROR }; /** * copy control settings used in DecryptHandle::copyControlVector */ enum DrmCopyControl { DRM_COPY_CONTROL_BASE = 1000, // the key used to set the value for HDCP // if the associated value is 1, then HDCP is required // otherwise, HDCP is not required DRM_COPY_CONTROL_HDCP = DRM_COPY_CONTROL_BASE }; /** * Defines DRM Buffer */ Loading Loading @@ -225,6 +236,20 @@ public: static const int CONTAINER_BASED = 0x02; }; /** * Defines decryption information */ class DecryptInfo { public: /** * size of memory to be allocated to get the decrypted content. */ int decryptBufferLength; /** * reserved for future purpose */ }; /** * Defines decryption handle */ Loading Loading @@ -262,16 +287,35 @@ public: * RIGHTS_VALID, RIGHTS_INVALID, RIGHTS_EXPIRED or RIGHTS_NOT_ACQUIRED */ int status; /** * Information required to decrypt content * e.g. size of memory to be allocated to get the decrypted content. */ DecryptInfo* decryptInfo; /** * Defines a vector for the copy control settings sent from the DRM plugin * to the player */ KeyedVector<DrmCopyControl, int> copyControlVector; /** * Defines a vector for any extra data the DRM plugin wants to send * to the native code */ KeyedVector<String8, String8> extendedData; public: DecryptHandle(): decryptId(INVALID_VALUE), mimeType(""), decryptApiType(INVALID_VALUE), status(INVALID_VALUE) { status(INVALID_VALUE), decryptInfo(NULL) { } ~DecryptHandle() { delete decryptInfo; decryptInfo = NULL; } }; Loading Loading
drm/common/IDrmManagerService.cpp +48 −0 Original line number Diff line number Diff line Loading @@ -33,6 +33,7 @@ #include "IDrmManagerService.h" #define INVALID_BUFFER_LENGTH (-1) #define MAX_BINDER_TRANSACTION_SIZE ((1*1024*1024)-(4096*2)) using namespace android; Loading @@ -43,6 +44,26 @@ static void writeDecryptHandleToParcelData( data->writeString8(handle->mimeType); data->writeInt32(handle->decryptApiType); data->writeInt32(handle->status); int size = handle->copyControlVector.size(); data->writeInt32(size); for (int i = 0; i < size; i++) { data->writeInt32(handle->copyControlVector.keyAt(i)); data->writeInt32(handle->copyControlVector.valueAt(i)); } size = handle->extendedData.size(); data->writeInt32(size); for (int i = 0; i < size; i++) { data->writeString8(handle->extendedData.keyAt(i)); data->writeString8(handle->extendedData.valueAt(i)); } if (NULL != handle->decryptInfo) { data->writeInt32(handle->decryptInfo->decryptBufferLength); } else { data->writeInt32(INVALID_BUFFER_LENGTH); } } static void readDecryptHandleFromParcelData( Loading @@ -55,12 +76,39 @@ static void readDecryptHandleFromParcelData( handle->mimeType = data.readString8(); handle->decryptApiType = data.readInt32(); handle->status = data.readInt32(); int size = data.readInt32(); for (int i = 0; i < size; i++) { DrmCopyControl key = (DrmCopyControl)data.readInt32(); int value = data.readInt32(); handle->copyControlVector.add(key, value); } size = data.readInt32(); for (int i = 0; i < size; i++) { String8 key = data.readString8(); String8 value = data.readString8(); handle->extendedData.add(key, value); } handle->decryptInfo = NULL; const int bufferLen = data.readInt32(); if (INVALID_BUFFER_LENGTH != bufferLen) { handle->decryptInfo = new DecryptInfo(); handle->decryptInfo->decryptBufferLength = bufferLen; } } static void clearDecryptHandle(sp<DecryptHandle> &handle) { if (handle == NULL) { return; } if (handle->decryptInfo) { delete handle->decryptInfo; handle->decryptInfo = NULL; } handle->copyControlVector.clear(); handle->extendedData.clear(); } int BpDrmManagerService::addUniqueId(bool isNative) { Loading
drm/libdrmframework/plugins/forward-lock/FwdLockEngine/src/FwdLockEngine.cpp +8 −0 Original line number Diff line number Diff line Loading @@ -512,6 +512,7 @@ status_t FwdLockEngine::onOpenDecryptSession(int /* uniqueId */, decryptHandle->mimeType = MimeTypeUtil::convertMimeType(contentType); decryptHandle->decryptApiType = DecryptApiType::CONTAINER_BASED; decryptHandle->status = RightsStatus::RIGHTS_VALID; decryptHandle->decryptInfo = NULL; result = DRM_NO_ERROR; } else { if (retVal && NULL != decodeSession) { Loading Loading @@ -578,6 +579,13 @@ status_t FwdLockEngine::onCloseDecryptSession(int /* uniqueId */, } if (NULL != decryptHandle.get()) { if (NULL != decryptHandle->decryptInfo) { delete decryptHandle->decryptInfo; decryptHandle->decryptInfo = NULL; } decryptHandle->copyControlVector.clear(); decryptHandle->extendedData.clear(); decryptHandle.clear(); } Loading
drm/libdrmframework/plugins/passthru/src/DrmPassthruPlugIn.cpp +4 −0 Original line number Diff line number Diff line Loading @@ -244,6 +244,7 @@ status_t DrmPassthruPlugIn::onOpenDecryptSession( decryptHandle->mimeType = String8("video/passthru"); decryptHandle->decryptApiType = DecryptApiType::ELEMENTARY_STREAM_BASED; decryptHandle->status = DRM_NO_ERROR; decryptHandle->decryptInfo = NULL; return DRM_NO_ERROR; #else (void)(decryptHandle.get()); // unused Loading @@ -260,6 +261,9 @@ status_t DrmPassthruPlugIn::onOpenDecryptSession( status_t DrmPassthruPlugIn::onCloseDecryptSession(int uniqueId, sp<DecryptHandle>& decryptHandle) { ALOGV("DrmPassthruPlugIn::onCloseDecryptSession() : %d", uniqueId); if (NULL != decryptHandle.get()) { if (NULL != decryptHandle->decryptInfo) { delete decryptHandle->decryptInfo; decryptHandle->decryptInfo = NULL; } decryptHandle.clear(); } return DRM_NO_ERROR; Loading
include/drm/drm_framework_common.h +45 −1 Original line number Diff line number Diff line Loading @@ -48,6 +48,17 @@ enum { DRM_NO_ERROR = NO_ERROR }; /** * copy control settings used in DecryptHandle::copyControlVector */ enum DrmCopyControl { DRM_COPY_CONTROL_BASE = 1000, // the key used to set the value for HDCP // if the associated value is 1, then HDCP is required // otherwise, HDCP is not required DRM_COPY_CONTROL_HDCP = DRM_COPY_CONTROL_BASE }; /** * Defines DRM Buffer */ Loading Loading @@ -225,6 +236,20 @@ public: static const int CONTAINER_BASED = 0x02; }; /** * Defines decryption information */ class DecryptInfo { public: /** * size of memory to be allocated to get the decrypted content. */ int decryptBufferLength; /** * reserved for future purpose */ }; /** * Defines decryption handle */ Loading Loading @@ -262,16 +287,35 @@ public: * RIGHTS_VALID, RIGHTS_INVALID, RIGHTS_EXPIRED or RIGHTS_NOT_ACQUIRED */ int status; /** * Information required to decrypt content * e.g. size of memory to be allocated to get the decrypted content. */ DecryptInfo* decryptInfo; /** * Defines a vector for the copy control settings sent from the DRM plugin * to the player */ KeyedVector<DrmCopyControl, int> copyControlVector; /** * Defines a vector for any extra data the DRM plugin wants to send * to the native code */ KeyedVector<String8, String8> extendedData; public: DecryptHandle(): decryptId(INVALID_VALUE), mimeType(""), decryptApiType(INVALID_VALUE), status(INVALID_VALUE) { status(INVALID_VALUE), decryptInfo(NULL) { } ~DecryptHandle() { delete decryptInfo; decryptInfo = NULL; } }; Loading