| 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/logging.h" | 18 #include "base/logging.h" |
| 19 #include "base/memory/ref_counted.h" | 19 #include "base/memory/ref_counted.h" |
| 20 #include "base/memory/scoped_ptr.h" | 20 #include "base/memory/scoped_ptr.h" |
| 21 #include "base/single_thread_task_runner.h" |
| 21 #include "base/time/time.h" | 22 #include "base/time/time.h" |
| 22 #include "media/base/media_export.h" | 23 #include "media/base/media_export.h" |
| 23 #include "media/base/video_frame.h" | 24 #include "media/base/video_frame.h" |
| 24 #include "media/video/capture/video_capture_types.h" | 25 #include "media/video/capture/video_capture_types.h" |
| 25 | 26 |
| 26 namespace media { | 27 namespace media { |
| 27 | 28 |
| 28 class MEDIA_EXPORT VideoCaptureDevice { | 29 class MEDIA_EXPORT VideoCaptureDevice { |
| 29 public: | 30 public: |
| 30 // Represents a capture device name and ID. | 31 // Represents a capture device name and ID. |
| (...skipping 152 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 183 const scoped_refptr<media::VideoFrame>& frame, | 184 const scoped_refptr<media::VideoFrame>& frame, |
| 184 base::TimeTicks timestamp) = 0; | 185 base::TimeTicks timestamp) = 0; |
| 185 | 186 |
| 186 // An error has occurred that cannot be handled and VideoCaptureDevice must | 187 // An error has occurred that cannot be handled and VideoCaptureDevice must |
| 187 // be StopAndDeAllocate()-ed. |reason| is a text description of the error. | 188 // be StopAndDeAllocate()-ed. |reason| is a text description of the error. |
| 188 virtual void OnError(const std::string& reason) = 0; | 189 virtual void OnError(const std::string& reason) = 0; |
| 189 }; | 190 }; |
| 190 | 191 |
| 191 // Creates a VideoCaptureDevice object. | 192 // Creates a VideoCaptureDevice object. |
| 192 // Return NULL if the hardware is not available. | 193 // Return NULL if the hardware is not available. |
| 193 static VideoCaptureDevice* Create(const Name& device_name); | 194 static VideoCaptureDevice* Create( |
| 195 scoped_refptr<base::SingleThreadTaskRunner> ui_task_runner, |
| 196 const Name& device_name); |
| 194 virtual ~VideoCaptureDevice(); | 197 virtual ~VideoCaptureDevice(); |
| 195 | 198 |
| 196 // Gets the names of all video capture devices connected to this computer. | 199 // Gets the names of all video capture devices connected to this computer. |
| 197 static void GetDeviceNames(Names* device_names); | 200 static void GetDeviceNames(Names* device_names); |
| 198 | 201 |
| 199 // Gets the supported formats of a particular device attached to the system. | 202 // Gets the supported formats of a particular device attached to the system. |
| 200 // This method should be called before allocating or starting a device. In | 203 // This method should be called before allocating or starting a device. In |
| 201 // case format enumeration is not supported, or there was a problem, the | 204 // case format enumeration is not supported, or there was a problem, the |
| 202 // formats array will be empty. | 205 // formats array will be empty. |
| 203 static void GetDeviceSupportedFormats(const Name& device, | 206 static void GetDeviceSupportedFormats(const Name& device, |
| (...skipping 23 matching lines...) Expand all Loading... |
| 227 int GetPowerLineFrequencyForLocation() const; | 230 int GetPowerLineFrequencyForLocation() const; |
| 228 | 231 |
| 229 protected: | 232 protected: |
| 230 static const int kPowerLine50Hz = 50; | 233 static const int kPowerLine50Hz = 50; |
| 231 static const int kPowerLine60Hz = 60; | 234 static const int kPowerLine60Hz = 60; |
| 232 }; | 235 }; |
| 233 | 236 |
| 234 } // namespace media | 237 } // namespace media |
| 235 | 238 |
| 236 #endif // MEDIA_VIDEO_CAPTURE_VIDEO_CAPTURE_DEVICE_H_ | 239 #endif // MEDIA_VIDEO_CAPTURE_VIDEO_CAPTURE_DEVICE_H_ |
| OLD | NEW |