1 /* 2 * Copyright (c) 2023 Huawei Device Co., Ltd. 3 * Licensed under the Apache License, Version 2.0 (the "License"); 4 * you may not use this file except in compliance with the License. 5 * You may obtain a copy of the License at 6 * 7 * http://www.apache.org/licenses/LICENSE-2.0 8 * 9 * Unless required by applicable law or agreed to in writing, software 10 * distributed under the License is distributed on an "AS IS" BASIS, 11 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 12 * See the License for the specific language governing permissions and 13 * limitations under the License. 14 */ 15 16 #ifndef OHOS_DRM_I_MEDIA_KEY_SYSTEM_SERVICE_H 17 #define OHOS_DRM_I_MEDIA_KEY_SYSTEM_SERVICE_H 18 19 #include "ipc_types.h" 20 #include "iremote_broker.h" 21 #include "iremote_proxy.h" 22 #include "iremote_stub.h" 23 #include "i_keysession_service.h" 24 #include "i_mediakeysystem_service_callback.h" 25 26 namespace OHOS { 27 namespace DrmStandard { 28 class IMediaKeySystemService : public IRemoteBroker { 29 public: 30 enum HdcpLevel { 31 HDCP_UNKNOWN, 32 HDCP_NONE, 33 HDCP_V1, 34 HDCP_V2, 35 HDCP_V2_1, 36 HDCP_V2_2, 37 HDCP_V2_3, 38 HDCP_NO_OUTPUT = 0x7fff, 39 }; 40 41 enum AdcpLevel { 42 ADCP_UNKNOWN = 0, 43 ADCP_V1_L1, 44 ADCP_V1_L2, 45 ADCP_V1_L3, 46 ADCP_NO_OUTPUT = 0x7fff, 47 }; 48 49 enum CertificateStatus { 50 CERT_STATUS_PROVISIONED = 0, 51 CERT_STATUS_NOT_PROVISIONED, 52 CERT_STATUS_EXPIRED, 53 CERT_STATUS_INVALID, 54 CERT_STATUS_UNAVAILABLE, 55 }; 56 57 struct MetircKeyValue { 58 std::string name; 59 std::string value; 60 }; 61 62 virtual ~IMediaKeySystemService() = default; 63 virtual int32_t Release() = 0; 64 virtual int32_t GenerateKeySystemRequest(std::vector<uint8_t> &request, std::string &defaultUrl) = 0; 65 virtual int32_t ProcessKeySystemResponse(const std::vector<uint8_t> &response) = 0; 66 virtual int32_t SetConfigurationString(std::string &configName, std::string &value) = 0; 67 virtual int32_t GetConfigurationString(std::string &configName, std::string &value) = 0; 68 virtual int32_t SetConfigurationByteArray(std::string &configName, std::vector<uint8_t> &value) = 0; 69 virtual int32_t GetConfigurationByteArray(std::string &configName, std::vector<uint8_t> &value) = 0; 70 virtual int32_t CreateMediaKeySession(IMediaKeySessionService::ContentProtectionLevel securityLevel, 71 sptr<IMediaKeySessionService> &keySessionProxy) = 0; 72 virtual int32_t GetStatistics(std::vector<IMediaKeySystemService::MetircKeyValue> &metrics) = 0; 73 virtual int32_t GetMaxContentProtectionLevel(IMediaKeySessionService::ContentProtectionLevel *securityLevel) = 0; 74 virtual int32_t GetCertificateStatus(IMediaKeySystemService::CertificateStatus *certStatus) = 0; 75 virtual int32_t GetOfflineMediaKeyIds(std::vector<std::vector<uint8_t>> &licenseIds) = 0; 76 virtual int32_t GetOfflineMediaKeyStatus(std::vector<uint8_t> &licenseId, 77 IMediaKeySessionService::OfflineMediaKeyStatus &status) = 0; 78 virtual int32_t ClearOfflineMediaKeys(std::vector<uint8_t> &licenseId) = 0; 79 virtual int32_t SetListenerObject(const sptr<IRemoteObject> &object) = 0; 80 virtual int32_t SetCallback(sptr<IMediaKeySystemServiceCallback> &callback) = 0; 81 DECLARE_INTERFACE_DESCRIPTOR(u"IMediaKeySystemSystemService"); 82 }; 83 } // DrmStandard 84 } // OHOS 85 #endif // OHOS_DRM_I_MEDIA_KEY_SYSTEM_SERVICE_H 86