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