desktop_frame_win.h 1.4 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849
  1. /*
  2. * Copyright (c) 2013 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_DESKTOP_FRAME_WIN_H_
  11. #define MODULES_DESKTOP_CAPTURE_DESKTOP_FRAME_WIN_H_
  12. #include <windows.h>
  13. #include <memory>
  14. #include "modules/desktop_capture/desktop_frame.h"
  15. #include "rtc_base/constructor_magic.h"
  16. namespace webrtc {
  17. // DesktopFrame implementation used by screen and window captures on Windows.
  18. // Frame data is stored in a GDI bitmap.
  19. class DesktopFrameWin : public DesktopFrame {
  20. public:
  21. ~DesktopFrameWin() override;
  22. static std::unique_ptr<DesktopFrameWin>
  23. Create(DesktopSize size, SharedMemoryFactory* shared_memory_factory, HDC hdc);
  24. HBITMAP bitmap() { return bitmap_; }
  25. private:
  26. DesktopFrameWin(DesktopSize size,
  27. int stride,
  28. uint8_t* data,
  29. std::unique_ptr<SharedMemory> shared_memory,
  30. HBITMAP bitmap);
  31. HBITMAP bitmap_;
  32. std::unique_ptr<SharedMemory> owned_shared_memory_;
  33. RTC_DISALLOW_COPY_AND_ASSIGN(DesktopFrameWin);
  34. };
  35. } // namespace webrtc
  36. #endif // MODULES_DESKTOP_CAPTURE_DESKTOP_FRAME_WIN_H_