OLD | NEW |
1 /* | 1 /* |
2 * Copyright (c) 2013 The WebRTC project authors. All Rights Reserved. | 2 * Copyright (c) 2013 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 #include "webrtc/modules/desktop_capture/screen_capturer.h" | |
12 | |
13 #include <memory> | 11 #include <memory> |
14 #include <utility> | 12 #include <utility> |
15 | 13 |
| 14 #include "webrtc/modules/desktop_capture/desktop_capturer.h" |
16 #include "webrtc/modules/desktop_capture/desktop_capture_options.h" | 15 #include "webrtc/modules/desktop_capture/desktop_capture_options.h" |
17 #include "webrtc/modules/desktop_capture/screen_capturer_differ_wrapper.h" | |
18 #include "webrtc/modules/desktop_capture/win/screen_capturer_win_directx.h" | 16 #include "webrtc/modules/desktop_capture/win/screen_capturer_win_directx.h" |
19 #include "webrtc/modules/desktop_capture/win/screen_capturer_win_gdi.h" | 17 #include "webrtc/modules/desktop_capture/win/screen_capturer_win_gdi.h" |
20 #include "webrtc/modules/desktop_capture/win/screen_capturer_win_magnifier.h" | 18 #include "webrtc/modules/desktop_capture/win/screen_capturer_win_magnifier.h" |
21 | 19 |
22 namespace webrtc { | 20 namespace webrtc { |
23 | 21 |
24 // static | 22 // static |
25 ScreenCapturer* ScreenCapturer::Create(const DesktopCaptureOptions& options) { | |
26 std::unique_ptr<ScreenCapturer> capturer; | |
27 if (options.allow_directx_capturer() && | |
28 ScreenCapturerWinDirectx::IsSupported()) { | |
29 capturer.reset(new ScreenCapturerWinDirectx(options)); | |
30 } else { | |
31 capturer.reset(new ScreenCapturerWinGdi(options)); | |
32 } | |
33 | |
34 if (options.allow_use_magnification_api()) { | |
35 capturer.reset(new ScreenCapturerWinMagnifier(std::move(capturer))); | |
36 } | |
37 | |
38 if (options.detect_updated_region()) { | |
39 capturer.reset(new ScreenCapturerDifferWrapper(std::move(capturer))); | |
40 } | |
41 | |
42 return capturer.release(); | |
43 } | |
44 | |
45 // static | |
46 std::unique_ptr<DesktopCapturer> DesktopCapturer::CreateRawScreenCapturer( | 23 std::unique_ptr<DesktopCapturer> DesktopCapturer::CreateRawScreenCapturer( |
47 const DesktopCaptureOptions& options) { | 24 const DesktopCaptureOptions& options) { |
48 std::unique_ptr<DesktopCapturer> capturer; | 25 std::unique_ptr<DesktopCapturer> capturer; |
49 if (options.allow_directx_capturer() && | 26 if (options.allow_directx_capturer() && |
50 ScreenCapturerWinDirectx::IsSupported()) { | 27 ScreenCapturerWinDirectx::IsSupported()) { |
51 capturer.reset(new ScreenCapturerWinDirectx(options)); | 28 capturer.reset(new ScreenCapturerWinDirectx(options)); |
52 } else { | 29 } else { |
53 capturer.reset(new ScreenCapturerWinGdi(options)); | 30 capturer.reset(new ScreenCapturerWinGdi(options)); |
54 } | 31 } |
55 | 32 |
56 if (options.allow_use_magnification_api()) { | 33 if (options.allow_use_magnification_api()) { |
57 capturer.reset(new ScreenCapturerWinMagnifier(std::move(capturer))); | 34 capturer.reset(new ScreenCapturerWinMagnifier(std::move(capturer))); |
58 } | 35 } |
59 | 36 |
60 return capturer; | 37 return capturer; |
61 } | 38 } |
62 | 39 |
63 } // namespace webrtc | 40 } // namespace webrtc |
OLD | NEW |