desktop_frame_win.h (1609B)
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 11 #ifndef MODULES_DESKTOP_CAPTURE_DESKTOP_FRAME_WIN_H_ 12 #define MODULES_DESKTOP_CAPTURE_DESKTOP_FRAME_WIN_H_ 13 14 #include <windows.h> 15 16 #include <cstdint> 17 #include <memory> 18 19 #include "modules/desktop_capture/desktop_frame.h" 20 #include "modules/desktop_capture/desktop_geometry.h" 21 #include "modules/desktop_capture/shared_memory.h" 22 23 namespace webrtc { 24 25 // DesktopFrame implementation used by screen and window captures on Windows. 26 // Frame data is stored in a GDI bitmap. 27 class DesktopFrameWin : public DesktopFrame { 28 public: 29 ~DesktopFrameWin() override; 30 31 DesktopFrameWin(const DesktopFrameWin&) = delete; 32 DesktopFrameWin& operator=(const DesktopFrameWin&) = delete; 33 34 static std::unique_ptr<DesktopFrameWin> 35 Create(DesktopSize size, SharedMemoryFactory* shared_memory_factory, HDC hdc); 36 37 HBITMAP bitmap() { return bitmap_; } 38 39 private: 40 DesktopFrameWin(DesktopSize size, 41 int stride, 42 uint8_t* data, 43 std::unique_ptr<SharedMemory> shared_memory, 44 HBITMAP bitmap); 45 46 HBITMAP bitmap_; 47 std::unique_ptr<SharedMemory> owned_shared_memory_; 48 }; 49 50 } // namespace webrtc 51 52 #endif // MODULES_DESKTOP_CAPTURE_DESKTOP_FRAME_WIN_H_