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