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: |
45 typedef DesktopCapturer::ScreenId ScreenId; | |
46 | |
44 // Use a struct to represent a screen although it has only an id for now, | 47 // 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. | 48 // because we may want to add more fields (e.g. description) in the future. |
46 struct Screen { | 49 struct Screen { |
47 ScreenId id; | 50 ScreenId id; |
48 }; | 51 }; |
49 typedef std::vector<Screen> ScreenList; | 52 typedef std::vector<Screen> ScreenList; |
50 | 53 |
51 ~ScreenCapturer() override {} | 54 ~ScreenCapturer() override; |
52 | 55 |
53 // Creates a platform-specific capturer. | 56 // Creates a platform-specific capturer. |
54 static ScreenCapturer* Create(const DesktopCaptureOptions& options); | 57 static ScreenCapturer* Create(const DesktopCaptureOptions& options); |
55 | 58 |
59 // Deprecated, use GetSourceList. | |
Sergey Ulanov
2016/10/28 15:53:22
nit: s/GetSourceList/GetSourceList()/
Hzj_jie
2016/10/28 22:03:53
Done.
| |
56 // Get the list of screens (not containing kFullDesktopScreenId). Returns | 60 // Get the list of screens (not containing kFullDesktopScreenId). Returns |
57 // false in case of a failure. | 61 // false in case of a failure. |
58 virtual bool GetScreenList(ScreenList* screens) = 0; | 62 virtual bool GetScreenList(ScreenList* screens); |
59 | 63 |
64 // Deprecated, use SelectSource. | |
Sergey Ulanov
2016/10/28 15:53:22
SelectSource()
Hzj_jie
2016/10/28 22:03:53
Done.
| |
60 // Select the screen to be captured. Returns false in case of a failure (e.g. | 65 // 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 | 66 // if there is no screen with the specified id). If this is never called, the |
62 // full desktop is captured. | 67 // full desktop is captured. |
63 virtual bool SelectScreen(ScreenId id) = 0; | 68 virtual bool SelectScreen(ScreenId id); |
69 | |
70 // DesktopCapturer interfaces. | |
71 bool GetSourceList(SourceList* sources) override; | |
72 bool SelectSource(const Source& source) override; | |
64 }; | 73 }; |
65 | 74 |
66 } // namespace webrtc | 75 } // namespace webrtc |
67 | 76 |
68 #endif // WEBRTC_MODULES_DESKTOP_CAPTURE_SCREEN_CAPTURER_H_ | 77 #endif // WEBRTC_MODULES_DESKTOP_CAPTURE_SCREEN_CAPTURER_H_ |
OLD | NEW |