xref: /aosp_15_r20/external/webrtc/modules/desktop_capture/window_capturer_null.cc (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 #include "modules/desktop_capture/desktop_capturer.h"
12 #include "modules/desktop_capture/desktop_frame.h"
13 #include "rtc_base/checks.h"
14 
15 namespace webrtc {
16 
17 namespace {
18 
19 class WindowCapturerNull : public DesktopCapturer {
20  public:
21   WindowCapturerNull();
22   ~WindowCapturerNull() override;
23 
24   WindowCapturerNull(const WindowCapturerNull&) = delete;
25   WindowCapturerNull& operator=(const WindowCapturerNull&) = delete;
26 
27   // DesktopCapturer interface.
28   void Start(Callback* callback) override;
29   void CaptureFrame() override;
30   bool GetSourceList(SourceList* sources) override;
31   bool SelectSource(SourceId id) override;
32 
33  private:
34   Callback* callback_ = nullptr;
35 };
36 
WindowCapturerNull()37 WindowCapturerNull::WindowCapturerNull() {}
~WindowCapturerNull()38 WindowCapturerNull::~WindowCapturerNull() {}
39 
GetSourceList(SourceList * sources)40 bool WindowCapturerNull::GetSourceList(SourceList* sources) {
41   // Not implemented yet.
42   return false;
43 }
44 
SelectSource(SourceId id)45 bool WindowCapturerNull::SelectSource(SourceId id) {
46   // Not implemented yet.
47   return false;
48 }
49 
Start(Callback * callback)50 void WindowCapturerNull::Start(Callback* callback) {
51   RTC_DCHECK(!callback_);
52   RTC_DCHECK(callback);
53 
54   callback_ = callback;
55 }
56 
CaptureFrame()57 void WindowCapturerNull::CaptureFrame() {
58   // Not implemented yet.
59   callback_->OnCaptureResult(Result::ERROR_TEMPORARY, nullptr);
60 }
61 
62 }  // namespace
63 
64 // static
CreateRawWindowCapturer(const DesktopCaptureOptions & options)65 std::unique_ptr<DesktopCapturer> DesktopCapturer::CreateRawWindowCapturer(
66     const DesktopCaptureOptions& options) {
67   return std::unique_ptr<DesktopCapturer>(new WindowCapturerNull());
68 }
69 
70 }  // namespace webrtc
71