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_wrapper.h" 17 18 #include "ohos_adapter/bridge/ark_audio_info_adapter_wrapper.h" 19 #include "ohos_adapter/bridge/ark_recorder_info_adapter_wrapper.h" 20 #include "ohos_adapter/bridge/ark_video_info_adapter_wrapper.h" 21 22 #include "base/bridge/ark_web_bridge_macros.h" 23 24 namespace OHOS::ArkWeb { 25 ArkScreenCaptureConfigAdapterWrapper(ArkWebRefPtr<ArkScreenCaptureConfigAdapter> ref)26ArkScreenCaptureConfigAdapterWrapper::ArkScreenCaptureConfigAdapterWrapper( 27 ArkWebRefPtr<ArkScreenCaptureConfigAdapter> ref) 28 : ctocpp_(ref) 29 {} 30 GetCaptureMode()31NWeb::CaptureModeAdapter ArkScreenCaptureConfigAdapterWrapper::GetCaptureMode() 32 { 33 return (NWeb::CaptureModeAdapter)ctocpp_->GetCaptureMode(); 34 } 35 GetDataType()36NWeb::DataTypeAdapter ArkScreenCaptureConfigAdapterWrapper::GetDataType() 37 { 38 return (NWeb::DataTypeAdapter)ctocpp_->GetDataType(); 39 } 40 GetAudioInfo()41std::shared_ptr<NWeb::AudioInfoAdapter> ArkScreenCaptureConfigAdapterWrapper::GetAudioInfo() 42 { 43 ArkWebRefPtr<ArkAudioInfoAdapter> adapter = ctocpp_->GetAudioInfo(); 44 if (CHECK_REF_PTR_IS_NULL(adapter)) { 45 return nullptr; 46 } 47 48 return std::make_shared<ArkAudioInfoAdapterWrapper>(adapter); 49 } 50 GetVideoInfo()51std::shared_ptr<NWeb::VideoInfoAdapter> ArkScreenCaptureConfigAdapterWrapper::GetVideoInfo() 52 { 53 ArkWebRefPtr<ArkVideoInfoAdapter> adapter = ctocpp_->GetVideoInfo(); 54 if (CHECK_REF_PTR_IS_NULL(adapter)) { 55 return nullptr; 56 } 57 58 return std::make_shared<ArkVideoInfoAdapterWrapper>(adapter); 59 } 60 GetRecorderInfo()61std::shared_ptr<NWeb::RecorderInfoAdapter> ArkScreenCaptureConfigAdapterWrapper::GetRecorderInfo() 62 { 63 ArkWebRefPtr<ArkRecorderInfoAdapter> adapter = ctocpp_->GetRecorderInfo(); 64 if (CHECK_REF_PTR_IS_NULL(adapter)) { 65 return nullptr; 66 } 67 68 return std::make_shared<ArkRecorderInfoAdapterWrapper>(adapter); 69 } 70 71 } // namespace OHOS::ArkWeb 72