| 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 157 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 168 | 168 |
| 169 // Interface defining the methods that clients of VideoCapture must have. It | 169 // Interface defining the methods that clients of VideoCapture must have. It |
| 170 // is actually two-in-one: clients may implement OnIncomingCapturedData() or | 170 // is actually two-in-one: clients may implement OnIncomingCapturedData() or |
| 171 // ReserveOutputBuffer() + OnIncomingCapturedVideoFrame(), or all of them. | 171 // ReserveOutputBuffer() + OnIncomingCapturedVideoFrame(), or all of them. |
| 172 // All clients must implement OnError(). | 172 // All clients must implement OnError(). |
| 173 class MEDIA_EXPORT Client { | 173 class MEDIA_EXPORT Client { |
| 174 public: | 174 public: |
| 175 // Memory buffer returned by Client::ReserveOutputBuffer(). | 175 // Memory buffer returned by Client::ReserveOutputBuffer(). |
| 176 class Buffer : public base::RefCountedThreadSafe<Buffer> { | 176 class Buffer : public base::RefCountedThreadSafe<Buffer> { |
| 177 public: | 177 public: |
| 178 int id() const { return id_; } | 178 virtual int id() const = 0; |
| 179 void* data() const { return data_; } | 179 virtual void* data() const = 0; |
| 180 size_t size() const { return size_; } | 180 virtual size_t size() const = 0; |
| 181 | 181 |
| 182 protected: | 182 protected: |
| 183 friend class base::RefCountedThreadSafe<Buffer>; | 183 friend class base::RefCountedThreadSafe<Buffer>; |
| 184 | |
| 185 Buffer(int id, void* data, size_t size) | |
| 186 : id_(id), data_(data), size_(size) {} | |
| 187 virtual ~Buffer() {} | 184 virtual ~Buffer() {} |
| 188 | |
| 189 const int id_; | |
| 190 void* const data_; | |
| 191 const size_t size_; | |
| 192 }; | 185 }; |
| 193 | 186 |
| 194 virtual ~Client() {} | 187 virtual ~Client() {} |
| 195 | 188 |
| 196 // Captured a new video frame, data for which is pointed to by |data|. | 189 // Captured a new video frame, data for which is pointed to by |data|. |
| 197 // | 190 // |
| 198 // The format of the frame is described by |frame_format|, and is assumed to | 191 // The format of the frame is described by |frame_format|, and is assumed to |
| 199 // be tightly packed. This method will try to reserve an output buffer and | 192 // be tightly packed. This method will try to reserve an output buffer and |
| 200 // copy from |data| into the output buffer. If no output buffer is | 193 // copy from |data| into the output buffer. If no output buffer is |
| 201 // available, the frame will be silently dropped. | 194 // available, the frame will be silently dropped. |
| (...skipping 123 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 325 virtual void CaptureImage() {} | 318 virtual void CaptureImage() {} |
| 326 | 319 |
| 327 protected: | 320 protected: |
| 328 static const int kPowerLine50Hz = 50; | 321 static const int kPowerLine50Hz = 50; |
| 329 static const int kPowerLine60Hz = 60; | 322 static const int kPowerLine60Hz = 60; |
| 330 }; | 323 }; |
| 331 | 324 |
| 332 } // namespace media | 325 } // namespace media |
| 333 | 326 |
| 334 #endif // MEDIA_VIDEO_CAPTURE_VIDEO_CAPTURE_DEVICE_H_ | 327 #endif // MEDIA_VIDEO_CAPTURE_VIDEO_CAPTURE_DEVICE_H_ |
| OLD | NEW |