1 /* 2 * Copyright (c) 2025 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 ARK_AUDIO_CENC_INFO_ADAPTER_IMPL_H 17 #define ARK_AUDIO_CENC_INFO_ADAPTER_IMPL_H 18 #pragma once 19 20 #include "audio_cenc_info_adapter.h" 21 #include "ohos_adapter/include/ark_audio_codec_decoder_adapter.h" 22 23 namespace OHOS::ArkWeb { 24 25 class ArkAudioCencInfoAdapterImpl : public ArkAudioCencInfoAdapter { 26 public: 27 explicit ArkAudioCencInfoAdapterImpl(std::shared_ptr<OHOS::NWeb::AudioCencInfoAdapter> ref); 28 29 uint8_t* GetKeyId() override; 30 31 uint32_t GetKeyIdLen() override; 32 33 uint8_t* GetIv() override; 34 35 uint32_t GetIvLen() override; 36 37 uint32_t GetAlgo() override; 38 39 uint32_t GetEncryptedBlockCount() override; 40 41 uint32_t GetSkippedBlockCount() override; 42 43 uint32_t GetFirstEncryptedOffset() override; 44 45 ArkWebUint32Vector GetClearHeaderLens() override; 46 47 ArkWebUint32Vector GetPayLoadLens() override; 48 49 uint32_t GetMode() override; 50 51 void SetKeyId(uint8_t* keyId) override; 52 53 void SetKeyIdLen(uint32_t keyIdLen) override; 54 55 void SetIv(uint8_t* iv) override; 56 57 void SetIvLen(uint32_t ivLen) override; 58 59 void SetAlgo(uint32_t algo) override; 60 61 void SetEncryptedBlockCount(uint32_t blockCount) override; 62 63 void SetSkippedBlockCount(uint32_t blockCount) override; 64 65 void SetFirstEncryptedOffset(uint32_t offset) override; 66 67 void SetClearHeaderLens(const ArkWebUint32Vector& lens) override; 68 69 void SetPayLoadLens(const ArkWebUint32Vector& lens) override; 70 71 void SetMode(uint32_t mode) override; 72 73 private: 74 std::shared_ptr<OHOS::NWeb::AudioCencInfoAdapter> real_; 75 76 IMPLEMENT_REFCOUNTING(ArkAudioCencInfoAdapterImpl); 77 }; 78 79 } // namespace OHOS::ArkWeb 80 81 #endif // ARK_AUDIO_CENC_INFO_ADAPTER_IMPL_H 82