1 /* 2 * Copyright (C) 2010 The Android Open Source Project 3 * 4 * Licensed under the Apache License, Version 2.0 (the "License"); 5 * you may not use this file except in compliance with the License. 6 * You may obtain a copy of the License at 7 * 8 * http://www.apache.org/licenses/LICENSE-2.0 9 * 10 * Unless required by applicable law or agreed to in writing, software 11 * distributed under the License is distributed on an "AS IS" BASIS, 12 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 * See the License for the specific language governing permissions and 14 * limitations under the License. 15 */ 16 17 #ifndef __DRM_PASSTHRU_PLUGIN_H__ 18 #define __DRM_PASSTHRU_PLUGIN_H__ 19 20 #include <DrmEngineBase.h> 21 22 namespace android { 23 24 class DrmPassthruPlugIn : public DrmEngineBase { 25 26 public: 27 DrmPassthruPlugIn(); 28 virtual ~DrmPassthruPlugIn(); 29 30 protected: 31 DrmConstraints* onGetConstraints(int uniqueId, const String8* path, int action); 32 33 DrmMetadata* onGetMetadata(int uniqueId, const String8* path); 34 35 status_t onInitialize(int uniqueId); 36 37 status_t onSetOnInfoListener(int uniqueId, const IDrmEngine::OnInfoListener* infoListener); 38 39 status_t onTerminate(int uniqueId); 40 41 bool onCanHandle(int uniqueId, const String8& path); 42 43 DrmInfoStatus* onProcessDrmInfo(int uniqueId, const DrmInfo* drmInfo); 44 45 status_t onSaveRights(int uniqueId, const DrmRights& drmRights, 46 const String8& rightsPath, const String8& contentPath); 47 48 DrmInfo* onAcquireDrmInfo(int uniqueId, const DrmInfoRequest* drmInfoRequest); 49 50 String8 onGetOriginalMimeType(int uniqueId, const String8& path, int fd); 51 52 int onGetDrmObjectType(int uniqueId, const String8& path, const String8& mimeType); 53 54 int onCheckRightsStatus(int uniqueId, const String8& path, int action); 55 56 status_t onConsumeRights(int uniqueId, sp<DecryptHandle>& decryptHandle, 57 int action, bool reserve); 58 59 status_t onSetPlaybackStatus( 60 int uniqueId, sp<DecryptHandle>& decryptHandle, int playbackStatus, int64_t position); 61 62 bool onValidateAction( 63 int uniqueId, const String8& path, int action, const ActionDescription& description); 64 65 status_t onRemoveRights(int uniqueId, const String8& path); 66 67 status_t onRemoveAllRights(int uniqueId); 68 69 status_t onOpenConvertSession(int uniqueId, int convertId); 70 71 DrmConvertedStatus* onConvertData(int uniqueId, int convertId, const DrmBuffer* inputData); 72 73 DrmConvertedStatus* onCloseConvertSession(int uniqueId, int convertId); 74 75 DrmSupportInfo* onGetSupportInfo(int uniqueId); 76 77 status_t onOpenDecryptSession( 78 int uniqueId, sp<DecryptHandle>& decryptHandle, int fd, off64_t offset, 79 off64_t length); 80 81 status_t onOpenDecryptSession( 82 int uniqueId, sp<DecryptHandle>& decryptHandle, const char* uri); 83 84 status_t onCloseDecryptSession(int uniqueId, sp<DecryptHandle>& decryptHandle); 85 86 status_t onInitializeDecryptUnit(int uniqueId, sp<DecryptHandle>& decryptHandle, 87 int decryptUnitId, const DrmBuffer* headerInfo); 88 89 status_t onDecrypt(int uniqueId, sp<DecryptHandle>& decryptHandle, int decryptUnitId, 90 const DrmBuffer* encBuffer, DrmBuffer** decBuffer, DrmBuffer* IV); 91 92 status_t onFinalizeDecryptUnit(int uniqueId, sp<DecryptHandle>& decryptHandle, 93 int decryptUnitId); 94 95 ssize_t onPread(int uniqueId, sp<DecryptHandle>& decryptHandle, 96 void* buffer, ssize_t numBytes, off64_t offset); 97 }; 98 99 }; 100 101 #endif /* __DRM_PASSTHRU_PLUGIN_H__ */ 102 103