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 #include "ohos_adapter/bridge/ark_screen_capture_config_adapter_impl.h"
17 
18 #include "ohos_adapter/bridge/ark_audio_info_adapter_impl.h"
19 #include "ohos_adapter/bridge/ark_recorder_info_adapter_impl.h"
20 #include "ohos_adapter/bridge/ark_video_info_adapter_impl.h"
21 
22 #include "base/bridge/ark_web_bridge_macros.h"
23 
24 namespace OHOS::ArkWeb {
ArkScreenCaptureConfigAdapterImpl(std::shared_ptr<OHOS::NWeb::ScreenCaptureConfigAdapter> ref)25 ArkScreenCaptureConfigAdapterImpl::ArkScreenCaptureConfigAdapterImpl(
26     std::shared_ptr<OHOS::NWeb::ScreenCaptureConfigAdapter> ref)
27     : real_(ref)
28 {}
29 
GetCaptureMode()30 int32_t ArkScreenCaptureConfigAdapterImpl::GetCaptureMode()
31 {
32     return (int32_t)real_->GetCaptureMode();
33 }
34 
GetDataType()35 int32_t ArkScreenCaptureConfigAdapterImpl::GetDataType()
36 {
37     return (int32_t)real_->GetDataType();
38 }
39 
GetAudioInfo()40 ArkWebRefPtr<ArkAudioInfoAdapter> ArkScreenCaptureConfigAdapterImpl::GetAudioInfo()
41 {
42     std::shared_ptr<NWeb::AudioInfoAdapter> info = real_->GetAudioInfo();
43     if (CHECK_SHARED_PTR_IS_NULL(info)) {
44         return nullptr;
45     }
46     return new ArkAudioInfoAdapterImpl(info);
47 }
48 
GetVideoInfo()49 ArkWebRefPtr<ArkVideoInfoAdapter> ArkScreenCaptureConfigAdapterImpl::GetVideoInfo()
50 {
51     std::shared_ptr<NWeb::VideoInfoAdapter> info = real_->GetVideoInfo();
52     if (CHECK_SHARED_PTR_IS_NULL(info)) {
53         return nullptr;
54     }
55     return new ArkVideoInfoAdapterImpl(info);
56 }
57 
GetRecorderInfo()58 ArkWebRefPtr<ArkRecorderInfoAdapter> ArkScreenCaptureConfigAdapterImpl::GetRecorderInfo()
59 {
60     std::shared_ptr<NWeb::RecorderInfoAdapter> info = real_->GetRecorderInfo();
61     if (CHECK_SHARED_PTR_IS_NULL(info)) {
62         return nullptr;
63     }
64     return new ArkRecorderInfoAdapterImpl(info);
65 }
66 
67 } // namespace OHOS::ArkWeb
68