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/common | |
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/common')
-rw-r--r-- | drm/common/DrmEngineBase.cpp | 5 | ||||
-rw-r--r-- | drm/common/IDrmManagerService.cpp | 51 |
2 files changed, 56 insertions, 0 deletions
diff --git a/drm/common/DrmEngineBase.cpp b/drm/common/DrmEngineBase.cpp index 1c345a2..a060f38 100644 --- a/drm/common/DrmEngineBase.cpp +++ b/drm/common/DrmEngineBase.cpp @@ -139,6 +139,11 @@ status_t DrmEngineBase::openDecryptSession( return onOpenDecryptSession(uniqueId, decryptHandle, uri, mime); } +status_t DrmEngineBase::openDecryptSession(int uniqueId, DecryptHandle* decryptHandle, + const DrmBuffer& buf, const String8& mimeType) { + return onOpenDecryptSession(uniqueId, decryptHandle, buf, mimeType); +} + status_t DrmEngineBase::closeDecryptSession(int uniqueId, DecryptHandle* decryptHandle) { return onCloseDecryptSession(uniqueId, decryptHandle); } diff --git a/drm/common/IDrmManagerService.cpp b/drm/common/IDrmManagerService.cpp index 43f64f2..ccff257 100644 --- a/drm/common/IDrmManagerService.cpp +++ b/drm/common/IDrmManagerService.cpp @@ -652,6 +652,33 @@ DecryptHandle* BpDrmManagerService::openDecryptSession( return handle; } +DecryptHandle* BpDrmManagerService::openDecryptSession( + int uniqueId, const DrmBuffer& buf, const String8& mimeType) { + ALOGV("Entering BpDrmManagerService::openDecryptSession"); + Parcel data, reply; + + data.writeInterfaceToken(IDrmManagerService::getInterfaceDescriptor()); + data.writeInt32(uniqueId); + if (buf.data != NULL && buf.length > 0) { + data.writeInt32(buf.length); + data.write(buf.data, buf.length); + } else { + data.writeInt32(0); + } + data.writeString8(mimeType); + + remote()->transact(OPEN_DECRYPT_SESSION_FOR_STREAMING, data, &reply); + + DecryptHandle* handle = NULL; + if (0 != reply.dataAvail()) { + handle = new DecryptHandle(); + readDecryptHandleFromParcelData(handle, reply); + } else { + ALOGV("no decryptHandle is generated in service side"); + } + return handle; +} + status_t BpDrmManagerService::closeDecryptSession(int uniqueId, DecryptHandle* decryptHandle) { ALOGV("closeDecryptSession"); Parcel data, reply; @@ -1312,6 +1339,30 @@ status_t BnDrmManagerService::onTransact( return DRM_NO_ERROR; } + case OPEN_DECRYPT_SESSION_FOR_STREAMING: + { + ALOGV("BnDrmManagerService::onTransact :OPEN_DECRYPT_SESSION_FOR_STREAMING"); + CHECK_INTERFACE(IDrmManagerService, data, reply); + + const int uniqueId = data.readInt32(); + const int bufferSize = data.readInt32(); + DrmBuffer buf((bufferSize > 0) ? (char *)data.readInplace(bufferSize) : NULL, + bufferSize); + const String8 mimeType(data.readString8()); + + DecryptHandle* handle = openDecryptSession(uniqueId, buf, mimeType); + + if (handle != NULL) { + writeDecryptHandleToParcelData(handle, reply); + clearDecryptHandle(handle); + delete handle; + handle = NULL; + } else { + ALOGV("NULL decryptHandle is returned"); + } + return DRM_NO_ERROR; + } + case CLOSE_DECRYPT_SESSION: { ALOGV("BnDrmManagerService::onTransact :CLOSE_DECRYPT_SESSION"); |