Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(684)

Side by Side Diff: webrtc/modules/desktop_capture/win/dxgi_adapter_duplicator.h

Issue 2099123002: [Chromoting] Improve DirectX capturer to support multiple outputs (Closed) Base URL: https://chromium.googlesource.com/external/webrtc.git@master
Patch Set: Use a self-incremented integer to identify a DxgiDuplicatorContaienr::Initialize Created 4 years, 4 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
OLDNEW
(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_context.h"
23 #include "webrtc/modules/desktop_capture/win/dxgi_output_duplicator.h"
24
25 namespace webrtc {
26
27 // A container of DxgiOutputDuplicators to duplicate monitors attached to a
28 // single video card.
29 class DxgiAdapterDuplicator {
30 public:
31 // Creates an instance of DxgiAdapterDuplicator from a D3dDevice. Only
32 // DxgiDuplicatorContainer can create an instance.
33 explicit DxgiAdapterDuplicator(const D3dDevice& device);
34
35 // To allow this class to work with vector.
36 DxgiAdapterDuplicator(DxgiAdapterDuplicator&& other);
37
38 // Initializes the DxgiAdapterDuplicator from a D3dDevice.
39 bool Initialize();
40
41 // Sequential calls Duplicate function of all the DxgiOutputDuplicators owned
42 // by this instance.
43 bool Duplicate(DxgiContext* context,
44 DesktopFrame* target,
45 const DesktopFrame* last_frame);
46
47 // Captures one screen and writes into target. If id < 0 or greater than
48 // screen_count(), this function returns false.
49 bool Duplicate(DxgiContext* context,
50 int id,
51 DesktopFrame* target,
52 const DesktopFrame* last_frame);
53
54 // Returns desktop rect covered by this DxgiAdapterDuplicator.
55 DesktopRect desktop_rect() const { return desktop_rect_; }
56
57 // Returns the size of one screen owned by this DxgiAdapterDuplicator. If id
58 // is less than zero, or greater than screen_count(), this function returns
59 // an empty DesktopRect.
60 DesktopRect ScreenRect(int id) const;
61
62 // Returns the count of screens owned by this DxgiAdapterDuplicator. i.e. the
63 // size of duplicators_. These screens can be retrieved by an interger in the
64 // range of [0, screen_count()).
65 int screen_count() const { return static_cast<int>(duplicators_.size()); }
66
67 private:
68 friend class DxgiDuplicatorContainer;
69
70 bool DoInitialize();
71
72 void Setup(DxgiContext* context);
73
74 void Unregister(const DxgiContext* const context);
75
76 const D3dDevice device_;
77 std::vector<DxgiOutputDuplicator> duplicators_;
78 DesktopRect desktop_rect_;
79 };
80
81 } // namespace webrtc
82
83 #endif // MODULES_DESKTOP_CAPTURE_WIN_DXGI_ADAPTER_DUPLICATOR_H_
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698