webrtc_m130/modules/desktop_capture/mac/desktop_frame_cgimage.h
Julien Isorce c0719cedac Add DesktopFrameCGImage
No functional change. This makes the code more generic
and this reduces the size of screen_capturer_mac.mm

Bug: webrtc:8652
Change-Id: I37743ba385fea5e1b40df3b094bfc321b8d796ae
Reviewed-on: https://webrtc-review.googlesource.com/65082
Commit-Queue: Julien Isorce <julien.isorce@chromium.org>
Commit-Queue: Zijie He <zijiehe@chromium.org>
Reviewed-by: Zijie He <zijiehe@chromium.org>
Cr-Commit-Position: refs/heads/master@{#22684}
2018-03-29 22:56:38 +00:00

49 lines
1.6 KiB
C++

/*
* Copyright (c) 2018 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_CGIMAGE_H_
#define MODULES_DESKTOP_CAPTURE_MAC_DESKTOP_FRAME_CGIMAGE_H_
#include <CoreGraphics/CoreGraphics.h>
#include <memory>
#include "modules/desktop_capture/desktop_frame.h"
#include "sdk/objc/Framework/Classes/Common/scoped_cftyperef.h"
namespace webrtc {
class DesktopFrameCGImage final : public DesktopFrame {
public:
// Create an image containing a snapshot of the display at the time this is
// being called.
static std::unique_ptr<DesktopFrameCGImage> CreateForDisplay(
CGDirectDisplayID display_id);
~DesktopFrameCGImage() override;
private:
// This constructor expects |cg_image| to hold a non-null CGImageRef.
DesktopFrameCGImage(DesktopSize size,
int stride,
uint8_t* data,
rtc::ScopedCFTypeRef<CGImageRef> cg_image,
rtc::ScopedCFTypeRef<CFDataRef> cg_data);
const rtc::ScopedCFTypeRef<CGImageRef> cg_image_;
const rtc::ScopedCFTypeRef<CFDataRef> cg_data_;
RTC_DISALLOW_COPY_AND_ASSIGN(DesktopFrameCGImage);
};
} // namespace webrtc
#endif // MODULES_DESKTOP_CAPTURE_MAC_DESKTOP_FRAME_CGIMAGE_H_