Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(426)

Side by Side Diff: webrtc/modules/desktop_capture/desktop_capturer.h

Issue 2433503002: Remove DesktopRegion parameter from DesktopCapturer::Capture (Closed)
Patch Set: Resolve review comments Created 4 years, 2 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
OLDNEW
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
(...skipping 13 matching lines...) Expand all
24 class DesktopFrame; 24 class DesktopFrame;
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 { 29 enum class Result {
30 // The frame was captured successfully. 30 // The frame was captured successfully.
31 SUCCESS, 31 SUCCESS,
32 32
33 // There was a temporary error. The caller should continue calling 33 // There was a temporary error. The caller should continue calling
34 // Capture(), in the expectation that it will eventually recover. 34 // CaptureFrame(), in the expectation that it will eventually recover.
35 ERROR_TEMPORARY, 35 ERROR_TEMPORARY,
36 36
37 // Capture has failed and will keep failing if the caller tries calling 37 // Capture has failed and will keep failing if the caller tries calling
38 // Capture() again. 38 // CaptureFrame() again.
39 ERROR_PERMANENT, 39 ERROR_PERMANENT,
40 40
41 MAX_VALUE = ERROR_PERMANENT 41 MAX_VALUE = ERROR_PERMANENT
42 }; 42 };
43 43
44 // Interface that must be implemented by the DesktopCapturer consumers. 44 // Interface that must be implemented by the DesktopCapturer consumers.
45 class Callback { 45 class Callback {
46 public: 46 public:
47 // Called after a frame has been captured. |frame| is not nullptr if and 47 // Called after a frame has been captured. |frame| is not nullptr if and
48 // only if |result| is SUCCESS. 48 // only if |result| is SUCCESS.
49 virtual void OnCaptureResult(Result result, 49 virtual void OnCaptureResult(Result result,
50 std::unique_ptr<DesktopFrame> frame) = 0; 50 std::unique_ptr<DesktopFrame> frame) = 0;
51 51
52 protected: 52 protected:
53 virtual ~Callback() {} 53 virtual ~Callback() {}
54 }; 54 };
55 55
56 virtual ~DesktopCapturer() {} 56 virtual ~DesktopCapturer() {}
57 57
58 // Called at the beginning of a capturing session. |callback| must remain 58 // Called at the beginning of a capturing session. |callback| must remain
59 // valid until capturer is destroyed. 59 // valid until capturer is destroyed.
60 virtual void Start(Callback* callback) = 0; 60 virtual void Start(Callback* callback) = 0;
61 61
62 // Sets SharedMemoryFactory that will be used to create buffers for the 62 // Sets SharedMemoryFactory that will be used to create buffers for the
63 // captured frames. The factory can be invoked on a thread other than the one 63 // captured frames. The factory can be invoked on a thread other than the one
64 // where Capture() is called. It will be destroyed on the same thread. Shared 64 // where CaptureFrame() is called. It will be destroyed on the same thread.
65 // memory is currently supported only by some DesktopCapturer implementations. 65 // Shared memory is currently supported only by some DesktopCapturer
66 // implementations.
66 virtual void SetSharedMemoryFactory( 67 virtual void SetSharedMemoryFactory(
67 std::unique_ptr<SharedMemoryFactory> shared_memory_factory) {} 68 std::unique_ptr<SharedMemoryFactory> shared_memory_factory) {}
68 69
69 // This is a legacy interface, consumers should call CaptureFrame() function.
70 virtual void Capture(const DesktopRegion& region) { CaptureFrame(); }
71
72 // Captures next frame, and involve callback provided by Start() function. 70 // Captures next frame, and involve callback provided by Start() function.
73 // Pending capture requests are canceled when DesktopCapturer is deleted. 71 // Pending capture requests are canceled when DesktopCapturer is deleted.
74 virtual void CaptureFrame() { Capture(DesktopRegion()); } 72 virtual void CaptureFrame() = 0;
75 73
76 // Sets the window to be excluded from the captured image in the future 74 // Sets the window to be excluded from the captured image in the future
77 // Capture calls. Used to exclude the screenshare notification window for 75 // Capture calls. Used to exclude the screenshare notification window for
78 // screen capturing. 76 // screen capturing.
79 virtual void SetExcludedWindow(WindowId window) {} 77 virtual void SetExcludedWindow(WindowId window) {}
80 }; 78 };
81 79
82 } // namespace webrtc 80 } // namespace webrtc
83 81
84 #endif // WEBRTC_MODULES_DESKTOP_CAPTURE_DESKTOP_CAPTURER_H_ 82 #endif // WEBRTC_MODULES_DESKTOP_CAPTURE_DESKTOP_CAPTURER_H_
85 83
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698