Chromium Code Reviews| 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_duplicator.h" | |
| 23 | |
| 24 namespace webrtc { | |
| 25 | |
| 26 // A container of DxgiDuplicators to duplicate monitors attached to a single | |
| 27 // video card. | |
| 28 class DxgiAdapterDuplicator { | |
| 29 public: | |
| 30 // Initializes the DxgiAdapterDuplicator from a D3dDevice. Caller must | |
| 31 // maintain the lifetime of input device to make sure it outlives this | |
| 32 // instance. | |
| 33 bool Initialize(const D3dDevice& device); | |
| 34 | |
| 35 // Sequential calls Duplicate function of all the DxgiDuplicators owned by | |
| 36 // this instance. | |
| 37 bool Duplicate(DesktopFrame* target, | |
| 38 const DesktopFrame* last_frame); | |
| 39 | |
| 40 // Captures one screen and writes into target. If id < 0 or greater than | |
| 41 // screen_count(), this function returns false. | |
| 42 bool Duplicate(int id, | |
| 43 DesktopFrame* target, | |
| 44 const DesktopFrame* last_frame); | |
| 45 | |
| 46 // Returns desktop rect covered by this DxgiAdapterDuplicator. | |
| 47 DesktopRect desktop_rect() const { | |
| 48 return desktop_rect_; | |
| 49 } | |
| 50 | |
| 51 // Returns the size of one screen owned by this DxgiAdapterDuplicator. If id | |
| 52 // is less than zero, or greater than screen_count(), this function returns | |
| 53 // an empty DesktopRect. | |
| 54 DesktopRect ScreenRect(int id) const; | |
| 55 | |
| 56 // Returns the count of screens owned by this DxgiAdapterDuplicator. i.e. the | |
| 57 // size of duplicators_. These screens can be retrieved by an interger in the | |
| 58 // range of [0, screen_count()). | |
|
Sergey Ulanov
2016/07/08 22:36:54
I don't think we want to use [0,N) indices as iden
Hzj_jie
2016/07/11 00:54:59
We can surely use HMONITOR to identify monitor, bu
| |
| 59 int screen_count() const { | |
| 60 return static_cast<int>(duplicators_.size()); | |
| 61 } | |
| 62 | |
| 63 private: | |
| 64 bool DoInitialize(const D3dDevice& device); | |
| 65 | |
| 66 std::vector<DxgiDuplicator> duplicators_; | |
| 67 DesktopRect desktop_rect_; | |
| 68 }; | |
| 69 | |
| 70 } // namespace webrtc | |
| 71 | |
| 72 #endif // MODULES_DESKTOP_CAPTURE_WIN_DXGI_ADAPTER_DUPLICATOR_H_ | |
| OLD | NEW |