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 #include "ohos_adapter/bridge/ark_audio_cenc_info_adapter_impl.h" 17 #include "base/include/ark_web_types.h" 18 19 namespace OHOS::ArkWeb { 20 ArkAudioCencInfoAdapterImpl(std::shared_ptr<OHOS::NWeb::AudioCencInfoAdapter> ref)21ArkAudioCencInfoAdapterImpl::ArkAudioCencInfoAdapterImpl(std::shared_ptr<OHOS::NWeb::AudioCencInfoAdapter> ref) 22 : real_(ref) 23 {} 24 GetKeyId()25uint8_t* ArkAudioCencInfoAdapterImpl::GetKeyId() 26 { 27 return real_->GetKeyId(); 28 } 29 GetKeyIdLen()30uint32_t ArkAudioCencInfoAdapterImpl::GetKeyIdLen() 31 { 32 return real_->GetKeyIdLen(); 33 } 34 GetIv()35uint8_t* ArkAudioCencInfoAdapterImpl::GetIv() 36 { 37 return real_->GetIv(); 38 } 39 GetIvLen()40uint32_t ArkAudioCencInfoAdapterImpl::GetIvLen() 41 { 42 return real_->GetIvLen(); 43 } 44 GetAlgo()45uint32_t ArkAudioCencInfoAdapterImpl::GetAlgo() 46 { 47 return real_->GetAlgo(); 48 } 49 GetEncryptedBlockCount()50uint32_t ArkAudioCencInfoAdapterImpl::GetEncryptedBlockCount() 51 { 52 return real_->GetEncryptedBlockCount(); 53 } 54 GetSkippedBlockCount()55uint32_t ArkAudioCencInfoAdapterImpl::GetSkippedBlockCount() 56 { 57 return real_->GetSkippedBlockCount(); 58 } 59 GetFirstEncryptedOffset()60uint32_t ArkAudioCencInfoAdapterImpl::GetFirstEncryptedOffset() 61 { 62 return real_->GetFirstEncryptedOffset(); 63 } 64 GetClearHeaderLens()65ArkWebUint32Vector ArkAudioCencInfoAdapterImpl::GetClearHeaderLens() 66 { 67 return ArkWebBasicVectorClassToStruct<uint32_t, ArkWebUint32Vector>(real_->GetClearHeaderLens()); 68 } 69 GetPayLoadLens()70ArkWebUint32Vector ArkAudioCencInfoAdapterImpl::GetPayLoadLens() 71 { 72 return ArkWebBasicVectorClassToStruct<uint32_t, ArkWebUint32Vector>(real_->GetPayLoadLens()); 73 } 74 GetMode()75uint32_t ArkAudioCencInfoAdapterImpl::GetMode() 76 { 77 return real_->GetMode(); 78 } 79 SetKeyId(uint8_t * keyId)80void ArkAudioCencInfoAdapterImpl::SetKeyId(uint8_t* keyId) 81 { 82 real_->SetKeyId(keyId); 83 } 84 SetKeyIdLen(uint32_t keyIdLen)85void ArkAudioCencInfoAdapterImpl::SetKeyIdLen(uint32_t keyIdLen) 86 { 87 real_->SetKeyIdLen(keyIdLen); 88 } 89 SetIv(uint8_t * iv)90void ArkAudioCencInfoAdapterImpl::SetIv(uint8_t* iv) 91 { 92 real_->SetIv(iv); 93 } 94 SetIvLen(uint32_t ivLen)95void ArkAudioCencInfoAdapterImpl::SetIvLen(uint32_t ivLen) 96 { 97 real_->SetIvLen(ivLen); 98 } 99 SetAlgo(uint32_t algo)100void ArkAudioCencInfoAdapterImpl::SetAlgo(uint32_t algo) 101 { 102 real_->SetAlgo(algo); 103 } 104 SetEncryptedBlockCount(uint32_t count)105void ArkAudioCencInfoAdapterImpl::SetEncryptedBlockCount(uint32_t count) 106 { 107 real_->SetEncryptedBlockCount(count); 108 } 109 SetSkippedBlockCount(uint32_t count)110void ArkAudioCencInfoAdapterImpl::SetSkippedBlockCount(uint32_t count) 111 { 112 real_->SetSkippedBlockCount(count); 113 } 114 SetFirstEncryptedOffset(uint32_t offset)115void ArkAudioCencInfoAdapterImpl::SetFirstEncryptedOffset(uint32_t offset) 116 { 117 real_->SetFirstEncryptedOffset(offset); 118 } 119 SetClearHeaderLens(const ArkWebUint32Vector & clearHeaderLens)120void ArkAudioCencInfoAdapterImpl::SetClearHeaderLens(const ArkWebUint32Vector& clearHeaderLens) 121 { 122 real_->SetClearHeaderLens(ArkWebBasicVectorStructToClass<uint32_t, ArkWebUint32Vector>(clearHeaderLens)); 123 } 124 SetPayLoadLens(const ArkWebUint32Vector & payLoadLens)125void ArkAudioCencInfoAdapterImpl::SetPayLoadLens(const ArkWebUint32Vector& payLoadLens) 126 { 127 real_->SetPayLoadLens(ArkWebBasicVectorStructToClass<uint32_t, ArkWebUint32Vector>(payLoadLens)); 128 } 129 SetMode(uint32_t mode)130void ArkAudioCencInfoAdapterImpl::SetMode(uint32_t mode) 131 { 132 real_->SetMode(mode); 133 } 134 135 } // namespace OHOS::NWeb 136