From d23d450a5034f633e984bac831e77a3be5d41eca Mon Sep 17 00:00:00 2001 From: Johannes Kron Date: Tue, 29 Aug 2023 15:55:31 +0200 Subject: [PATCH] Make DesktopFrame::CreateFromCGImage() accessible for external targets The build target that CreateFromCGImage() belongs to, desktop_capture_obj is not visible externally. A utility header is created to make it accessible. Bug: chromium:1471931 Change-Id: Ie40f39114d277dc4b62fe2ce95a6b0c7b61a3943 Reviewed-on: https://webrtc-review.googlesource.com/c/src/+/318123 Commit-Queue: Harald Alvestrand Auto-Submit: Johannes Kron Reviewed-by: Harald Alvestrand Reviewed-by: Mirko Bonadei Cr-Commit-Position: refs/heads/main@{#40659} --- modules/desktop_capture/BUILD.gn | 2 ++ .../mac/desktop_frame_utils.cc | 22 +++++++++++++++ .../desktop_capture/mac/desktop_frame_utils.h | 27 +++++++++++++++++++ 3 files changed, 51 insertions(+) create mode 100644 modules/desktop_capture/mac/desktop_frame_utils.cc create mode 100644 modules/desktop_capture/mac/desktop_frame_utils.h diff --git a/modules/desktop_capture/BUILD.gn b/modules/desktop_capture/BUILD.gn index 6f3e9d26c5..fcf1836930 100644 --- a/modules/desktop_capture/BUILD.gn +++ b/modules/desktop_capture/BUILD.gn @@ -334,6 +334,8 @@ rtc_library("desktop_capture") { "mac/desktop_configuration.h", "mac/desktop_configuration_monitor.cc", "mac/desktop_configuration_monitor.h", + "mac/desktop_frame_utils.cc", + "mac/desktop_frame_utils.h", "mac/full_screen_mac_application_handler.cc", "mac/full_screen_mac_application_handler.h", "mac/window_list_utils.cc", diff --git a/modules/desktop_capture/mac/desktop_frame_utils.cc b/modules/desktop_capture/mac/desktop_frame_utils.cc new file mode 100644 index 0000000000..32ba67e999 --- /dev/null +++ b/modules/desktop_capture/mac/desktop_frame_utils.cc @@ -0,0 +1,22 @@ +/* + * Copyright (c) 2023 The WebRTC project authors. All Rights Reserved. + * + * Use of this source code is governed by a BSD-style license + * that can be found in the LICENSE file in the root of the source + * tree. An additional intellectual property rights grant can be found + * in the file PATENTS. All contributing project authors may + * be found in the AUTHORS file in the root of the source tree. + */ + +#include "modules/desktop_capture/mac/desktop_frame_utils.h" + +#include + +namespace webrtc { + +std::unique_ptr CreateDesktopFrameFromCGImage( + rtc::ScopedCFTypeRef cg_image) { + return DesktopFrameCGImage::CreateFromCGImage(cg_image); +} + +} // namespace webrtc diff --git a/modules/desktop_capture/mac/desktop_frame_utils.h b/modules/desktop_capture/mac/desktop_frame_utils.h new file mode 100644 index 0000000000..1be2436098 --- /dev/null +++ b/modules/desktop_capture/mac/desktop_frame_utils.h @@ -0,0 +1,27 @@ +/* + * Copyright (c) 2023 The WebRTC project authors. All Rights Reserved. + * + * Use of this source code is governed by a BSD-style license + * that can be found in the LICENSE file in the root of the source + * tree. An additional intellectual property rights grant can be found + * in the file PATENTS. All contributing project authors may + * be found in the AUTHORS file in the root of the source tree. + */ + +#ifndef MODULES_DESKTOP_CAPTURE_MAC_DESKTOP_FRAME_UTILS_H_ +#define MODULES_DESKTOP_CAPTURE_MAC_DESKTOP_FRAME_UTILS_H_ + +#include + +#include "modules/desktop_capture/desktop_frame.h" +#include "modules/desktop_capture/mac/desktop_frame_cgimage.h" +#include "rtc_base/system/rtc_export.h" + +namespace webrtc { + +std::unique_ptr RTC_EXPORT +CreateDesktopFrameFromCGImage(rtc::ScopedCFTypeRef cg_image); + +} // namespace webrtc + +#endif // MODULES_DESKTOP_CAPTURE_MAC_DESKTOP_FRAME_UTILS_H_