Fix for b/3501089 Require an API in the DRM client to specify the license type (offline/streaming) and b/4084670 Define events in DRM API to support license expiration, revocation, license failure. Implements events and license changes as documented in the Widevine_Java_API_for_Android_DRM_Framework spec
Change-Id: I3d0440e4f64d2279ab3b272a5287db5144e41eb1
This commit is contained in:
@@ -1,17 +1,7 @@
|
||||
/*
|
||||
* Copyright (C) 2011 The Android Open Source Project
|
||||
* Copyright 2011 Widevine Technologies, Inc., All Rights Reserved
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
* You may obtain a copy of the License at
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
* Declarations for Widevine DRM Plugin API
|
||||
*/
|
||||
|
||||
#ifndef __WVMDRMPLUGIN_API_H__
|
||||
@@ -38,6 +28,12 @@ class WVDRMPluginAPI {
|
||||
PLAYBACK_INVALID
|
||||
};
|
||||
|
||||
static const int PlaybackMode_Default = 0;
|
||||
static const int PlaybackMode_Streaming = 1;
|
||||
static const int PlaybackMode_Offline = 2;
|
||||
static const int PlaybackMode_Any = PlaybackMode_Streaming |
|
||||
PlaybackMode_Offline;
|
||||
|
||||
static WVDRMPluginAPI *create();
|
||||
static void destroy(WVDRMPluginAPI *plugin);
|
||||
|
||||
@@ -48,19 +44,35 @@ class WVDRMPluginAPI {
|
||||
virtual bool RegisterDrmInfo(std::string &portal, std::string &dsPath) = 0;
|
||||
virtual bool UnregisterDrmInfo(std::string &portal, std::string &dsPath) = 0;
|
||||
virtual bool AcquireDrmInfo(std::string &assetPath, WVCredentials &credentials,
|
||||
std::string &dsPath,
|
||||
const std::string &assetIdStr, const std::string &systemIdStr,
|
||||
std::string &dsPath, const std::string &assetIdStr,
|
||||
const std::string &systemIdStr,
|
||||
const std::string &keyIdStr,
|
||||
uint32_t *assetId, uint32_t *systemId, uint32_t *keyId) = 0;
|
||||
virtual bool ProcessDrmInfo(std::string &assetPath) = 0;
|
||||
uint32_t *assetId, uint32_t *systemId,
|
||||
uint32_t *keyId) = 0;
|
||||
|
||||
virtual bool ProcessDrmInfo(std::string &assetPath, int playbackMode) = 0;
|
||||
virtual int CheckRightsStatus(std::string &path) = 0;
|
||||
virtual bool GetConstraints(std::string &path, uint32_t *timeSincePlayback, uint32_t *timeRemaining, uint32_t *licenseDuration) = 0;
|
||||
virtual bool GetConstraints(std::string &path, uint32_t *timeSincePlayback,
|
||||
uint32_t *timeRemaining,
|
||||
uint32_t *licenseDuration, std::string &lastError,
|
||||
bool &allowOffline, bool &allowStreaming,
|
||||
bool &denyHD) = 0;
|
||||
virtual bool SetPlaybackStatus(int playbackStatus, off64_t position) = 0;
|
||||
virtual bool RemoveRights(std::string &path) = 0;
|
||||
virtual bool RemoveAllRights() = 0;
|
||||
virtual bool Prepare(char *data, int len) = 0;
|
||||
virtual bool Operate(char *in, char *out, int len, char *iv) = 0;
|
||||
|
||||
enum EventType {
|
||||
EventType_AcquireDrmInfoFailed,
|
||||
EventType_ProcessDrmInfoFailed,
|
||||
EventType_RightsInstalled,
|
||||
EventType_RightsRemoved
|
||||
};
|
||||
|
||||
typedef void (*EventHandler)(EventType type, const std::string &path);
|
||||
virtual void SetEventHandler(EventHandler handler) = 0;
|
||||
|
||||
protected:
|
||||
// use create factory method, don't construct directly
|
||||
WVDRMPluginAPI() {}
|
||||
|
||||
@@ -101,7 +101,10 @@ protected:
|
||||
void* buffer, ssize_t numBytes, off64_t offset);
|
||||
|
||||
private:
|
||||
const IDrmEngine::OnInfoListener *mOnInfoListener;
|
||||
static void SendEvent(WVDRMPluginAPI::EventType code, const std::string &path);
|
||||
static IDrmEngine::OnInfoListener *sOnInfoListener;
|
||||
static int sUniqueId;
|
||||
|
||||
WVDRMPluginAPI *mDrmPluginImpl;
|
||||
};
|
||||
|
||||
|
||||
Reference in New Issue
Block a user