1 /*
2  *  Copyright (c) 2017 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_CONTEXT_H_
12 #define MODULES_DESKTOP_CAPTURE_WIN_DXGI_CONTEXT_H_
13 
14 #include <vector>
15 
16 #include "modules/desktop_capture/desktop_region.h"
17 
18 namespace webrtc {
19 
20 // A DxgiOutputContext stores the status of a single DxgiFrame of
21 // DxgiOutputDuplicator.
22 struct DxgiOutputContext final {
23   // The updated region DxgiOutputDuplicator::DetectUpdatedRegion() output
24   // during last Duplicate() function call. It's always relative to the (0, 0).
25   DesktopRegion updated_region;
26 };
27 
28 // A DxgiAdapterContext stores the status of a single DxgiFrame of
29 // DxgiAdapterDuplicator.
30 struct DxgiAdapterContext final {
31   DxgiAdapterContext();
32   DxgiAdapterContext(const DxgiAdapterContext& other);
33   ~DxgiAdapterContext();
34 
35   // Child DxgiOutputContext belongs to this AdapterContext.
36   std::vector<DxgiOutputContext> contexts;
37 };
38 
39 // A DxgiFrameContext stores the status of a single DxgiFrame of
40 // DxgiDuplicatorController.
41 struct DxgiFrameContext final {
42  public:
43   DxgiFrameContext();
44   // Unregister this Context instance from DxgiDuplicatorController during
45   // destructing.
46   ~DxgiFrameContext();
47 
48   // Reset current Context, so it will be reinitialized next time.
49   void Reset();
50 
51   // A Context will have an exactly same |controller_id| as
52   // DxgiDuplicatorController, to ensure it has been correctly setted up after
53   // each DxgiDuplicatorController::Initialize().
54   int controller_id = 0;
55 
56   // Child DxgiAdapterContext belongs to this DxgiFrameContext.
57   std::vector<DxgiAdapterContext> contexts;
58 };
59 
60 }  // namespace webrtc
61 
62 #endif  // MODULES_DESKTOP_CAPTURE_WIN_DXGI_CONTEXT_H_
63