FwdLockEngine.h revision fdd65a0fc7df2c878cc601e4c0f4021cb264f051
1fdd65a0fc7df2c878cc601e4c0f4021cb264f051Pravat Dalbehera/* 2fdd65a0fc7df2c878cc601e4c0f4021cb264f051Pravat Dalbehera * Copyright (C) 2010 The Android Open Source Project 3fdd65a0fc7df2c878cc601e4c0f4021cb264f051Pravat Dalbehera * 4fdd65a0fc7df2c878cc601e4c0f4021cb264f051Pravat Dalbehera * Licensed under the Apache License, Version 2.0 (the "License"); 5fdd65a0fc7df2c878cc601e4c0f4021cb264f051Pravat Dalbehera * you may not use this file except in compliance with the License. 6fdd65a0fc7df2c878cc601e4c0f4021cb264f051Pravat Dalbehera * You may obtain a copy of the License at 7fdd65a0fc7df2c878cc601e4c0f4021cb264f051Pravat Dalbehera * 8fdd65a0fc7df2c878cc601e4c0f4021cb264f051Pravat Dalbehera * http://www.apache.org/licenses/LICENSE-2.0 9fdd65a0fc7df2c878cc601e4c0f4021cb264f051Pravat Dalbehera * 10fdd65a0fc7df2c878cc601e4c0f4021cb264f051Pravat Dalbehera * Unless required by applicable law or agreed to in writing, software 11fdd65a0fc7df2c878cc601e4c0f4021cb264f051Pravat Dalbehera * distributed under the License is distributed on an "AS IS" BASIS, 12fdd65a0fc7df2c878cc601e4c0f4021cb264f051Pravat Dalbehera * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13fdd65a0fc7df2c878cc601e4c0f4021cb264f051Pravat Dalbehera * See the License for the specific language governing permissions and 14fdd65a0fc7df2c878cc601e4c0f4021cb264f051Pravat Dalbehera * limitations under the License. 15fdd65a0fc7df2c878cc601e4c0f4021cb264f051Pravat Dalbehera */ 16fdd65a0fc7df2c878cc601e4c0f4021cb264f051Pravat Dalbehera 17fdd65a0fc7df2c878cc601e4c0f4021cb264f051Pravat Dalbehera#ifndef __FWDLOCKENGINE_H__ 18fdd65a0fc7df2c878cc601e4c0f4021cb264f051Pravat Dalbehera#define __FWDLOCKENGINE_H__ 19fdd65a0fc7df2c878cc601e4c0f4021cb264f051Pravat Dalbehera 20fdd65a0fc7df2c878cc601e4c0f4021cb264f051Pravat Dalbehera#include <DrmEngineBase.h> 21fdd65a0fc7df2c878cc601e4c0f4021cb264f051Pravat Dalbehera#include <DrmConstraints.h> 22fdd65a0fc7df2c878cc601e4c0f4021cb264f051Pravat Dalbehera#include <DrmRights.h> 23fdd65a0fc7df2c878cc601e4c0f4021cb264f051Pravat Dalbehera#include <DrmInfo.h> 24fdd65a0fc7df2c878cc601e4c0f4021cb264f051Pravat Dalbehera#include <DrmInfoStatus.h> 25fdd65a0fc7df2c878cc601e4c0f4021cb264f051Pravat Dalbehera#include <DrmConvertedStatus.h> 26fdd65a0fc7df2c878cc601e4c0f4021cb264f051Pravat Dalbehera#include <DrmInfoRequest.h> 27fdd65a0fc7df2c878cc601e4c0f4021cb264f051Pravat Dalbehera#include <DrmSupportInfo.h> 28fdd65a0fc7df2c878cc601e4c0f4021cb264f051Pravat Dalbehera#include <DrmInfoEvent.h> 29fdd65a0fc7df2c878cc601e4c0f4021cb264f051Pravat Dalbehera 30fdd65a0fc7df2c878cc601e4c0f4021cb264f051Pravat Dalbehera#include "SessionMap.h" 31fdd65a0fc7df2c878cc601e4c0f4021cb264f051Pravat Dalbehera#include "FwdLockConv.h" 32fdd65a0fc7df2c878cc601e4c0f4021cb264f051Pravat Dalbehera 33fdd65a0fc7df2c878cc601e4c0f4021cb264f051Pravat Dalbeheranamespace android { 34fdd65a0fc7df2c878cc601e4c0f4021cb264f051Pravat Dalbehera 35fdd65a0fc7df2c878cc601e4c0f4021cb264f051Pravat Dalbehera/** 36fdd65a0fc7df2c878cc601e4c0f4021cb264f051Pravat Dalbehera * Forward Lock Engine class. 37fdd65a0fc7df2c878cc601e4c0f4021cb264f051Pravat Dalbehera */ 38fdd65a0fc7df2c878cc601e4c0f4021cb264f051Pravat Dalbeheraclass FwdLockEngine : public android::DrmEngineBase { 39fdd65a0fc7df2c878cc601e4c0f4021cb264f051Pravat Dalbehera 40fdd65a0fc7df2c878cc601e4c0f4021cb264f051Pravat Dalbeherapublic: 41fdd65a0fc7df2c878cc601e4c0f4021cb264f051Pravat Dalbehera FwdLockEngine(); 42fdd65a0fc7df2c878cc601e4c0f4021cb264f051Pravat Dalbehera virtual ~FwdLockEngine(); 43fdd65a0fc7df2c878cc601e4c0f4021cb264f051Pravat Dalbehera 44fdd65a0fc7df2c878cc601e4c0f4021cb264f051Pravat Dalbeheraprotected: 45fdd65a0fc7df2c878cc601e4c0f4021cb264f051Pravat Dalbehera/** 46fdd65a0fc7df2c878cc601e4c0f4021cb264f051Pravat Dalbehera * Get constraint information associated with input content. 47fdd65a0fc7df2c878cc601e4c0f4021cb264f051Pravat Dalbehera * 48fdd65a0fc7df2c878cc601e4c0f4021cb264f051Pravat Dalbehera * @param uniqueId Unique identifier for a session 49fdd65a0fc7df2c878cc601e4c0f4021cb264f051Pravat Dalbehera * @param path Path of the protected content 50fdd65a0fc7df2c878cc601e4c0f4021cb264f051Pravat Dalbehera * @param action Actions defined such as, 51fdd65a0fc7df2c878cc601e4c0f4021cb264f051Pravat Dalbehera * Action::DEFAULT, Action::PLAY, etc 52fdd65a0fc7df2c878cc601e4c0f4021cb264f051Pravat Dalbehera * @return DrmConstraints 53fdd65a0fc7df2c878cc601e4c0f4021cb264f051Pravat Dalbehera * key-value pairs of constraint are embedded in it 54fdd65a0fc7df2c878cc601e4c0f4021cb264f051Pravat Dalbehera * @note 55fdd65a0fc7df2c878cc601e4c0f4021cb264f051Pravat Dalbehera * In case of error, return NULL 56fdd65a0fc7df2c878cc601e4c0f4021cb264f051Pravat Dalbehera */ 57fdd65a0fc7df2c878cc601e4c0f4021cb264f051Pravat DalbeheraDrmConstraints* onGetConstraints(int uniqueId, const String8* path, int action); 58fdd65a0fc7df2c878cc601e4c0f4021cb264f051Pravat Dalbehera 59fdd65a0fc7df2c878cc601e4c0f4021cb264f051Pravat Dalbehera/** 60fdd65a0fc7df2c878cc601e4c0f4021cb264f051Pravat Dalbehera * Get metadata information associated with input content. 61fdd65a0fc7df2c878cc601e4c0f4021cb264f051Pravat Dalbehera * 62fdd65a0fc7df2c878cc601e4c0f4021cb264f051Pravat Dalbehera * @param uniqueId Unique identifier for a session 63fdd65a0fc7df2c878cc601e4c0f4021cb264f051Pravat Dalbehera * @param path Path of the protected content 64fdd65a0fc7df2c878cc601e4c0f4021cb264f051Pravat Dalbehera * @return DrmMetadata 65fdd65a0fc7df2c878cc601e4c0f4021cb264f051Pravat Dalbehera * For Forward Lock engine, it returns an empty object 66fdd65a0fc7df2c878cc601e4c0f4021cb264f051Pravat Dalbehera * @note 67fdd65a0fc7df2c878cc601e4c0f4021cb264f051Pravat Dalbehera * In case of error, returns NULL 68fdd65a0fc7df2c878cc601e4c0f4021cb264f051Pravat Dalbehera */ 69fdd65a0fc7df2c878cc601e4c0f4021cb264f051Pravat DalbeheraDrmMetadata* onGetMetadata(int uniqueId, const String8* path); 70fdd65a0fc7df2c878cc601e4c0f4021cb264f051Pravat Dalbehera 71fdd65a0fc7df2c878cc601e4c0f4021cb264f051Pravat Dalbehera/** 72fdd65a0fc7df2c878cc601e4c0f4021cb264f051Pravat Dalbehera * Initialize plug-in. 73fdd65a0fc7df2c878cc601e4c0f4021cb264f051Pravat Dalbehera * 74fdd65a0fc7df2c878cc601e4c0f4021cb264f051Pravat Dalbehera * @param uniqueId Unique identifier for a session 75fdd65a0fc7df2c878cc601e4c0f4021cb264f051Pravat Dalbehera * @return status_t 76fdd65a0fc7df2c878cc601e4c0f4021cb264f051Pravat Dalbehera * Returns DRM_NO_ERROR for success, DRM_ERROR_UNKNOWN for failure 77fdd65a0fc7df2c878cc601e4c0f4021cb264f051Pravat Dalbehera */ 78fdd65a0fc7df2c878cc601e4c0f4021cb264f051Pravat Dalbeherastatus_t onInitialize(int uniqueId); 79fdd65a0fc7df2c878cc601e4c0f4021cb264f051Pravat Dalbehera 80fdd65a0fc7df2c878cc601e4c0f4021cb264f051Pravat Dalbehera/** 81fdd65a0fc7df2c878cc601e4c0f4021cb264f051Pravat Dalbehera * Register a callback to be invoked when the caller required to 82fdd65a0fc7df2c878cc601e4c0f4021cb264f051Pravat Dalbehera * receive necessary information. 83fdd65a0fc7df2c878cc601e4c0f4021cb264f051Pravat Dalbehera * 84fdd65a0fc7df2c878cc601e4c0f4021cb264f051Pravat Dalbehera * @param uniqueId Unique identifier for a session 85fdd65a0fc7df2c878cc601e4c0f4021cb264f051Pravat Dalbehera * @param infoListener Listener 86fdd65a0fc7df2c878cc601e4c0f4021cb264f051Pravat Dalbehera * @return status_t 87fdd65a0fc7df2c878cc601e4c0f4021cb264f051Pravat Dalbehera * Returns DRM_NO_ERROR for success, DRM_ERROR_UNKNOWN for failure 88fdd65a0fc7df2c878cc601e4c0f4021cb264f051Pravat Dalbehera */ 89fdd65a0fc7df2c878cc601e4c0f4021cb264f051Pravat Dalbeherastatus_t onSetOnInfoListener(int uniqueId, const IDrmEngine::OnInfoListener* infoListener); 90fdd65a0fc7df2c878cc601e4c0f4021cb264f051Pravat Dalbehera 91fdd65a0fc7df2c878cc601e4c0f4021cb264f051Pravat Dalbehera/** 92fdd65a0fc7df2c878cc601e4c0f4021cb264f051Pravat Dalbehera * Terminate the plug-in and release resources bound to it. 93fdd65a0fc7df2c878cc601e4c0f4021cb264f051Pravat Dalbehera * 94fdd65a0fc7df2c878cc601e4c0f4021cb264f051Pravat Dalbehera * @param uniqueId Unique identifier for a session 95fdd65a0fc7df2c878cc601e4c0f4021cb264f051Pravat Dalbehera * @return status_t 96fdd65a0fc7df2c878cc601e4c0f4021cb264f051Pravat Dalbehera * Returns DRM_NO_ERROR for success, DRM_ERROR_UNKNOWN for failure 97fdd65a0fc7df2c878cc601e4c0f4021cb264f051Pravat Dalbehera */ 98fdd65a0fc7df2c878cc601e4c0f4021cb264f051Pravat Dalbeherastatus_t onTerminate(int uniqueId); 99fdd65a0fc7df2c878cc601e4c0f4021cb264f051Pravat Dalbehera 100fdd65a0fc7df2c878cc601e4c0f4021cb264f051Pravat Dalbehera/** 101fdd65a0fc7df2c878cc601e4c0f4021cb264f051Pravat Dalbehera * Get whether the given content can be handled by this plugin or not. 102fdd65a0fc7df2c878cc601e4c0f4021cb264f051Pravat Dalbehera * 103fdd65a0fc7df2c878cc601e4c0f4021cb264f051Pravat Dalbehera * @param uniqueId Unique identifier for a session 104fdd65a0fc7df2c878cc601e4c0f4021cb264f051Pravat Dalbehera * @param path Path to the protected object 105fdd65a0fc7df2c878cc601e4c0f4021cb264f051Pravat Dalbehera * @return bool 106fdd65a0fc7df2c878cc601e4c0f4021cb264f051Pravat Dalbehera * Returns true if this plugin can handle , false in case of not able to handle 107fdd65a0fc7df2c878cc601e4c0f4021cb264f051Pravat Dalbehera */ 108fdd65a0fc7df2c878cc601e4c0f4021cb264f051Pravat Dalbeherabool onCanHandle(int uniqueId, const String8& path); 109fdd65a0fc7df2c878cc601e4c0f4021cb264f051Pravat Dalbehera 110fdd65a0fc7df2c878cc601e4c0f4021cb264f051Pravat Dalbehera/** 111fdd65a0fc7df2c878cc601e4c0f4021cb264f051Pravat Dalbehera * Processes the given DRM information as appropriate for its type. 112fdd65a0fc7df2c878cc601e4c0f4021cb264f051Pravat Dalbehera * Not used for Forward Lock Engine. 113fdd65a0fc7df2c878cc601e4c0f4021cb264f051Pravat Dalbehera * 114fdd65a0fc7df2c878cc601e4c0f4021cb264f051Pravat Dalbehera * @param uniqueId Unique identifier for a session 115fdd65a0fc7df2c878cc601e4c0f4021cb264f051Pravat Dalbehera * @param drmInfo Information that needs to be processed 116fdd65a0fc7df2c878cc601e4c0f4021cb264f051Pravat Dalbehera * @return DrmInfoStatus 117fdd65a0fc7df2c878cc601e4c0f4021cb264f051Pravat Dalbehera * instance as a result of processing given input 118fdd65a0fc7df2c878cc601e4c0f4021cb264f051Pravat Dalbehera */ 119fdd65a0fc7df2c878cc601e4c0f4021cb264f051Pravat DalbeheraDrmInfoStatus* onProcessDrmInfo(int uniqueId, const DrmInfo* drmInfo); 120fdd65a0fc7df2c878cc601e4c0f4021cb264f051Pravat Dalbehera 121fdd65a0fc7df2c878cc601e4c0f4021cb264f051Pravat Dalbehera/** 122fdd65a0fc7df2c878cc601e4c0f4021cb264f051Pravat Dalbehera * Save DRM rights to specified rights path 123fdd65a0fc7df2c878cc601e4c0f4021cb264f051Pravat Dalbehera * and make association with content path. 124fdd65a0fc7df2c878cc601e4c0f4021cb264f051Pravat Dalbehera * 125fdd65a0fc7df2c878cc601e4c0f4021cb264f051Pravat Dalbehera * @param uniqueId Unique identifier for a session 126fdd65a0fc7df2c878cc601e4c0f4021cb264f051Pravat Dalbehera * @param drmRights DrmRights to be saved 127fdd65a0fc7df2c878cc601e4c0f4021cb264f051Pravat Dalbehera * @param rightsPath File path where rights to be saved 128fdd65a0fc7df2c878cc601e4c0f4021cb264f051Pravat Dalbehera * @param contentPath File path where content was saved 129fdd65a0fc7df2c878cc601e4c0f4021cb264f051Pravat Dalbehera * @return status_t 130fdd65a0fc7df2c878cc601e4c0f4021cb264f051Pravat Dalbehera * Returns DRM_NO_ERROR for success, DRM_ERROR_UNKNOWN for failure 131fdd65a0fc7df2c878cc601e4c0f4021cb264f051Pravat Dalbehera */ 132fdd65a0fc7df2c878cc601e4c0f4021cb264f051Pravat Dalbeherastatus_t onSaveRights(int uniqueId, 133fdd65a0fc7df2c878cc601e4c0f4021cb264f051Pravat Dalbehera const DrmRights& drmRights, 134fdd65a0fc7df2c878cc601e4c0f4021cb264f051Pravat Dalbehera const String8& rightsPath, 135fdd65a0fc7df2c878cc601e4c0f4021cb264f051Pravat Dalbehera const String8& contentPath); 136fdd65a0fc7df2c878cc601e4c0f4021cb264f051Pravat Dalbehera 137fdd65a0fc7df2c878cc601e4c0f4021cb264f051Pravat Dalbehera/** 138fdd65a0fc7df2c878cc601e4c0f4021cb264f051Pravat Dalbehera * Retrieves necessary information for registration, unregistration or rights 139fdd65a0fc7df2c878cc601e4c0f4021cb264f051Pravat Dalbehera * acquisition information. 140fdd65a0fc7df2c878cc601e4c0f4021cb264f051Pravat Dalbehera * 141fdd65a0fc7df2c878cc601e4c0f4021cb264f051Pravat Dalbehera * @param uniqueId Unique identifier for a session 142fdd65a0fc7df2c878cc601e4c0f4021cb264f051Pravat Dalbehera * @param drmInfoRequest Request information to retrieve drmInfo 143fdd65a0fc7df2c878cc601e4c0f4021cb264f051Pravat Dalbehera * @return DrmInfo 144fdd65a0fc7df2c878cc601e4c0f4021cb264f051Pravat Dalbehera * instance as a result of processing given input 145fdd65a0fc7df2c878cc601e4c0f4021cb264f051Pravat Dalbehera */ 146fdd65a0fc7df2c878cc601e4c0f4021cb264f051Pravat DalbeheraDrmInfo* onAcquireDrmInfo(int uniqueId, 147fdd65a0fc7df2c878cc601e4c0f4021cb264f051Pravat Dalbehera const DrmInfoRequest* drmInfoRequest); 148fdd65a0fc7df2c878cc601e4c0f4021cb264f051Pravat Dalbehera 149fdd65a0fc7df2c878cc601e4c0f4021cb264f051Pravat Dalbehera/** 150fdd65a0fc7df2c878cc601e4c0f4021cb264f051Pravat Dalbehera * Retrieves the mime type embedded inside the original content. 151fdd65a0fc7df2c878cc601e4c0f4021cb264f051Pravat Dalbehera * 152fdd65a0fc7df2c878cc601e4c0f4021cb264f051Pravat Dalbehera * @param uniqueId Unique identifier for a session 153fdd65a0fc7df2c878cc601e4c0f4021cb264f051Pravat Dalbehera * @param path Path of the protected content 154fdd65a0fc7df2c878cc601e4c0f4021cb264f051Pravat Dalbehera * @return String8 155fdd65a0fc7df2c878cc601e4c0f4021cb264f051Pravat Dalbehera * Returns mime-type of the original content, such as "video/mpeg" 156fdd65a0fc7df2c878cc601e4c0f4021cb264f051Pravat Dalbehera */ 157fdd65a0fc7df2c878cc601e4c0f4021cb264f051Pravat DalbeheraString8 onGetOriginalMimeType(int uniqueId, const String8& path); 158fdd65a0fc7df2c878cc601e4c0f4021cb264f051Pravat Dalbehera 159fdd65a0fc7df2c878cc601e4c0f4021cb264f051Pravat Dalbehera/** 160fdd65a0fc7df2c878cc601e4c0f4021cb264f051Pravat Dalbehera * Retrieves the type of the protected object (content, rights, etc..) 161fdd65a0fc7df2c878cc601e4c0f4021cb264f051Pravat Dalbehera * using specified path or mimetype. At least one parameter should be non null 162fdd65a0fc7df2c878cc601e4c0f4021cb264f051Pravat Dalbehera * to retrieve DRM object type. 163fdd65a0fc7df2c878cc601e4c0f4021cb264f051Pravat Dalbehera * 164fdd65a0fc7df2c878cc601e4c0f4021cb264f051Pravat Dalbehera * @param uniqueId Unique identifier for a session 165fdd65a0fc7df2c878cc601e4c0f4021cb264f051Pravat Dalbehera * @param path Path of the content or null. 166fdd65a0fc7df2c878cc601e4c0f4021cb264f051Pravat Dalbehera * @param mimeType Mime type of the content or null. 167fdd65a0fc7df2c878cc601e4c0f4021cb264f051Pravat Dalbehera * @return type of the DRM content, 168fdd65a0fc7df2c878cc601e4c0f4021cb264f051Pravat Dalbehera * such as DrmObjectType::CONTENT, DrmObjectType::RIGHTS_OBJECT 169fdd65a0fc7df2c878cc601e4c0f4021cb264f051Pravat Dalbehera */ 170fdd65a0fc7df2c878cc601e4c0f4021cb264f051Pravat Dalbeheraint onGetDrmObjectType(int uniqueId, 171fdd65a0fc7df2c878cc601e4c0f4021cb264f051Pravat Dalbehera const String8& path, 172fdd65a0fc7df2c878cc601e4c0f4021cb264f051Pravat Dalbehera const String8& mimeType); 173fdd65a0fc7df2c878cc601e4c0f4021cb264f051Pravat Dalbehera 174fdd65a0fc7df2c878cc601e4c0f4021cb264f051Pravat Dalbehera/** 175fdd65a0fc7df2c878cc601e4c0f4021cb264f051Pravat Dalbehera * Check whether the given content has valid rights or not. 176fdd65a0fc7df2c878cc601e4c0f4021cb264f051Pravat Dalbehera * 177fdd65a0fc7df2c878cc601e4c0f4021cb264f051Pravat Dalbehera * @param uniqueId Unique identifier for a session 178fdd65a0fc7df2c878cc601e4c0f4021cb264f051Pravat Dalbehera * @param path Path of the protected content 179fdd65a0fc7df2c878cc601e4c0f4021cb264f051Pravat Dalbehera * @param action Action to perform (Action::DEFAULT, Action::PLAY, etc) 180fdd65a0fc7df2c878cc601e4c0f4021cb264f051Pravat Dalbehera * @return the status of the rights for the protected content, 181fdd65a0fc7df2c878cc601e4c0f4021cb264f051Pravat Dalbehera * such as RightsStatus::RIGHTS_VALID, RightsStatus::RIGHTS_EXPIRED, etc. 182fdd65a0fc7df2c878cc601e4c0f4021cb264f051Pravat Dalbehera */ 183fdd65a0fc7df2c878cc601e4c0f4021cb264f051Pravat Dalbeheraint onCheckRightsStatus(int uniqueId, 184fdd65a0fc7df2c878cc601e4c0f4021cb264f051Pravat Dalbehera const String8& path, 185fdd65a0fc7df2c878cc601e4c0f4021cb264f051Pravat Dalbehera int action); 186fdd65a0fc7df2c878cc601e4c0f4021cb264f051Pravat Dalbehera 187fdd65a0fc7df2c878cc601e4c0f4021cb264f051Pravat Dalbehera/** 188fdd65a0fc7df2c878cc601e4c0f4021cb264f051Pravat Dalbehera * Consumes the rights for a content. 189fdd65a0fc7df2c878cc601e4c0f4021cb264f051Pravat Dalbehera * If the reserve parameter is true the rights are reserved until the same 190fdd65a0fc7df2c878cc601e4c0f4021cb264f051Pravat Dalbehera * application calls this api again with the reserve parameter set to false. 191fdd65a0fc7df2c878cc601e4c0f4021cb264f051Pravat Dalbehera * 192fdd65a0fc7df2c878cc601e4c0f4021cb264f051Pravat Dalbehera * @param uniqueId Unique identifier for a session 193fdd65a0fc7df2c878cc601e4c0f4021cb264f051Pravat Dalbehera * @param decryptHandle Handle for the decryption session 194fdd65a0fc7df2c878cc601e4c0f4021cb264f051Pravat Dalbehera * @param action Action to perform. (Action::DEFAULT, Action::PLAY, etc) 195fdd65a0fc7df2c878cc601e4c0f4021cb264f051Pravat Dalbehera * @param reserve True if the rights should be reserved. 196fdd65a0fc7df2c878cc601e4c0f4021cb264f051Pravat Dalbehera * @return status_t 197fdd65a0fc7df2c878cc601e4c0f4021cb264f051Pravat Dalbehera * Returns DRM_NO_ERROR for success, DRM_ERROR_UNKNOWN for failure 198fdd65a0fc7df2c878cc601e4c0f4021cb264f051Pravat Dalbehera */ 199fdd65a0fc7df2c878cc601e4c0f4021cb264f051Pravat Dalbeherastatus_t onConsumeRights(int uniqueId, 200fdd65a0fc7df2c878cc601e4c0f4021cb264f051Pravat Dalbehera DecryptHandle* decryptHandle, 201fdd65a0fc7df2c878cc601e4c0f4021cb264f051Pravat Dalbehera int action, 202fdd65a0fc7df2c878cc601e4c0f4021cb264f051Pravat Dalbehera bool reserve); 203fdd65a0fc7df2c878cc601e4c0f4021cb264f051Pravat Dalbehera 204fdd65a0fc7df2c878cc601e4c0f4021cb264f051Pravat Dalbehera/** 205fdd65a0fc7df2c878cc601e4c0f4021cb264f051Pravat Dalbehera * Informs the DRM Engine about the playback actions performed on the DRM files. 206fdd65a0fc7df2c878cc601e4c0f4021cb264f051Pravat Dalbehera * 207fdd65a0fc7df2c878cc601e4c0f4021cb264f051Pravat Dalbehera * @param uniqueId Unique identifier for a session 208fdd65a0fc7df2c878cc601e4c0f4021cb264f051Pravat Dalbehera * @param decryptHandle Handle for the decryption session 209fdd65a0fc7df2c878cc601e4c0f4021cb264f051Pravat Dalbehera * @param playbackStatus Playback action (Playback::START, Playback::STOP, Playback::PAUSE) 210fdd65a0fc7df2c878cc601e4c0f4021cb264f051Pravat Dalbehera * @param position Position in the file (in milliseconds) where the start occurs. 211fdd65a0fc7df2c878cc601e4c0f4021cb264f051Pravat Dalbehera * Only valid together with Playback::START. 212fdd65a0fc7df2c878cc601e4c0f4021cb264f051Pravat Dalbehera * @return status_t 213fdd65a0fc7df2c878cc601e4c0f4021cb264f051Pravat Dalbehera * Returns DRM_NO_ERROR for success, DRM_ERROR_UNKNOWN for failure 214fdd65a0fc7df2c878cc601e4c0f4021cb264f051Pravat Dalbehera */ 215fdd65a0fc7df2c878cc601e4c0f4021cb264f051Pravat Dalbehera#ifdef USE_64BIT_DRM_API 216fdd65a0fc7df2c878cc601e4c0f4021cb264f051Pravat Dalbeherastatus_t onSetPlaybackStatus(int uniqueId, 217fdd65a0fc7df2c878cc601e4c0f4021cb264f051Pravat Dalbehera DecryptHandle* decryptHandle, 218fdd65a0fc7df2c878cc601e4c0f4021cb264f051Pravat Dalbehera int playbackStatus, 219fdd65a0fc7df2c878cc601e4c0f4021cb264f051Pravat Dalbehera int64_t position); 220fdd65a0fc7df2c878cc601e4c0f4021cb264f051Pravat Dalbehera#else 221fdd65a0fc7df2c878cc601e4c0f4021cb264f051Pravat Dalbeherastatus_t onSetPlaybackStatus(int uniqueId, 222fdd65a0fc7df2c878cc601e4c0f4021cb264f051Pravat Dalbehera DecryptHandle* decryptHandle, 223fdd65a0fc7df2c878cc601e4c0f4021cb264f051Pravat Dalbehera int playbackStatus, 224fdd65a0fc7df2c878cc601e4c0f4021cb264f051Pravat Dalbehera int position); 225fdd65a0fc7df2c878cc601e4c0f4021cb264f051Pravat Dalbehera#endif 226fdd65a0fc7df2c878cc601e4c0f4021cb264f051Pravat Dalbehera 227fdd65a0fc7df2c878cc601e4c0f4021cb264f051Pravat Dalbehera/** 228fdd65a0fc7df2c878cc601e4c0f4021cb264f051Pravat Dalbehera * Validates whether an action on the DRM content is allowed or not. 229fdd65a0fc7df2c878cc601e4c0f4021cb264f051Pravat Dalbehera * 230fdd65a0fc7df2c878cc601e4c0f4021cb264f051Pravat Dalbehera * @param uniqueId Unique identifier for a session 231fdd65a0fc7df2c878cc601e4c0f4021cb264f051Pravat Dalbehera * @param path Path of the protected content 232fdd65a0fc7df2c878cc601e4c0f4021cb264f051Pravat Dalbehera * @param action Action to validate (Action::PLAY, Action::TRANSFER, etc) 233fdd65a0fc7df2c878cc601e4c0f4021cb264f051Pravat Dalbehera * @param description Detailed description of the action 234fdd65a0fc7df2c878cc601e4c0f4021cb264f051Pravat Dalbehera * @return true if the action is allowed. 235fdd65a0fc7df2c878cc601e4c0f4021cb264f051Pravat Dalbehera */ 236fdd65a0fc7df2c878cc601e4c0f4021cb264f051Pravat Dalbeherabool onValidateAction(int uniqueId, 237fdd65a0fc7df2c878cc601e4c0f4021cb264f051Pravat Dalbehera const String8& path, 238fdd65a0fc7df2c878cc601e4c0f4021cb264f051Pravat Dalbehera int action, 239fdd65a0fc7df2c878cc601e4c0f4021cb264f051Pravat Dalbehera const ActionDescription& description); 240fdd65a0fc7df2c878cc601e4c0f4021cb264f051Pravat Dalbehera 241fdd65a0fc7df2c878cc601e4c0f4021cb264f051Pravat Dalbehera/** 242fdd65a0fc7df2c878cc601e4c0f4021cb264f051Pravat Dalbehera * Removes the rights associated with the given protected content. 243fdd65a0fc7df2c878cc601e4c0f4021cb264f051Pravat Dalbehera * Not used for Forward Lock Engine. 244fdd65a0fc7df2c878cc601e4c0f4021cb264f051Pravat Dalbehera * 245fdd65a0fc7df2c878cc601e4c0f4021cb264f051Pravat Dalbehera * @param uniqueId Unique identifier for a session 246fdd65a0fc7df2c878cc601e4c0f4021cb264f051Pravat Dalbehera * @param path Path of the protected content 247fdd65a0fc7df2c878cc601e4c0f4021cb264f051Pravat Dalbehera * @return status_t 248fdd65a0fc7df2c878cc601e4c0f4021cb264f051Pravat Dalbehera * Returns DRM_NO_ERROR for success, DRM_ERROR_UNKNOWN for failure 249fdd65a0fc7df2c878cc601e4c0f4021cb264f051Pravat Dalbehera */ 250fdd65a0fc7df2c878cc601e4c0f4021cb264f051Pravat Dalbeherastatus_t onRemoveRights(int uniqueId, const String8& path); 251fdd65a0fc7df2c878cc601e4c0f4021cb264f051Pravat Dalbehera 252fdd65a0fc7df2c878cc601e4c0f4021cb264f051Pravat Dalbehera/** 253fdd65a0fc7df2c878cc601e4c0f4021cb264f051Pravat Dalbehera * Removes all the rights information of each plug-in associated with 254fdd65a0fc7df2c878cc601e4c0f4021cb264f051Pravat Dalbehera * DRM framework. Will be used in master reset but does nothing for 255fdd65a0fc7df2c878cc601e4c0f4021cb264f051Pravat Dalbehera * Forward Lock Engine. 256fdd65a0fc7df2c878cc601e4c0f4021cb264f051Pravat Dalbehera * 257fdd65a0fc7df2c878cc601e4c0f4021cb264f051Pravat Dalbehera * @param uniqueId Unique identifier for a session 258fdd65a0fc7df2c878cc601e4c0f4021cb264f051Pravat Dalbehera * @return status_t 259fdd65a0fc7df2c878cc601e4c0f4021cb264f051Pravat Dalbehera * Returns DRM_NO_ERROR for success, DRM_ERROR_UNKNOWN for failure 260fdd65a0fc7df2c878cc601e4c0f4021cb264f051Pravat Dalbehera */ 261fdd65a0fc7df2c878cc601e4c0f4021cb264f051Pravat Dalbeherastatus_t onRemoveAllRights(int uniqueId); 262fdd65a0fc7df2c878cc601e4c0f4021cb264f051Pravat Dalbehera 263fdd65a0fc7df2c878cc601e4c0f4021cb264f051Pravat Dalbehera/** 264fdd65a0fc7df2c878cc601e4c0f4021cb264f051Pravat Dalbehera * Starts the Forward Lock file conversion session. 265fdd65a0fc7df2c878cc601e4c0f4021cb264f051Pravat Dalbehera * Each time the application tries to download a new DRM file 266fdd65a0fc7df2c878cc601e4c0f4021cb264f051Pravat Dalbehera * which needs to be converted, then the application has to 267fdd65a0fc7df2c878cc601e4c0f4021cb264f051Pravat Dalbehera * begin with calling this API. The convertId is used as the conversion session key 268fdd65a0fc7df2c878cc601e4c0f4021cb264f051Pravat Dalbehera * and must not be the same for different convert sessions. 269fdd65a0fc7df2c878cc601e4c0f4021cb264f051Pravat Dalbehera * 270fdd65a0fc7df2c878cc601e4c0f4021cb264f051Pravat Dalbehera * @param uniqueId Unique identifier for a session 271fdd65a0fc7df2c878cc601e4c0f4021cb264f051Pravat Dalbehera * @param convertId Handle for the convert session 272fdd65a0fc7df2c878cc601e4c0f4021cb264f051Pravat Dalbehera * @return status_t 273fdd65a0fc7df2c878cc601e4c0f4021cb264f051Pravat Dalbehera * Returns DRM_NO_ERROR for success, DRM_ERROR_UNKNOWN for failure 274fdd65a0fc7df2c878cc601e4c0f4021cb264f051Pravat Dalbehera */ 275fdd65a0fc7df2c878cc601e4c0f4021cb264f051Pravat Dalbeherastatus_t onOpenConvertSession(int uniqueId, int convertId); 276fdd65a0fc7df2c878cc601e4c0f4021cb264f051Pravat Dalbehera 277fdd65a0fc7df2c878cc601e4c0f4021cb264f051Pravat Dalbehera/** 278fdd65a0fc7df2c878cc601e4c0f4021cb264f051Pravat Dalbehera * Accepts and converts the input data which is part of DRM file. 279fdd65a0fc7df2c878cc601e4c0f4021cb264f051Pravat Dalbehera * The resultant converted data and the status is returned in the DrmConvertedInfo 280fdd65a0fc7df2c878cc601e4c0f4021cb264f051Pravat Dalbehera * object. This method will be called each time there is a new block 281fdd65a0fc7df2c878cc601e4c0f4021cb264f051Pravat Dalbehera * of data received by the application. 282fdd65a0fc7df2c878cc601e4c0f4021cb264f051Pravat Dalbehera * 283fdd65a0fc7df2c878cc601e4c0f4021cb264f051Pravat Dalbehera * @param uniqueId Unique identifier for a session 284fdd65a0fc7df2c878cc601e4c0f4021cb264f051Pravat Dalbehera * @param convertId Handle for the convert session 285fdd65a0fc7df2c878cc601e4c0f4021cb264f051Pravat Dalbehera * @param inputData Input Data which need to be converted 286fdd65a0fc7df2c878cc601e4c0f4021cb264f051Pravat Dalbehera * @return Return object contains the status of the data conversion, 287fdd65a0fc7df2c878cc601e4c0f4021cb264f051Pravat Dalbehera * the output converted data and offset. In this case the 288fdd65a0fc7df2c878cc601e4c0f4021cb264f051Pravat Dalbehera * application will ignore the offset information. 289fdd65a0fc7df2c878cc601e4c0f4021cb264f051Pravat Dalbehera */ 290fdd65a0fc7df2c878cc601e4c0f4021cb264f051Pravat DalbeheraDrmConvertedStatus* onConvertData(int uniqueId, 291fdd65a0fc7df2c878cc601e4c0f4021cb264f051Pravat Dalbehera int convertId, 292fdd65a0fc7df2c878cc601e4c0f4021cb264f051Pravat Dalbehera const DrmBuffer* inputData); 293fdd65a0fc7df2c878cc601e4c0f4021cb264f051Pravat Dalbehera 294fdd65a0fc7df2c878cc601e4c0f4021cb264f051Pravat Dalbehera/** 295fdd65a0fc7df2c878cc601e4c0f4021cb264f051Pravat Dalbehera * Closes the convert session in case of data supply completed or error occurred. 296fdd65a0fc7df2c878cc601e4c0f4021cb264f051Pravat Dalbehera * Upon successful conversion of the complete data, it returns signature calculated over 297fdd65a0fc7df2c878cc601e4c0f4021cb264f051Pravat Dalbehera * the entire data used over a conversion session. This signature must be copied to the offset 298fdd65a0fc7df2c878cc601e4c0f4021cb264f051Pravat Dalbehera * mentioned in the DrmConvertedStatus. Signature is used for data integrity protection. 299fdd65a0fc7df2c878cc601e4c0f4021cb264f051Pravat Dalbehera * 300fdd65a0fc7df2c878cc601e4c0f4021cb264f051Pravat Dalbehera * @param uniqueId Unique identifier for a session 301fdd65a0fc7df2c878cc601e4c0f4021cb264f051Pravat Dalbehera * @param convertId Handle for the convert session 302fdd65a0fc7df2c878cc601e4c0f4021cb264f051Pravat Dalbehera * @return Return object contains the status of the data conversion, 303fdd65a0fc7df2c878cc601e4c0f4021cb264f051Pravat Dalbehera * the header and body signature data. It also informs 304fdd65a0fc7df2c878cc601e4c0f4021cb264f051Pravat Dalbehera * the application about the file offset at which this 305fdd65a0fc7df2c878cc601e4c0f4021cb264f051Pravat Dalbehera * signature data should be written. 306fdd65a0fc7df2c878cc601e4c0f4021cb264f051Pravat Dalbehera */ 307fdd65a0fc7df2c878cc601e4c0f4021cb264f051Pravat DalbeheraDrmConvertedStatus* onCloseConvertSession(int uniqueId, int convertId); 308fdd65a0fc7df2c878cc601e4c0f4021cb264f051Pravat Dalbehera 309fdd65a0fc7df2c878cc601e4c0f4021cb264f051Pravat Dalbehera/** 310fdd65a0fc7df2c878cc601e4c0f4021cb264f051Pravat Dalbehera * Returns the information about the Drm Engine capabilities which includes 311fdd65a0fc7df2c878cc601e4c0f4021cb264f051Pravat Dalbehera * supported MimeTypes and file suffixes. 312fdd65a0fc7df2c878cc601e4c0f4021cb264f051Pravat Dalbehera * 313fdd65a0fc7df2c878cc601e4c0f4021cb264f051Pravat Dalbehera * @param uniqueId Unique identifier for a session 314fdd65a0fc7df2c878cc601e4c0f4021cb264f051Pravat Dalbehera * @return DrmSupportInfo 315fdd65a0fc7df2c878cc601e4c0f4021cb264f051Pravat Dalbehera * instance which holds the capabilities of a plug-in 316fdd65a0fc7df2c878cc601e4c0f4021cb264f051Pravat Dalbehera */ 317fdd65a0fc7df2c878cc601e4c0f4021cb264f051Pravat DalbeheraDrmSupportInfo* onGetSupportInfo(int uniqueId); 318fdd65a0fc7df2c878cc601e4c0f4021cb264f051Pravat Dalbehera 319fdd65a0fc7df2c878cc601e4c0f4021cb264f051Pravat Dalbehera/** 320fdd65a0fc7df2c878cc601e4c0f4021cb264f051Pravat Dalbehera * Open the decrypt session to decrypt the given protected content. 321fdd65a0fc7df2c878cc601e4c0f4021cb264f051Pravat Dalbehera * 322fdd65a0fc7df2c878cc601e4c0f4021cb264f051Pravat Dalbehera * @param uniqueId Unique identifier for a session 323fdd65a0fc7df2c878cc601e4c0f4021cb264f051Pravat Dalbehera * @param decryptHandle Handle for the current decryption session 324fdd65a0fc7df2c878cc601e4c0f4021cb264f051Pravat Dalbehera * @param fd File descriptor of the protected content to be decrypted 325fdd65a0fc7df2c878cc601e4c0f4021cb264f051Pravat Dalbehera * @param offset Start position of the content 326fdd65a0fc7df2c878cc601e4c0f4021cb264f051Pravat Dalbehera * @param length The length of the protected content 327fdd65a0fc7df2c878cc601e4c0f4021cb264f051Pravat Dalbehera * @return 328fdd65a0fc7df2c878cc601e4c0f4021cb264f051Pravat Dalbehera * DRM_ERROR_CANNOT_HANDLE for failure and DRM_NO_ERROR for success 329fdd65a0fc7df2c878cc601e4c0f4021cb264f051Pravat Dalbehera */ 330fdd65a0fc7df2c878cc601e4c0f4021cb264f051Pravat Dalbehera#ifdef USE_64BIT_DRM_API 331fdd65a0fc7df2c878cc601e4c0f4021cb264f051Pravat Dalbeherastatus_t onOpenDecryptSession(int uniqueId, 332fdd65a0fc7df2c878cc601e4c0f4021cb264f051Pravat Dalbehera DecryptHandle* decryptHandle, 333fdd65a0fc7df2c878cc601e4c0f4021cb264f051Pravat Dalbehera int fd, off64_t offset, off64_t length); 334fdd65a0fc7df2c878cc601e4c0f4021cb264f051Pravat Dalbehera#else 335fdd65a0fc7df2c878cc601e4c0f4021cb264f051Pravat Dalbeherastatus_t onOpenDecryptSession(int uniqueId, 336fdd65a0fc7df2c878cc601e4c0f4021cb264f051Pravat Dalbehera DecryptHandle* decryptHandle, 337fdd65a0fc7df2c878cc601e4c0f4021cb264f051Pravat Dalbehera int fd, int offset, int length); 338fdd65a0fc7df2c878cc601e4c0f4021cb264f051Pravat Dalbehera#endif 339fdd65a0fc7df2c878cc601e4c0f4021cb264f051Pravat Dalbehera 340fdd65a0fc7df2c878cc601e4c0f4021cb264f051Pravat Dalbehera/** 341fdd65a0fc7df2c878cc601e4c0f4021cb264f051Pravat Dalbehera * Open the decrypt session to decrypt the given protected content. 342fdd65a0fc7df2c878cc601e4c0f4021cb264f051Pravat Dalbehera * 343fdd65a0fc7df2c878cc601e4c0f4021cb264f051Pravat Dalbehera * @param uniqueId Unique identifier for a session 344fdd65a0fc7df2c878cc601e4c0f4021cb264f051Pravat Dalbehera * @param decryptHandle Handle for the current decryption session 345fdd65a0fc7df2c878cc601e4c0f4021cb264f051Pravat Dalbehera * @param uri Path of the protected content to be decrypted 346fdd65a0fc7df2c878cc601e4c0f4021cb264f051Pravat Dalbehera * @return 347fdd65a0fc7df2c878cc601e4c0f4021cb264f051Pravat Dalbehera * DRM_ERROR_CANNOT_HANDLE for failure and DRM_NO_ERROR for success 348fdd65a0fc7df2c878cc601e4c0f4021cb264f051Pravat Dalbehera */ 349fdd65a0fc7df2c878cc601e4c0f4021cb264f051Pravat Dalbeherastatus_t onOpenDecryptSession(int uniqueId, 350fdd65a0fc7df2c878cc601e4c0f4021cb264f051Pravat Dalbehera DecryptHandle* decryptHandle, 351fdd65a0fc7df2c878cc601e4c0f4021cb264f051Pravat Dalbehera const char* uri); 352fdd65a0fc7df2c878cc601e4c0f4021cb264f051Pravat Dalbehera 353fdd65a0fc7df2c878cc601e4c0f4021cb264f051Pravat Dalbehera/** 354fdd65a0fc7df2c878cc601e4c0f4021cb264f051Pravat Dalbehera * Close the decrypt session for the given handle. 355fdd65a0fc7df2c878cc601e4c0f4021cb264f051Pravat Dalbehera * 356fdd65a0fc7df2c878cc601e4c0f4021cb264f051Pravat Dalbehera * @param uniqueId Unique identifier for a session 357fdd65a0fc7df2c878cc601e4c0f4021cb264f051Pravat Dalbehera * @param decryptHandle Handle for the decryption session 358fdd65a0fc7df2c878cc601e4c0f4021cb264f051Pravat Dalbehera * @return status_t 359fdd65a0fc7df2c878cc601e4c0f4021cb264f051Pravat Dalbehera * Returns DRM_NO_ERROR for success, DRM_ERROR_UNKNOWN for failure 360fdd65a0fc7df2c878cc601e4c0f4021cb264f051Pravat Dalbehera */ 361fdd65a0fc7df2c878cc601e4c0f4021cb264f051Pravat Dalbeherastatus_t onCloseDecryptSession(int uniqueId, 362fdd65a0fc7df2c878cc601e4c0f4021cb264f051Pravat Dalbehera DecryptHandle* decryptHandle); 363fdd65a0fc7df2c878cc601e4c0f4021cb264f051Pravat Dalbehera 364fdd65a0fc7df2c878cc601e4c0f4021cb264f051Pravat Dalbehera/** 365fdd65a0fc7df2c878cc601e4c0f4021cb264f051Pravat Dalbehera * Initialize decryption for the given unit of the protected content. 366fdd65a0fc7df2c878cc601e4c0f4021cb264f051Pravat Dalbehera * 367fdd65a0fc7df2c878cc601e4c0f4021cb264f051Pravat Dalbehera * @param uniqueId Unique identifier for a session 368fdd65a0fc7df2c878cc601e4c0f4021cb264f051Pravat Dalbehera * @param decryptHandle Handle for the decryption session 369fdd65a0fc7df2c878cc601e4c0f4021cb264f051Pravat Dalbehera * @param decryptUnitId ID which specifies decryption unit, such as track ID 370fdd65a0fc7df2c878cc601e4c0f4021cb264f051Pravat Dalbehera * @param headerInfo Information for initializing decryption of this decrypUnit 371fdd65a0fc7df2c878cc601e4c0f4021cb264f051Pravat Dalbehera * @return 372fdd65a0fc7df2c878cc601e4c0f4021cb264f051Pravat Dalbehera * DRM_ERROR_CANNOT_HANDLE for failure and DRM_NO_ERROR for success 373fdd65a0fc7df2c878cc601e4c0f4021cb264f051Pravat Dalbehera */ 374fdd65a0fc7df2c878cc601e4c0f4021cb264f051Pravat Dalbeherastatus_t onInitializeDecryptUnit(int uniqueId, 375fdd65a0fc7df2c878cc601e4c0f4021cb264f051Pravat Dalbehera DecryptHandle* decryptHandle, 376fdd65a0fc7df2c878cc601e4c0f4021cb264f051Pravat Dalbehera int decryptUnitId, 377fdd65a0fc7df2c878cc601e4c0f4021cb264f051Pravat Dalbehera const DrmBuffer* headerInfo); 378fdd65a0fc7df2c878cc601e4c0f4021cb264f051Pravat Dalbehera 379fdd65a0fc7df2c878cc601e4c0f4021cb264f051Pravat Dalbehera/** 380fdd65a0fc7df2c878cc601e4c0f4021cb264f051Pravat Dalbehera * Decrypt the protected content buffers for the given unit. 381fdd65a0fc7df2c878cc601e4c0f4021cb264f051Pravat Dalbehera * This method will be called any number of times, based on number of 382fdd65a0fc7df2c878cc601e4c0f4021cb264f051Pravat Dalbehera * encrypted streams received from application. 383fdd65a0fc7df2c878cc601e4c0f4021cb264f051Pravat Dalbehera * 384fdd65a0fc7df2c878cc601e4c0f4021cb264f051Pravat Dalbehera * @param uniqueId Unique identifier for a session 385fdd65a0fc7df2c878cc601e4c0f4021cb264f051Pravat Dalbehera * @param decryptHandle Handle for the decryption session 386fdd65a0fc7df2c878cc601e4c0f4021cb264f051Pravat Dalbehera * @param decryptUnitId ID which specifies decryption unit, such as track ID 387fdd65a0fc7df2c878cc601e4c0f4021cb264f051Pravat Dalbehera * @param encBuffer Encrypted data block 388fdd65a0fc7df2c878cc601e4c0f4021cb264f051Pravat Dalbehera * @param decBuffer Decrypted data block 389fdd65a0fc7df2c878cc601e4c0f4021cb264f051Pravat Dalbehera * @return status_t 390fdd65a0fc7df2c878cc601e4c0f4021cb264f051Pravat Dalbehera * Returns the error code for this API 391fdd65a0fc7df2c878cc601e4c0f4021cb264f051Pravat Dalbehera * DRM_NO_ERROR for success, and one of DRM_ERROR_UNKNOWN, DRM_ERROR_LICENSE_EXPIRED 392fdd65a0fc7df2c878cc601e4c0f4021cb264f051Pravat Dalbehera * DRM_ERROR_SESSION_NOT_OPENED, DRM_ERROR_DECRYPT_UNIT_NOT_INITIALIZED, 393fdd65a0fc7df2c878cc601e4c0f4021cb264f051Pravat Dalbehera * DRM_ERROR_DECRYPT for failure. 394fdd65a0fc7df2c878cc601e4c0f4021cb264f051Pravat Dalbehera */ 395fdd65a0fc7df2c878cc601e4c0f4021cb264f051Pravat Dalbeherastatus_t onDecrypt(int uniqueId, 396fdd65a0fc7df2c878cc601e4c0f4021cb264f051Pravat Dalbehera DecryptHandle* decryptHandle, 397fdd65a0fc7df2c878cc601e4c0f4021cb264f051Pravat Dalbehera int decryptUnitId, 398fdd65a0fc7df2c878cc601e4c0f4021cb264f051Pravat Dalbehera const DrmBuffer* encBuffer, 399fdd65a0fc7df2c878cc601e4c0f4021cb264f051Pravat Dalbehera DrmBuffer** decBuffer); 400fdd65a0fc7df2c878cc601e4c0f4021cb264f051Pravat Dalbehera 401fdd65a0fc7df2c878cc601e4c0f4021cb264f051Pravat Dalbehera/** 402fdd65a0fc7df2c878cc601e4c0f4021cb264f051Pravat Dalbehera * Decrypt the protected content buffers for the given unit. 403fdd65a0fc7df2c878cc601e4c0f4021cb264f051Pravat Dalbehera * This method will be called any number of times, based on number of 404fdd65a0fc7df2c878cc601e4c0f4021cb264f051Pravat Dalbehera * encrypted streams received from application. 405fdd65a0fc7df2c878cc601e4c0f4021cb264f051Pravat Dalbehera * 406fdd65a0fc7df2c878cc601e4c0f4021cb264f051Pravat Dalbehera * @param uniqueId Unique identifier for a session 407fdd65a0fc7df2c878cc601e4c0f4021cb264f051Pravat Dalbehera * @param decryptId Handle for the decryption session 408fdd65a0fc7df2c878cc601e4c0f4021cb264f051Pravat Dalbehera * @param decryptUnitId ID Specifies decryption unit, such as track ID 409fdd65a0fc7df2c878cc601e4c0f4021cb264f051Pravat Dalbehera * @param encBuffer Encrypted data block 410fdd65a0fc7df2c878cc601e4c0f4021cb264f051Pravat Dalbehera * @param decBuffer Decrypted data block 411fdd65a0fc7df2c878cc601e4c0f4021cb264f051Pravat Dalbehera * @param IV Optional buffer 412fdd65a0fc7df2c878cc601e4c0f4021cb264f051Pravat Dalbehera * @return status_t 413fdd65a0fc7df2c878cc601e4c0f4021cb264f051Pravat Dalbehera * Returns the error code for this API 414fdd65a0fc7df2c878cc601e4c0f4021cb264f051Pravat Dalbehera * DRM_NO_ERROR for success, and one of DRM_ERROR_UNKNOWN, DRM_ERROR_LICENSE_EXPIRED 415fdd65a0fc7df2c878cc601e4c0f4021cb264f051Pravat Dalbehera * DRM_ERROR_SESSION_NOT_OPENED, DRM_ERROR_DECRYPT_UNIT_NOT_INITIALIZED, 416fdd65a0fc7df2c878cc601e4c0f4021cb264f051Pravat Dalbehera * DRM_ERROR_DECRYPT for failure. 417fdd65a0fc7df2c878cc601e4c0f4021cb264f051Pravat Dalbehera */ 418fdd65a0fc7df2c878cc601e4c0f4021cb264f051Pravat Dalbeherastatus_t onDecrypt(int uniqueId, DecryptHandle* decryptHandle, 419fdd65a0fc7df2c878cc601e4c0f4021cb264f051Pravat Dalbehera int decryptUnitId, const DrmBuffer* encBuffer, 420fdd65a0fc7df2c878cc601e4c0f4021cb264f051Pravat Dalbehera DrmBuffer** decBuffer, DrmBuffer* IV); 421fdd65a0fc7df2c878cc601e4c0f4021cb264f051Pravat Dalbehera 422fdd65a0fc7df2c878cc601e4c0f4021cb264f051Pravat Dalbehera/** 423fdd65a0fc7df2c878cc601e4c0f4021cb264f051Pravat Dalbehera * Finalize decryption for the given unit of the protected content. 424fdd65a0fc7df2c878cc601e4c0f4021cb264f051Pravat Dalbehera * 425fdd65a0fc7df2c878cc601e4c0f4021cb264f051Pravat Dalbehera * @param uniqueId Unique identifier for a session 426fdd65a0fc7df2c878cc601e4c0f4021cb264f051Pravat Dalbehera * @param decryptHandle Handle for the decryption session 427fdd65a0fc7df2c878cc601e4c0f4021cb264f051Pravat Dalbehera * @param decryptUnitId ID Specifies decryption unit, such as track ID 428fdd65a0fc7df2c878cc601e4c0f4021cb264f051Pravat Dalbehera * @return 429fdd65a0fc7df2c878cc601e4c0f4021cb264f051Pravat Dalbehera * DRM_ERROR_CANNOT_HANDLE for failure and DRM_NO_ERROR for success 430fdd65a0fc7df2c878cc601e4c0f4021cb264f051Pravat Dalbehera */ 431fdd65a0fc7df2c878cc601e4c0f4021cb264f051Pravat Dalbeherastatus_t onFinalizeDecryptUnit(int uniqueId, 432fdd65a0fc7df2c878cc601e4c0f4021cb264f051Pravat Dalbehera DecryptHandle* decryptHandle, 433fdd65a0fc7df2c878cc601e4c0f4021cb264f051Pravat Dalbehera int decryptUnitId); 434fdd65a0fc7df2c878cc601e4c0f4021cb264f051Pravat Dalbehera 435fdd65a0fc7df2c878cc601e4c0f4021cb264f051Pravat Dalbehera/** 436fdd65a0fc7df2c878cc601e4c0f4021cb264f051Pravat Dalbehera * Reads the specified number of bytes from an open DRM file. 437fdd65a0fc7df2c878cc601e4c0f4021cb264f051Pravat Dalbehera * 438fdd65a0fc7df2c878cc601e4c0f4021cb264f051Pravat Dalbehera * @param uniqueId Unique identifier for a session 439fdd65a0fc7df2c878cc601e4c0f4021cb264f051Pravat Dalbehera * @param decryptHandle Handle for the decryption session 440fdd65a0fc7df2c878cc601e4c0f4021cb264f051Pravat Dalbehera * @param buffer Reference to the buffer that should receive the read data. 441fdd65a0fc7df2c878cc601e4c0f4021cb264f051Pravat Dalbehera * @param numBytes Number of bytes to read. 442fdd65a0fc7df2c878cc601e4c0f4021cb264f051Pravat Dalbehera * 443fdd65a0fc7df2c878cc601e4c0f4021cb264f051Pravat Dalbehera * @return Number of bytes read. 444fdd65a0fc7df2c878cc601e4c0f4021cb264f051Pravat Dalbehera * @retval -1 Failure. 445fdd65a0fc7df2c878cc601e4c0f4021cb264f051Pravat Dalbehera */ 446fdd65a0fc7df2c878cc601e4c0f4021cb264f051Pravat Dalbeherassize_t onRead(int uniqueId, 447fdd65a0fc7df2c878cc601e4c0f4021cb264f051Pravat Dalbehera DecryptHandle* decryptHandle, 448fdd65a0fc7df2c878cc601e4c0f4021cb264f051Pravat Dalbehera void* pBuffer, 449fdd65a0fc7df2c878cc601e4c0f4021cb264f051Pravat Dalbehera int numBytes); 450fdd65a0fc7df2c878cc601e4c0f4021cb264f051Pravat Dalbehera 451fdd65a0fc7df2c878cc601e4c0f4021cb264f051Pravat Dalbehera/** 452fdd65a0fc7df2c878cc601e4c0f4021cb264f051Pravat Dalbehera * Updates the file position within an open DRM file. 453fdd65a0fc7df2c878cc601e4c0f4021cb264f051Pravat Dalbehera * 454fdd65a0fc7df2c878cc601e4c0f4021cb264f051Pravat Dalbehera * @param uniqueId Unique identifier for a session 455fdd65a0fc7df2c878cc601e4c0f4021cb264f051Pravat Dalbehera * @param decryptHandle Handle for the decryption session 456fdd65a0fc7df2c878cc601e4c0f4021cb264f051Pravat Dalbehera * @param offset Offset with which to update the file position. 457fdd65a0fc7df2c878cc601e4c0f4021cb264f051Pravat Dalbehera * @param whence One of SEEK_SET, SEEK_CUR, and SEEK_END. 458fdd65a0fc7df2c878cc601e4c0f4021cb264f051Pravat Dalbehera * These constants are defined in unistd.h. 459fdd65a0fc7df2c878cc601e4c0f4021cb264f051Pravat Dalbehera * 460fdd65a0fc7df2c878cc601e4c0f4021cb264f051Pravat Dalbehera * @return New file position. 461fdd65a0fc7df2c878cc601e4c0f4021cb264f051Pravat Dalbehera * @retval ((off_t)-1) Failure. 462fdd65a0fc7df2c878cc601e4c0f4021cb264f051Pravat Dalbehera */ 463fdd65a0fc7df2c878cc601e4c0f4021cb264f051Pravat Dalbehera#ifdef USE_64BIT_DRM_API 464fdd65a0fc7df2c878cc601e4c0f4021cb264f051Pravat Dalbeheraoff64_t onLseek(int uniqueId, 465fdd65a0fc7df2c878cc601e4c0f4021cb264f051Pravat Dalbehera DecryptHandle* decryptHandle, 466fdd65a0fc7df2c878cc601e4c0f4021cb264f051Pravat Dalbehera off64_t offset, 467fdd65a0fc7df2c878cc601e4c0f4021cb264f051Pravat Dalbehera int whence); 468fdd65a0fc7df2c878cc601e4c0f4021cb264f051Pravat Dalbehera#else 469fdd65a0fc7df2c878cc601e4c0f4021cb264f051Pravat Dalbeheraoff_t onLseek(int uniqueId, 470fdd65a0fc7df2c878cc601e4c0f4021cb264f051Pravat Dalbehera DecryptHandle* decryptHandle, 471fdd65a0fc7df2c878cc601e4c0f4021cb264f051Pravat Dalbehera off_t offset, 472fdd65a0fc7df2c878cc601e4c0f4021cb264f051Pravat Dalbehera int whence); 473fdd65a0fc7df2c878cc601e4c0f4021cb264f051Pravat Dalbehera#endif 474fdd65a0fc7df2c878cc601e4c0f4021cb264f051Pravat Dalbehera 475fdd65a0fc7df2c878cc601e4c0f4021cb264f051Pravat Dalbehera/** 476fdd65a0fc7df2c878cc601e4c0f4021cb264f051Pravat Dalbehera * Reads the specified number of bytes from an open DRM file. 477fdd65a0fc7df2c878cc601e4c0f4021cb264f051Pravat Dalbehera * 478fdd65a0fc7df2c878cc601e4c0f4021cb264f051Pravat Dalbehera * @param uniqueId Unique identifier for a session 479fdd65a0fc7df2c878cc601e4c0f4021cb264f051Pravat Dalbehera * @param decryptHandle Handle for the decryption session 480fdd65a0fc7df2c878cc601e4c0f4021cb264f051Pravat Dalbehera * @param buffer Reference to the buffer that should receive the read data. 481fdd65a0fc7df2c878cc601e4c0f4021cb264f051Pravat Dalbehera * @param numBytes Number of bytes to read. 482fdd65a0fc7df2c878cc601e4c0f4021cb264f051Pravat Dalbehera * @param offset Offset with which to update the file position. 483fdd65a0fc7df2c878cc601e4c0f4021cb264f051Pravat Dalbehera * 484fdd65a0fc7df2c878cc601e4c0f4021cb264f051Pravat Dalbehera * @return Number of bytes read. Returns -1 for Failure. 485fdd65a0fc7df2c878cc601e4c0f4021cb264f051Pravat Dalbehera */ 486fdd65a0fc7df2c878cc601e4c0f4021cb264f051Pravat Dalbehera#ifdef USE_64BIT_DRM_API 487fdd65a0fc7df2c878cc601e4c0f4021cb264f051Pravat Dalbeherassize_t onPread(int uniqueId, 488fdd65a0fc7df2c878cc601e4c0f4021cb264f051Pravat Dalbehera DecryptHandle* decryptHandle, 489fdd65a0fc7df2c878cc601e4c0f4021cb264f051Pravat Dalbehera void* buffer, 490fdd65a0fc7df2c878cc601e4c0f4021cb264f051Pravat Dalbehera ssize_t numBytes, 491fdd65a0fc7df2c878cc601e4c0f4021cb264f051Pravat Dalbehera off64_t offset); 492fdd65a0fc7df2c878cc601e4c0f4021cb264f051Pravat Dalbehera#else 493fdd65a0fc7df2c878cc601e4c0f4021cb264f051Pravat Dalbeherassize_t onPread(int uniqueId, 494fdd65a0fc7df2c878cc601e4c0f4021cb264f051Pravat Dalbehera DecryptHandle* decryptHandle, 495fdd65a0fc7df2c878cc601e4c0f4021cb264f051Pravat Dalbehera void* buffer, 496fdd65a0fc7df2c878cc601e4c0f4021cb264f051Pravat Dalbehera ssize_t numBytes, 497fdd65a0fc7df2c878cc601e4c0f4021cb264f051Pravat Dalbehera off_t offset); 498fdd65a0fc7df2c878cc601e4c0f4021cb264f051Pravat Dalbehera#endif 499fdd65a0fc7df2c878cc601e4c0f4021cb264f051Pravat Dalbehera 500fdd65a0fc7df2c878cc601e4c0f4021cb264f051Pravat Dalbeheraprivate: 501fdd65a0fc7df2c878cc601e4c0f4021cb264f051Pravat Dalbehera 502fdd65a0fc7df2c878cc601e4c0f4021cb264f051Pravat Dalbehera/** 503fdd65a0fc7df2c878cc601e4c0f4021cb264f051Pravat Dalbehera * Session Class for Forward Lock Conversion. An object of this class is created 504fdd65a0fc7df2c878cc601e4c0f4021cb264f051Pravat Dalbehera * for every conversion. 505fdd65a0fc7df2c878cc601e4c0f4021cb264f051Pravat Dalbehera */ 506fdd65a0fc7df2c878cc601e4c0f4021cb264f051Pravat Dalbeheraclass ConvertSession { 507fdd65a0fc7df2c878cc601e4c0f4021cb264f051Pravat Dalbehera public : 508fdd65a0fc7df2c878cc601e4c0f4021cb264f051Pravat Dalbehera int uniqueId; 509fdd65a0fc7df2c878cc601e4c0f4021cb264f051Pravat Dalbehera FwdLockConv_Output_t output; 510fdd65a0fc7df2c878cc601e4c0f4021cb264f051Pravat Dalbehera 511fdd65a0fc7df2c878cc601e4c0f4021cb264f051Pravat Dalbehera ConvertSession() { 512fdd65a0fc7df2c878cc601e4c0f4021cb264f051Pravat Dalbehera uniqueId = 0; 513fdd65a0fc7df2c878cc601e4c0f4021cb264f051Pravat Dalbehera memset(&output, 0, sizeof(FwdLockConv_Output_t)); 514fdd65a0fc7df2c878cc601e4c0f4021cb264f051Pravat Dalbehera } 515fdd65a0fc7df2c878cc601e4c0f4021cb264f051Pravat Dalbehera 516fdd65a0fc7df2c878cc601e4c0f4021cb264f051Pravat Dalbehera virtual ~ConvertSession() {} 517fdd65a0fc7df2c878cc601e4c0f4021cb264f051Pravat Dalbehera}; 518fdd65a0fc7df2c878cc601e4c0f4021cb264f051Pravat Dalbehera 519fdd65a0fc7df2c878cc601e4c0f4021cb264f051Pravat Dalbehera/** 520fdd65a0fc7df2c878cc601e4c0f4021cb264f051Pravat Dalbehera * Session Class for Forward Lock decoder. An object of this class is created 521fdd65a0fc7df2c878cc601e4c0f4021cb264f051Pravat Dalbehera * for every decoding session. 522fdd65a0fc7df2c878cc601e4c0f4021cb264f051Pravat Dalbehera */ 523fdd65a0fc7df2c878cc601e4c0f4021cb264f051Pravat Dalbeheraclass DecodeSession { 524fdd65a0fc7df2c878cc601e4c0f4021cb264f051Pravat Dalbehera public : 525fdd65a0fc7df2c878cc601e4c0f4021cb264f051Pravat Dalbehera int fileDesc; 526fdd65a0fc7df2c878cc601e4c0f4021cb264f051Pravat Dalbehera off_t offset; 527fdd65a0fc7df2c878cc601e4c0f4021cb264f051Pravat Dalbehera 528fdd65a0fc7df2c878cc601e4c0f4021cb264f051Pravat Dalbehera DecodeSession() { 529fdd65a0fc7df2c878cc601e4c0f4021cb264f051Pravat Dalbehera fileDesc = -1; 530fdd65a0fc7df2c878cc601e4c0f4021cb264f051Pravat Dalbehera offset = 0; 531fdd65a0fc7df2c878cc601e4c0f4021cb264f051Pravat Dalbehera } 532fdd65a0fc7df2c878cc601e4c0f4021cb264f051Pravat Dalbehera 533fdd65a0fc7df2c878cc601e4c0f4021cb264f051Pravat Dalbehera DecodeSession(int fd) { 534fdd65a0fc7df2c878cc601e4c0f4021cb264f051Pravat Dalbehera fileDesc = fd; 535fdd65a0fc7df2c878cc601e4c0f4021cb264f051Pravat Dalbehera offset = 0; 536fdd65a0fc7df2c878cc601e4c0f4021cb264f051Pravat Dalbehera } 537fdd65a0fc7df2c878cc601e4c0f4021cb264f051Pravat Dalbehera 538fdd65a0fc7df2c878cc601e4c0f4021cb264f051Pravat Dalbehera virtual ~DecodeSession() {} 539fdd65a0fc7df2c878cc601e4c0f4021cb264f051Pravat Dalbehera}; 540fdd65a0fc7df2c878cc601e4c0f4021cb264f051Pravat Dalbehera 541fdd65a0fc7df2c878cc601e4c0f4021cb264f051Pravat Dalbehera/** 542fdd65a0fc7df2c878cc601e4c0f4021cb264f051Pravat Dalbehera * Session Map Tables for Conversion and Decoding of forward lock files. 543fdd65a0fc7df2c878cc601e4c0f4021cb264f051Pravat Dalbehera */ 544fdd65a0fc7df2c878cc601e4c0f4021cb264f051Pravat DalbeheraSessionMap<ConvertSession*> convertSessionMap; 545fdd65a0fc7df2c878cc601e4c0f4021cb264f051Pravat DalbeheraSessionMap<DecodeSession*> decodeSessionMap; 546fdd65a0fc7df2c878cc601e4c0f4021cb264f051Pravat Dalbehera 547fdd65a0fc7df2c878cc601e4c0f4021cb264f051Pravat Dalbehera/** 548fdd65a0fc7df2c878cc601e4c0f4021cb264f051Pravat Dalbehera * Converts the error code from Forward Lock Converter to DrmConvertStatus error code. 549fdd65a0fc7df2c878cc601e4c0f4021cb264f051Pravat Dalbehera * 550fdd65a0fc7df2c878cc601e4c0f4021cb264f051Pravat Dalbehera * @param Forward Lock Converter error code 551fdd65a0fc7df2c878cc601e4c0f4021cb264f051Pravat Dalbehera * 552fdd65a0fc7df2c878cc601e4c0f4021cb264f051Pravat Dalbehera * @return Status code from DrmConvertStatus. 553fdd65a0fc7df2c878cc601e4c0f4021cb264f051Pravat Dalbehera */ 554fdd65a0fc7df2c878cc601e4c0f4021cb264f051Pravat Dalbeherastatic int getConvertedStatus(FwdLockConv_Status_t status); 555fdd65a0fc7df2c878cc601e4c0f4021cb264f051Pravat Dalbehera}; 556fdd65a0fc7df2c878cc601e4c0f4021cb264f051Pravat Dalbehera 557fdd65a0fc7df2c878cc601e4c0f4021cb264f051Pravat Dalbehera}; 558fdd65a0fc7df2c878cc601e4c0f4021cb264f051Pravat Dalbehera 559fdd65a0fc7df2c878cc601e4c0f4021cb264f051Pravat Dalbehera#endif /* __FWDLOCKENGINE_H__ */ 560