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

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, 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 // DxgiDuplicatorController 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(DxgiAdapterContext* context,
44 const DesktopFrame* last_frame,
45 DesktopFrame* target);
46
47 // Captures one monitor and writes into target. |monitor_id| should be between
48 // [0, screen_count()).
49 bool DuplicateMonitor(DxgiAdapterContext* context,
50 int monitor_id,
51 const DesktopFrame* last_frame,
52 DesktopFrame* target);
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. |id|
58 // should be between [0, screen_count()).
59 DesktopRect ScreenRect(int id) const;
60
61 // Returns the count of screens owned by this DxgiAdapterDuplicator. i.e. the
62 // size of duplicators_. These screens can be retrieved by an interger in the
63 // range of [0, screen_count()).
64 int screen_count() const { return static_cast<int>(duplicators_.size()); }
65
66 private:
67 friend class DxgiDuplicatorController;
68
69 bool DoInitialize();
70
71 void Setup(DxgiAdapterContext* context);
72
73 void Unregister(const DxgiAdapterContext* const context);
74
75 const D3dDevice device_;
76 std::vector<DxgiOutputDuplicator> duplicators_;
77 DesktopRect desktop_rect_;
78 };
79
80 } // namespace webrtc
81
82 #endif // MODULES_DESKTOP_CAPTURE_WIN_DXGI_ADAPTER_DUPLICATOR_H_
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698