| 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_DXGI_OUTPUT_DUPLICATOR_H_ | 11 #ifndef WEBRTC_MODULES_DESKTOP_CAPTURE_WIN_DXGI_OUTPUT_DUPLICATOR_H_ |
| 12 #define WEBRTC_MODULES_DESKTOP_CAPTURE_WIN_DXGI_OUTPUT_DUPLICATOR_H_ | 12 #define WEBRTC_MODULES_DESKTOP_CAPTURE_WIN_DXGI_OUTPUT_DUPLICATOR_H_ |
| 13 | 13 |
| 14 #include <comdef.h> | 14 #include <comdef.h> |
| 15 #include <wrl/client.h> | 15 #include <wrl/client.h> |
| 16 #include <DXGI.h> | 16 #include <DXGI.h> |
| 17 #include <DXGI1_2.h> | 17 #include <DXGI1_2.h> |
| 18 | 18 |
| 19 #include <memory> | 19 #include <memory> |
| 20 #include <vector> | 20 #include <vector> |
| 21 | 21 |
| 22 #include "webrtc/base/criticalsection.h" | 22 #include "webrtc/base/criticalsection.h" |
| 23 #include "webrtc/base/thread_annotations.h" | 23 #include "webrtc/base/thread_annotations.h" |
| 24 #include "webrtc/modules/desktop_capture/desktop_geometry.h" | 24 #include "webrtc/modules/desktop_capture/desktop_geometry.h" |
| 25 #include "webrtc/modules/desktop_capture/desktop_region.h" | 25 #include "webrtc/modules/desktop_capture/desktop_region.h" |
| 26 #include "webrtc/modules/desktop_capture/desktop_frame_rotation.h" | 26 #include "webrtc/modules/desktop_capture/desktop_frame_rotation.h" |
| 27 #include "webrtc/modules/desktop_capture/shared_desktop_frame.h" | 27 #include "webrtc/modules/desktop_capture/shared_desktop_frame.h" |
| 28 #include "webrtc/modules/desktop_capture/win/d3d_device.h" | 28 #include "webrtc/modules/desktop_capture/win/d3d_device.h" |
| 29 #include "webrtc/modules/desktop_capture/win/dxgi_context.h" |
| 29 #include "webrtc/modules/desktop_capture/win/dxgi_texture.h" | 30 #include "webrtc/modules/desktop_capture/win/dxgi_texture.h" |
| 30 | 31 |
| 31 namespace webrtc { | 32 namespace webrtc { |
| 32 | 33 |
| 33 // Duplicates the content on one IDXGIOutput, i.e. one monitor attached to one | 34 // Duplicates the content on one IDXGIOutput, i.e. one monitor attached to one |
| 34 // video card. None of functions in this class is thread-safe. | 35 // video card. None of functions in this class is thread-safe. |
| 35 class DxgiOutputDuplicator { | 36 class DxgiOutputDuplicator { |
| 36 public: | 37 public: |
| 37 struct Context { | 38 using Context = DxgiOutputContext; |
| 38 // The updated region DxgiOutputDuplicator::DetectUpdatedRegion() output | |
| 39 // during last Duplicate() function call. It's always relative to the | |
| 40 // (0, 0). | |
| 41 DesktopRegion updated_region; | |
| 42 }; | |
| 43 | 39 |
| 44 // Creates an instance of DxgiOutputDuplicator from a D3dDevice and one of its | 40 // Creates an instance of DxgiOutputDuplicator from a D3dDevice and one of its |
| 45 // IDXGIOutput1. Caller must maintain the lifetime of device, to make sure it | 41 // IDXGIOutput1. Caller must maintain the lifetime of device, to make sure it |
| 46 // outlives this instance. Only DxgiAdapterDuplicator can create an instance. | 42 // outlives this instance. Only DxgiAdapterDuplicator can create an instance. |
| 47 DxgiOutputDuplicator(const D3dDevice& device, | 43 DxgiOutputDuplicator(const D3dDevice& device, |
| 48 const Microsoft::WRL::ComPtr<IDXGIOutput1>& output, | 44 const Microsoft::WRL::ComPtr<IDXGIOutput1>& output, |
| 49 const DXGI_OUTPUT_DESC& desc); | 45 const DXGI_OUTPUT_DESC& desc); |
| 50 | 46 |
| 51 // To allow this class to work with vector. | 47 // To allow this class to work with vector. |
| 52 DxgiOutputDuplicator(DxgiOutputDuplicator&& other); | 48 DxgiOutputDuplicator(DxgiOutputDuplicator&& other); |
| (...skipping 79 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 132 // |last_frame_|. | 128 // |last_frame_|. |
| 133 std::unique_ptr<SharedDesktopFrame> last_frame_; | 129 std::unique_ptr<SharedDesktopFrame> last_frame_; |
| 134 DesktopVector last_frame_offset_; | 130 DesktopVector last_frame_offset_; |
| 135 | 131 |
| 136 int64_t num_frames_captured_ = 0; | 132 int64_t num_frames_captured_ = 0; |
| 137 }; | 133 }; |
| 138 | 134 |
| 139 } // namespace webrtc | 135 } // namespace webrtc |
| 140 | 136 |
| 141 #endif // WEBRTC_MODULES_DESKTOP_CAPTURE_WIN_DXGI_OUTPUT_DUPLICATOR_H_ | 137 #endif // WEBRTC_MODULES_DESKTOP_CAPTURE_WIN_DXGI_OUTPUT_DUPLICATOR_H_ |
| OLD | NEW |