1 /*
2  *  Copyright 2018 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 <memory>
12 
13 #include "modules/desktop_capture/desktop_capture_options.h"
14 #include "modules/desktop_capture/desktop_capturer.h"
15 
16 #if defined(WEBRTC_USE_PIPEWIRE)
17 #include "modules/desktop_capture/linux/screen_capturer_pipewire.h"
18 #endif  // defined(WEBRTC_USE_PIPEWIRE)
19 
20 #if defined(WEBRTC_USE_X11)
21 #include "modules/desktop_capture/linux/screen_capturer_x11.h"
22 #endif  // defined(WEBRTC_USE_X11)
23 
24 namespace webrtc {
25 
26 // static
CreateRawScreenCapturer(const DesktopCaptureOptions & options)27 std::unique_ptr<DesktopCapturer> DesktopCapturer::CreateRawScreenCapturer(
28     const DesktopCaptureOptions& options) {
29 #if defined(WEBRTC_USE_PIPEWIRE)
30   if (options.allow_pipewire() && DesktopCapturer::IsRunningUnderWayland()) {
31     return ScreenCapturerPipeWire::CreateRawScreenCapturer(options);
32   }
33 #endif  // defined(WEBRTC_USE_PIPEWIRE)
34 
35 #if defined(WEBRTC_USE_X11)
36   return ScreenCapturerX11::CreateRawScreenCapturer(options);
37 #endif  // defined(WEBRTC_USE_X11)
38 
39   return nullptr;
40 }
41 
42 }  // namespace webrtc
43