• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1 /*
2  *  Copyright (c) 2014 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 #ifndef MODULES_DESKTOP_CAPTURE_WIN_SCREEN_CAPTURE_UTILS_H_
12 #define MODULES_DESKTOP_CAPTURE_WIN_SCREEN_CAPTURE_UTILS_H_
13 
14 #include <string>
15 #include <vector>
16 
17 #include "modules/desktop_capture/desktop_capturer.h"
18 #include "rtc_base/system/rtc_export.h"
19 
20 namespace webrtc {
21 
22 // Output the list of active screens into |screens|. Returns true if succeeded,
23 // or false if it fails to enumerate the display devices. If the |device_names|
24 // is provided, it will be filled with the DISPLAY_DEVICE.DeviceName in UTF-8
25 // encoding. If this function returns true, consumers can always assume that
26 // |screens|[i] and |device_names|[i] indicate the same monitor on the system.
27 bool GetScreenList(DesktopCapturer::SourceList* screens,
28                    std::vector<std::string>* device_names = nullptr);
29 
30 // Returns true if |screen| is a valid screen. The screen device key is
31 // returned through |device_key| if the screen is valid. The device key can be
32 // used in GetScreenRect to verify the screen matches the previously obtained
33 // id.
34 bool IsScreenValid(DesktopCapturer::SourceId screen, std::wstring* device_key);
35 
36 // Get the rect of the entire system in system coordinate system. I.e. the
37 // primary monitor always starts from (0, 0).
38 DesktopRect GetFullscreenRect();
39 
40 // Get the rect of the screen identified by |screen|, relative to the primary
41 // display's top-left. If the screen device key does not match |device_key|, or
42 // the screen does not exist, or any error happens, an empty rect is returned.
43 RTC_EXPORT DesktopRect GetScreenRect(DesktopCapturer::SourceId screen,
44                                      const std::wstring& device_key);
45 
46 }  // namespace webrtc
47 
48 #endif  // MODULES_DESKTOP_CAPTURE_WIN_SCREEN_CAPTURE_UTILS_H_
49