diff --git a/modules/desktop_capture/BUILD.gn b/modules/desktop_capture/BUILD.gn index 274af391728baad6fd5b59ac31268fc4c1d184f6..80612663e71d8bc126973993e0f6356e84282eeb 100644 --- a/modules/desktop_capture/BUILD.gn +++ b/modules/desktop_capture/BUILD.gn @@ -416,22 +416,6 @@ rtc_library("desktop_capture") { "window_capturer_ohos.cc", "ohos/base_window_capturer.cc", "ohos/base_window_capturer.h", - "ohos/audio_capture_info_adapter_impl.cc", - "ohos/audio_capture_info_adapter_impl.h", - "ohos/audio_enc_info_adapter_impl.cc", - "ohos/audio_enc_info_adapter_impl.h", - "ohos/audio_info_adapter_impl.cc", - "ohos/audio_info_adapter_impl.h", - "ohos/recorder_info_adapter_impl.cc", - "ohos/recorder_info_adapter_impl.h", - "ohos/screen_capture_config_adapter_impl.cc", - "ohos/screen_capture_config_adapter_impl.h", - "ohos/video_capture_info_adapter_impl.cc", - "ohos/video_capture_info_adapter_impl.h", - "ohos/video_enc_info_adapter_impl.cc", - "ohos/video_enc_info_adapter_impl.h", - "ohos/video_info_adapter_impl.cc", - "ohos/video_info_adapter_impl.h", ] include_dirs = ohos_src_includes deps += [ diff --git a/modules/desktop_capture/ohos/audio_capture_info_adapter_impl.cc b/modules/desktop_capture/ohos/audio_capture_info_adapter_impl.cc deleted file mode 100644 index 7ea04e36e9a6f509f787b8164be7d92506a5918b..0000000000000000000000000000000000000000 --- a/modules/desktop_capture/ohos/audio_capture_info_adapter_impl.cc +++ /dev/null @@ -1,44 +0,0 @@ -/* - * Copyright (c) 2023 Huawei Device Co., Ltd. - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ - -#include "audio_capture_info_adapter_impl.h" - -namespace OHOS::NWeb { -int32_t AudioCaptureInfoAdapterImpl::GetAudioSampleRate() { - return sample_rate_; -} - -int32_t AudioCaptureInfoAdapterImpl::GetAudioChannels() { - return channels_; -} - -AudioCaptureSourceTypeAdapter AudioCaptureInfoAdapterImpl::GetAudioSource() { - return source_; -} - -void AudioCaptureInfoAdapterImpl::SetAudioSampleRate(int32_t rate) { - sample_rate_ = rate; -} - -void AudioCaptureInfoAdapterImpl::SetAudioChannels(int32_t channel) { - channels_ = channel; -} - -void AudioCaptureInfoAdapterImpl::SetAudioSource( - AudioCaptureSourceTypeAdapter type) { - source_ = type; -} - -} // namespace OHOS::NWeb diff --git a/modules/desktop_capture/ohos/audio_capture_info_adapter_impl.h b/modules/desktop_capture/ohos/audio_capture_info_adapter_impl.h deleted file mode 100644 index f0dd1da6bedcc012b7c50df8b2cd131d29df23eb..0000000000000000000000000000000000000000 --- a/modules/desktop_capture/ohos/audio_capture_info_adapter_impl.h +++ /dev/null @@ -1,51 +0,0 @@ -/* - * Copyright (c) 2023 Huawei Device Co., Ltd. - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ - -#ifndef AUDIO_CAPTURE_INFO_ADAPTER_IMPL_H -#define AUDIO_CAPTURE_INFO_ADAPTER_IMPL_H - -#include "screen_capture_adapter.h" - -namespace OHOS::NWeb { - -class AudioCaptureInfoAdapterImpl : public AudioCaptureInfoAdapter { - public: - AudioCaptureInfoAdapterImpl() = default; - - int32_t GetAudioSampleRate() override; - - int32_t GetAudioChannels() override; - - AudioCaptureSourceTypeAdapter GetAudioSource() override; - - void SetAudioSampleRate(int32_t rate); - - void SetAudioChannels(int32_t channel); - - void SetAudioSource(AudioCaptureSourceTypeAdapter type); - - private: - /* Audio capture sample rate info */ - int32_t sample_rate_ = 0; - /* Audio capture channel info */ - int32_t channels_ = 0; - /* Audio capture source type */ - AudioCaptureSourceTypeAdapter source_ = - AudioCaptureSourceTypeAdapter::SOURCE_DEFAULT; -}; - -} // namespace OHOS::NWeb - -#endif // AUDIO_CAPTURE_INFO_ADAPTER_IMPL_H diff --git a/modules/desktop_capture/ohos/audio_enc_info_adapter_impl.cc b/modules/desktop_capture/ohos/audio_enc_info_adapter_impl.cc deleted file mode 100644 index 4813f390cd571952d294f1fe821379e0f6d9cdf6..0000000000000000000000000000000000000000 --- a/modules/desktop_capture/ohos/audio_enc_info_adapter_impl.cc +++ /dev/null @@ -1,37 +0,0 @@ -/* - * Copyright (c) 2023 Huawei Device Co., Ltd. - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ - -#include "audio_enc_info_adapter_impl.h" - -namespace OHOS::NWeb { - -int32_t AudioEncInfoAdapterImpl::GetAudioBitrate() { - return bitrate_; -} - -AudioCodecFormatAdapter AudioEncInfoAdapterImpl::GetAudioCodecformat() { - return codec_format_; -} - -void AudioEncInfoAdapterImpl::SetAudioBitrate(int32_t bitrate) { - bitrate_ = bitrate; -} - -void AudioEncInfoAdapterImpl::SetAudioCodecformat( - AudioCodecFormatAdapter format) { - codec_format_ = format; -} - -} // namespace OHOS::NWeb diff --git a/modules/desktop_capture/ohos/audio_enc_info_adapter_impl.h b/modules/desktop_capture/ohos/audio_enc_info_adapter_impl.h deleted file mode 100644 index 3a7fea69bbf1c01971c983b9b6fad122c049a852..0000000000000000000000000000000000000000 --- a/modules/desktop_capture/ohos/audio_enc_info_adapter_impl.h +++ /dev/null @@ -1,45 +0,0 @@ -/* - * Copyright (c) 2023 Huawei Device Co., Ltd. - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ - -#ifndef AUDIO_ENC_INFO_ADAPTER_IMPL_H -#define AUDIO_ENC_INFO_ADAPTER_IMPL_H - -#include "screen_capture_adapter.h" - -namespace OHOS::NWeb { - -class AudioEncInfoAdapterImpl : public AudioEncInfoAdapter { - public: - AudioEncInfoAdapterImpl() = default; - - int32_t GetAudioBitrate() override; - - AudioCodecFormatAdapter GetAudioCodecformat() override; - - void SetAudioBitrate(int32_t bitrate); - - void SetAudioCodecformat(AudioCodecFormatAdapter format); - - private: - /* Audio encoder bitrate */ - int32_t bitrate_ = 0; - /* Audio codec format */ - AudioCodecFormatAdapter codec_format_ = - AudioCodecFormatAdapter::AUDIO_DEFAULT; -}; - -} // namespace OHOS::NWeb - -#endif // AUDIO_ENC_INFO_ADAPTER_IMPL_H diff --git a/modules/desktop_capture/ohos/audio_info_adapter_impl.cc b/modules/desktop_capture/ohos/audio_info_adapter_impl.cc deleted file mode 100644 index 32f05bdb6ef47268589d104917dc13b7d7d57b71..0000000000000000000000000000000000000000 --- a/modules/desktop_capture/ohos/audio_info_adapter_impl.cc +++ /dev/null @@ -1,48 +0,0 @@ -/* - * Copyright (c) 2023 Huawei Device Co., Ltd. - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ - -#include "audio_info_adapter_impl.h" - -namespace OHOS::NWeb { - -std::shared_ptr AudioInfoAdapterImpl::GetMicCapInfo() { - return mic_cap_info_; -} - -std::shared_ptr -AudioInfoAdapterImpl::GetInnerCapInfo() { - return inner_cap_info_; -} - -std::shared_ptr AudioInfoAdapterImpl::GetAudioEncInfo() { - return enc_info_; -} - -void AudioInfoAdapterImpl::SetMicCapInfo( - std::shared_ptr info) { - mic_cap_info_ = info; -} - -void AudioInfoAdapterImpl::SetInnerCapInfo( - std::shared_ptr info) { - inner_cap_info_ = info; -} - -void AudioInfoAdapterImpl::SetAudioEncInfo( - std::shared_ptr info) { - enc_info_ = info; -} - -} // namespace OHOS::NWeb diff --git a/modules/desktop_capture/ohos/audio_info_adapter_impl.h b/modules/desktop_capture/ohos/audio_info_adapter_impl.h deleted file mode 100644 index fa4369e46ff9dda3247008b93ac6cf415a4621ff..0000000000000000000000000000000000000000 --- a/modules/desktop_capture/ohos/audio_info_adapter_impl.h +++ /dev/null @@ -1,51 +0,0 @@ -/* - * Copyright (c) 2023 Huawei Device Co., Ltd. - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ - -#ifndef AUDIO_INFO_ADAPTER_IMPL_H -#define AUDIO_INFO_ADAPTER_IMPL_H - -#include "screen_capture_adapter.h" - -namespace OHOS::NWeb { - -class AudioInfoAdapterImpl : public AudioInfoAdapter { - public: - AudioInfoAdapterImpl() = default; - - std::shared_ptr GetMicCapInfo() override; - - std::shared_ptr GetInnerCapInfo() override; - - std::shared_ptr GetAudioEncInfo() override; - - void SetMicCapInfo(std::shared_ptr info); - - void SetInnerCapInfo(std::shared_ptr info); - - void SetAudioEncInfo(std::shared_ptr info); - - private: - /* Audio capture info of microphone */ - std::shared_ptr mic_cap_info_ = nullptr; - /* Audio capture info of inner */ - std::shared_ptr inner_cap_info_ = nullptr; - /* Audio encoder info, no need to set, while dataType = - * ORIGINAL_STREAM_DATA_TYPE */ - std::shared_ptr enc_info_ = nullptr; -}; - -} // namespace OHOS::NWeb - -#endif // AUDIO_INFO_ADAPTER_IMPL_H diff --git a/modules/desktop_capture/ohos/base_window_capturer.cc b/modules/desktop_capture/ohos/base_window_capturer.cc old mode 100644 new mode 100755 index e75caf9e642a5e7b4673c0a03b5755c2f7960fc2..80e9bc6d00e5942593c5fdcf6e0a96ab5d5b5cc6 --- a/modules/desktop_capture/ohos/base_window_capturer.cc +++ b/modules/desktop_capture/ohos/base_window_capturer.cc @@ -21,26 +21,19 @@ #include "absl/memory/memory.h" #include "base/logging.h" -#include "base/memory/platform_shared_memory_region.h" -#include "base/memory/ptr_util.h" -#include "base/memory/read_only_shared_memory_region.h" #include "base/task/single_thread_task_runner.h" #include "modules/desktop_capture/desktop_capture_options.h" #include "modules/desktop_capture/desktop_capturer.h" -#include "modules/desktop_capture/ohos/audio_capture_info_adapter_impl.h" -#include "modules/desktop_capture/ohos/audio_enc_info_adapter_impl.h" -#include "modules/desktop_capture/ohos/audio_info_adapter_impl.h" -#include "modules/desktop_capture/ohos/recorder_info_adapter_impl.h" -#include "modules/desktop_capture/ohos/screen_capture_config_adapter_impl.h" -#include "modules/desktop_capture/ohos/video_capture_info_adapter_impl.h" -#include "modules/desktop_capture/ohos/video_enc_info_adapter_impl.h" -#include "modules/desktop_capture/ohos/video_info_adapter_impl.h" #include "rtc_base/checks.h" #include "rtc_base/logging.h" #include "rtc_base/string_encode.h" #include "rtc_base/string_to_number.h" #include "rtc_base/time_utils.h" +#include "base/memory/platform_shared_memory_region.h" +#include "base/memory/ptr_util.h" +#include "base/memory/read_only_shared_memory_region.h" + namespace webrtc { namespace { constexpr int32_t kAudioSampleRate = 16000; @@ -186,36 +179,26 @@ BaseWindowCapturer::BaseWindowCapturer(CaptureSourceType source_type) LOG(ERROR) << "create screen capture adapter failed"; return; } - - std::shared_ptr micCapInfo = - std::make_shared(); - micCapInfo->SetAudioSampleRate(kAudioSampleRate); - micCapInfo->SetAudioChannels(kAudioChannels); - micCapInfo->SetAudioSource( - OHOS::NWeb::AudioCaptureSourceTypeAdapter::SOURCE_DEFAULT); - - std::shared_ptr audioInfo = - std::make_shared(); - audioInfo->SetMicCapInfo(micCapInfo); - - std::shared_ptr videoCapInfo = - std::make_shared(); - videoCapInfo->SetVideoFrameWidth(videoFrameWidth); - videoCapInfo->SetVideoFrameHeight(videoFrameHeight); - videoCapInfo->SetVideoSourceType( - OHOS::NWeb::VideoSourceTypeAdapter::VIDEO_SOURCE_SURFACE_RGBA); - - std::shared_ptr videoInfo = - std::make_shared(); - videoInfo->SetVideoCapInfo(videoCapInfo); - - std::shared_ptr config = - std::make_shared(); - config->SetCaptureMode(OHOS::NWeb::CaptureModeAdapter::CAPTURE_HOME_SCREEN); - config->SetDataType(OHOS::NWeb::DataTypeAdapter::ORIGINAL_STREAM_DATA_TYPE); - config->SetAudioInfo(audioInfo); - config->SetVideoInfo(videoInfo); - + OHOS::NWeb::AudioCaptureInfoAdapter micCapInfo = { + .audioSampleRate = kAudioSampleRate, + .audioChannels = kAudioChannels, + .audioSource = OHOS::NWeb::AudioCaptureSourceTypeAdapter::SOURCE_DEFAULT + }; + OHOS::NWeb::AudioInfoAdapter audioInfo = {.micCapInfo = micCapInfo}; + + OHOS::NWeb::VideoCaptureInfoAdapter videoCapInfo = { + .videoFrameWidth = videoFrameWidth, + .videoFrameHeight = videoFrameHeight, + .videoSource = + OHOS::NWeb::VideoSourceTypeAdapter::VIDEO_SOURCE_SURFACE_RGBA + }; + OHOS::NWeb::VideoInfoAdapter videoInfo = {.videoCapInfo = videoCapInfo}; + OHOS::NWeb::ScreenCaptureConfigAdapter config = { + .captureMode = OHOS::NWeb::CaptureModeAdapter::CAPTURE_HOME_SCREEN, + .dataType = OHOS::NWeb::DataTypeAdapter::ORIGINAL_STREAM_DATA_TYPE, + .audioInfo = audioInfo, + .videoInfo = videoInfo + }; if (screen_capture_adapter_->Init(config) != 0) { screen_capture_adapter_ = nullptr; LOG(ERROR) << "screen capture init failed"; @@ -297,8 +280,7 @@ void BaseWindowCapturer::HandleBuffer() { pData += frameStride; pSrcData += stride; } - current_frame->mutable_updated_region()->SetRect( - DesktopRect::MakeSize(current_frame->size())); + current_frame->mutable_updated_region()->SetRect(DesktopRect::MakeSize(current_frame->size())); { webrtc::MutexLock lock(¤t_frame_lock_); diff --git a/modules/desktop_capture/ohos/recorder_info_adapter_impl.cc b/modules/desktop_capture/ohos/recorder_info_adapter_impl.cc deleted file mode 100644 index 9a6a9c57cd7308d4f50bf6461a38f5faf5292707..0000000000000000000000000000000000000000 --- a/modules/desktop_capture/ohos/recorder_info_adapter_impl.cc +++ /dev/null @@ -1,36 +0,0 @@ -/* - * Copyright (c) 2023 Huawei Device Co., Ltd. - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ - -#include "recorder_info_adapter_impl.h" - -namespace OHOS::NWeb { - -std::string RecorderInfoAdapterImpl::GetUrl() { - return url_; -} - -ContainerFormatTypeAdapter RecorderInfoAdapterImpl::GetFileFormat() { - return file_format_; -} - -void RecorderInfoAdapterImpl::SetUrl(std::string url) { - url_ = url; -} - -void RecorderInfoAdapterImpl::SetFileFormat(ContainerFormatTypeAdapter format) { - file_format_ = format; -} - -} // namespace OHOS::NWeb diff --git a/modules/desktop_capture/ohos/recorder_info_adapter_impl.h b/modules/desktop_capture/ohos/recorder_info_adapter_impl.h deleted file mode 100644 index 6a07f1046e9e586ad9b13d3779a9d9c8fcb43baa..0000000000000000000000000000000000000000 --- a/modules/desktop_capture/ohos/recorder_info_adapter_impl.h +++ /dev/null @@ -1,45 +0,0 @@ -/* - * Copyright (c) 2023 Huawei Device Co., Ltd. - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ - -#ifndef RECORDER_INFO_ADAPTER_IMPL_H -#define RECORDER_INFO_ADAPTER_IMPL_H - -#include "screen_capture_adapter.h" - -namespace OHOS::NWeb { - -class RecorderInfoAdapterImpl : public RecorderInfoAdapter { - public: - RecorderInfoAdapterImpl() = default; - - std::string GetUrl() override; - - ContainerFormatTypeAdapter GetFileFormat() override; - - void SetUrl(std::string url); - - void SetFileFormat(ContainerFormatTypeAdapter format); - - private: - /* Recorder file url */ - std::string url_ = ""; - /* Recorder file format */ - ContainerFormatTypeAdapter file_format_ = - ContainerFormatTypeAdapter::CFT_MPEG_4A_TYPE; -}; - -} // namespace OHOS::NWeb - -#endif // RECORDER_INFO_ADAPTER_IMPL_H diff --git a/modules/desktop_capture/ohos/screen_capture_config_adapter_impl.cc b/modules/desktop_capture/ohos/screen_capture_config_adapter_impl.cc deleted file mode 100644 index f1d1bee73b57da9b66b53b15048823a7a31f45c0..0000000000000000000000000000000000000000 --- a/modules/desktop_capture/ohos/screen_capture_config_adapter_impl.cc +++ /dev/null @@ -1,66 +0,0 @@ -/* - * Copyright (c) 2023 Huawei Device Co., Ltd. - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ - -#include "screen_capture_config_adapter_impl.h" - -namespace OHOS::NWeb { - -CaptureModeAdapter ScreenCaptureConfigAdapterImpl::GetCaptureMode() { - return capture_mode_; -} - -DataTypeAdapter ScreenCaptureConfigAdapterImpl::GetDataType() { - return data_type_; -} - -std::shared_ptr -ScreenCaptureConfigAdapterImpl::GetAudioInfo() { - return audio_info_; -} - -std::shared_ptr -ScreenCaptureConfigAdapterImpl::GetVideoInfo() { - return video_info_; -} - -std::shared_ptr -ScreenCaptureConfigAdapterImpl::GetRecorderInfo() { - return recorder_info_; -} - -void ScreenCaptureConfigAdapterImpl::SetCaptureMode(CaptureModeAdapter mode) { - capture_mode_ = mode; -} - -void ScreenCaptureConfigAdapterImpl::SetDataType(DataTypeAdapter type) { - data_type_ = type; -} - -void ScreenCaptureConfigAdapterImpl::SetAudioInfo( - std::shared_ptr info) { - audio_info_ = info; -} - -void ScreenCaptureConfigAdapterImpl::SetVideoInfo( - std::shared_ptr info) { - video_info_ = info; -} - -void ScreenCaptureConfigAdapterImpl::SetRecorderInfo( - std::shared_ptr info) { - recorder_info_ = info; -} - -} // namespace OHOS::NWeb diff --git a/modules/desktop_capture/ohos/screen_capture_config_adapter_impl.h b/modules/desktop_capture/ohos/screen_capture_config_adapter_impl.h deleted file mode 100644 index cbed7e3cd6801d5ae493ee43779e19486b3580d4..0000000000000000000000000000000000000000 --- a/modules/desktop_capture/ohos/screen_capture_config_adapter_impl.h +++ /dev/null @@ -1,58 +0,0 @@ -/* - * Copyright (c) 2023 Huawei Device Co., Ltd. - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ - -#ifndef SCREEN_CAPTURE_CONFIG_ADAPTER_IMPL_H -#define SCREEN_CAPTURE_CONFIG_ADAPTER_IMPL_H - -#include "screen_capture_adapter.h" - -namespace OHOS::NWeb { - -class ScreenCaptureConfigAdapterImpl : public ScreenCaptureConfigAdapter { - public: - ScreenCaptureConfigAdapterImpl() = default; - - CaptureModeAdapter GetCaptureMode() override; - - DataTypeAdapter GetDataType() override; - - std::shared_ptr GetAudioInfo() override; - - std::shared_ptr GetVideoInfo() override; - - std::shared_ptr GetRecorderInfo() override; - - void SetCaptureMode(CaptureModeAdapter mode); - - void SetDataType(DataTypeAdapter type); - - void SetAudioInfo(std::shared_ptr info); - - void SetVideoInfo(std::shared_ptr info); - - void SetRecorderInfo(std::shared_ptr info); - - private: - CaptureModeAdapter capture_mode_ = CaptureModeAdapter::CAPTURE_INVAILD; - DataTypeAdapter data_type_ = DataTypeAdapter::INVAILD_DATA_TYPE; - std::shared_ptr audio_info_ = nullptr; - std::shared_ptr video_info_ = nullptr; - /* should be set, while dataType = CAPTURE_FILE */ - std::shared_ptr recorder_info_ = nullptr; -}; - -} // namespace OHOS::NWeb - -#endif // SCREEN_CAPTURE_CONFIG_ADAPTER_IMPL_H diff --git a/modules/desktop_capture/ohos/video_capture_info_adapter_impl.cc b/modules/desktop_capture/ohos/video_capture_info_adapter_impl.cc deleted file mode 100644 index a3334fbba605bc0e346b44a5b54c32ff18a08d81..0000000000000000000000000000000000000000 --- a/modules/desktop_capture/ohos/video_capture_info_adapter_impl.cc +++ /dev/null @@ -1,60 +0,0 @@ -/* - * Copyright (c) 2023 Huawei Device Co., Ltd. - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ - -#include "video_capture_info_adapter_impl.h" - -namespace OHOS::NWeb { - -uint64_t VideoCaptureInfoAdapterImpl::GetDisplayId() { - return display_id_; -} - -std::list VideoCaptureInfoAdapterImpl::GetTaskIDs() { - return task_ids_; -} - -int32_t VideoCaptureInfoAdapterImpl::GetVideoFrameWidth() { - return video_frame_width_; -} - -int32_t VideoCaptureInfoAdapterImpl::GetVideoFrameHeight() { - return video_frame_height_; -} - -VideoSourceTypeAdapter VideoCaptureInfoAdapterImpl::GetVideoSourceType() { - return video_source_; -} - -void VideoCaptureInfoAdapterImpl::SetDisplayId(uint64_t id) { - display_id_ = id; -} - -void VideoCaptureInfoAdapterImpl::SetTaskIDs(std::list ids) { - task_ids_ = ids; -} - -void VideoCaptureInfoAdapterImpl::SetVideoFrameWidth(int32_t width) { - video_frame_width_ = width; -} - -void VideoCaptureInfoAdapterImpl::SetVideoFrameHeight(int32_t height) { - video_frame_height_ = height; -} - -void VideoCaptureInfoAdapterImpl::SetVideoSourceType( - VideoSourceTypeAdapter type) { - video_source_ = type; -} -} // namespace OHOS::NWeb diff --git a/modules/desktop_capture/ohos/video_capture_info_adapter_impl.h b/modules/desktop_capture/ohos/video_capture_info_adapter_impl.h deleted file mode 100644 index e25bbf02420fdad0acf6b681a51c0f964a7a15d0..0000000000000000000000000000000000000000 --- a/modules/desktop_capture/ohos/video_capture_info_adapter_impl.h +++ /dev/null @@ -1,64 +0,0 @@ -/* - * Copyright (c) 2023 Huawei Device Co., Ltd. - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ - -#ifndef VIDEO_CAPTURE_INFO_ADAPTER_IMPL_H -#define VIDEO_CAPTURE_INFO_ADAPTER_IMPL_H - -#include "screen_capture_adapter.h" - -namespace OHOS::NWeb { - -class VideoCaptureInfoAdapterImpl : public VideoCaptureInfoAdapter { - public: - VideoCaptureInfoAdapterImpl() = default; - - uint64_t GetDisplayId() override; - - std::list GetTaskIDs() override; - - int32_t GetVideoFrameWidth() override; - - int32_t GetVideoFrameHeight() override; - - VideoSourceTypeAdapter GetVideoSourceType() override; - - void SetDisplayId(uint64_t id); - - void SetTaskIDs(std::list ids); - - void SetVideoFrameWidth(int32_t width); - - void SetVideoFrameHeight(int32_t height); - - void SetVideoSourceType(VideoSourceTypeAdapter type); - - private: - /* Display id, should be set while captureMode = CAPTURE_SPECIFIED_SCREEN */ - uint64_t display_id_ = 0; - /* The ids of mission, should be set while captureMode = - * CAPTURE_SPECIFIED_WINDOW */ - std::list task_ids_; - /* Video frame width of avscreeencapture */ - int32_t video_frame_width_ = 0; - /* Video frame height of avscreeencapture */ - int32_t video_frame_height_ = 0; - /* Video source type of avscreeencapture */ - VideoSourceTypeAdapter video_source_ = - VideoSourceTypeAdapter::VIDEO_SOURCE_SURFACE_RGBA; -}; - -} // namespace OHOS::NWeb - -#endif // VIDEO_CAPTURE_INFO_ADAPTER_IMPL_H diff --git a/modules/desktop_capture/ohos/video_enc_info_adapter_impl.cc b/modules/desktop_capture/ohos/video_enc_info_adapter_impl.cc deleted file mode 100644 index 54337679d78bc7058dfa6adba28aa1887932a1e2..0000000000000000000000000000000000000000 --- a/modules/desktop_capture/ohos/video_enc_info_adapter_impl.cc +++ /dev/null @@ -1,44 +0,0 @@ -/* - * Copyright (c) 2023 Huawei Device Co., Ltd. - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ - -#include "video_enc_info_adapter_impl.h" - -namespace OHOS::NWeb { - -VideoCodecFormatAdapter VideoEncInfoAdapterImpl::GetVideoCodecFormat() { - return codec_; -} - -int32_t VideoEncInfoAdapterImpl::GetVideoBitrate() { - return bitrate_; -} - -int32_t VideoEncInfoAdapterImpl::GetVideoFrameRate() { - return frame_rate_; -} - -void VideoEncInfoAdapterImpl::SetVideoCodecFormat( - VideoCodecFormatAdapter format) { - codec_ = format; -} - -void VideoEncInfoAdapterImpl::SetVideoBitrate(int32_t bitrate) { - bitrate_ = bitrate; -} - -void VideoEncInfoAdapterImpl::SetVideoFrameRate(int32_t frameRate) { - frame_rate_ = frameRate; -} -} // namespace OHOS::NWeb diff --git a/modules/desktop_capture/ohos/video_enc_info_adapter_impl.h b/modules/desktop_capture/ohos/video_enc_info_adapter_impl.h deleted file mode 100644 index 6f3a52e61f78f7ccbc05e2807331ac6d350b29d8..0000000000000000000000000000000000000000 --- a/modules/desktop_capture/ohos/video_enc_info_adapter_impl.h +++ /dev/null @@ -1,50 +0,0 @@ -/* - * Copyright (c) 2023 Huawei Device Co., Ltd. - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ - -#ifndef VIDEO_ENC_INFO_ADAPTER_IMPL_H -#define VIDEO_ENC_INFO_ADAPTER_IMPL_H - -#include "screen_capture_adapter.h" - -namespace OHOS::NWeb { - -class VideoEncInfoAdapterImpl : public VideoEncInfoAdapter { - public: - VideoEncInfoAdapterImpl() = default; - - VideoCodecFormatAdapter GetVideoCodecFormat() override; - - int32_t GetVideoBitrate() override; - - int32_t GetVideoFrameRate() override; - - void SetVideoCodecFormat(VideoCodecFormatAdapter format); - - void SetVideoBitrate(int32_t bitrate); - - void SetVideoFrameRate(int32_t frameRate); - - private: - /* Video encoder format */ - VideoCodecFormatAdapter codec_ = VideoCodecFormatAdapter::VIDEO_DEFAULT; - /* Video encoder bitrate */ - int32_t bitrate_ = 0; - /* Video encoder frame rate */ - int32_t frame_rate_ = 0; -}; - -} // namespace OHOS::NWeb - -#endif // VIDEO_ENC_INFO_ADAPTER_IMPL_H diff --git a/modules/desktop_capture/ohos/video_info_adapter_impl.cc b/modules/desktop_capture/ohos/video_info_adapter_impl.cc deleted file mode 100644 index 97fc467924c4975f80d8eacc764d59fdb931bad4..0000000000000000000000000000000000000000 --- a/modules/desktop_capture/ohos/video_info_adapter_impl.cc +++ /dev/null @@ -1,38 +0,0 @@ -/* - * Copyright (c) 2023 Huawei Device Co., Ltd. - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ - -#include "video_info_adapter_impl.h" - -namespace OHOS::NWeb { - -std::shared_ptr -VideoInfoAdapterImpl::GetVideoCapInfo() { - return cap_info_; -} - -std::shared_ptr VideoInfoAdapterImpl::GetVideoEncInfo() { - return enc_info_; -} - -void VideoInfoAdapterImpl::SetVideoCapInfo( - std::shared_ptr info) { - cap_info_ = info; -} - -void VideoInfoAdapterImpl::SetVideoEncInfo( - std::shared_ptr info) { - enc_info_ = info; -} -} // namespace OHOS::NWeb diff --git a/modules/desktop_capture/ohos/video_info_adapter_impl.h b/modules/desktop_capture/ohos/video_info_adapter_impl.h deleted file mode 100644 index 2f1aa46c33a97575e57294b3f866e3c67371d8c7..0000000000000000000000000000000000000000 --- a/modules/desktop_capture/ohos/video_info_adapter_impl.h +++ /dev/null @@ -1,44 +0,0 @@ -/* - * Copyright (c) 2023 Huawei Device Co., Ltd. - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ - -#ifndef VIDEO_INFO_ADAPTER_IMPL_H -#define VIDEO_INFO_ADAPTER_IMPL_H - -#include "screen_capture_adapter.h" - -namespace OHOS::NWeb { - -class VideoInfoAdapterImpl : public VideoInfoAdapter { - public: - VideoInfoAdapterImpl() = default; - - std::shared_ptr GetVideoCapInfo() override; - - std::shared_ptr GetVideoEncInfo() override; - - void SetVideoCapInfo(std::shared_ptr info); - - void SetVideoEncInfo(std::shared_ptr info); - - private: - /* Video capture info */ - std::shared_ptr cap_info_ = nullptr; - /* Video encoder info */ - std::shared_ptr enc_info_ = nullptr; -}; - -} // namespace OHOS::NWeb - -#endif // VIDEO_INFO_ADAPTER_IMPL_H