| 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 |
| (...skipping 10 matching lines...) Expand all Loading... |
| 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. This |
| 28 // implementation won't work when ScreenCaptureFrameQueue.kQueueLength is not 2. | 28 // implementation won't work when ScreenCaptureFrameQueue.kQueueLength is not 2. |
| 29 class ScreenCapturerWinDirectx : public ScreenCapturer { | 29 class ScreenCapturerWinDirectx : public ScreenCapturer { |
| 30 public: | 30 public: |
| 31 // Whether the system support DirectX based capturing. | 31 // Whether the system supports DirectX based capturing. |
| 32 static bool IsSupported(); | 32 static bool IsSupported(); |
| 33 | 33 |
| 34 explicit ScreenCapturerWinDirectx(const DesktopCaptureOptions& options); | 34 // Creates a ScreenCapturer which uses DirectX APIs to capture screen. Returns |
| 35 // nullptr if the system does not support DirectX duplication APIs. |
| 36 static std::unique_ptr<ScreenCapturer> Create( |
| 37 const DesktopCaptureOptions& options); |
| 38 |
| 35 virtual ~ScreenCapturerWinDirectx(); | 39 virtual ~ScreenCapturerWinDirectx(); |
| 36 | 40 |
| 37 void Start(Callback* callback) override; | 41 void Start(Callback* callback) override; |
| 38 void SetSharedMemoryFactory( | 42 void SetSharedMemoryFactory( |
| 39 std::unique_ptr<SharedMemoryFactory> shared_memory_factory) override; | 43 std::unique_ptr<SharedMemoryFactory> shared_memory_factory) override; |
| 40 void Capture(const DesktopRegion& region) override; | 44 void Capture(const DesktopRegion& region) override; |
| 41 bool GetScreenList(ScreenList* screens) override; | 45 bool GetScreenList(ScreenList* screens) override; |
| 42 bool SelectScreen(ScreenId id) override; | 46 bool SelectScreen(ScreenId id) override; |
| 43 | 47 |
| 44 private: | 48 private: |
| 49 explicit ScreenCapturerWinDirectx(const DesktopCaptureOptions& options); |
| 50 |
| 45 // Returns desktop size of selected screen. | 51 // Returns desktop size of selected screen. |
| 46 DesktopSize SelectedDesktopSize() const; | 52 DesktopSize SelectedDesktopSize() const; |
| 47 | 53 |
| 48 ScreenCaptureFrameQueue<SharedDesktopFrame> frames_; | 54 ScreenCaptureFrameQueue<SharedDesktopFrame> frames_; |
| 49 std::unique_ptr<SharedMemoryFactory> shared_memory_factory_; | 55 std::unique_ptr<SharedMemoryFactory> shared_memory_factory_; |
| 50 Callback* callback_ = nullptr; | 56 Callback* callback_ = nullptr; |
| 51 | 57 |
| 52 DxgiDuplicatorController::Context context_; | 58 DxgiDuplicatorController::Context context_; |
| 53 | 59 |
| 54 ScreenId current_screen_id = kFullDesktopScreenId; | 60 ScreenId current_screen_id = kFullDesktopScreenId; |
| 55 | 61 |
| 56 RTC_DISALLOW_COPY_AND_ASSIGN(ScreenCapturerWinDirectx); | 62 RTC_DISALLOW_COPY_AND_ASSIGN(ScreenCapturerWinDirectx); |
| 57 }; | 63 }; |
| 58 | 64 |
| 59 } // namespace webrtc | 65 } // namespace webrtc |
| 60 | 66 |
| 61 #endif // WEBRTC_MODULES_DESKTOP_CAPTURE_WIN_SCREEN_CAPTURER_WIN_DIRECTX_H_ | 67 #endif // WEBRTC_MODULES_DESKTOP_CAPTURE_WIN_SCREEN_CAPTURER_WIN_DIRECTX_H_ |
| OLD | NEW |