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

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: Resolve review comments Created 4 years, 5 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 // Initializes the DxgiAdapterDuplicator from a D3dDevice. Caller must
32 // maintain the lifetime of input device to make sure it outlives this
33 // instance.
34 bool Initialize(const D3dDevice& device);
35
36 // Sequential calls Duplicate function of all the DxgiOutputDuplicators owned
37 // by this instance.
38 bool Duplicate(DxgiContext* context,
39 DesktopFrame* target,
40 const DesktopFrame* last_frame);
41
42 // Captures one screen and writes into target. If id < 0 or greater than
43 // screen_count(), this function returns false.
44 bool Duplicate(DxgiContext* context,
45 int id,
46 DesktopFrame* target,
47 const DesktopFrame* last_frame);
48
49 // Returns desktop rect covered by this DxgiAdapterDuplicator.
50 DesktopRect desktop_rect() const {
51 return desktop_rect_;
52 }
53
54 // Returns the size of one screen owned by this DxgiAdapterDuplicator. If id
55 // is less than zero, or greater than screen_count(), this function returns
56 // an empty DesktopRect.
57 DesktopRect ScreenRect(int id) const;
58
59 // Returns the count of screens owned by this DxgiAdapterDuplicator. i.e. the
60 // size of duplicators_. These screens can be retrieved by an interger in the
61 // range of [0, screen_count()).
62 int screen_count() const {
63 return static_cast<int>(duplicators_.size());
64 }
65
66 private:
67 friend class DxgiDuplicatorContainer;
68
69 bool DoInitialize(const D3dDevice& device);
70
71 void Setup(DxgiContext* context);
72
73 std::vector<DxgiOutputDuplicator> duplicators_;
74 DesktopRect desktop_rect_;
75 };
76
77 } // namespace webrtc
78
79 #endif // MODULES_DESKTOP_CAPTURE_WIN_DXGI_ADAPTER_DUPLICATOR_H_
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698