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_WINDOW_CAPTURER_WIN_WGC_H_
12 #define MODULES_DESKTOP_CAPTURE_WIN_WINDOW_CAPTURER_WIN_WGC_H_
13 
14 #include <memory>
15 
16 #include "modules/desktop_capture/desktop_capture_options.h"
17 #include "modules/desktop_capture/desktop_capturer.h"
18 #include "modules/desktop_capture/win/window_capture_utils.h"
19 
20 namespace webrtc {
21 
22 class WindowCapturerWinWgc : public DesktopCapturer {
23  public:
24   WindowCapturerWinWgc();
25 
26   // Disallow copy and assign
27   WindowCapturerWinWgc(const WindowCapturerWinWgc&) = delete;
28   WindowCapturerWinWgc& operator=(const WindowCapturerWinWgc&) = delete;
29 
30   ~WindowCapturerWinWgc() override;
31 
32   static std::unique_ptr<DesktopCapturer> CreateRawWindowCapturer(
33       const DesktopCaptureOptions& options);
34 
35   // DesktopCapturer interface.
36   void Start(Callback* callback) override;
37   void CaptureFrame() override;
38   bool GetSourceList(SourceList* sources) override;
39   bool SelectSource(SourceId id) override;
40 
41  private:
42   Callback* callback_ = nullptr;
43 
44   // HWND for the currently selected window or nullptr if window is not
45   // selected.
46   HWND window_ = nullptr;
47   WindowCaptureHelperWin window_capture_helper_;
48 };
49 
50 }  // namespace webrtc
51 
52 #endif  // MODULES_DESKTOP_CAPTURE_WIN_WINDOW_CAPTURER_WIN_WGC_H_
53