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