Line data Source code
1 : /*
2 : * Copyright (c) 2013 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 WEBRTC_MODULES_DESKTOP_CAPTURE_DESKTOP_CAPTURE_OPTIONS_H_
11 : #define WEBRTC_MODULES_DESKTOP_CAPTURE_DESKTOP_CAPTURE_OPTIONS_H_
12 :
13 : #include "webrtc/base/constructormagic.h"
14 : #include "webrtc/base/scoped_ref_ptr.h"
15 :
16 : #if defined(USE_X11)
17 : #include "webrtc/modules/desktop_capture/x11/shared_x_display.h"
18 : #endif
19 :
20 : #if defined(WEBRTC_MAC) && !defined(WEBRTC_IOS)
21 : #include "webrtc/modules/desktop_capture/mac/desktop_configuration_monitor.h"
22 : #include "webrtc/modules/desktop_capture/mac/full_screen_chrome_window_detector.h"
23 : #endif
24 :
25 : namespace webrtc {
26 :
27 : // An object that stores initialization parameters for screen and window
28 : // capturers.
29 0 : class DesktopCaptureOptions {
30 : public:
31 : // Returns instance of DesktopCaptureOptions with default parameters. On Linux
32 : // also initializes X window connection. x_display() will be set to null if
33 : // X11 connection failed (e.g. DISPLAY isn't set).
34 : static DesktopCaptureOptions CreateDefault();
35 :
36 : DesktopCaptureOptions();
37 : DesktopCaptureOptions(const DesktopCaptureOptions& options);
38 : DesktopCaptureOptions(DesktopCaptureOptions&& options);
39 : ~DesktopCaptureOptions();
40 :
41 : DesktopCaptureOptions& operator=(const DesktopCaptureOptions& options);
42 : DesktopCaptureOptions& operator=(DesktopCaptureOptions&& options);
43 :
44 : #if defined(USE_X11)
45 0 : SharedXDisplay* x_display() const { return x_display_; }
46 0 : void set_x_display(rtc::scoped_refptr<SharedXDisplay> x_display) {
47 0 : x_display_ = x_display;
48 0 : }
49 : #endif
50 :
51 : #if defined(WEBRTC_MAC) && !defined(WEBRTC_IOS)
52 : DesktopConfigurationMonitor* configuration_monitor() const {
53 : return configuration_monitor_;
54 : }
55 : void set_configuration_monitor(
56 : rtc::scoped_refptr<DesktopConfigurationMonitor> m) {
57 : configuration_monitor_ = m;
58 : }
59 :
60 : FullScreenChromeWindowDetector* full_screen_chrome_window_detector() const {
61 : return full_screen_window_detector_;
62 : }
63 : void set_full_screen_chrome_window_detector(
64 : rtc::scoped_refptr<FullScreenChromeWindowDetector> detector) {
65 : full_screen_window_detector_ = detector;
66 : }
67 : #endif
68 :
69 : // Flag indicating that the capturer should use screen change notifications.
70 : // Enables/disables use of XDAMAGE in the X11 capturer.
71 0 : bool use_update_notifications() const { return use_update_notifications_; }
72 : void set_use_update_notifications(bool use_update_notifications) {
73 : use_update_notifications_ = use_update_notifications;
74 : }
75 :
76 : // Flag indicating if desktop effects (e.g. Aero) should be disabled when the
77 : // capturer is active. Currently used only on Windows.
78 : bool disable_effects() const { return disable_effects_; }
79 0 : void set_disable_effects(bool disable_effects) {
80 0 : disable_effects_ = disable_effects;
81 0 : }
82 :
83 : // Flag that should be set if the consumer uses updated_region() and the
84 : // capturer should try to provide correct updated_region() for the frames it
85 : // generates (e.g. by comparing each frame with the previous one).
86 : // TODO(zijiehe): WindowCapturer ignores this opinion until we merge
87 : // ScreenCapturer and WindowCapturer interfaces.
88 0 : bool detect_updated_region() const { return detect_updated_region_; }
89 : void set_detect_updated_region(bool detect_updated_region) {
90 : detect_updated_region_ = detect_updated_region;
91 : }
92 :
93 : #if defined(WEBRTC_WIN)
94 : bool allow_use_magnification_api() const {
95 : return allow_use_magnification_api_;
96 : }
97 : void set_allow_use_magnification_api(bool allow) {
98 : allow_use_magnification_api_ = allow;
99 : }
100 : // Allowing directx based capturer or not, this capturer works on windows 7
101 : // with platform update / windows 8 or upper.
102 : bool allow_directx_capturer() const {
103 : return allow_directx_capturer_;
104 : }
105 : void set_allow_directx_capturer(bool enabled) {
106 : allow_directx_capturer_ = enabled;
107 : }
108 : #endif
109 :
110 : private:
111 : #if defined(USE_X11)
112 : rtc::scoped_refptr<SharedXDisplay> x_display_;
113 : #endif
114 :
115 : #if defined(WEBRTC_MAC) && !defined(WEBRTC_IOS)
116 : rtc::scoped_refptr<DesktopConfigurationMonitor> configuration_monitor_;
117 : rtc::scoped_refptr<FullScreenChromeWindowDetector>
118 : full_screen_window_detector_;
119 : #endif
120 :
121 : #if defined(WEBRTC_WIN)
122 : bool allow_use_magnification_api_ = false;
123 : bool allow_directx_capturer_ = false;
124 : #endif
125 : #if defined(USE_X11)
126 : bool use_update_notifications_ = false;
127 : #else
128 : bool use_update_notifications_ = true;
129 : #endif
130 : bool disable_effects_ = true;
131 : bool detect_updated_region_ = false;
132 : };
133 :
134 : } // namespace webrtc
135 :
136 : #endif // WEBRTC_MODULES_DESKTOP_CAPTURE_DESKTOP_CAPTURE_OPTIONS_H_
|