diff options
author | Jeff Tinker <jtinker@google.com> | 2015-03-31 15:47:24 -0700 |
---|---|---|
committer | Jeff Tinker <jtinker@google.com> | 2015-04-09 22:44:56 +0000 |
commit | 9a498ef11566a5ae82c24b0651c58280309dfd04 (patch) | |
tree | a0ee80d15290c2ce04bb9391df3aab10071a460c | |
parent | 16af1b044e67370d9f7e44b1e0b60ced60a85ba9 (diff) | |
download | frameworks_native-9a498ef11566a5ae82c24b0651c58280309dfd04.zip frameworks_native-9a498ef11566a5ae82c24b0651c58280309dfd04.tar.gz frameworks_native-9a498ef11566a5ae82c24b0651c58280309dfd04.tar.bz2 |
Add expiration update and keys change events
In support of unprefixed EME
bug: 19771612
bug: 19771431
Change-Id: Ibb8471701a62dedfbf5231ad958e2c33ebb3c42f
-rw-r--r-- | include/media/drm/DrmAPI.h | 63 | ||||
-rw-r--r-- | include/media/hardware/CryptoAPI.h | 3 |
2 files changed, 61 insertions, 5 deletions
diff --git a/include/media/drm/DrmAPI.h b/include/media/drm/DrmAPI.h index b01476a..272881b 100644 --- a/include/media/drm/DrmAPI.h +++ b/include/media/drm/DrmAPI.h @@ -81,7 +81,9 @@ namespace android { kDrmPluginEventKeyNeeded, kDrmPluginEventKeyExpired, kDrmPluginEventVendorDefined, - kDrmPluginEventSessionReclaimed + kDrmPluginEventSessionReclaimed, + kDrmPluginEventExpirationUpdate, + kDrmPluginEventKeysChange, }; // Drm keys can be for offline content or for online streaming. @@ -103,6 +105,24 @@ namespace android { kKeyRequestType_Release }; + // Enumerate KeyStatusTypes which indicate the state of a key + enum KeyStatusType + { + kKeyStatusType_Usable, + kKeyStatusType_Expired, + kKeyStatusType_OutputNotAllowed, + kKeyStatusType_StatusPending, + kKeyStatusType_InternalError + }; + + // Used by sendKeysChange to report the usability status of each + // key to the app. + struct KeyStatus + { + Vector<uint8_t> mKeyId; + KeyStatusType mType; + }; + DrmPlugin() {} virtual ~DrmPlugin() {} @@ -326,11 +346,18 @@ namespace android { } protected: - // Plugins call sendEvent to deliver events to the java app + // Plugins call these methods to deliver events to the java app void sendEvent(EventType eventType, int extra, Vector<uint8_t> const *sessionId, Vector<uint8_t> const *data); + void sendExpirationUpdate(Vector<uint8_t> const *sessionId, + int64_t expiryTimeInMS); + + void sendKeysChange(Vector<uint8_t> const *sessionId, + Vector<DrmPlugin::KeyStatus> const *keyStatusList, + bool hasNewUsableKey); + private: Mutex mEventLock; sp<DrmPluginListener> mListener; @@ -342,14 +369,20 @@ namespace android { { public: virtual void sendEvent(DrmPlugin::EventType eventType, int extra, - Vector<uint8_t> const *sesionId, + Vector<uint8_t> const *sessionId, Vector<uint8_t> const *data) = 0; + + virtual void sendExpirationUpdate(Vector<uint8_t> const *sessionId, + int64_t expiryTimeInMS) = 0; + + virtual void sendKeysChange(Vector<uint8_t> const *sessionId, + Vector<DrmPlugin::KeyStatus> const *keyStatusList, + bool hasNewUsableKey) = 0; }; inline void DrmPlugin::sendEvent(EventType eventType, int extra, Vector<uint8_t> const *sessionId, Vector<uint8_t> const *data) { - mEventLock.lock(); sp<DrmPluginListener> listener = mListener; mEventLock.unlock(); @@ -359,6 +392,28 @@ namespace android { } } + inline void DrmPlugin::sendExpirationUpdate(Vector<uint8_t> const *sessionId, + int64_t expiryTimeInMS) { + mEventLock.lock(); + sp<DrmPluginListener> listener = mListener; + mEventLock.unlock(); + + if (listener != NULL) { + listener->sendExpirationUpdate(sessionId, expiryTimeInMS); + } + } + + inline void DrmPlugin::sendKeysChange(Vector<uint8_t> const *sessionId, + Vector<DrmPlugin::KeyStatus> const *keyStatusList, + bool hasNewUsableKey) { + mEventLock.lock(); + sp<DrmPluginListener> listener = mListener; + mEventLock.unlock(); + + if (listener != NULL) { + listener->sendKeysChange(sessionId, keyStatusList, hasNewUsableKey); + } + } } // namespace android #endif // DRM_API_H_ diff --git a/include/media/hardware/CryptoAPI.h b/include/media/hardware/CryptoAPI.h index c800825..ab8e2e2 100644 --- a/include/media/hardware/CryptoAPI.h +++ b/include/media/hardware/CryptoAPI.h @@ -68,7 +68,8 @@ struct CryptoPlugin { // the resolution of the video being decrypted. The media player should // call this method when the resolution is determined and any time it // is subsequently changed. - virtual void notifyResolution(uint32_t width, uint32_t height) {} + + virtual void notifyResolution(uint32_t /* width */, uint32_t /* height */) {} // If the error returned falls into the range // ERROR_DRM_VENDOR_MIN..ERROR_DRM_VENDOR_MAX, errorDetailMsg should be |