diff options
author | Kei Takahashi <KeiA.Takahashi@jp.sony.com> | 2012-01-18 17:10:19 +0900 |
---|---|---|
committer | Jean-Baptiste Queru <jbq@google.com> | 2012-05-23 14:44:06 -0700 |
commit | cba7b32d8f2c47632313f54118ed3733b4b02cc8 (patch) | |
tree | b24101645accdc9067e7970ef22f3d934bda8edf /drm/drmserver | |
parent | cf0bf78c28cf25c30c42c784c1dc5bc094e6035d (diff) | |
download | frameworks_av-cba7b32d8f2c47632313f54118ed3733b4b02cc8.zip frameworks_av-cba7b32d8f2c47632313f54118ed3733b4b02cc8.tar.gz frameworks_av-cba7b32d8f2c47632313f54118ed3733b4b02cc8.tar.bz2 |
Add a new API on DRM Framework for streaming
In case of DRM streaming, decrypt session can start just after
receiving the header, and it doesn't need to wait for the entire
content. However, current API of DRM framework only accepts file
handle or URI. With this new API, DRM session can start
without waiting for the entire content.
Changes are made by SEMC and Sony.
Change-Id: I74375fe127df636067f1c300ea91654ba3d1aa3c
Diffstat (limited to 'drm/drmserver')
-rw-r--r-- | drm/drmserver/DrmManager.cpp | 30 | ||||
-rw-r--r-- | drm/drmserver/DrmManagerService.cpp | 10 |
2 files changed, 40 insertions, 0 deletions
diff --git a/drm/drmserver/DrmManager.cpp b/drm/drmserver/DrmManager.cpp index 999295a..737edab 100644 --- a/drm/drmserver/DrmManager.cpp +++ b/drm/drmserver/DrmManager.cpp @@ -484,6 +484,36 @@ DecryptHandle* DrmManager::openDecryptSession( return handle; } +DecryptHandle* DrmManager::openDecryptSession( + int uniqueId, const DrmBuffer& buf, const String8& mimeType) { + Mutex::Autolock _l(mDecryptLock); + status_t result = DRM_ERROR_CANNOT_HANDLE; + Vector<String8> plugInIdList = mPlugInManager.getPlugInIdList(); + + DecryptHandle* handle = new DecryptHandle(); + if (NULL != handle) { + handle->decryptId = mDecryptSessionId + 1; + + for (size_t index = 0; index < plugInIdList.size(); index++) { + String8 plugInId = plugInIdList.itemAt(index); + IDrmEngine& rDrmEngine = mPlugInManager.getPlugIn(plugInId); + result = rDrmEngine.openDecryptSession(uniqueId, handle, buf, mimeType); + + if (DRM_NO_ERROR == result) { + ++mDecryptSessionId; + mDecryptSessionMap.add(mDecryptSessionId, &rDrmEngine); + break; + } + } + } + if (DRM_NO_ERROR != result) { + delete handle; + handle = NULL; + ALOGV("DrmManager::openDecryptSession: no capable plug-in found"); + } + return handle; +} + status_t DrmManager::closeDecryptSession(int uniqueId, DecryptHandle* decryptHandle) { Mutex::Autolock _l(mDecryptLock); status_t result = DRM_ERROR_UNKNOWN; diff --git a/drm/drmserver/DrmManagerService.cpp b/drm/drmserver/DrmManagerService.cpp index 746f506..25a4e7b 100644 --- a/drm/drmserver/DrmManagerService.cpp +++ b/drm/drmserver/DrmManagerService.cpp @@ -219,6 +219,16 @@ DecryptHandle* DrmManagerService::openDecryptSession( return NULL; } +DecryptHandle* DrmManagerService::openDecryptSession( + int uniqueId, const DrmBuffer& buf, const String8& mimeType) { + ALOGV("Entering DrmManagerService::openDecryptSession for streaming"); + if (isProtectedCallAllowed()) { + return mDrmManager->openDecryptSession(uniqueId, buf, mimeType); + } + + return NULL; +} + status_t DrmManagerService::closeDecryptSession(int uniqueId, DecryptHandle* decryptHandle) { ALOGV("Entering closeDecryptSession"); if (!isProtectedCallAllowed()) { |