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 #include "modules/desktop_capture/win/window_capturer_win_wgc.h" 12 13 #include <memory> 14 15 #include "modules/desktop_capture/desktop_capturer.h" 16 17 namespace webrtc { 18 19 WindowCapturerWinWgc::WindowCapturerWinWgc() = default; 20 WindowCapturerWinWgc::~WindowCapturerWinWgc() = default; 21 GetSourceList(SourceList * sources)22bool WindowCapturerWinWgc::GetSourceList(SourceList* sources) { 23 return window_capture_helper_.EnumerateCapturableWindows(sources); 24 } 25 SelectSource(SourceId id)26bool WindowCapturerWinWgc::SelectSource(SourceId id) { 27 HWND window = reinterpret_cast<HWND>(id); 28 if (!IsWindowValidAndVisible(window)) 29 return false; 30 31 window_ = window; 32 return true; 33 } 34 Start(Callback * callback)35void WindowCapturerWinWgc::Start(Callback* callback) { 36 RTC_DCHECK(!callback_); 37 RTC_DCHECK(callback); 38 39 callback_ = callback; 40 } 41 CaptureFrame()42void WindowCapturerWinWgc::CaptureFrame() { 43 RTC_DCHECK(callback_); 44 45 callback_->OnCaptureResult(Result::ERROR_TEMPORARY, nullptr); 46 } 47 48 // static CreateRawWindowCapturer(const DesktopCaptureOptions & options)49std::unique_ptr<DesktopCapturer> WindowCapturerWinWgc::CreateRawWindowCapturer( 50 const DesktopCaptureOptions& options) { 51 return std::unique_ptr<DesktopCapturer>(new WindowCapturerWinWgc()); 52 } 53 54 } // namespace webrtc 55