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 |
(...skipping 22 matching lines...) Expand all Loading... |
33 // Captures the screen using the Magnification API to support window exclusion. | 33 // Captures the screen using the Magnification API to support window exclusion. |
34 // Each capturer must run on a dedicated thread because it uses thread local | 34 // Each capturer must run on a dedicated thread because it uses thread local |
35 // storage for redirecting the library callback. Also the thread must have a UI | 35 // storage for redirecting the library callback. Also the thread must have a UI |
36 // message loop to handle the window messages for the magnifier window. | 36 // message loop to handle the window messages for the magnifier window. |
37 // | 37 // |
38 // This class does not detect DesktopFrame::updated_region(), the field is | 38 // This class does not detect DesktopFrame::updated_region(), the field is |
39 // always set to the entire frame rectangle. ScreenCapturerDifferWrapper should | 39 // always set to the entire frame rectangle. ScreenCapturerDifferWrapper should |
40 // be used if that functionality is necessary. | 40 // be used if that functionality is necessary. |
41 class ScreenCapturerWinMagnifier : public DesktopCapturer { | 41 class ScreenCapturerWinMagnifier : public DesktopCapturer { |
42 public: | 42 public: |
43 // |fallback_capturer| will be used to capture the screen if a non-primary | 43 ScreenCapturerWinMagnifier(); |
44 // screen is being captured, or the OS does not support Magnification API, or | |
45 // the magnifier capturer fails (e.g. in Windows8 Metro mode). | |
46 explicit ScreenCapturerWinMagnifier( | |
47 std::unique_ptr<DesktopCapturer> fallback_capturer); | |
48 ~ScreenCapturerWinMagnifier() override; | 44 ~ScreenCapturerWinMagnifier() override; |
49 | 45 |
50 // Overridden from ScreenCapturer: | 46 // Overridden from ScreenCapturer: |
51 void Start(Callback* callback) override; | 47 void Start(Callback* callback) override; |
52 void SetSharedMemoryFactory( | 48 void SetSharedMemoryFactory( |
53 std::unique_ptr<SharedMemoryFactory> shared_memory_factory) override; | 49 std::unique_ptr<SharedMemoryFactory> shared_memory_factory) override; |
54 void CaptureFrame() override; | 50 void CaptureFrame() override; |
55 bool GetSourceList(SourceList* screens) override; | 51 bool GetSourceList(SourceList* screens) override; |
56 bool SelectSource(SourceId id) override; | 52 bool SelectSource(SourceId id) override; |
57 void SetExcludedWindow(WindowId window) override; | 53 void SetExcludedWindow(WindowId window) override; |
(...skipping 38 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
96 // Helper method for setting up the magnifier control. Returns true if | 92 // Helper method for setting up the magnifier control. Returns true if |
97 // succeeded. | 93 // succeeded. |
98 bool InitializeMagnifier(); | 94 bool InitializeMagnifier(); |
99 | 95 |
100 // Called by OnMagImageScalingCallback to output captured data. | 96 // Called by OnMagImageScalingCallback to output captured data. |
101 void OnCaptured(void* data, const MAGIMAGEHEADER& header); | 97 void OnCaptured(void* data, const MAGIMAGEHEADER& header); |
102 | 98 |
103 // Makes sure the current frame exists and matches |size|. | 99 // Makes sure the current frame exists and matches |size|. |
104 void CreateCurrentFrameIfNecessary(const DesktopSize& size); | 100 void CreateCurrentFrameIfNecessary(const DesktopSize& size); |
105 | 101 |
106 // Start the fallback capturer and select the screen. | |
107 void StartFallbackCapturer(); | |
108 | |
109 static Atomic32 tls_index_; | 102 static Atomic32 tls_index_; |
110 | 103 |
111 std::unique_ptr<DesktopCapturer> fallback_capturer_; | |
112 bool fallback_capturer_started_ = false; | |
113 Callback* callback_ = nullptr; | 104 Callback* callback_ = nullptr; |
114 std::unique_ptr<SharedMemoryFactory> shared_memory_factory_; | 105 std::unique_ptr<SharedMemoryFactory> shared_memory_factory_; |
115 ScreenId current_screen_id_ = kFullDesktopScreenId; | 106 ScreenId current_screen_id_ = kFullDesktopScreenId; |
116 std::wstring current_device_key_; | 107 std::wstring current_device_key_; |
117 HWND excluded_window_ = NULL; | 108 HWND excluded_window_ = NULL; |
118 | 109 |
119 // Queue of the frames buffers. | 110 // Queue of the frames buffers. |
120 ScreenCaptureFrameQueue<SharedDesktopFrame> queue_; | 111 ScreenCaptureFrameQueue<SharedDesktopFrame> queue_; |
121 | 112 |
122 ScopedThreadDesktop desktop_; | 113 ScopedThreadDesktop desktop_; |
(...skipping 19 matching lines...) Expand all Loading... |
142 // True if the last OnMagImageScalingCallback was called and handled | 133 // True if the last OnMagImageScalingCallback was called and handled |
143 // successfully. Reset at the beginning of each CaptureImage call. | 134 // successfully. Reset at the beginning of each CaptureImage call. |
144 bool magnifier_capture_succeeded_ = true; | 135 bool magnifier_capture_succeeded_ = true; |
145 | 136 |
146 RTC_DISALLOW_COPY_AND_ASSIGN(ScreenCapturerWinMagnifier); | 137 RTC_DISALLOW_COPY_AND_ASSIGN(ScreenCapturerWinMagnifier); |
147 }; | 138 }; |
148 | 139 |
149 } // namespace webrtc | 140 } // namespace webrtc |
150 | 141 |
151 #endif // WEBRTC_MODULES_DESKTOP_CAPTURE_WIN_SCREEN_CAPTURER_WIN_MAGNIFIER_H_ | 142 #endif // WEBRTC_MODULES_DESKTOP_CAPTURE_WIN_SCREEN_CAPTURER_WIN_MAGNIFIER_H_ |
OLD | NEW |