xref: /aosp_15_r20/external/webrtc/modules/desktop_capture/desktop_capturer_wrapper.h (revision d9f758449e529ab9291ac668be2861e7a55c2422)
1 /*
2  *  Copyright (c) 2017 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_CAPTURER_WRAPPER_H_
12 #define MODULES_DESKTOP_CAPTURE_DESKTOP_CAPTURER_WRAPPER_H_
13 
14 #include <memory>
15 
16 #include "modules/desktop_capture/desktop_capture_types.h"
17 #include "modules/desktop_capture/desktop_capturer.h"
18 #include "modules/desktop_capture/desktop_geometry.h"
19 #include "modules/desktop_capture/shared_memory.h"
20 
21 namespace webrtc {
22 
23 // Wraps a DesktopCapturer and forwards all the function calls to it.
24 class DesktopCapturerWrapper : public DesktopCapturer {
25  public:
26   explicit DesktopCapturerWrapper(
27       std::unique_ptr<DesktopCapturer> base_capturer);
28   ~DesktopCapturerWrapper() override;
29 
30   // DesktopCapturer implementations.
31   void Start(Callback* callback) override;
32   void SetSharedMemoryFactory(
33       std::unique_ptr<SharedMemoryFactory> shared_memory_factory) override;
34   void CaptureFrame() override;
35   void SetExcludedWindow(WindowId window) override;
36   bool GetSourceList(SourceList* sources) override;
37   bool SelectSource(SourceId id) override;
38   bool FocusOnSelectedSource() override;
39   bool IsOccluded(const DesktopVector& pos) override;
40 
41  protected:
42   // Guaranteed to be valid.
43   const std::unique_ptr<DesktopCapturer> base_capturer_;
44 };
45 
46 }  // namespace webrtc
47 
48 #endif  // MODULES_DESKTOP_CAPTURE_DESKTOP_CAPTURER_WRAPPER_H_
49