Update To 11.40.268.0
[platform/framework/web/crosswalk.git] / src / third_party / webrtc / modules / desktop_capture / screen_capturer.h
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
11 #ifndef WEBRTC_MODULES_DESKTOP_CAPTURE_SCREEN_CAPTURER_H_
12 #define WEBRTC_MODULES_DESKTOP_CAPTURE_SCREEN_CAPTURER_H_
13
14 #include <vector>
15
16 #include "webrtc/modules/desktop_capture/desktop_capture_types.h"
17 #include "webrtc/modules/desktop_capture/desktop_capturer.h"
18 #include "webrtc/system_wrappers/interface/scoped_ptr.h"
19 #include "webrtc/typedefs.h"
20
21 namespace webrtc {
22
23 class DesktopCaptureOptions;
24
25 // Class used to capture video frames asynchronously.
26 //
27 // The full capture sequence is as follows:
28 //
29 // (1) Start
30 //     This is when pre-capture steps are executed, such as flagging the
31 //     display to prevent it from sleeping during a session.
32 //
33 // (2) CaptureFrame
34 //     This is where the bits for the invalid rects are packaged up and sent
35 //     to the encoder.
36 //     A screen capture is performed if needed. For example, Windows requires
37 //     a capture to calculate the diff from the previous screen, whereas the
38 //     Mac version does not.
39 //
40 // Implementation has to ensure the following guarantees:
41 // 1. Double buffering
42 //    Since data can be read while another capture action is happening.
43 class ScreenCapturer : public DesktopCapturer {
44  public:
45   // Use a struct to represent a screen although it has only an id for now,
46   // because we may want to add more fields (e.g. description) in the future.
47   struct Screen {
48     ScreenId id;
49   };
50   typedef std::vector<Screen> ScreenList;
51
52   // TODO(sergeyu): Remove this class once all dependencies are removed from
53   // chromium.
54   class MouseShapeObserver {
55   };
56
57   virtual ~ScreenCapturer() {}
58
59   // Creates platform-specific capturer.
60   //
61   // TODO(sergeyu): Remove all Create() methods except the first one.
62   // crbug.com/172183
63   static ScreenCapturer* Create(const DesktopCaptureOptions& options);
64   static ScreenCapturer* Create();
65
66 #if defined(WEBRTC_LINUX)
67   // Creates platform-specific capturer and instructs it whether it should use
68   // X DAMAGE support.
69   static ScreenCapturer* CreateWithXDamage(bool use_x_damage);
70 #elif defined(WEBRTC_WIN)
71   // Creates Windows-specific capturer and instructs it whether or not to
72   // disable desktop compositing.
73   static ScreenCapturer* CreateWithDisableAero(bool disable_aero);
74 #endif  // defined(WEBRTC_WIN)
75
76   // TODO(sergeyu): Remove this method once all dependencies are removed from
77   // chromium.
78   virtual void SetMouseShapeObserver(
79       MouseShapeObserver* mouse_shape_observer) {};
80
81   // Get the list of screens (not containing kFullDesktopScreenId). Returns
82   // false in case of a failure.
83   virtual bool GetScreenList(ScreenList* screens) = 0;
84
85   // Select the screen to be captured. Returns false in case of a failure (e.g.
86   // if there is no screen with the specified id). If this is never called, the
87   // full desktop is captured.
88   virtual bool SelectScreen(ScreenId id) = 0;
89 };
90
91 }  // namespace webrtc
92
93 #endif  // WEBRTC_MODULES_DESKTOP_CAPTURE_SCREEN_CAPTURER_H_