diff options
Diffstat (limited to 'include/drm')
-rw-r--r-- | include/drm/DrmManagerClient.h | 21 | ||||
-rw-r--r-- | include/drm/drm_framework_common.h | 10 |
2 files changed, 20 insertions, 11 deletions
diff --git a/include/drm/DrmManagerClient.h b/include/drm/DrmManagerClient.h index 12142bc..5011137 100644 --- a/include/drm/DrmManagerClient.h +++ b/include/drm/DrmManagerClient.h @@ -69,7 +69,7 @@ public: * @return * Handle for the decryption session */ - DecryptHandle* openDecryptSession(int fd, off64_t offset, off64_t length); + sp<DecryptHandle> openDecryptSession(int fd, off64_t offset, off64_t length); /** * Open the decrypt session to decrypt the given protected content @@ -78,7 +78,7 @@ public: * @return * Handle for the decryption session */ - DecryptHandle* openDecryptSession(const char* uri); + sp<DecryptHandle> openDecryptSession(const char* uri); /** * Close the decrypt session for the given handle @@ -87,7 +87,7 @@ public: * @return status_t * Returns DRM_NO_ERROR for success, DRM_ERROR_UNKNOWN for failure */ - status_t closeDecryptSession(DecryptHandle* decryptHandle); + status_t closeDecryptSession(sp<DecryptHandle> &decryptHandle); /** * Consumes the rights for a content. @@ -101,7 +101,7 @@ public: * Returns DRM_NO_ERROR for success, DRM_ERROR_UNKNOWN for failure. * In case license has been expired, DRM_ERROR_LICENSE_EXPIRED will be returned. */ - status_t consumeRights(DecryptHandle* decryptHandle, int action, bool reserve); + status_t consumeRights(sp<DecryptHandle> &decryptHandle, int action, bool reserve); /** * Informs the DRM engine about the playback actions performed on the DRM files. @@ -113,7 +113,8 @@ public: * @return status_t * Returns DRM_NO_ERROR for success, DRM_ERROR_UNKNOWN for failure */ - status_t setPlaybackStatus(DecryptHandle* decryptHandle, int playbackStatus, int64_t position); + status_t setPlaybackStatus( + sp<DecryptHandle> &decryptHandle, int playbackStatus, int64_t position); /** * Initialize decryption for the given unit of the protected content @@ -125,7 +126,7 @@ public: * Returns DRM_NO_ERROR for success, DRM_ERROR_UNKNOWN for failure */ status_t initializeDecryptUnit( - DecryptHandle* decryptHandle, int decryptUnitId, const DrmBuffer* headerInfo); + sp<DecryptHandle> &decryptHandle, int decryptUnitId, const DrmBuffer* headerInfo); /** * Decrypt the protected content buffers for the given unit @@ -144,7 +145,7 @@ public: * DRM_ERROR_DECRYPT for failure. */ status_t decrypt( - DecryptHandle* decryptHandle, int decryptUnitId, + sp<DecryptHandle> &decryptHandle, int decryptUnitId, const DrmBuffer* encBuffer, DrmBuffer** decBuffer, DrmBuffer* IV = NULL); /** @@ -155,7 +156,8 @@ public: * @return status_t * Returns DRM_NO_ERROR for success, DRM_ERROR_UNKNOWN for failure */ - status_t finalizeDecryptUnit(DecryptHandle* decryptHandle, int decryptUnitId); + status_t finalizeDecryptUnit( + sp<DecryptHandle> &decryptHandle, int decryptUnitId); /** * Reads the specified number of bytes from an open DRM file. @@ -167,7 +169,8 @@ public: * * @return Number of bytes read. Returns -1 for Failure. */ - ssize_t pread(DecryptHandle* decryptHandle, void* buffer, ssize_t numBytes, off64_t offset); + ssize_t pread(sp<DecryptHandle> &decryptHandle, + void* buffer, ssize_t numBytes, off64_t offset); /** * Validates whether an action on the DRM content is allowed or not. diff --git a/include/drm/drm_framework_common.h b/include/drm/drm_framework_common.h index 1758cdd..3ad0330 100644 --- a/include/drm/drm_framework_common.h +++ b/include/drm/drm_framework_common.h @@ -19,6 +19,7 @@ #include <utils/Vector.h> #include <utils/KeyedVector.h> +#include <utils/RefBase.h> #include <utils/String8.h> #include <utils/Errors.h> @@ -240,7 +241,7 @@ public: /** * Defines decryption handle */ -class DecryptHandle { +class DecryptHandle : public RefBase { public: /** * Decryption session Handle @@ -285,10 +286,15 @@ public: decryptId(INVALID_VALUE), mimeType(""), decryptApiType(INVALID_VALUE), - status(INVALID_VALUE) { + status(INVALID_VALUE), + decryptInfo(NULL) { } + ~DecryptHandle() { + delete decryptInfo; decryptInfo = NULL; + } + bool operator<(const DecryptHandle& handle) const { return (decryptId < handle.decryptId); } |