dxgi_texture_mapping.h (1534B)
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_TEXTURE_MAPPING_H_ 12 #define MODULES_DESKTOP_CAPTURE_WIN_DXGI_TEXTURE_MAPPING_H_ 13 14 #include <d3d11.h> 15 #include <dxgi1_2.h> 16 17 #include "modules/desktop_capture/win/dxgi_texture.h" 18 19 namespace webrtc { 20 21 // A DxgiTexture which directly maps bitmap from IDXGIResource. This class is 22 // used when DXGI_OUTDUPL_DESC.DesktopImageInSystemMemory is true. (This usually 23 // means the video card shares main memory with CPU, instead of having its own 24 // individual memory.) 25 class DxgiTextureMapping : public DxgiTexture { 26 public: 27 // Creates a DxgiTextureMapping instance. Caller must maintain the lifetime 28 // of input `duplication` to make sure it outlives this instance. 29 explicit DxgiTextureMapping(IDXGIOutputDuplication* duplication); 30 31 ~DxgiTextureMapping() override; 32 33 protected: 34 bool CopyFromTexture(const DXGI_OUTDUPL_FRAME_INFO& frame_info, 35 ID3D11Texture2D* texture) override; 36 37 bool DoRelease() override; 38 39 private: 40 IDXGIOutputDuplication* const duplication_; 41 }; 42 43 } // namespace webrtc 44 45 #endif // MODULES_DESKTOP_CAPTURE_WIN_DXGI_TEXTURE_MAPPING_H_