15821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)/*
25821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles) *  Copyright (c) 2013 The WebRTC project authors. All Rights Reserved.
35821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles) *
45821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles) *  Use of this source code is governed by a BSD-style license
590dce4d38c5ff5333bea97d859d4e484e27edf0cTorne (Richard Coles) *  that can be found in the LICENSE file in the root of the source
65821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles) *  tree. An additional intellectual property rights grant can be found
75d1f7b1de12d16ceb2c938c56701a3e8bfa558f7Torne (Richard Coles) *  in the file PATENTS.  All contributing project authors may
85821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles) *  be found in the AUTHORS file in the root of the source tree.
95d1f7b1de12d16ceb2c938c56701a3e8bfa558f7Torne (Richard Coles) */
1090dce4d38c5ff5333bea97d859d4e484e27edf0cTorne (Richard Coles)#ifndef WEBRTC_MODULES_DESKTOP_CAPTURE_DESKTOP_CAPTURE_OPTIONS_H_
115821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)#define WEBRTC_MODULES_DESKTOP_CAPTURE_DESKTOP_CAPTURE_OPTIONS_H_
12424c4d7b64af9d0d8fd9624f381f469654d5e3d2Torne (Richard Coles)
135d1f7b1de12d16ceb2c938c56701a3e8bfa558f7Torne (Richard Coles)#include "webrtc/base/constructormagic.h"
145821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)#include "webrtc/system_wrappers/interface/scoped_refptr.h"
155821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)
16c2e0dbddbe15c98d52c4786dac06cb8952a8ae6dTorne (Richard Coles)#if defined(USE_X11)
175821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)#include "webrtc/modules/desktop_capture/x11/shared_x_display.h"
185d1f7b1de12d16ceb2c938c56701a3e8bfa558f7Torne (Richard Coles)#endif
195d1f7b1de12d16ceb2c938c56701a3e8bfa558f7Torne (Richard Coles)
205821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)#if defined(WEBRTC_MAC) && !defined(WEBRTC_IOS)
215821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)#include "webrtc/modules/desktop_capture/mac/desktop_configuration_monitor.h"
22ca12bfac764ba476d6cd062bf1dde12cc64c3f40Ben Murdoch#include "webrtc/modules/desktop_capture/mac/full_screen_chrome_window_detector.h"
23ca12bfac764ba476d6cd062bf1dde12cc64c3f40Ben Murdoch#endif
24a1401311d1ab56c4ed0a474bd38c108f75cb0cd9Torne (Richard Coles)
255821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)namespace webrtc {
26eb525c5499e34cc9c4b825d6d9e75bb07cc06aceBen Murdoch
27eb525c5499e34cc9c4b825d6d9e75bb07cc06aceBen Murdoch// An object that stores initialization parameters for screen and window
285821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)// capturers.
295821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)class DesktopCaptureOptions {
305821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles) public:
315821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)  // Creates an empty Options instance (e.g. without X display).
325821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)  DesktopCaptureOptions();
335821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)  ~DesktopCaptureOptions();
345821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)
355821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)  // Returns instance of DesktopCaptureOptions with default parameters. On Linux
365821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)  // also initializes X window connection. x_display() will be set to null if
37eb525c5499e34cc9c4b825d6d9e75bb07cc06aceBen Murdoch  // X11 connection failed (e.g. DISPLAY isn't set).
38eb525c5499e34cc9c4b825d6d9e75bb07cc06aceBen Murdoch  static DesktopCaptureOptions CreateDefault();
3990dce4d38c5ff5333bea97d859d4e484e27edf0cTorne (Richard Coles)
405821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)#if defined(USE_X11)
415821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)  SharedXDisplay* x_display() const { return x_display_; }
425821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)  void set_x_display(scoped_refptr<SharedXDisplay> x_display) {
435821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)    x_display_ = x_display;
445d1f7b1de12d16ceb2c938c56701a3e8bfa558f7Torne (Richard Coles)  }
455d1f7b1de12d16ceb2c938c56701a3e8bfa558f7Torne (Richard Coles)#endif
465d1f7b1de12d16ceb2c938c56701a3e8bfa558f7Torne (Richard Coles)
475d1f7b1de12d16ceb2c938c56701a3e8bfa558f7Torne (Richard Coles)#if defined(WEBRTC_MAC) && !defined(WEBRTC_IOS)
485d1f7b1de12d16ceb2c938c56701a3e8bfa558f7Torne (Richard Coles)  DesktopConfigurationMonitor* configuration_monitor() const {
495d1f7b1de12d16ceb2c938c56701a3e8bfa558f7Torne (Richard Coles)    return configuration_monitor_;
505d1f7b1de12d16ceb2c938c56701a3e8bfa558f7Torne (Richard Coles)  }
515d1f7b1de12d16ceb2c938c56701a3e8bfa558f7Torne (Richard Coles)  void set_configuration_monitor(scoped_refptr<DesktopConfigurationMonitor> m) {
525821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)    configuration_monitor_ = m;
535821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)  }
545821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)
555d1f7b1de12d16ceb2c938c56701a3e8bfa558f7Torne (Richard Coles)  FullScreenChromeWindowDetector* full_screen_chrome_window_detector() const {
565d1f7b1de12d16ceb2c938c56701a3e8bfa558f7Torne (Richard Coles)    return full_screen_window_detector_;
575821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)  }
585821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)  void set_full_screen_chrome_window_detector(
595821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)      scoped_refptr<FullScreenChromeWindowDetector> detector) {
605821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)    full_screen_window_detector_ = detector;
615821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)  }
625821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)#endif
63c2e0dbddbe15c98d52c4786dac06cb8952a8ae6dTorne (Richard Coles)
64a1401311d1ab56c4ed0a474bd38c108f75cb0cd9Torne (Richard Coles)  // Flag indicating that the capturer should use screen change notifications.
65c2e0dbddbe15c98d52c4786dac06cb8952a8ae6dTorne (Richard Coles)  // Enables/disables use of XDAMAGE in the X11 capturer.
66a1401311d1ab56c4ed0a474bd38c108f75cb0cd9Torne (Richard Coles)  bool use_update_notifications() const { return use_update_notifications_; }
67c2e0dbddbe15c98d52c4786dac06cb8952a8ae6dTorne (Richard Coles)  void set_use_update_notifications(bool use_update_notifications) {
68c2e0dbddbe15c98d52c4786dac06cb8952a8ae6dTorne (Richard Coles)    use_update_notifications_ = use_update_notifications;
69eb525c5499e34cc9c4b825d6d9e75bb07cc06aceBen Murdoch  }
705821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)
71eb525c5499e34cc9c4b825d6d9e75bb07cc06aceBen Murdoch  // Flag indicating if desktop effects (e.g. Aero) should be disabled when the
72c2e0dbddbe15c98d52c4786dac06cb8952a8ae6dTorne (Richard Coles)  // capturer is active. Currently used only on Windows.
73c2e0dbddbe15c98d52c4786dac06cb8952a8ae6dTorne (Richard Coles)  bool disable_effects() const { return disable_effects_; }
74eb525c5499e34cc9c4b825d6d9e75bb07cc06aceBen Murdoch  void set_disable_effects(bool disable_effects) {
75a1401311d1ab56c4ed0a474bd38c108f75cb0cd9Torne (Richard Coles)    disable_effects_ = disable_effects;
76c2e0dbddbe15c98d52c4786dac06cb8952a8ae6dTorne (Richard Coles)  }
775821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)
785821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)#if defined(WEBRTC_WIN)
795d1f7b1de12d16ceb2c938c56701a3e8bfa558f7Torne (Richard Coles)  bool allow_use_magnification_api() const {
805d1f7b1de12d16ceb2c938c56701a3e8bfa558f7Torne (Richard Coles)    return allow_use_magnification_api_;
815d1f7b1de12d16ceb2c938c56701a3e8bfa558f7Torne (Richard Coles)  }
825d1f7b1de12d16ceb2c938c56701a3e8bfa558f7Torne (Richard Coles)  void set_allow_use_magnification_api(bool allow) {
835d1f7b1de12d16ceb2c938c56701a3e8bfa558f7Torne (Richard Coles)    allow_use_magnification_api_ = allow;
845d1f7b1de12d16ceb2c938c56701a3e8bfa558f7Torne (Richard Coles)  }
855d1f7b1de12d16ceb2c938c56701a3e8bfa558f7Torne (Richard Coles)#endif
865d1f7b1de12d16ceb2c938c56701a3e8bfa558f7Torne (Richard Coles)
875d1f7b1de12d16ceb2c938c56701a3e8bfa558f7Torne (Richard Coles) private:
885821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)#if defined(USE_X11)
895821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)  scoped_refptr<SharedXDisplay> x_display_;
90eb525c5499e34cc9c4b825d6d9e75bb07cc06aceBen Murdoch#endif
915821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)
925821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)#if defined(WEBRTC_MAC) && !defined(WEBRTC_IOS)
935d1f7b1de12d16ceb2c938c56701a3e8bfa558f7Torne (Richard Coles)  scoped_refptr<DesktopConfigurationMonitor> configuration_monitor_;
945d1f7b1de12d16ceb2c938c56701a3e8bfa558f7Torne (Richard Coles)  scoped_refptr<FullScreenChromeWindowDetector> full_screen_window_detector_;
955d1f7b1de12d16ceb2c938c56701a3e8bfa558f7Torne (Richard Coles)#endif
965d1f7b1de12d16ceb2c938c56701a3e8bfa558f7Torne (Richard Coles)
975d1f7b1de12d16ceb2c938c56701a3e8bfa558f7Torne (Richard Coles)#if defined(WEBRTC_WIN)
985d1f7b1de12d16ceb2c938c56701a3e8bfa558f7Torne (Richard Coles)  bool allow_use_magnification_api_;
995d1f7b1de12d16ceb2c938c56701a3e8bfa558f7Torne (Richard Coles)#endif
1005d1f7b1de12d16ceb2c938c56701a3e8bfa558f7Torne (Richard Coles)  bool use_update_notifications_;
1015d1f7b1de12d16ceb2c938c56701a3e8bfa558f7Torne (Richard Coles)  bool disable_effects_;
1025d1f7b1de12d16ceb2c938c56701a3e8bfa558f7Torne (Richard Coles)};
1035d1f7b1de12d16ceb2c938c56701a3e8bfa558f7Torne (Richard Coles)
1045d1f7b1de12d16ceb2c938c56701a3e8bfa558f7Torne (Richard Coles)}  // namespace webrtc
1055d1f7b1de12d16ceb2c938c56701a3e8bfa558f7Torne (Richard Coles)
106a1401311d1ab56c4ed0a474bd38c108f75cb0cd9Torne (Richard Coles)#endif  // WEBRTC_MODULES_DESKTOP_CAPTURE_DESKTOP_CAPTURE_OPTIONS_H_
1075d1f7b1de12d16ceb2c938c56701a3e8bfa558f7Torne (Richard Coles)