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_