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

Side by Side Diff: webrtc/modules/desktop_capture/win/dxgi_texture.h

Issue 2099123002: [Chromoting] Improve DirectX capturer to support multiple outputs (Closed) Base URL: https://chromium.googlesource.com/external/webrtc.git@master
Patch Set: Created 4 years, 5 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_TEXTURE_H_
12 #define MODULES_DESKTOP_CAPTURE_WIN_DXGI_TEXTURE_H_
13
14 #include <DXGI1_2.h>
15
16 #include <memory>
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
22 namespace webrtc {
23
24 // A texture copied or mapped from a DXGI_OUTDUPL_FRAME_INFO and IDXGIResource.
25 class DxgiTexture {
26 public:
27 // Creates a DxgiTexture instance, which represents the DesktopRect area of
28 // entire screen -- usually a monitor on the system.
29 explicit DxgiTexture(const DesktopRect& desktop_rect);
30
31 virtual ~DxgiTexture() = default;
32
33 // Copies selected regions of a frame represented by frame_info and resource.
34 // Returns false if anything wrong.
35 virtual bool CopyFrom(const DXGI_OUTDUPL_FRAME_INFO& frame_info,
36 IDXGIResource* resource,
37 const DesktopRegion& region) = 0;
38
39 const DesktopRect& desktop_rect() const {
40 return desktop_rect_;
41 }
42
43 uint8_t* bits() const {
44 return static_cast<uint8_t*>(rect_.pBits);
45 }
46
47 int pitch() const {
48 return static_cast<int>(rect_.Pitch);
49 }
50
51 // Releases the resource currently holds by this instance. Returns false if
52 // anything wrong, and this instance should be deprecated in this state. bits
53 // and pitch are only valid after a success CopyFrom call, but before Release
Sergey Ulanov 2016/07/08 22:36:55 s/CopyFrom/CopyFrom()/ s/Release/Release()/
Hzj_jie 2016/07/11 00:55:00 Done.
54 // call.
55 virtual bool Release() = 0;
56
57 // Returns a DesktopFrame snapshot of a DxgiTexture instance. This
58 // DesktopFrame is used to copy a DxgiTexture content to another DesktopFrame
59 // only. And it should not outlive its DxgiTexture instance.
Sergey Ulanov 2016/07/08 22:36:55 If it's not allowed to outlive the texture then do
Hzj_jie 2016/07/11 00:55:00 Done.
60 std::unique_ptr<DesktopFrame> AsDesktopFrame() const;
61
62 protected:
63 DXGI_MAPPED_RECT rect_ = {0};
64
65 private:
66 class DxgiDesktopFrame : public DesktopFrame {
67 public:
68 explicit DxgiDesktopFrame(const DxgiTexture& texture);
69 virtual ~DxgiDesktopFrame() = default;
70 };
71
72 const DesktopRect desktop_rect_;
73 };
74
75 } // namespace webrtc
76
77 #endif // MODULES_DESKTOP_CAPTURE_WIN_DXGI_TEXTURE_H_
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698