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/modules/desktop_capture/desktop_frame.h" | |
18 #include "webrtc/modules/desktop_capture/desktop_capture_types.h" | 19 #include "webrtc/modules/desktop_capture/desktop_capture_types.h" |
19 #include "webrtc/modules/desktop_capture/shared_memory.h" | 20 #include "webrtc/modules/desktop_capture/shared_memory.h" |
20 | 21 |
21 namespace webrtc { | 22 namespace webrtc { |
22 | 23 |
23 class DesktopFrame; | 24 class DesktopFrame; |
24 class DesktopRegion; | |
25 | 25 |
26 // Abstract interface for screen and window capturers. | 26 // Abstract interface for screen and window capturers. |
27 class DesktopCapturer { | 27 class DesktopCapturer { |
28 public: | 28 public: |
29 enum class Result { | |
30 // The frame was captured successfully. | |
31 SUCCESS, | |
32 | |
33 // There was a temporary error. The caller should retry capting again. | |
Wez
2016/06/01 21:29:05
typo: capting
nit: IIUC what you mean here is tha
Sergey Ulanov
2016/06/03 08:14:31
Good point. Reworded the comment a bit.
| |
34 ERROR_TEMPORARY, | |
35 | |
36 // Capture has failed and will keep failing if the caller tries calling | |
37 // Capture() again. | |
38 ERROR_PERMANENT, | |
39 }; | |
40 | |
29 // Interface that must be implemented by the DesktopCapturer consumers. | 41 // Interface that must be implemented by the DesktopCapturer consumers. |
30 class Callback { | 42 class Callback { |
31 public: | 43 public: |
32 // Called after a frame has been captured. Handler must take ownership of | 44 // Called after a frame has been captured. |frame| is not nullptr iff |
Wez
2016/06/01 21:29:05
nit: I've been told off before for using "iff". ;)
Sergey Ulanov
2016/06/03 08:14:31
Done.
| |
33 // |frame|. If capture has failed for any reason |frame| is set to NULL | 45 // |result| is SUCCESS. |
34 // (e.g. the window has been closed). | 46 virtual void OnCaptureResult(Result result, |
35 virtual void OnCaptureCompleted(DesktopFrame* frame) = 0; | 47 std::unique_ptr<DesktopFrame> frame) { |
48 OnCaptureCompleted(frame.release()); | |
49 } | |
50 | |
51 // Deprecated version of the method above that uses raw pointer instead of | |
52 // std::unique_ptr<>. | |
53 // TODO(sergeyu): Remove this method and make OnCaptureResult() pure | |
54 // virtual. crbug.com/webrtc/5950 | |
55 virtual void OnCaptureCompleted(DesktopFrame* frame) { delete frame; }; | |
36 | 56 |
37 protected: | 57 protected: |
38 virtual ~Callback() {} | 58 virtual ~Callback() {} |
39 }; | 59 }; |
40 | 60 |
41 virtual ~DesktopCapturer() {} | 61 virtual ~DesktopCapturer() {} |
42 | 62 |
43 // Called at the beginning of a capturing session. |callback| must remain | 63 // Called at the beginning of a capturing session. |callback| must remain |
44 // valid until capturer is destroyed. | 64 // valid until capturer is destroyed. |
45 virtual void Start(Callback* callback) = 0; | 65 virtual void Start(Callback* callback) = 0; |
(...skipping 16 matching lines...) Expand all Loading... | |
62 // Sets the window to be excluded from the captured image in the future | 82 // Sets the window to be excluded from the captured image in the future |
63 // Capture calls. Used to exclude the screenshare notification window for | 83 // Capture calls. Used to exclude the screenshare notification window for |
64 // screen capturing. | 84 // screen capturing. |
65 virtual void SetExcludedWindow(WindowId window) {} | 85 virtual void SetExcludedWindow(WindowId window) {} |
66 }; | 86 }; |
67 | 87 |
68 } // namespace webrtc | 88 } // namespace webrtc |
69 | 89 |
70 #endif // WEBRTC_MODULES_DESKTOP_CAPTURE_DESKTOP_CAPTURER_H_ | 90 #endif // WEBRTC_MODULES_DESKTOP_CAPTURE_DESKTOP_CAPTURER_H_ |
71 | 91 |
OLD | NEW |