diff options
author | Takeshi Aimi <aimitakeshi@gmail.com> | 2010-09-20 23:40:41 +0900 |
---|---|---|
committer | Takeshi Aimi <aimitakeshi@gmail.com> | 2010-10-04 22:14:53 +0900 |
commit | 2272ee27d9022d173b6eab45c409b3c3f57f30ec (patch) | |
tree | 42fd86597781bdf6b3795907ec1d086b0b549a5c /drm/libdrmframework/plugins | |
parent | 0335b70c6cdbe96650d4bed817f9233cd8db1c6d (diff) | |
download | frameworks_av-2272ee27d9022d173b6eab45c409b3c3f57f30ec.zip frameworks_av-2272ee27d9022d173b6eab45c409b3c3f57f30ec.tar.gz frameworks_av-2272ee27d9022d173b6eab45c409b3c3f57f30ec.tar.bz2 |
Update of DRM framework.
- Change "void" type of return value to "int" for returning status.
- Add some of overloaded Java APIs which accept database Uri as input.
- Add asynchronous APIs
- Add OnEventListener and OnErrorListener for asynchronous APIs
- Disable debug log
- Change decrypt() API to accept an optional buffer needed by some of DRM schemes
Changes are incorporated by Sony Corporation.
Change-Id: I414a165e22cc79be6ea7cd28041788aa2b6b8f7c
Diffstat (limited to 'drm/libdrmframework/plugins')
4 files changed, 101 insertions, 54 deletions
diff --git a/drm/libdrmframework/plugins/common/include/DrmEngineBase.h b/drm/libdrmframework/plugins/common/include/DrmEngineBase.h index 667958a..b355534 100644 --- a/drm/libdrmframework/plugins/common/include/DrmEngineBase.h +++ b/drm/libdrmframework/plugins/common/include/DrmEngineBase.h @@ -46,7 +46,7 @@ public: DrmInfoStatus* processDrmInfo(int uniqueId, const DrmInfo* drmInfo); - void saveRights(int uniqueId, const DrmRights& drmRights, + status_t saveRights(int uniqueId, const DrmRights& drmRights, const String8& rightsPath, const String8& contentPath); DrmInfo* acquireDrmInfo(int uniqueId, const DrmInfoRequest* drmInfoRequest); @@ -57,19 +57,19 @@ public: int checkRightsStatus(int uniqueId, const String8& path, int action); - void consumeRights(int uniqueId, DecryptHandle* decryptHandle, int action, bool reserve); + status_t consumeRights(int uniqueId, DecryptHandle* decryptHandle, int action, bool reserve); - void setPlaybackStatus( + status_t setPlaybackStatus( int uniqueId, DecryptHandle* decryptHandle, int playbackStatus, int position); bool validateAction( int uniqueId, const String8& path, int action, const ActionDescription& description); - void removeRights(int uniqueId, const String8& path); + status_t removeRights(int uniqueId, const String8& path); - void removeAllRights(int uniqueId); + status_t removeAllRights(int uniqueId); - void openConvertSession(int uniqueId, int convertId); + status_t openConvertSession(int uniqueId, int convertId); DrmConvertedStatus* convertData(int uniqueId, int convertId, const DrmBuffer* inputData); @@ -80,15 +80,15 @@ public: status_t openDecryptSession( int uniqueId, DecryptHandle* decryptHandle, int fd, int offset, int length); - void closeDecryptSession(int uniqueId, DecryptHandle* decryptHandle); + status_t closeDecryptSession(int uniqueId, DecryptHandle* decryptHandle); - void initializeDecryptUnit(int uniqueId, DecryptHandle* decryptHandle, + status_t initializeDecryptUnit(int uniqueId, DecryptHandle* decryptHandle, int decryptUnitId, const DrmBuffer* headerInfo); - status_t decrypt(int uniqueId, DecryptHandle* decryptHandle, - int decryptUnitId, const DrmBuffer* encBuffer, DrmBuffer** decBuffer); + status_t decrypt(int uniqueId, DecryptHandle* decryptHandle, int decryptUnitId, + const DrmBuffer* encBuffer, DrmBuffer** decBuffer, DrmBuffer* IV); - void finalizeDecryptUnit(int uniqueId, DecryptHandle* decryptHandle, int decryptUnitId); + status_t finalizeDecryptUnit(int uniqueId, DecryptHandle* decryptHandle, int decryptUnitId); ssize_t pread(int uniqueId, DecryptHandle* decryptHandle, void* buffer, ssize_t numBytes, off_t offset); @@ -172,8 +172,10 @@ protected: * @param[in] drmRights DrmRights to be saved * @param[in] rightsPath File path where rights to be saved * @param[in] contentPath File path where content was saved + * @return status_t + * Returns DRM_NO_ERROR for success, DRM_ERROR_UNKNOWN for failure */ - virtual void onSaveRights(int uniqueId, const DrmRights& drmRights, + virtual status_t onSaveRights(int uniqueId, const DrmRights& drmRights, const String8& rightspath, const String8& contentPath) = 0; /** @@ -231,8 +233,10 @@ protected: * @param[in] decryptHandle Handle for the decryption session * @param[in] action Action to perform. (Action::DEFAULT, Action::PLAY, etc) * @param[in] reserve True if the rights should be reserved. + * @return status_t + * Returns DRM_NO_ERROR for success, DRM_ERROR_UNKNOWN for failure */ - virtual void onConsumeRights(int uniqueId, DecryptHandle* decryptHandle, + virtual status_t onConsumeRights(int uniqueId, DecryptHandle* decryptHandle, int action, bool reserve) = 0; /** @@ -243,8 +247,10 @@ protected: * @param[in] playbackStatus Playback action (Playback::START, Playback::STOP, Playback::PAUSE) * @param[in] position Position in the file (in milliseconds) where the start occurs. * Only valid together with Playback::START. + * @return status_t + * Returns DRM_NO_ERROR for success, DRM_ERROR_UNKNOWN for failure */ - virtual void onSetPlaybackStatus( + virtual status_t onSetPlaybackStatus( int uniqueId, DecryptHandle* decryptHandle, int playbackStatus, int position) = 0; /** @@ -264,16 +270,20 @@ protected: * * @param[in] uniqueId Unique identifier for a session * @param[in] path Path of the protected content + * @return status_t + * Returns DRM_NO_ERROR for success, DRM_ERROR_UNKNOWN for failure */ - virtual void onRemoveRights(int uniqueId, const String8& path) = 0; + virtual status_t onRemoveRights(int uniqueId, const String8& path) = 0; /** * Removes all the rights information of each plug-in associated with * DRM framework. Will be used in master reset * * @param[in] uniqueId Unique identifier for a session + * @return status_t + * Returns DRM_NO_ERROR for success, DRM_ERROR_UNKNOWN for failure */ - virtual void onRemoveAllRights(int uniqueId) = 0; + virtual status_t onRemoveAllRights(int uniqueId) = 0; /** * This API is for Forward Lock based DRM scheme. @@ -283,8 +293,10 @@ protected: * * @param[in] uniqueId Unique identifier for a session * @param[in] convertId Handle for the convert session + * @return status_t + * Returns DRM_NO_ERROR for success, DRM_ERROR_UNKNOWN for failure */ - virtual void onOpenConvertSession(int uniqueId, int convertId) = 0; + virtual status_t onOpenConvertSession(int uniqueId, int convertId) = 0; /** * Accepts and converts the input data which is part of DRM file. @@ -347,8 +359,10 @@ protected: * * @param[in] uniqueId Unique identifier for a session * @param[in] decryptHandle Handle for the decryption session + * @return status_t + * Returns DRM_NO_ERROR for success, DRM_ERROR_UNKNOWN for failure */ - virtual void onCloseDecryptSession(int uniqueId, DecryptHandle* decryptHandle) = 0; + virtual status_t onCloseDecryptSession(int uniqueId, DecryptHandle* decryptHandle) = 0; /** * Initialize decryption for the given unit of the protected content @@ -357,8 +371,10 @@ protected: * @param[in] decryptId Handle for the decryption session * @param[in] decryptUnitId ID Specifies decryption unit, such as track ID * @param[in] headerInfo Information for initializing decryption of this decrypUnit + * @return status_t + * Returns DRM_NO_ERROR for success, DRM_ERROR_UNKNOWN for failure */ - virtual void onInitializeDecryptUnit(int uniqueId, DecryptHandle* decryptHandle, + virtual status_t onInitializeDecryptUnit(int uniqueId, DecryptHandle* decryptHandle, int decryptUnitId, const DrmBuffer* headerInfo) = 0; /** @@ -371,14 +387,15 @@ protected: * @param[in] decryptUnitId ID Specifies decryption unit, such as track ID * @param[in] encBuffer Encrypted data block * @param[out] decBuffer Decrypted data block + * @param[in] IV Optional buffer * @return status_t * Returns the error code for this API * DRM_NO_ERROR for success, and one of DRM_ERROR_UNKNOWN, DRM_ERROR_LICENSE_EXPIRED * DRM_ERROR_SESSION_NOT_OPENED, DRM_ERROR_DECRYPT_UNIT_NOT_INITIALIZED, * DRM_ERROR_DECRYPT for failure. */ - virtual status_t onDecrypt(int uniqueId, DecryptHandle* decryptHandle, - int decryptUnitId, const DrmBuffer* encBuffer, DrmBuffer** decBuffer) = 0; + virtual status_t onDecrypt(int uniqueId, DecryptHandle* decryptHandle, int decryptUnitId, + const DrmBuffer* encBuffer, DrmBuffer** decBuffer, DrmBuffer* IV) = 0; /** * Finalize decryption for the given unit of the protected content @@ -386,8 +403,10 @@ protected: * @param[in] uniqueId Unique identifier for a session * @param[in] decryptHandle Handle for the decryption session * @param[in] decryptUnitId ID Specifies decryption unit, such as track ID + * @return status_t + * Returns DRM_NO_ERROR for success, DRM_ERROR_UNKNOWN for failure */ - virtual void onFinalizeDecryptUnit( + virtual status_t onFinalizeDecryptUnit( int uniqueId, DecryptHandle* decryptHandle, int decryptUnitId) = 0; /** diff --git a/drm/libdrmframework/plugins/common/include/IDrmEngine.h b/drm/libdrmframework/plugins/common/include/IDrmEngine.h index 0d52f66..b711500 100644 --- a/drm/libdrmframework/plugins/common/include/IDrmEngine.h +++ b/drm/libdrmframework/plugins/common/include/IDrmEngine.h @@ -143,8 +143,10 @@ public: * @param[in] drmRights DrmRights to be saved * @param[in] rightsPath File path where rights to be saved * @param[in] contentPath File path where content was saved + * @return status_t + * Returns DRM_NO_ERROR for success, DRM_ERROR_UNKNOWN for failure */ - virtual void saveRights(int uniqueId, const DrmRights& drmRights, + virtual status_t saveRights(int uniqueId, const DrmRights& drmRights, const String8& rightsPath, const String8& contentPath) = 0; /** @@ -191,8 +193,10 @@ public: * @param[in] decryptHandle Handle for the decryption session * @param[in] action Action to perform. (Action::DEFAULT, Action::PLAY, etc) * @param[in] reserve True if the rights should be reserved. + * @return status_t + * Returns DRM_NO_ERROR for success, DRM_ERROR_UNKNOWN for failure */ - virtual void consumeRights( + virtual status_t consumeRights( int uniqueId, DecryptHandle* decryptHandle, int action, bool reserve) = 0; /** @@ -203,8 +207,10 @@ public: * @param[in] playbackStatus Playback action (Playback::START, Playback::STOP, Playback::PAUSE) * @param[in] position Position in the file (in milliseconds) where the start occurs. * Only valid together with Playback::START. + * @return status_t + * Returns DRM_NO_ERROR for success, DRM_ERROR_UNKNOWN for failure */ - virtual void setPlaybackStatus(int uniqueId, DecryptHandle* decryptHandle, + virtual status_t setPlaybackStatus(int uniqueId, DecryptHandle* decryptHandle, int playbackStatus, int position) = 0; /** @@ -224,16 +230,20 @@ public: * * @param[in] uniqueId Unique identifier for a session * @param[in] path Path of the protected content + * @return status_t + * Returns DRM_NO_ERROR for success, DRM_ERROR_UNKNOWN for failure */ - virtual void removeRights(int uniqueId, const String8& path) = 0; + virtual status_t removeRights(int uniqueId, const String8& path) = 0; /** * Removes all the rights information of each plug-in associated with * DRM framework. Will be used in master reset * * @param[in] uniqueId Unique identifier for a session + * @return status_t + * Returns DRM_NO_ERROR for success, DRM_ERROR_UNKNOWN for failure */ - virtual void removeAllRights(int uniqueId) = 0; + virtual status_t removeAllRights(int uniqueId) = 0; /** * This API is for Forward Lock based DRM scheme. @@ -243,8 +253,10 @@ public: * * @param[in] uniqueId Unique identifier for a session * @param[in] convertId Handle for the convert session + * @return status_t + * Returns DRM_NO_ERROR for success, DRM_ERROR_UNKNOWN for failure */ - virtual void openConvertSession(int uniqueId, int convertId) = 0; + virtual status_t openConvertSession(int uniqueId, int convertId) = 0; /** * Accepts and converts the input data which is part of DRM file. @@ -307,8 +319,10 @@ public: * * @param[in] uniqueId Unique identifier for a session * @param[in] decryptHandle Handle for the decryption session + * @return status_t + * Returns DRM_NO_ERROR for success, DRM_ERROR_UNKNOWN for failure */ - virtual void closeDecryptSession(int uniqueId, DecryptHandle* decryptHandle) = 0; + virtual status_t closeDecryptSession(int uniqueId, DecryptHandle* decryptHandle) = 0; /** * Initialize decryption for the given unit of the protected content @@ -317,8 +331,10 @@ public: * @param[in] decryptHandle Handle for the decryption session * @param[in] decryptUnitId ID which specifies decryption unit, such as track ID * @param[in] headerInfo Information for initializing decryption of this decrypUnit + * @return status_t + * Returns DRM_NO_ERROR for success, DRM_ERROR_UNKNOWN for failure */ - virtual void initializeDecryptUnit(int uniqueId, DecryptHandle* decryptHandle, + virtual status_t initializeDecryptUnit(int uniqueId, DecryptHandle* decryptHandle, int decryptUnitId, const DrmBuffer* headerInfo) = 0; /** @@ -331,14 +347,15 @@ public: * @param[in] decryptUnitId ID which specifies decryption unit, such as track ID * @param[in] encBuffer Encrypted data block * @param[out] decBuffer Decrypted data block + * @param[in] IV Optional buffer * @return status_t * Returns the error code for this API * DRM_NO_ERROR for success, and one of DRM_ERROR_UNKNOWN, DRM_ERROR_LICENSE_EXPIRED * DRM_ERROR_SESSION_NOT_OPENED, DRM_ERROR_DECRYPT_UNIT_NOT_INITIALIZED, * DRM_ERROR_DECRYPT for failure. */ - virtual status_t decrypt(int uniqueId, DecryptHandle* decryptHandle, - int decryptUnitId, const DrmBuffer* encBuffer, DrmBuffer** decBuffer) = 0; + virtual status_t decrypt(int uniqueId, DecryptHandle* decryptHandle, int decryptUnitId, + const DrmBuffer* encBuffer, DrmBuffer** decBuffer, DrmBuffer* IV) = 0; /** * Finalize decryption for the given unit of the protected content @@ -346,8 +363,10 @@ public: * @param[in] uniqueId Unique identifier for a session * @param[in] decryptHandle Handle for the decryption session * @param[in] decryptUnitId ID which specifies decryption unit, such as track ID + * @return status_t + * Returns DRM_NO_ERROR for success, DRM_ERROR_UNKNOWN for failure */ - virtual void finalizeDecryptUnit( + virtual status_t finalizeDecryptUnit( int uniqueId, DecryptHandle* decryptHandle, int decryptUnitId) = 0; /** diff --git a/drm/libdrmframework/plugins/passthru/include/DrmPassthruPlugIn.h b/drm/libdrmframework/plugins/passthru/include/DrmPassthruPlugIn.h index d2c7852..eed1628 100644 --- a/drm/libdrmframework/plugins/passthru/include/DrmPassthruPlugIn.h +++ b/drm/libdrmframework/plugins/passthru/include/DrmPassthruPlugIn.h @@ -40,7 +40,7 @@ protected: DrmInfoStatus* onProcessDrmInfo(int uniqueId, const DrmInfo* drmInfo); - void onSaveRights(int uniqueId, const DrmRights& drmRights, + status_t onSaveRights(int uniqueId, const DrmRights& drmRights, const String8& rightsPath, const String8& contentPath); DrmInfo* onAcquireDrmInfo(int uniqueId, const DrmInfoRequest* drmInfoRequest); @@ -51,19 +51,19 @@ protected: int onCheckRightsStatus(int uniqueId, const String8& path, int action); - void onConsumeRights(int uniqueId, DecryptHandle* decryptHandle, int action, bool reserve); + status_t onConsumeRights(int uniqueId, DecryptHandle* decryptHandle, int action, bool reserve); - void onSetPlaybackStatus( + status_t onSetPlaybackStatus( int uniqueId, DecryptHandle* decryptHandle, int playbackStatus, int position); bool onValidateAction( int uniqueId, const String8& path, int action, const ActionDescription& description); - void onRemoveRights(int uniqueId, const String8& path); + status_t onRemoveRights(int uniqueId, const String8& path); - void onRemoveAllRights(int uniqueId); + status_t onRemoveAllRights(int uniqueId); - void onOpenConvertSession(int uniqueId, int convertId); + status_t onOpenConvertSession(int uniqueId, int convertId); DrmConvertedStatus* onConvertData(int uniqueId, int convertId, const DrmBuffer* inputData); @@ -74,15 +74,15 @@ protected: status_t onOpenDecryptSession( int uniqueId, DecryptHandle* decryptHandle, int fd, int offset, int length); - void onCloseDecryptSession(int uniqueId, DecryptHandle* decryptHandle); + status_t onCloseDecryptSession(int uniqueId, DecryptHandle* decryptHandle); - void onInitializeDecryptUnit(int uniqueId, DecryptHandle* decryptHandle, + status_t onInitializeDecryptUnit(int uniqueId, DecryptHandle* decryptHandle, int decryptUnitId, const DrmBuffer* headerInfo); - status_t onDecrypt(int uniqueId, DecryptHandle* decryptHandle, - int decryptUnitId, const DrmBuffer* encBuffer, DrmBuffer** decBuffer); + status_t onDecrypt(int uniqueId, DecryptHandle* decryptHandle, int decryptUnitId, + const DrmBuffer* encBuffer, DrmBuffer** decBuffer, DrmBuffer* IV); - void onFinalizeDecryptUnit(int uniqueId, DecryptHandle* decryptHandle, int decryptUnitId); + status_t onFinalizeDecryptUnit(int uniqueId, DecryptHandle* decryptHandle, int decryptUnitId); ssize_t onPread(int uniqueId, DecryptHandle* decryptHandle, void* buffer, ssize_t numBytes, off_t offset); diff --git a/drm/libdrmframework/plugins/passthru/src/DrmPassthruPlugIn.cpp b/drm/libdrmframework/plugins/passthru/src/DrmPassthruPlugIn.cpp index 2655d0b..4c7714d 100644 --- a/drm/libdrmframework/plugins/passthru/src/DrmPassthruPlugIn.cpp +++ b/drm/libdrmframework/plugins/passthru/src/DrmPassthruPlugIn.cpp @@ -129,9 +129,10 @@ DrmSupportInfo* DrmPassthruPlugIn::onGetSupportInfo(int uniqueId) { return drmSupportInfo; } -void DrmPassthruPlugIn::onSaveRights(int uniqueId, const DrmRights& drmRights, +status_t DrmPassthruPlugIn::onSaveRights(int uniqueId, const DrmRights& drmRights, const String8& rightsPath, const String8& contentPath) { LOGD("DrmPassthruPlugIn::onSaveRights : %d", uniqueId); + return DRM_NO_ERROR; } DrmInfo* DrmPassthruPlugIn::onAcquireDrmInfo(int uniqueId, const DrmInfoRequest* drmInfoRequest) { @@ -174,14 +175,16 @@ int DrmPassthruPlugIn::onCheckRightsStatus(int uniqueId, const String8& path, in return rightsStatus; } -void DrmPassthruPlugIn::onConsumeRights(int uniqueId, DecryptHandle* decryptHandle, +status_t DrmPassthruPlugIn::onConsumeRights(int uniqueId, DecryptHandle* decryptHandle, int action, bool reserve) { LOGD("DrmPassthruPlugIn::onConsumeRights() : %d", uniqueId); + return DRM_NO_ERROR; } -void DrmPassthruPlugIn::onSetPlaybackStatus(int uniqueId, DecryptHandle* decryptHandle, +status_t DrmPassthruPlugIn::onSetPlaybackStatus(int uniqueId, DecryptHandle* decryptHandle, int playbackStatus, int position) { LOGD("DrmPassthruPlugIn::onSetPlaybackStatus() : %d", uniqueId); + return DRM_NO_ERROR; } bool DrmPassthruPlugIn::onValidateAction(int uniqueId, const String8& path, @@ -190,16 +193,19 @@ bool DrmPassthruPlugIn::onValidateAction(int uniqueId, const String8& path, return true; } -void DrmPassthruPlugIn::onRemoveRights(int uniqueId, const String8& path) { +status_t DrmPassthruPlugIn::onRemoveRights(int uniqueId, const String8& path) { LOGD("DrmPassthruPlugIn::onRemoveRights() : %d", uniqueId); + return DRM_NO_ERROR; } -void DrmPassthruPlugIn::onRemoveAllRights(int uniqueId) { +status_t DrmPassthruPlugIn::onRemoveAllRights(int uniqueId) { LOGD("DrmPassthruPlugIn::onRemoveAllRights() : %d", uniqueId); + return DRM_NO_ERROR; } -void DrmPassthruPlugIn::onOpenConvertSession(int uniqueId, int convertId) { +status_t DrmPassthruPlugIn::onOpenConvertSession(int uniqueId, int convertId) { LOGD("DrmPassthruPlugIn::onOpenConvertSession() : %d", uniqueId); + return DRM_NO_ERROR; } DrmConvertedStatus* DrmPassthruPlugIn::onConvertData( @@ -237,7 +243,7 @@ status_t DrmPassthruPlugIn::onOpenDecryptSession( return DRM_ERROR_CANNOT_HANDLE; } -void DrmPassthruPlugIn::onCloseDecryptSession(int uniqueId, DecryptHandle* decryptHandle) { +status_t DrmPassthruPlugIn::onCloseDecryptSession(int uniqueId, DecryptHandle* decryptHandle) { LOGD("DrmPassthruPlugIn::onCloseDecryptSession() : %d", uniqueId); if (NULL != decryptHandle) { if (NULL != decryptHandle->decryptInfo) { @@ -245,15 +251,17 @@ void DrmPassthruPlugIn::onCloseDecryptSession(int uniqueId, DecryptHandle* decry } delete decryptHandle; decryptHandle = NULL; } + return DRM_NO_ERROR; } -void DrmPassthruPlugIn::onInitializeDecryptUnit(int uniqueId, DecryptHandle* decryptHandle, +status_t DrmPassthruPlugIn::onInitializeDecryptUnit(int uniqueId, DecryptHandle* decryptHandle, int decryptUnitId, const DrmBuffer* headerInfo) { LOGD("DrmPassthruPlugIn::onInitializeDecryptUnit() : %d", uniqueId); + return DRM_NO_ERROR; } status_t DrmPassthruPlugIn::onDecrypt(int uniqueId, DecryptHandle* decryptHandle, - int decryptUnitId, const DrmBuffer* encBuffer, DrmBuffer** decBuffer) { + int decryptUnitId, const DrmBuffer* encBuffer, DrmBuffer** decBuffer, DrmBuffer* IV) { LOGD("DrmPassthruPlugIn::onDecrypt() : %d", uniqueId); /** * As a workaround implementation passthru would copy the given @@ -267,9 +275,10 @@ status_t DrmPassthruPlugIn::onDecrypt(int uniqueId, DecryptHandle* decryptHandle return DRM_NO_ERROR; } -void DrmPassthruPlugIn::onFinalizeDecryptUnit( +status_t DrmPassthruPlugIn::onFinalizeDecryptUnit( int uniqueId, DecryptHandle* decryptHandle, int decryptUnitId) { LOGD("DrmPassthruPlugIn::onFinalizeDecryptUnit() : %d", uniqueId); + return DRM_NO_ERROR; } ssize_t DrmPassthruPlugIn::onPread(int uniqueId, DecryptHandle* decryptHandle, |