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_MAGNIFIER_H_ | 11 #ifndef WEBRTC_MODULES_DESKTOP_CAPTURE_WIN_SCREEN_CAPTURER_WIN_MAGNIFIER_H_ |
12 #define WEBRTC_MODULES_DESKTOP_CAPTURE_WIN_SCREEN_CAPTURER_WIN_MAGNIFIER_H_ | 12 #define WEBRTC_MODULES_DESKTOP_CAPTURE_WIN_SCREEN_CAPTURER_WIN_MAGNIFIER_H_ |
13 | 13 |
14 #include <memory> | 14 #include <memory> |
15 | 15 |
16 #include <windows.h> | 16 #include <windows.h> |
17 #include <magnification.h> | 17 #include <magnification.h> |
18 #include <wincodec.h> | 18 #include <wincodec.h> |
19 | 19 |
20 #include "webrtc/base/constructormagic.h" | 20 #include "webrtc/base/constructormagic.h" |
21 #include "webrtc/base/scoped_ptr.h" | |
22 #include "webrtc/modules/desktop_capture/screen_capture_frame_queue.h" | 21 #include "webrtc/modules/desktop_capture/screen_capture_frame_queue.h" |
23 #include "webrtc/modules/desktop_capture/screen_capturer.h" | 22 #include "webrtc/modules/desktop_capture/screen_capturer.h" |
24 #include "webrtc/modules/desktop_capture/screen_capturer_helper.h" | 23 #include "webrtc/modules/desktop_capture/screen_capturer_helper.h" |
25 #include "webrtc/modules/desktop_capture/shared_desktop_frame.h" | 24 #include "webrtc/modules/desktop_capture/shared_desktop_frame.h" |
26 #include "webrtc/modules/desktop_capture/win/scoped_thread_desktop.h" | 25 #include "webrtc/modules/desktop_capture/win/scoped_thread_desktop.h" |
27 #include "webrtc/system_wrappers/include/atomic32.h" | 26 #include "webrtc/system_wrappers/include/atomic32.h" |
28 | 27 |
29 namespace webrtc { | 28 namespace webrtc { |
30 | 29 |
31 class DesktopFrame; | 30 class DesktopFrame; |
32 class DesktopRect; | 31 class DesktopRect; |
33 class Differ; | 32 class Differ; |
34 | 33 |
35 // Captures the screen using the Magnification API to support window exclusion. | 34 // Captures the screen using the Magnification API to support window exclusion. |
36 // Each capturer must run on a dedicated thread because it uses thread local | 35 // Each capturer must run on a dedicated thread because it uses thread local |
37 // storage for redirecting the library callback. Also the thread must have a UI | 36 // storage for redirecting the library callback. Also the thread must have a UI |
38 // message loop to handle the window messages for the magnifier window. | 37 // message loop to handle the window messages for the magnifier window. |
39 class ScreenCapturerWinMagnifier : public ScreenCapturer { | 38 class ScreenCapturerWinMagnifier : public ScreenCapturer { |
40 public: | 39 public: |
41 // |fallback_capturer| will be used to capture the screen if a non-primary | 40 // |fallback_capturer| will be used to capture the screen if a non-primary |
42 // screen is being captured, or the OS does not support Magnification API, or | 41 // screen is being captured, or the OS does not support Magnification API, or |
43 // the magnifier capturer fails (e.g. in Windows8 Metro mode). | 42 // the magnifier capturer fails (e.g. in Windows8 Metro mode). |
44 explicit ScreenCapturerWinMagnifier( | 43 explicit ScreenCapturerWinMagnifier( |
45 std::unique_ptr<ScreenCapturer> fallback_capturer); | 44 std::unique_ptr<ScreenCapturer> fallback_capturer); |
46 virtual ~ScreenCapturerWinMagnifier(); | 45 virtual ~ScreenCapturerWinMagnifier(); |
47 | 46 |
48 // Overridden from ScreenCapturer: | 47 // Overridden from ScreenCapturer: |
49 void Start(Callback* callback) override; | 48 void Start(Callback* callback) override; |
50 void SetSharedMemoryFactory( | 49 void SetSharedMemoryFactory( |
51 rtc::scoped_ptr<SharedMemoryFactory> shared_memory_factory) override; | 50 std::unique_ptr<SharedMemoryFactory> shared_memory_factory) override; |
52 void Capture(const DesktopRegion& region) override; | 51 void Capture(const DesktopRegion& region) override; |
53 bool GetScreenList(ScreenList* screens) override; | 52 bool GetScreenList(ScreenList* screens) override; |
54 bool SelectScreen(ScreenId id) override; | 53 bool SelectScreen(ScreenId id) override; |
55 void SetExcludedWindow(WindowId window) override; | 54 void SetExcludedWindow(WindowId window) override; |
56 | 55 |
57 private: | 56 private: |
58 typedef BOOL(WINAPI* MagImageScalingCallback)(HWND hwnd, | 57 typedef BOOL(WINAPI* MagImageScalingCallback)(HWND hwnd, |
59 void* srcdata, | 58 void* srcdata, |
60 MAGIMAGEHEADER srcheader, | 59 MAGIMAGEHEADER srcheader, |
61 void* destdata, | 60 void* destdata, |
(...skipping 88 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
150 // True if the last OnMagImageScalingCallback was called and handled | 149 // True if the last OnMagImageScalingCallback was called and handled |
151 // successfully. Reset at the beginning of each CaptureImage call. | 150 // successfully. Reset at the beginning of each CaptureImage call. |
152 bool magnifier_capture_succeeded_; | 151 bool magnifier_capture_succeeded_; |
153 | 152 |
154 RTC_DISALLOW_COPY_AND_ASSIGN(ScreenCapturerWinMagnifier); | 153 RTC_DISALLOW_COPY_AND_ASSIGN(ScreenCapturerWinMagnifier); |
155 }; | 154 }; |
156 | 155 |
157 } // namespace webrtc | 156 } // namespace webrtc |
158 | 157 |
159 #endif // WEBRTC_MODULES_DESKTOP_CAPTURE_WIN_SCREEN_CAPTURER_WIN_MAGNIFIER_H_ | 158 #endif // WEBRTC_MODULES_DESKTOP_CAPTURE_WIN_SCREEN_CAPTURER_WIN_MAGNIFIER_H_ |
OLD | NEW |