| 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 10 matching lines...) Expand all Loading... |
| 21 | 21 |
| 22 #include "base/files/file.h" | 22 #include "base/files/file.h" |
| 23 #include "base/logging.h" | 23 #include "base/logging.h" |
| 24 #include "base/memory/ref_counted.h" | 24 #include "base/memory/ref_counted.h" |
| 25 #include "base/single_thread_task_runner.h" | 25 #include "base/single_thread_task_runner.h" |
| 26 #include "base/time/time.h" | 26 #include "base/time/time.h" |
| 27 #include "build/build_config.h" | 27 #include "build/build_config.h" |
| 28 #include "media/base/media_export.h" | 28 #include "media/base/media_export.h" |
| 29 #include "media/base/video_capture_types.h" | 29 #include "media/base/video_capture_types.h" |
| 30 #include "media/base/video_frame.h" | 30 #include "media/base/video_frame.h" |
| 31 #include "media/capture/video/scoped_callback.h" |
| 32 #include "third_party/WebKit/public/platform/modules/imagecapture/image_capture.
mojom.h" |
| 31 #include "ui/gfx/gpu_memory_buffer.h" | 33 #include "ui/gfx/gpu_memory_buffer.h" |
| 32 | 34 |
| 33 namespace tracked_objects { | 35 namespace tracked_objects { |
| 34 class Location; | 36 class Location; |
| 35 } // namespace tracked_objects | 37 } // namespace tracked_objects |
| 36 | 38 |
| 37 namespace media { | 39 namespace media { |
| 38 | 40 |
| 39 class MEDIA_EXPORT VideoCaptureDevice { | 41 class MEDIA_EXPORT VideoCaptureDevice { |
| 40 public: | 42 public: |
| (...skipping 252 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 293 // memory associated with capture, and delete the |client| pointer passed into | 295 // memory associated with capture, and delete the |client| pointer passed into |
| 294 // AllocateAndStart. | 296 // AllocateAndStart. |
| 295 // | 297 // |
| 296 // If deallocation is done asynchronously, then the device implementation must | 298 // If deallocation is done asynchronously, then the device implementation must |
| 297 // ensure that a subsequent AllocateAndStart() operation targeting the same ID | 299 // ensure that a subsequent AllocateAndStart() operation targeting the same ID |
| 298 // would be sequenced through the same task runner, so that deallocation | 300 // would be sequenced through the same task runner, so that deallocation |
| 299 // happens first. | 301 // happens first. |
| 300 virtual void StopAndDeAllocate() = 0; | 302 virtual void StopAndDeAllocate() = 0; |
| 301 | 303 |
| 302 // Asynchronously takes a photo, possibly reconfiguring the capture objects | 304 // Asynchronously takes a photo, possibly reconfiguring the capture objects |
| 303 // and/or interrupting the capture flow. Returns false if taking the picture | 305 // and/or interrupting the capture flow. Runs |callback| on the thread |
| 304 // could not be scheduled at all, or else runs |photo_callback| (on the thread | 306 // where TakePhoto() is called, if the photo was successfully taken. |
| 305 // where TakePhoto() is run). | 307 using TakePhotoCallback = blink::mojom::ImageCapture::TakePhotoCallback; |
| 306 using TakePhotoCallback = | 308 virtual void TakePhoto(ScopedCallback<TakePhotoCallback> callback); |
| 307 base::Callback<void(const std::string&, | |
| 308 std::unique_ptr<std::vector<uint8_t>>)>; | |
| 309 virtual bool TakePhoto(const TakePhotoCallback& photo_callback) | |
| 310 WARN_UNUSED_RESULT; | |
| 311 | 309 |
| 312 // Gets the power line frequency, either from the params if specified by the | 310 // Gets the power line frequency, either from the params if specified by the |
| 313 // user or from the current system time zone. | 311 // user or from the current system time zone. |
| 314 PowerLineFrequency GetPowerLineFrequency( | 312 PowerLineFrequency GetPowerLineFrequency( |
| 315 const VideoCaptureParams& params) const; | 313 const VideoCaptureParams& params) const; |
| 316 | 314 |
| 317 private: | 315 private: |
| 318 // Gets the power line frequency from the current system time zone if this is | 316 // Gets the power line frequency from the current system time zone if this is |
| 319 // defined, otherwise returns 0. | 317 // defined, otherwise returns 0. |
| 320 PowerLineFrequency GetPowerLineFrequencyForLocation() const; | 318 PowerLineFrequency GetPowerLineFrequencyForLocation() const; |
| 321 }; | 319 }; |
| 322 | 320 |
| 323 } // namespace media | 321 } // namespace media |
| 324 | 322 |
| 325 #endif // MEDIA_VIDEO_CAPTURE_VIDEO_CAPTURE_DEVICE_H_ | 323 #endif // MEDIA_VIDEO_CAPTURE_VIDEO_CAPTURE_DEVICE_H_ |
| OLD | NEW |