| 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 160 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 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 virtual int id() const = 0; | 178 virtual int id() const = 0; |
| 179 virtual void* data() const = 0; | 179 virtual void* data() const = 0; |
| 180 virtual size_t size() const = 0; | 180 virtual size_t size() const = 0; |
| 181 virtual base::SharedMemoryHandle handle() const = 0; |
| 181 | 182 |
| 182 protected: | 183 protected: |
| 183 friend class base::RefCountedThreadSafe<Buffer>; | 184 friend class base::RefCountedThreadSafe<Buffer>; |
| 184 virtual ~Buffer() {} | 185 virtual ~Buffer() {} |
| 185 }; | 186 }; |
| 186 | 187 |
| 187 virtual ~Client() {} | 188 virtual ~Client() {} |
| 188 | 189 |
| 190 // TODO(kcwu): do we need this? |
| 191 virtual bool InitializeJpegDecoder() = 0; |
| 192 |
| 189 // Captured a new video frame, data for which is pointed to by |data|. | 193 // Captured a new video frame, data for which is pointed to by |data|. |
| 190 // | 194 // |
| 191 // The format of the frame is described by |frame_format|, and is assumed to | 195 // The format of the frame is described by |frame_format|, and is assumed to |
| 192 // be tightly packed. This method will try to reserve an output buffer and | 196 // be tightly packed. This method will try to reserve an output buffer and |
| 193 // copy from |data| into the output buffer. If no output buffer is | 197 // copy from |data| into the output buffer. If no output buffer is |
| 194 // available, the frame will be silently dropped. | 198 // available, the frame will be silently dropped. |
| 195 virtual void OnIncomingCapturedData(const uint8* data, | 199 virtual void OnIncomingCapturedData(const uint8* data, |
| 196 int length, | 200 int length, |
| 197 const VideoCaptureFormat& frame_format, | 201 const VideoCaptureFormat& frame_format, |
| 198 int rotation, // Clockwise. | 202 int rotation, // Clockwise. |
| (...skipping 57 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 256 int GetPowerLineFrequencyForLocation() const; | 260 int GetPowerLineFrequencyForLocation() const; |
| 257 | 261 |
| 258 protected: | 262 protected: |
| 259 static const int kPowerLine50Hz = 50; | 263 static const int kPowerLine50Hz = 50; |
| 260 static const int kPowerLine60Hz = 60; | 264 static const int kPowerLine60Hz = 60; |
| 261 }; | 265 }; |
| 262 | 266 |
| 263 } // namespace media | 267 } // namespace media |
| 264 | 268 |
| 265 #endif // MEDIA_VIDEO_CAPTURE_VIDEO_CAPTURE_DEVICE_H_ | 269 #endif // MEDIA_VIDEO_CAPTURE_VIDEO_CAPTURE_DEVICE_H_ |
| OLD | NEW |