| 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. | |
| 25 // Class used to capture video frames asynchronously. | 24 // Class used to capture video frames asynchronously. |
| 26 // | 25 // |
| 27 // The full capture sequence is as follows: | 26 // The full capture sequence is as follows: |
| 28 // | 27 // |
| 29 // (1) Start | 28 // (1) Start |
| 30 // This is when pre-capture steps are executed, such as flagging the | 29 // This is when pre-capture steps are executed, such as flagging the |
| 31 // display to prevent it from sleeping during a session. | 30 // display to prevent it from sleeping during a session. |
| 32 // | 31 // |
| 33 // (2) CaptureFrame | 32 // (2) CaptureFrame |
| 34 // This is where the bits for the invalid rects are packaged up and sent | 33 // This is where the bits for the invalid rects are packaged up and sent |
| 35 // to the encoder. | 34 // to the encoder. |
| 36 // A screen capture is performed if needed. For example, Windows requires | 35 // A screen capture is performed if needed. For example, Windows requires |
| 37 // a capture to calculate the diff from the previous screen, whereas the | 36 // a capture to calculate the diff from the previous screen, whereas the |
| 38 // Mac version does not. | 37 // Mac version does not. |
| 39 // | 38 // |
| 40 // Implementation has to ensure the following guarantees: | 39 // Implementation has to ensure the following guarantees: |
| 41 // 1. Double buffering | 40 // 1. Double buffering |
| 42 // Since data can be read while another capture action is happening. | 41 // Since data can be read while another capture action is happening. |
| 43 class ScreenCapturer : public DesktopCapturer { | 42 class ScreenCapturer : public DesktopCapturer { |
| 44 public: | 43 public: |
| 45 // Use a struct to represent a screen although it has only an id for now, | 44 // 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. | 45 // because we may want to add more fields (e.g. description) in the future. |
| 47 struct Screen { | 46 struct Screen { |
| 48 ScreenId id; | 47 ScreenId id; |
| 49 }; | 48 }; |
| 50 typedef std::vector<Screen> ScreenList; | 49 typedef std::vector<Screen> ScreenList; |
| 51 | 50 |
| 52 ~ScreenCapturer() override; | 51 ~ScreenCapturer() override {} |
| 53 | 52 |
| 54 // Creates a platform-specific capturer. | 53 // Creates a platform-specific capturer. |
| 55 static ScreenCapturer* Create(const DesktopCaptureOptions& options); | 54 static ScreenCapturer* Create(const DesktopCaptureOptions& options); |
| 56 | 55 |
| 57 // Deprecated, use GetSourceList(). | |
| 58 // Get the list of screens (not containing kFullDesktopScreenId). Returns | 56 // Get the list of screens (not containing kFullDesktopScreenId). Returns |
| 59 // false in case of a failure. | 57 // false in case of a failure. |
| 60 virtual bool GetScreenList(ScreenList* screens); | 58 virtual bool GetScreenList(ScreenList* screens) = 0; |
| 61 | 59 |
| 62 // Deprecated, use SelectSource(). | |
| 63 // Select the screen to be captured. Returns false in case of a failure (e.g. | 60 // 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 | 61 // if there is no screen with the specified id). If this is never called, the |
| 65 // full desktop is captured. | 62 // full desktop is captured. |
| 66 virtual bool SelectScreen(ScreenId id); | 63 virtual bool SelectScreen(ScreenId id) = 0; |
| 67 | |
| 68 // DesktopCapturer interfaces. | |
| 69 bool GetSourceList(SourceList* sources) override; | |
| 70 bool SelectSource(SourceId id) override; | |
| 71 }; | 64 }; |
| 72 | 65 |
| 73 } // namespace webrtc | 66 } // namespace webrtc |
| 74 | 67 |
| 75 #endif // WEBRTC_MODULES_DESKTOP_CAPTURE_SCREEN_CAPTURER_H_ | 68 #endif // WEBRTC_MODULES_DESKTOP_CAPTURE_SCREEN_CAPTURER_H_ |
| OLD | NEW |