sergeyu@chromium.org | b10ccbe | 2013-05-19 07:02:48 +0000 | [diff] [blame] | 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 | |
pbos@webrtc.org | 12dc1a3 | 2013-08-05 16:22:53 +0000 | [diff] [blame] | 11 | #include <assert.h> |
sergeyu@chromium.org | b10ccbe | 2013-05-19 07:02:48 +0000 | [diff] [blame] | 12 | |
zijiehe | 98903d2 | 2016-11-10 21:57:10 -0800 | [diff] [blame] | 13 | #include "webrtc/modules/desktop_capture/desktop_capturer.h" |
sergeyu@chromium.org | b10ccbe | 2013-05-19 07:02:48 +0000 | [diff] [blame] | 14 | #include "webrtc/modules/desktop_capture/desktop_frame.h" |
Edward Lemur | c20978e | 2017-07-06 19:44:34 +0200 | [diff] [blame] | 15 | #include "webrtc/rtc_base/constructormagic.h" |
sergeyu@chromium.org | b10ccbe | 2013-05-19 07:02:48 +0000 | [diff] [blame] | 16 | |
| 17 | namespace webrtc { |
| 18 | |
| 19 | namespace { |
| 20 | |
zijiehe | 98903d2 | 2016-11-10 21:57:10 -0800 | [diff] [blame] | 21 | class WindowCapturerNull : public DesktopCapturer { |
sergeyu@chromium.org | b10ccbe | 2013-05-19 07:02:48 +0000 | [diff] [blame] | 22 | public: |
sergeyu@chromium.org | 9f28240 | 2013-08-23 18:22:12 +0000 | [diff] [blame] | 23 | WindowCapturerNull(); |
sergeyu | e183121 | 2016-10-26 13:15:42 -0700 | [diff] [blame] | 24 | ~WindowCapturerNull() override; |
sergeyu@chromium.org | b10ccbe | 2013-05-19 07:02:48 +0000 | [diff] [blame] | 25 | |
sergeyu@chromium.org | b10ccbe | 2013-05-19 07:02:48 +0000 | [diff] [blame] | 26 | // DesktopCapturer interface. |
kjellander@webrtc.org | 14665ff | 2015-03-04 12:58:35 +0000 | [diff] [blame] | 27 | void Start(Callback* callback) override; |
zijiehe | 91902cb | 2016-10-13 16:47:49 -0700 | [diff] [blame] | 28 | void CaptureFrame() override; |
zijiehe | fce4905 | 2016-11-07 15:25:18 -0800 | [diff] [blame] | 29 | bool GetSourceList(SourceList* sources) override; |
| 30 | bool SelectSource(SourceId id) override; |
sergeyu@chromium.org | b10ccbe | 2013-05-19 07:02:48 +0000 | [diff] [blame] | 31 | |
| 32 | private: |
sergeyu | 5d91028 | 2016-06-07 16:41:58 -0700 | [diff] [blame] | 33 | Callback* callback_ = nullptr; |
sergeyu@chromium.org | b10ccbe | 2013-05-19 07:02:48 +0000 | [diff] [blame] | 34 | |
henrikg | 3c089d7 | 2015-09-16 05:37:44 -0700 | [diff] [blame] | 35 | RTC_DISALLOW_COPY_AND_ASSIGN(WindowCapturerNull); |
sergeyu@chromium.org | b10ccbe | 2013-05-19 07:02:48 +0000 | [diff] [blame] | 36 | }; |
| 37 | |
sergeyu | 5d91028 | 2016-06-07 16:41:58 -0700 | [diff] [blame] | 38 | WindowCapturerNull::WindowCapturerNull() {} |
| 39 | WindowCapturerNull::~WindowCapturerNull() {} |
sergeyu@chromium.org | b10ccbe | 2013-05-19 07:02:48 +0000 | [diff] [blame] | 40 | |
zijiehe | fce4905 | 2016-11-07 15:25:18 -0800 | [diff] [blame] | 41 | bool WindowCapturerNull::GetSourceList(SourceList* sources) { |
sergeyu@chromium.org | b10ccbe | 2013-05-19 07:02:48 +0000 | [diff] [blame] | 42 | // Not implemented yet. |
| 43 | return false; |
| 44 | } |
| 45 | |
zijiehe | fce4905 | 2016-11-07 15:25:18 -0800 | [diff] [blame] | 46 | bool WindowCapturerNull::SelectSource(SourceId id) { |
jiayl@webrtc.org | 886c94f | 2014-03-18 17:10:36 +0000 | [diff] [blame] | 47 | // Not implemented yet. |
| 48 | return false; |
| 49 | } |
| 50 | |
sergeyu@chromium.org | 9f28240 | 2013-08-23 18:22:12 +0000 | [diff] [blame] | 51 | void WindowCapturerNull::Start(Callback* callback) { |
sergeyu@chromium.org | b10ccbe | 2013-05-19 07:02:48 +0000 | [diff] [blame] | 52 | assert(!callback_); |
| 53 | assert(callback); |
| 54 | |
| 55 | callback_ = callback; |
| 56 | } |
| 57 | |
zijiehe | 91902cb | 2016-10-13 16:47:49 -0700 | [diff] [blame] | 58 | void WindowCapturerNull::CaptureFrame() { |
sergeyu@chromium.org | b10ccbe | 2013-05-19 07:02:48 +0000 | [diff] [blame] | 59 | // Not implemented yet. |
sergeyu | 5d91028 | 2016-06-07 16:41:58 -0700 | [diff] [blame] | 60 | callback_->OnCaptureResult(Result::ERROR_TEMPORARY, nullptr); |
sergeyu@chromium.org | b10ccbe | 2013-05-19 07:02:48 +0000 | [diff] [blame] | 61 | } |
| 62 | |
| 63 | } // namespace |
| 64 | |
| 65 | // static |
zijiehe | 54fd579 | 2016-11-02 14:49:35 -0700 | [diff] [blame] | 66 | std::unique_ptr<DesktopCapturer> DesktopCapturer::CreateRawWindowCapturer( |
| 67 | const DesktopCaptureOptions& options) { |
| 68 | return std::unique_ptr<DesktopCapturer>(new WindowCapturerNull()); |
| 69 | } |
| 70 | |
sergeyu@chromium.org | b10ccbe | 2013-05-19 07:02:48 +0000 | [diff] [blame] | 71 | } // namespace webrtc |