xref: /aosp_15_r20/external/webrtc/modules/desktop_capture/win/wgc_desktop_frame.h (revision d9f758449e529ab9291ac668be2861e7a55c2422)
1 /*
2  *  Copyright (c) 2020 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_WGC_DESKTOP_FRAME_H_
12 #define MODULES_DESKTOP_CAPTURE_WIN_WGC_DESKTOP_FRAME_H_
13 
14 #include <d3d11.h>
15 #include <wrl/client.h>
16 
17 #include <memory>
18 #include <vector>
19 
20 #include "modules/desktop_capture/desktop_frame.h"
21 #include "modules/desktop_capture/desktop_geometry.h"
22 
23 namespace webrtc {
24 
25 // DesktopFrame implementation used by capturers that use the
26 // Windows.Graphics.Capture API.
27 class WgcDesktopFrame final : public DesktopFrame {
28  public:
29   // WgcDesktopFrame receives an rvalue reference to the `image_data` vector
30   // so that it can take ownership of it (and avoid a copy).
31   WgcDesktopFrame(DesktopSize size,
32                   int stride,
33                   std::vector<uint8_t>&& image_data);
34 
35   WgcDesktopFrame(const WgcDesktopFrame&) = delete;
36   WgcDesktopFrame& operator=(const WgcDesktopFrame&) = delete;
37 
38   ~WgcDesktopFrame() override;
39 
40  private:
41   std::vector<uint8_t> image_data_;
42 };
43 
44 }  // namespace webrtc
45 
46 #endif  // MODULES_DESKTOP_CAPTURE_WIN_WGC_DESKTOP_FRAME_H_
47