OLD | NEW |
1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. |
2 // Use of this source code is governed by a BSD-style license that can be | 2 // Use of this source code is governed by a BSD-style license that can be |
3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
4 // | 4 // |
5 // VideoCaptureDevice is the abstract base class for realizing video capture | 5 // VideoCaptureDevice is the abstract base class for realizing video capture |
6 // device support in Chromium. It provides the interface for OS dependent | 6 // device support in Chromium. It provides the interface for OS dependent |
7 // implementations. | 7 // implementations. |
8 // The class is created and functions are invoked on a thread owned by | 8 // The class is created and functions are invoked on a thread owned by |
9 // VideoCaptureManager. Capturing is done on other threads, depending on the OS | 9 // VideoCaptureManager. Capturing is done on other threads, depending on the OS |
10 // specific implementation. | 10 // specific implementation. |
(...skipping 57 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
68 static constexpr double kNoUtilizationRecorded = -1.0; | 68 static constexpr double kNoUtilizationRecorded = -1.0; |
69 }; | 69 }; |
70 | 70 |
71 class CAPTURE_EXPORT VideoCaptureDevice | 71 class CAPTURE_EXPORT VideoCaptureDevice |
72 : public VideoFrameConsumerFeedbackObserver { | 72 : public VideoFrameConsumerFeedbackObserver { |
73 public: | 73 public: |
74 | 74 |
75 // Interface defining the methods that clients of VideoCapture must have. It | 75 // Interface defining the methods that clients of VideoCapture must have. It |
76 // is actually two-in-one: clients may implement OnIncomingCapturedData() or | 76 // is actually two-in-one: clients may implement OnIncomingCapturedData() or |
77 // ReserveOutputBuffer() + OnIncomingCapturedVideoFrame(), or all of them. | 77 // ReserveOutputBuffer() + OnIncomingCapturedVideoFrame(), or all of them. |
78 // All clients must implement OnError(). | 78 // All methods may be called as soon as AllocateAndStart() of the |
| 79 // corresponding VideoCaptureDevice is invoked. The methods for buffer |
| 80 // reservation and frame delivery may be called from arbitrary threads but |
| 81 // are guaranteed to be called non-concurrently. The status reporting methods |
| 82 // (OnStarted, OnLog, OnError) may be called concurrently. |
79 class CAPTURE_EXPORT Client { | 83 class CAPTURE_EXPORT Client { |
80 public: | 84 public: |
81 // Struct bundling several parameters being passed between a | 85 // Struct bundling several parameters being passed between a |
82 // VideoCaptureDevice and its VideoCaptureDevice::Client. | 86 // VideoCaptureDevice and its VideoCaptureDevice::Client. |
83 struct CAPTURE_EXPORT Buffer { | 87 struct CAPTURE_EXPORT Buffer { |
84 public: | 88 public: |
85 // Destructor-only interface for encapsulating scoped access permission to | 89 // Destructor-only interface for encapsulating scoped access permission to |
86 // a Buffer. | 90 // a Buffer. |
87 class CAPTURE_EXPORT ScopedAccessPermission { | 91 class CAPTURE_EXPORT ScopedAccessPermission { |
88 public: | 92 public: |
(...skipping 104 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
193 // be StopAndDeAllocate()-ed. |reason| is a text description of the error. | 197 // be StopAndDeAllocate()-ed. |reason| is a text description of the error. |
194 virtual void OnError(const tracked_objects::Location& from_here, | 198 virtual void OnError(const tracked_objects::Location& from_here, |
195 const std::string& reason) = 0; | 199 const std::string& reason) = 0; |
196 | 200 |
197 // VideoCaptureDevice requests the |message| to be logged. | 201 // VideoCaptureDevice requests the |message| to be logged. |
198 virtual void OnLog(const std::string& message) {} | 202 virtual void OnLog(const std::string& message) {} |
199 | 203 |
200 // Returns the current buffer pool utilization, in the range 0.0 (no buffers | 204 // Returns the current buffer pool utilization, in the range 0.0 (no buffers |
201 // are in use by producers or consumers) to 1.0 (all buffers are in use). | 205 // are in use by producers or consumers) to 1.0 (all buffers are in use). |
202 virtual double GetBufferPoolUtilization() const = 0; | 206 virtual double GetBufferPoolUtilization() const = 0; |
| 207 |
| 208 // VideoCaptureDevice reports it's successfully started. |
| 209 virtual void OnStarted() = 0; |
203 }; | 210 }; |
204 | 211 |
205 ~VideoCaptureDevice() override; | 212 ~VideoCaptureDevice() override; |
206 | 213 |
207 // Prepares the video capturer for use. StopAndDeAllocate() must be called | 214 // Prepares the video capturer for use. StopAndDeAllocate() must be called |
208 // before the object is deleted. | 215 // before the object is deleted. |
209 virtual void AllocateAndStart(const VideoCaptureParams& params, | 216 virtual void AllocateAndStart(const VideoCaptureParams& params, |
210 std::unique_ptr<Client> client) = 0; | 217 std::unique_ptr<Client> client) = 0; |
211 | 218 |
212 // In cases where the video capturer self-pauses (e.g., a screen capturer | 219 // In cases where the video capturer self-pauses (e.g., a screen capturer |
(...skipping 75 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
288 | 295 |
289 private: | 296 private: |
290 // Gets the power line frequency from the current system time zone if this is | 297 // Gets the power line frequency from the current system time zone if this is |
291 // defined, otherwise returns 0. | 298 // defined, otherwise returns 0. |
292 PowerLineFrequency GetPowerLineFrequencyForLocation() const; | 299 PowerLineFrequency GetPowerLineFrequencyForLocation() const; |
293 }; | 300 }; |
294 | 301 |
295 } // namespace media | 302 } // namespace media |
296 | 303 |
297 #endif // MEDIA_CAPTURE_VIDEO_VIDEO_CAPTURE_DEVICE_H_ | 304 #endif // MEDIA_CAPTURE_VIDEO_VIDEO_CAPTURE_DEVICE_H_ |
OLD | NEW |