OLD | NEW |
| (Empty) |
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/typedefs.h" | |
19 | |
20 namespace webrtc { | |
21 | |
22 class DesktopCaptureOptions; | |
23 | |
24 // TODO(zijiehe): Remove this class. | |
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 ~ScreenCapturer() override; | |
53 | |
54 // Creates a platform-specific capturer. | |
55 static ScreenCapturer* Create(const DesktopCaptureOptions& options); | |
56 | |
57 // Deprecated, use GetSourceList(). | |
58 // Get the list of screens (not containing kFullDesktopScreenId). Returns | |
59 // false in case of a failure. | |
60 virtual bool GetScreenList(ScreenList* screens); | |
61 | |
62 // Deprecated, use SelectSource(). | |
63 // Select the screen to be captured. Returns false in case of a failure (e.g. | |
64 // if there is no screen with the specified id). If this is never called, the | |
65 // full desktop is captured. | |
66 virtual bool SelectScreen(ScreenId id); | |
67 | |
68 // DesktopCapturer interfaces. | |
69 bool GetSourceList(SourceList* sources) override; | |
70 bool SelectSource(SourceId id) override; | |
71 }; | |
72 | |
73 } // namespace webrtc | |
74 | |
75 #endif // WEBRTC_MODULES_DESKTOP_CAPTURE_SCREEN_CAPTURER_H_ | |
OLD | NEW |