• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
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_buffer_adapter_impl.h"
17 #include "base/bridge/ark_web_bridge_macros.h"
18 
19 namespace OHOS::ArkWeb {
ArkAudioBufferAdapterImpl(std::shared_ptr<OHOS::NWeb::AudioBufferAdapter> ref)20 ArkAudioBufferAdapterImpl::ArkAudioBufferAdapterImpl(
21     std::shared_ptr<OHOS::NWeb::AudioBufferAdapter> ref)
22     : real_(ref)
23 {}
24 
GetBuffer()25 uint8_t* ArkAudioBufferAdapterImpl::GetBuffer()
26 {
27     return (uint8_t*)real_->GetBuffer();
28 }
29 
GetLength()30 int32_t ArkAudioBufferAdapterImpl::GetLength()
31 {
32     return (int32_t)real_->GetLength();
33 }
34 
GetTimestamp()35 int64_t ArkAudioBufferAdapterImpl::GetTimestamp()
36 {
37     return (int64_t)real_->GetTimestamp();
38 }
39 
GetSourcetype()40 int32_t ArkAudioBufferAdapterImpl::GetSourcetype()
41 {
42     return (int32_t)real_->GetSourcetype();
43 }
44 
SetBuffer(uint8_t * buffer)45 void ArkAudioBufferAdapterImpl::SetBuffer(uint8_t* buffer)
46 {
47     real_->SetBuffer(buffer);
48 }
49 
SetLength(int32_t length)50 void ArkAudioBufferAdapterImpl::SetLength(int32_t length)
51 {
52     real_->SetLength(length);
53 }
54 
SetTimestamp(int64_t timestamp)55 void ArkAudioBufferAdapterImpl::SetTimestamp(int64_t timestamp)
56 {
57     real_->SetTimestamp(timestamp);
58 }
59 
SetSourcetype(int32_t sourcetype)60 void ArkAudioBufferAdapterImpl::SetSourcetype(int32_t sourcetype)
61 {
62     real_->SetSourcetype((NWeb::AudioCaptureSourceTypeAdapter)sourcetype);
63 }
64 
65 } // namespace OHOS::ArkWeb