OLD | NEW |
1 /* | 1 /* |
2 * Copyright (c) 2014 The WebRTC project authors. All Rights Reserved. | 2 * Copyright (c) 2014 The WebRTC project authors. All Rights Reserved. |
3 * | 3 * |
4 * Use of this source code is governed by a BSD-style license | 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 | 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 | 6 * tree. An additional intellectual property rights grant can be found |
7 * in the file PATENTS. All contributing project authors may | 7 * in the file PATENTS. All contributing project authors may |
8 * be found in the AUTHORS file in the root of the source tree. | 8 * be found in the AUTHORS file in the root of the source tree. |
9 */ | 9 */ |
10 | 10 |
11 #ifndef WEBRTC_MODULES_DESKTOP_CAPTURE_WIN_SCREEN_CAPTURER_WIN_GDI_H_ | 11 #ifndef WEBRTC_MODULES_DESKTOP_CAPTURE_WIN_SCREEN_CAPTURER_WIN_GDI_H_ |
12 #define WEBRTC_MODULES_DESKTOP_CAPTURE_WIN_SCREEN_CAPTURER_WIN_GDI_H_ | 12 #define WEBRTC_MODULES_DESKTOP_CAPTURE_WIN_SCREEN_CAPTURER_WIN_GDI_H_ |
13 | 13 |
14 #include <memory> | 14 #include <memory> |
15 | 15 |
16 #include "webrtc/modules/desktop_capture/screen_capturer.h" | 16 #include "webrtc/modules/desktop_capture/screen_capturer.h" |
17 | 17 |
18 #include <windows.h> | 18 #include <windows.h> |
19 | 19 |
20 #include "webrtc/base/constructormagic.h" | 20 #include "webrtc/base/constructormagic.h" |
21 #include "webrtc/modules/desktop_capture/screen_capture_frame_queue.h" | 21 #include "webrtc/modules/desktop_capture/screen_capture_frame_queue.h" |
22 #include "webrtc/modules/desktop_capture/screen_capturer_helper.h" | |
23 #include "webrtc/modules/desktop_capture/shared_desktop_frame.h" | 22 #include "webrtc/modules/desktop_capture/shared_desktop_frame.h" |
24 #include "webrtc/modules/desktop_capture/win/scoped_thread_desktop.h" | 23 #include "webrtc/modules/desktop_capture/win/scoped_thread_desktop.h" |
25 | 24 |
26 namespace webrtc { | 25 namespace webrtc { |
27 | 26 |
28 class Differ; | |
29 | |
30 // ScreenCapturerWinGdi captures 32bit RGB using GDI. | 27 // ScreenCapturerWinGdi captures 32bit RGB using GDI. |
31 // | 28 // |
32 // ScreenCapturerWinGdi is double-buffered as required by ScreenCapturer. | 29 // ScreenCapturerWinGdi is double-buffered as required by ScreenCapturer. |
33 class ScreenCapturerWinGdi : public ScreenCapturer { | 30 class ScreenCapturerWinGdi : public ScreenCapturer { |
34 public: | 31 public: |
35 explicit ScreenCapturerWinGdi(const DesktopCaptureOptions& options); | 32 explicit ScreenCapturerWinGdi(const DesktopCaptureOptions& options); |
36 virtual ~ScreenCapturerWinGdi(); | 33 virtual ~ScreenCapturerWinGdi(); |
37 | 34 |
38 // Overridden from ScreenCapturer: | 35 // Overridden from ScreenCapturer: |
39 void Start(Callback* callback) override; | 36 void Start(Callback* callback) override; |
(...skipping 14 matching lines...) Expand all Loading... |
54 bool CaptureImage(); | 51 bool CaptureImage(); |
55 | 52 |
56 // Capture the current cursor shape. | 53 // Capture the current cursor shape. |
57 void CaptureCursor(); | 54 void CaptureCursor(); |
58 | 55 |
59 Callback* callback_ = nullptr; | 56 Callback* callback_ = nullptr; |
60 std::unique_ptr<SharedMemoryFactory> shared_memory_factory_; | 57 std::unique_ptr<SharedMemoryFactory> shared_memory_factory_; |
61 ScreenId current_screen_id_ = kFullDesktopScreenId; | 58 ScreenId current_screen_id_ = kFullDesktopScreenId; |
62 std::wstring current_device_key_; | 59 std::wstring current_device_key_; |
63 | 60 |
64 // A thread-safe list of invalid rectangles, and the size of the most | |
65 // recently captured screen. | |
66 ScreenCapturerHelper helper_; | |
67 | |
68 ScopedThreadDesktop desktop_; | 61 ScopedThreadDesktop desktop_; |
69 | 62 |
70 // GDI resources used for screen capture. | 63 // GDI resources used for screen capture. |
71 HDC desktop_dc_ = NULL; | 64 HDC desktop_dc_ = NULL; |
72 HDC memory_dc_ = NULL; | 65 HDC memory_dc_ = NULL; |
73 | 66 |
74 // Queue of the frames buffers. | 67 // Queue of the frames buffers. |
75 ScreenCaptureFrameQueue<SharedDesktopFrame> queue_; | 68 ScreenCaptureFrameQueue<SharedDesktopFrame> queue_; |
76 | 69 |
77 // Rectangle describing the bounds of the desktop device context, relative to | 70 // Rectangle describing the bounds of the desktop device context, relative to |
78 // the primary display's top-left. | 71 // the primary display's top-left. |
79 DesktopRect desktop_dc_rect_; | 72 DesktopRect desktop_dc_rect_; |
80 | 73 |
81 // Class to calculate the difference between two screen bitmaps. | |
82 std::unique_ptr<Differ> differ_; | |
83 | |
84 HMODULE dwmapi_library_ = NULL; | 74 HMODULE dwmapi_library_ = NULL; |
85 DwmEnableCompositionFunc composition_func_ = nullptr; | 75 DwmEnableCompositionFunc composition_func_ = nullptr; |
86 | 76 |
87 RTC_DISALLOW_COPY_AND_ASSIGN(ScreenCapturerWinGdi); | 77 RTC_DISALLOW_COPY_AND_ASSIGN(ScreenCapturerWinGdi); |
88 }; | 78 }; |
89 | 79 |
90 } // namespace webrtc | 80 } // namespace webrtc |
91 | 81 |
92 #endif // WEBRTC_MODULES_DESKTOP_CAPTURE_WIN_SCREEN_CAPTURER_WIN_GDI_H_ | 82 #endif // WEBRTC_MODULES_DESKTOP_CAPTURE_WIN_SCREEN_CAPTURER_WIN_GDI_H_ |
OLD | NEW |