desktop_frame_iosurface.h 1.4 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344
  1. /*
  2. * Copyright (c) 2018 The WebRTC project authors. All Rights Reserved.
  3. *
  4. * Use of this source code is governed by a BSD-style license
  5. * that can be found in the LICENSE file in the root of the source
  6. * tree. An additional intellectual property rights grant can be found
  7. * in the file PATENTS. All contributing project authors may
  8. * be found in the AUTHORS file in the root of the source tree.
  9. */
  10. #ifndef MODULES_DESKTOP_CAPTURE_MAC_DESKTOP_FRAME_IOSURFACE_H_
  11. #define MODULES_DESKTOP_CAPTURE_MAC_DESKTOP_FRAME_IOSURFACE_H_
  12. #include <CoreGraphics/CoreGraphics.h>
  13. #include <IOSurface/IOSurface.h>
  14. #include <memory>
  15. #include "modules/desktop_capture/desktop_frame.h"
  16. #include "sdk/objc/helpers/scoped_cftyperef.h"
  17. namespace webrtc {
  18. class DesktopFrameIOSurface final : public DesktopFrame {
  19. public:
  20. // Lock an IOSurfaceRef containing a snapshot of a display. Return NULL if
  21. // failed to lock.
  22. static std::unique_ptr<DesktopFrameIOSurface> Wrap(
  23. rtc::ScopedCFTypeRef<IOSurfaceRef> io_surface);
  24. ~DesktopFrameIOSurface() override;
  25. private:
  26. // This constructor expects |io_surface| to hold a non-null IOSurfaceRef.
  27. explicit DesktopFrameIOSurface(rtc::ScopedCFTypeRef<IOSurfaceRef> io_surface);
  28. const rtc::ScopedCFTypeRef<IOSurfaceRef> io_surface_;
  29. RTC_DISALLOW_COPY_AND_ASSIGN(DesktopFrameIOSurface);
  30. };
  31. } // namespace webrtc
  32. #endif // MODULES_DESKTOP_CAPTURE_MAC_DESKTOP_FRAME_IOSURFACE_H_