OLD | NEW |
1 /* | 1 /* |
2 * Copyright (c) 2016 The WebRTC project authors. All Rights Reserved. | 2 * Copyright (c) 2016 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_DIRECTX_H_ | 11 #ifndef WEBRTC_MODULES_DESKTOP_CAPTURE_WIN_SCREEN_CAPTURER_WIN_DIRECTX_H_ |
12 #define WEBRTC_MODULES_DESKTOP_CAPTURE_WIN_SCREEN_CAPTURER_WIN_DIRECTX_H_ | 12 #define WEBRTC_MODULES_DESKTOP_CAPTURE_WIN_SCREEN_CAPTURER_WIN_DIRECTX_H_ |
13 | 13 |
14 #include "webrtc/modules/desktop_capture/screen_capturer.h" | 14 #include "webrtc/modules/desktop_capture/screen_capturer.h" |
15 | 15 |
16 #include <memory> | 16 #include <memory> |
17 #include <vector> | 17 #include <vector> |
18 | 18 |
19 #include "webrtc/modules/desktop_capture/desktop_capture_options.h" | 19 #include "webrtc/modules/desktop_capture/desktop_capture_options.h" |
20 #include "webrtc/modules/desktop_capture/desktop_region.h" | 20 #include "webrtc/modules/desktop_capture/desktop_region.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/shared_desktop_frame.h" | 22 #include "webrtc/modules/desktop_capture/shared_desktop_frame.h" |
23 #include "webrtc/modules/desktop_capture/win/dxgi_duplicator_controller.h" | 23 #include "webrtc/modules/desktop_capture/win/dxgi_duplicator_controller.h" |
24 | 24 |
25 namespace webrtc { | 25 namespace webrtc { |
26 | 26 |
27 // ScreenCapturerWinDirectx captures 32bit RGBA using DirectX. This | 27 // ScreenCapturerWinDirectx captures 32bit RGBA using DirectX. |
28 // implementation won't work when ScreenCaptureFrameQueue.kQueueLength is not 2. | |
29 class ScreenCapturerWinDirectx : public ScreenCapturer { | 28 class ScreenCapturerWinDirectx : public ScreenCapturer { |
30 public: | 29 public: |
31 // Whether the system supports DirectX based capturing. | 30 // Whether the system supports DirectX based capturing. |
32 static bool IsSupported(); | 31 static bool IsSupported(); |
33 | 32 |
34 explicit ScreenCapturerWinDirectx(const DesktopCaptureOptions& options); | 33 explicit ScreenCapturerWinDirectx(const DesktopCaptureOptions& options); |
35 | 34 |
36 virtual ~ScreenCapturerWinDirectx(); | 35 virtual ~ScreenCapturerWinDirectx(); |
37 | 36 |
38 void Start(Callback* callback) override; | 37 void Start(Callback* callback) override; |
39 void SetSharedMemoryFactory( | 38 void SetSharedMemoryFactory( |
40 std::unique_ptr<SharedMemoryFactory> shared_memory_factory) override; | 39 std::unique_ptr<SharedMemoryFactory> shared_memory_factory) override; |
41 void CaptureFrame() override; | 40 void Capture() override; |
42 bool GetScreenList(ScreenList* screens) override; | 41 bool GetScreenList(ScreenList* screens) override; |
43 bool SelectScreen(ScreenId id) override; | 42 bool SelectScreen(ScreenId id) override; |
44 | 43 |
45 private: | 44 private: |
46 // Returns desktop size of selected screen. | 45 // Returns desktop size of selected screen. |
47 DesktopSize SelectedDesktopSize() const; | 46 DesktopSize SelectedDesktopSize() const; |
48 | 47 |
49 ScreenCaptureFrameQueue<SharedDesktopFrame> frames_; | 48 ScreenCaptureFrameQueue<SharedDesktopFrame> frames_; |
50 std::unique_ptr<SharedMemoryFactory> shared_memory_factory_; | 49 std::unique_ptr<SharedMemoryFactory> shared_memory_factory_; |
51 Callback* callback_ = nullptr; | 50 Callback* callback_ = nullptr; |
52 | 51 |
53 DxgiDuplicatorController::Context context_; | 52 DxgiDuplicatorController::Context context_; |
54 | 53 |
55 ScreenId current_screen_id = kFullDesktopScreenId; | 54 ScreenId current_screen_id = kFullDesktopScreenId; |
56 | 55 |
57 RTC_DISALLOW_COPY_AND_ASSIGN(ScreenCapturerWinDirectx); | 56 RTC_DISALLOW_COPY_AND_ASSIGN(ScreenCapturerWinDirectx); |
58 }; | 57 }; |
59 | 58 |
60 } // namespace webrtc | 59 } // namespace webrtc |
61 | 60 |
62 #endif // WEBRTC_MODULES_DESKTOP_CAPTURE_WIN_SCREEN_CAPTURER_WIN_DIRECTX_H_ | 61 #endif // WEBRTC_MODULES_DESKTOP_CAPTURE_WIN_SCREEN_CAPTURER_WIN_DIRECTX_H_ |
OLD | NEW |