OLD | NEW |
1 /* | 1 /* |
2 * Copyright (c) 2013 The WebRTC project authors. All Rights Reserved. | 2 * Copyright (c) 2013 The WebRTC project authors. All Rights Reserved. |
3 * | 3 * |
4 * Use of this source code is governed by a BSD-style license | 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 | 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 | 6 * tree. An additional intellectual property rights grant can be found |
7 * in the file PATENTS. All contributing project authors may | 7 * in the file PATENTS. All contributing project authors may |
8 * be found in the AUTHORS file in the root of the source tree. | 8 * be found in the AUTHORS file in the root of the source tree. |
9 */ | 9 */ |
10 | 10 |
11 #ifndef WEBRTC_MODULES_DESKTOP_CAPTURE_SCREEN_CAPTURER_H_ | 11 #ifndef WEBRTC_MODULES_DESKTOP_CAPTURE_SCREEN_CAPTURER_H_ |
12 #define WEBRTC_MODULES_DESKTOP_CAPTURE_SCREEN_CAPTURER_H_ | 12 #define WEBRTC_MODULES_DESKTOP_CAPTURE_SCREEN_CAPTURER_H_ |
13 | 13 |
14 #include <vector> | 14 #include <vector> |
15 | 15 |
16 #include "webrtc/modules/desktop_capture/desktop_capture_types.h" | 16 #include "webrtc/modules/desktop_capture/desktop_capture_types.h" |
17 #include "webrtc/modules/desktop_capture/desktop_capturer.h" | 17 #include "webrtc/modules/desktop_capture/desktop_capturer.h" |
18 #include "webrtc/typedefs.h" | 18 #include "webrtc/typedefs.h" |
19 | 19 |
20 namespace webrtc { | 20 namespace webrtc { |
21 | 21 |
22 class DesktopCaptureOptions; | 22 class DesktopCaptureOptions; |
23 | 23 |
| 24 // TODO(zijiehe): Remove this class. |
24 // Class used to capture video frames asynchronously. | 25 // Class used to capture video frames asynchronously. |
25 // | 26 // |
26 // The full capture sequence is as follows: | 27 // The full capture sequence is as follows: |
27 // | 28 // |
28 // (1) Start | 29 // (1) Start |
29 // This is when pre-capture steps are executed, such as flagging the | 30 // This is when pre-capture steps are executed, such as flagging the |
30 // display to prevent it from sleeping during a session. | 31 // display to prevent it from sleeping during a session. |
31 // | 32 // |
32 // (2) CaptureFrame | 33 // (2) CaptureFrame |
33 // This is where the bits for the invalid rects are packaged up and sent | 34 // This is where the bits for the invalid rects are packaged up and sent |
34 // to the encoder. | 35 // to the encoder. |
35 // A screen capture is performed if needed. For example, Windows requires | 36 // A screen capture is performed if needed. For example, Windows requires |
36 // a capture to calculate the diff from the previous screen, whereas the | 37 // a capture to calculate the diff from the previous screen, whereas the |
37 // Mac version does not. | 38 // Mac version does not. |
38 // | 39 // |
39 // Implementation has to ensure the following guarantees: | 40 // Implementation has to ensure the following guarantees: |
40 // 1. Double buffering | 41 // 1. Double buffering |
41 // Since data can be read while another capture action is happening. | 42 // Since data can be read while another capture action is happening. |
42 class ScreenCapturer : public DesktopCapturer { | 43 class ScreenCapturer : public DesktopCapturer { |
43 public: | 44 public: |
44 // Use a struct to represent a screen although it has only an id for now, | 45 // Use a struct to represent a screen although it has only an id for now, |
45 // because we may want to add more fields (e.g. description) in the future. | 46 // because we may want to add more fields (e.g. description) in the future. |
46 struct Screen { | 47 struct Screen { |
47 ScreenId id; | 48 ScreenId id; |
48 }; | 49 }; |
49 typedef std::vector<Screen> ScreenList; | 50 typedef std::vector<Screen> ScreenList; |
50 | 51 |
51 ~ScreenCapturer() override {} | 52 ~ScreenCapturer() override; |
52 | 53 |
53 // Creates a platform-specific capturer. | 54 // Creates a platform-specific capturer. |
54 static ScreenCapturer* Create(const DesktopCaptureOptions& options); | 55 static ScreenCapturer* Create(const DesktopCaptureOptions& options); |
55 | 56 |
| 57 // Deprecated, use GetSourceList(). |
56 // Get the list of screens (not containing kFullDesktopScreenId). Returns | 58 // Get the list of screens (not containing kFullDesktopScreenId). Returns |
57 // false in case of a failure. | 59 // false in case of a failure. |
58 virtual bool GetScreenList(ScreenList* screens) = 0; | 60 virtual bool GetScreenList(ScreenList* screens); |
59 | 61 |
| 62 // Deprecated, use SelectSource(). |
60 // Select the screen to be captured. Returns false in case of a failure (e.g. | 63 // Select the screen to be captured. Returns false in case of a failure (e.g. |
61 // if there is no screen with the specified id). If this is never called, the | 64 // if there is no screen with the specified id). If this is never called, the |
62 // full desktop is captured. | 65 // full desktop is captured. |
63 virtual bool SelectScreen(ScreenId id) = 0; | 66 virtual bool SelectScreen(ScreenId id); |
| 67 |
| 68 // DesktopCapturer interfaces. |
| 69 bool GetSourceList(SourceList* sources) override; |
| 70 bool SelectSource(SourceId id) override; |
64 }; | 71 }; |
65 | 72 |
66 } // namespace webrtc | 73 } // namespace webrtc |
67 | 74 |
68 #endif // WEBRTC_MODULES_DESKTOP_CAPTURE_SCREEN_CAPTURER_H_ | 75 #endif // WEBRTC_MODULES_DESKTOP_CAPTURE_SCREEN_CAPTURER_H_ |
OLD | NEW |