Add expiration update and keys change events
In support of unprefixed EME bug: 19771612 bug: 19771431 Change-Id: Ibb8471701a62dedfbf5231ad958e2c33ebb3c42f
This commit is contained in:
parent
16af1b044e
commit
9a498ef115
@ -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_
|
||||
|
@ -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
|
||||
|
Loading…
Reference in New Issue
Block a user