xref: /aosp_15_r20/external/webrtc/modules/desktop_capture/desktop_frame_win.h (revision d9f758449e529ab9291ac668be2861e7a55c2422)
1 /*
2  *  Copyright (c) 2013 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_DESKTOP_FRAME_WIN_H_
12 #define MODULES_DESKTOP_CAPTURE_DESKTOP_FRAME_WIN_H_
13 
14 #include <windows.h>
15 
16 #include <memory>
17 
18 #include "modules/desktop_capture/desktop_frame.h"
19 
20 namespace webrtc {
21 
22 // DesktopFrame implementation used by screen and window captures on Windows.
23 // Frame data is stored in a GDI bitmap.
24 class DesktopFrameWin : public DesktopFrame {
25  public:
26   ~DesktopFrameWin() override;
27 
28   DesktopFrameWin(const DesktopFrameWin&) = delete;
29   DesktopFrameWin& operator=(const DesktopFrameWin&) = delete;
30 
31   static std::unique_ptr<DesktopFrameWin>
32   Create(DesktopSize size, SharedMemoryFactory* shared_memory_factory, HDC hdc);
33 
bitmap()34   HBITMAP bitmap() { return bitmap_; }
35 
36  private:
37   DesktopFrameWin(DesktopSize size,
38                   int stride,
39                   uint8_t* data,
40                   std::unique_ptr<SharedMemory> shared_memory,
41                   HBITMAP bitmap);
42 
43   HBITMAP bitmap_;
44   std::unique_ptr<SharedMemory> owned_shared_memory_;
45 };
46 
47 }  // namespace webrtc
48 
49 #endif  // MODULES_DESKTOP_CAPTURE_DESKTOP_FRAME_WIN_H_
50