Chromium Code Reviews| 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_DESKTOP_CAPTURER_H_ | 11 #ifndef WEBRTC_MODULES_DESKTOP_CAPTURE_DESKTOP_CAPTURER_H_ |
| 12 #define WEBRTC_MODULES_DESKTOP_CAPTURE_DESKTOP_CAPTURER_H_ | 12 #define WEBRTC_MODULES_DESKTOP_CAPTURE_DESKTOP_CAPTURER_H_ |
| 13 | 13 |
| 14 #include <stddef.h> | 14 #include <stddef.h> |
| 15 | 15 |
| 16 #include <memory> | 16 #include <memory> |
| 17 | 17 |
| 18 #include "webrtc/base/checks.h" | |
| 18 #include "webrtc/modules/desktop_capture/desktop_frame.h" | 19 #include "webrtc/modules/desktop_capture/desktop_frame.h" |
| 19 #include "webrtc/modules/desktop_capture/desktop_capture_types.h" | 20 #include "webrtc/modules/desktop_capture/desktop_capture_types.h" |
| 20 #include "webrtc/modules/desktop_capture/shared_memory.h" | 21 #include "webrtc/modules/desktop_capture/shared_memory.h" |
| 21 | 22 |
| 22 namespace webrtc { | 23 namespace webrtc { |
| 23 | 24 |
| 24 class DesktopFrame; | 25 class DesktopFrame; |
| 25 | 26 |
| 26 // Abstract interface for screen and window capturers. | 27 // Abstract interface for screen and window capturers. |
| 27 class DesktopCapturer { | 28 class DesktopCapturer { |
| (...skipping 14 matching lines...) Expand all Loading... | |
| 42 }; | 43 }; |
| 43 | 44 |
| 44 // Interface that must be implemented by the DesktopCapturer consumers. | 45 // Interface that must be implemented by the DesktopCapturer consumers. |
| 45 class Callback { | 46 class Callback { |
| 46 public: | 47 public: |
| 47 // Called after a frame has been captured. |frame| is not nullptr if and | 48 // Called after a frame has been captured. |frame| is not nullptr if and |
| 48 // only if |result| is SUCCESS. | 49 // only if |result| is SUCCESS. |
| 49 virtual void OnCaptureResult(Result result, | 50 virtual void OnCaptureResult(Result result, |
| 50 std::unique_ptr<DesktopFrame> frame) = 0; | 51 std::unique_ptr<DesktopFrame> frame) = 0; |
| 51 | 52 |
| 53 // A shortcut to return a temporary error. | |
| 54 void OnTemporaryError() { | |
|
Sergey Ulanov
2016/07/08 22:36:53
Please don't add these methods here. Callback is a
Hzj_jie
2016/07/11 00:54:59
Done.
| |
| 55 OnCaptureResult(Result::ERROR_TEMPORARY, nullptr); | |
| 56 } | |
| 57 | |
| 58 // A shortcut to return a permanent error. | |
| 59 void OnPermanentError() { | |
| 60 OnCaptureResult(Result::ERROR_PERMANENT, nullptr); | |
| 61 } | |
| 62 | |
| 63 // A shortcut to return a capture result. | |
| 64 void OnCaptureSucceeded(std::unique_ptr<DesktopFrame> frame) { | |
| 65 RTC_DCHECK(frame); | |
| 66 OnCaptureResult(Result::SUCCESS, std::move(frame)); | |
| 67 } | |
| 68 | |
| 52 protected: | 69 protected: |
| 53 virtual ~Callback() {} | 70 virtual ~Callback() {} |
| 54 }; | 71 }; |
| 55 | 72 |
| 56 virtual ~DesktopCapturer() {} | 73 virtual ~DesktopCapturer() {} |
| 57 | 74 |
| 58 // Called at the beginning of a capturing session. |callback| must remain | 75 // Called at the beginning of a capturing session. |callback| must remain |
| 59 // valid until capturer is destroyed. | 76 // valid until capturer is destroyed. |
| 60 virtual void Start(Callback* callback) = 0; | 77 virtual void Start(Callback* callback) = 0; |
| 61 | 78 |
| (...skipping 15 matching lines...) Expand all Loading... | |
| 77 // Sets the window to be excluded from the captured image in the future | 94 // Sets the window to be excluded from the captured image in the future |
| 78 // Capture calls. Used to exclude the screenshare notification window for | 95 // Capture calls. Used to exclude the screenshare notification window for |
| 79 // screen capturing. | 96 // screen capturing. |
| 80 virtual void SetExcludedWindow(WindowId window) {} | 97 virtual void SetExcludedWindow(WindowId window) {} |
| 81 }; | 98 }; |
| 82 | 99 |
| 83 } // namespace webrtc | 100 } // namespace webrtc |
| 84 | 101 |
| 85 #endif // WEBRTC_MODULES_DESKTOP_CAPTURE_DESKTOP_CAPTURER_H_ | 102 #endif // WEBRTC_MODULES_DESKTOP_CAPTURE_DESKTOP_CAPTURER_H_ |
| 86 | 103 |
| OLD | NEW |