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_HDI_DRM_V1_0_MEDIADECRYPTMODULEPROXY_H
17 #define OHOS_HDI_DRM_V1_0_MEDIADECRYPTMODULEPROXY_H
18 
19 #include "v1_0/imedia_decrypt_module.h"
20 #include <iproxy_broker.h>
21 
22 namespace OHOS {
23 namespace HDI {
24 namespace Drm {
25 namespace V1_0 {
26 
27 class MediaDecryptModuleProxy : public IProxyBroker<OHOS::HDI::Drm::V1_0::IMediaDecryptModule> {
28 public:
MediaDecryptModuleProxy(const sptr<IRemoteObject> & remote)29     explicit MediaDecryptModuleProxy(const sptr<IRemoteObject>& remote) : IProxyBroker<OHOS::HDI::Drm::V1_0::IMediaDecryptModule>(remote) {}
30 
31     virtual ~MediaDecryptModuleProxy() = default;
32 
IsProxy()33     inline bool IsProxy() override
34     {
35         return true;
36     }
37 
38     int32_t DecryptMediaData(bool secure, const OHOS::HDI::Drm::V1_0::CryptoInfo& cryptoInfo,
39          const OHOS::HDI::Drm::V1_0::DrmBuffer& srcBuffer, const OHOS::HDI::Drm::V1_0::DrmBuffer& destBuffer) override;
40 
41     int32_t Release() override;
42 
43     int32_t GetVersion(uint32_t& majorVer, uint32_t& minorVer) override;
44 
45     static int32_t DecryptMediaData_(bool secure, const OHOS::HDI::Drm::V1_0::CryptoInfo& cryptoInfo,
46          const OHOS::HDI::Drm::V1_0::DrmBuffer& srcBuffer, const OHOS::HDI::Drm::V1_0::DrmBuffer& destBuffer, const sptr<IRemoteObject> remote);
47 
48     static int32_t Release_(const sptr<IRemoteObject> remote);
49 
50     static int32_t GetVersion_(uint32_t& majorVer, uint32_t& minorVer, const sptr<IRemoteObject> remote);
51 
52 private:
53     static inline BrokerDelegator<OHOS::HDI::Drm::V1_0::MediaDecryptModuleProxy> delegator_;
54 };
55 
56 } // V1_0
57 } // Drm
58 } // HDI
59 } // OHOS
60 
61 #endif // OHOS_HDI_DRM_V1_0_MEDIADECRYPTMODULEPROXY_H