Chromium Code Reviews| Index: webrtc/modules/desktop_capture/win/dxgi_adapter_duplicator.h |
| diff --git a/webrtc/modules/desktop_capture/win/dxgi_adapter_duplicator.h b/webrtc/modules/desktop_capture/win/dxgi_adapter_duplicator.h |
| new file mode 100644 |
| index 0000000000000000000000000000000000000000..c99da5b8e01c82c62ba5ba5509150bdc9c9a24ec |
| --- /dev/null |
| +++ b/webrtc/modules/desktop_capture/win/dxgi_adapter_duplicator.h |
| @@ -0,0 +1,72 @@ |
| +/* |
| + * Copyright (c) 2016 The WebRTC project authors. All Rights Reserved. |
| + * |
| + * Use of this source code is governed by a BSD-style license |
| + * that can be found in the LICENSE file in the root of the source |
| + * tree. An additional intellectual property rights grant can be found |
| + * in the file PATENTS. All contributing project authors may |
| + * be found in the AUTHORS file in the root of the source tree. |
| + */ |
| + |
| +#ifndef MODULES_DESKTOP_CAPTURE_WIN_DXGI_ADAPTER_DUPLICATOR_H_ |
| +#define MODULES_DESKTOP_CAPTURE_WIN_DXGI_ADAPTER_DUPLICATOR_H_ |
| + |
| +#include <wrl/client.h> |
| + |
| +#include <vector> |
| + |
| +#include "webrtc/modules/desktop_capture/desktop_frame.h" |
| +#include "webrtc/modules/desktop_capture/desktop_geometry.h" |
| +#include "webrtc/modules/desktop_capture/desktop_region.h" |
| +#include "webrtc/modules/desktop_capture/win/d3d_device.h" |
| +#include "webrtc/modules/desktop_capture/win/dxgi_duplicator.h" |
| + |
| +namespace webrtc { |
| + |
| +// A container of DxgiDuplicators to duplicate monitors attached to a single |
| +// video card. |
| +class DxgiAdapterDuplicator { |
| + public: |
| + // Initializes the DxgiAdapterDuplicator from a D3dDevice. Caller must |
| + // maintain the lifetime of input device to make sure it outlives this |
| + // instance. |
| + bool Initialize(const D3dDevice& device); |
| + |
| + // Sequential calls Duplicate function of all the DxgiDuplicators owned by |
| + // this instance. |
| + bool Duplicate(DesktopFrame* target, |
| + const DesktopFrame* last_frame); |
| + |
| + // Captures one screen and writes into target. If id < 0 or greater than |
| + // screen_count(), this function returns false. |
| + bool Duplicate(int id, |
| + DesktopFrame* target, |
| + const DesktopFrame* last_frame); |
| + |
| + // Returns desktop rect covered by this DxgiAdapterDuplicator. |
| + DesktopRect desktop_rect() const { |
| + return desktop_rect_; |
| + } |
| + |
| + // Returns the size of one screen owned by this DxgiAdapterDuplicator. If id |
| + // is less than zero, or greater than screen_count(), this function returns |
| + // an empty DesktopRect. |
| + DesktopRect ScreenRect(int id) const; |
| + |
| + // Returns the count of screens owned by this DxgiAdapterDuplicator. i.e. the |
| + // size of duplicators_. These screens can be retrieved by an interger in the |
| + // 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
|
| + int screen_count() const { |
| + return static_cast<int>(duplicators_.size()); |
| + } |
| + |
| + private: |
| + bool DoInitialize(const D3dDevice& device); |
| + |
| + std::vector<DxgiDuplicator> duplicators_; |
| + DesktopRect desktop_rect_; |
| +}; |
| + |
| +} // namespace webrtc |
| + |
| +#endif // MODULES_DESKTOP_CAPTURE_WIN_DXGI_ADAPTER_DUPLICATOR_H_ |