OLD | NEW |
---|---|
(Empty) | |
1 /* | |
2 * Copyright (c) 2016 The WebRTC project authors. All Rights Reserved. | |
3 * | |
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 | |
6 * tree. An additional intellectual property rights grant can be found | |
7 * in the file PATENTS. All contributing project authors may | |
8 * be found in the AUTHORS file in the root of the source tree. | |
9 */ | |
10 | |
11 #ifndef MODULES_DESKTOP_CAPTURE_WIN_DXGI_ADAPTER_DUPLICATOR_H_ | |
12 #define MODULES_DESKTOP_CAPTURE_WIN_DXGI_ADAPTER_DUPLICATOR_H_ | |
13 | |
14 #include <wrl/client.h> | |
15 | |
16 #include <vector> | |
17 | |
18 #include "webrtc/modules/desktop_capture/desktop_frame.h" | |
19 #include "webrtc/modules/desktop_capture/desktop_geometry.h" | |
20 #include "webrtc/modules/desktop_capture/desktop_region.h" | |
21 #include "webrtc/modules/desktop_capture/win/d3d_device.h" | |
22 #include "webrtc/modules/desktop_capture/win/dxgi_output_duplicator.h" | |
23 | |
24 namespace webrtc { | |
25 | |
26 // Child DxgiOutputContext belongs to this DxgiAdapterContext. | |
27 struct DxgiAdapterContext { | |
28 std::vector<DxgiOutputContext> contexts; | |
29 }; | |
30 | |
31 // A container of DxgiOutputDuplicators to duplicate monitors attached to a | |
32 // single video card. | |
33 class DxgiAdapterDuplicator { | |
34 public: | |
35 // Creates an instance of DxgiAdapterDuplicator from a D3dDevice. Only | |
36 // DxgiDuplicatorController can create an instance. | |
37 explicit DxgiAdapterDuplicator(const D3dDevice& device); | |
38 | |
39 // To allow this class to work with vector. | |
Sergey Ulanov
2016/08/06 01:27:57
nit: suggest rewording:
// Move constructor, to
Hzj_jie
2016/08/08 00:16:08
Done.
| |
40 DxgiAdapterDuplicator(DxgiAdapterDuplicator&& other); | |
41 | |
42 // Initializes the DxgiAdapterDuplicator from a D3dDevice. | |
43 bool Initialize(); | |
44 | |
45 // Sequential calls Duplicate function of all the DxgiOutputDuplicators owned | |
46 // by this instance. | |
47 bool Duplicate(DxgiAdapterContext* context, | |
48 const DesktopFrame* last_frame, | |
49 DesktopFrame* target); | |
50 | |
51 // Captures one monitor and writes into target. |monitor_id| should be between | |
52 // [0, screen_count()). | |
53 bool DuplicateMonitor(DxgiAdapterContext* context, | |
54 int monitor_id, | |
55 const DesktopFrame* last_frame, | |
56 DesktopFrame* target); | |
57 | |
58 // Returns desktop rect covered by this DxgiAdapterDuplicator. | |
59 DesktopRect desktop_rect() const { return desktop_rect_; } | |
60 | |
61 // Returns the size of one screen owned by this DxgiAdapterDuplicator. |id| | |
62 // should be between [0, screen_count()). | |
63 DesktopRect ScreenRect(int id) const; | |
64 | |
65 // Returns the count of screens owned by this DxgiAdapterDuplicator. i.e. the | |
66 // size of duplicators_. These screens can be retrieved by an interger in the | |
Sergey Ulanov
2016/08/06 01:27:57
remove "i.e. the size of duplicators_" . duplicato
Hzj_jie
2016/08/08 00:16:08
Done.
| |
67 // range of [0, screen_count()). | |
68 int screen_count() const { return static_cast<int>(duplicators_.size()); } | |
69 | |
70 private: | |
71 friend class DxgiDuplicatorController; | |
72 | |
73 bool DoInitialize(); | |
74 | |
75 void Setup(DxgiAdapterContext* context); | |
76 | |
77 void Unregister(const DxgiAdapterContext* const context); | |
78 | |
79 const D3dDevice device_; | |
80 std::vector<DxgiOutputDuplicator> duplicators_; | |
81 DesktopRect desktop_rect_; | |
82 }; | |
83 | |
84 } // namespace webrtc | |
85 | |
86 #endif // MODULES_DESKTOP_CAPTURE_WIN_DXGI_ADAPTER_DUPLICATOR_H_ | |
OLD | NEW |