| 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. |
| 11 | 11 |
| 12 #ifndef MEDIA_VIDEO_CAPTURE_VIDEO_CAPTURE_DEVICE_H_ | 12 #ifndef MEDIA_VIDEO_CAPTURE_VIDEO_CAPTURE_DEVICE_H_ |
| 13 #define MEDIA_VIDEO_CAPTURE_VIDEO_CAPTURE_DEVICE_H_ | 13 #define MEDIA_VIDEO_CAPTURE_VIDEO_CAPTURE_DEVICE_H_ |
| 14 | 14 |
| 15 #include <list> | 15 #include <list> |
| 16 #include <string> | 16 #include <string> |
| 17 | 17 |
| 18 #include "base/files/file.h" | 18 #include "base/files/file.h" |
| 19 #include "base/logging.h" | 19 #include "base/logging.h" |
| 20 #include "base/memory/ref_counted.h" | 20 #include "base/memory/ref_counted.h" |
| 21 #include "base/memory/scoped_ptr.h" | 21 #include "base/memory/scoped_ptr.h" |
| 22 #include "base/single_thread_task_runner.h" | 22 #include "base/single_thread_task_runner.h" |
| 23 #include "base/time/time.h" | 23 #include "base/time/time.h" |
| 24 #include "media/base/media_export.h" | 24 #include "media/base/media_export.h" |
| 25 #include "media/base/video_capture_types.h" | 25 #include "media/base/video_capture_types.h" |
| 26 #include "media/base/video_frame.h" | 26 #include "media/base/video_frame.h" |
| 27 #include "ui/gfx/gpu_memory_buffer.h" | 27 #include "ui/gfx/gpu_memory_buffer.h" |
| 28 | 28 |
| 29 namespace tracked_objects { |
| 30 class Location; |
| 31 } // namespace tracked_objects |
| 32 |
| 29 namespace media { | 33 namespace media { |
| 30 | 34 |
| 31 class MEDIA_EXPORT VideoCaptureDevice { | 35 class MEDIA_EXPORT VideoCaptureDevice { |
| 32 public: | 36 public: |
| 33 // Represents a capture device name and ID. | 37 // Represents a capture device name and ID. |
| 34 // You should not create an instance of this class directly by e.g. setting | 38 // You should not create an instance of this class directly by e.g. setting |
| 35 // various properties directly. Instead use | 39 // various properties directly. Instead use |
| 36 // VideoCaptureDevice::GetDeviceNames to do this for you and if you need to | 40 // VideoCaptureDevice::GetDeviceNames to do this for you and if you need to |
| 37 // cache your own copy of a name, you can do so via the copy constructor. | 41 // cache your own copy of a name, you can do so via the copy constructor. |
| 38 // The reason for this is that a device name might contain platform specific | 42 // The reason for this is that a device name might contain platform specific |
| (...skipping 204 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 243 scoped_ptr<Buffer> buffer, | 247 scoped_ptr<Buffer> buffer, |
| 244 const VideoCaptureFormat& frame_format, | 248 const VideoCaptureFormat& frame_format, |
| 245 const base::TimeTicks& timestamp) = 0; | 249 const base::TimeTicks& timestamp) = 0; |
| 246 virtual void OnIncomingCapturedVideoFrame( | 250 virtual void OnIncomingCapturedVideoFrame( |
| 247 scoped_ptr<Buffer> buffer, | 251 scoped_ptr<Buffer> buffer, |
| 248 const scoped_refptr<VideoFrame>& frame, | 252 const scoped_refptr<VideoFrame>& frame, |
| 249 const base::TimeTicks& timestamp) = 0; | 253 const base::TimeTicks& timestamp) = 0; |
| 250 | 254 |
| 251 // An error has occurred that cannot be handled and VideoCaptureDevice must | 255 // An error has occurred that cannot be handled and VideoCaptureDevice must |
| 252 // be StopAndDeAllocate()-ed. |reason| is a text description of the error. | 256 // be StopAndDeAllocate()-ed. |reason| is a text description of the error. |
| 253 virtual void OnError(const std::string& reason) = 0; | 257 virtual void OnError(const tracked_objects::Location& from_here, |
| 258 const std::string& reason) = 0; |
| 254 | 259 |
| 255 // VideoCaptureDevice requests the |message| to be logged. | 260 // VideoCaptureDevice requests the |message| to be logged. |
| 256 virtual void OnLog(const std::string& message) {} | 261 virtual void OnLog(const std::string& message) {} |
| 257 | 262 |
| 258 // Returns the current buffer pool utilization, in the range 0.0 (no buffers | 263 // Returns the current buffer pool utilization, in the range 0.0 (no buffers |
| 259 // are in use by producers or consumers) to 1.0 (all buffers are in use). | 264 // are in use by producers or consumers) to 1.0 (all buffers are in use). |
| 260 virtual double GetBufferPoolUtilization() const = 0; | 265 virtual double GetBufferPoolUtilization() const = 0; |
| 261 }; | 266 }; |
| 262 | 267 |
| 263 virtual ~VideoCaptureDevice(); | 268 virtual ~VideoCaptureDevice(); |
| (...skipping 24 matching lines...) Expand all Loading... |
| 288 | 293 |
| 289 private: | 294 private: |
| 290 // Gets the power line frequency from the current system time zone if this is | 295 // Gets the power line frequency from the current system time zone if this is |
| 291 // defined, otherwise returns 0. | 296 // defined, otherwise returns 0. |
| 292 PowerLineFrequency GetPowerLineFrequencyForLocation() const; | 297 PowerLineFrequency GetPowerLineFrequencyForLocation() const; |
| 293 }; | 298 }; |
| 294 | 299 |
| 295 } // namespace media | 300 } // namespace media |
| 296 | 301 |
| 297 #endif // MEDIA_VIDEO_CAPTURE_VIDEO_CAPTURE_DEVICE_H_ | 302 #endif // MEDIA_VIDEO_CAPTURE_VIDEO_CAPTURE_DEVICE_H_ |
| OLD | NEW |