screen_capture_utils.h 2.1 KB

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