| 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_CAPTURE_VIDEO_VIDEO_CAPTURE_DEVICE_H_ | 12 #ifndef MEDIA_CAPTURE_VIDEO_VIDEO_CAPTURE_DEVICE_H_ |
| 13 #define MEDIA_CAPTURE_VIDEO_VIDEO_CAPTURE_DEVICE_H_ | 13 #define MEDIA_CAPTURE_VIDEO_VIDEO_CAPTURE_DEVICE_H_ |
| 14 | 14 |
| 15 #include <stddef.h> | 15 #include <stddef.h> |
| 16 #include <stdint.h> | 16 #include <stdint.h> |
| 17 | 17 |
| 18 #include <list> | 18 #include <list> |
| 19 #include <memory> | 19 #include <memory> |
| 20 #include <string> | 20 #include <string> |
| 21 | 21 |
| 22 #include "base/callback.h" | |
| 23 #include "base/files/file.h" | 22 #include "base/files/file.h" |
| 24 #include "base/logging.h" | 23 #include "base/logging.h" |
| 25 #include "base/memory/ref_counted.h" | 24 #include "base/memory/ref_counted.h" |
| 26 #include "base/single_thread_task_runner.h" | 25 #include "base/single_thread_task_runner.h" |
| 27 #include "base/time/time.h" | 26 #include "base/time/time.h" |
| 28 #include "build/build_config.h" | 27 #include "build/build_config.h" |
| 29 #include "media/base/media_export.h" | 28 #include "media/base/media_export.h" |
| 30 #include "media/base/video_capture_types.h" | 29 #include "media/base/video_capture_types.h" |
| 31 #include "media/base/video_frame.h" | 30 #include "media/base/video_frame.h" |
| 32 #include "media/capture/video/scoped_result_callback.h" | 31 #include "media/capture/video/scoped_result_callback.h" |
| 33 #include "mojo/public/cpp/bindings/array.h" | 32 #include "mojo/public/cpp/bindings/array.h" |
| 33 #include "mojo/public/cpp/bindings/callback.h" |
| 34 #include "ui/gfx/gpu_memory_buffer.h" | 34 #include "ui/gfx/gpu_memory_buffer.h" |
| 35 | 35 |
| 36 namespace tracked_objects { | 36 namespace tracked_objects { |
| 37 class Location; | 37 class Location; |
| 38 } // namespace tracked_objects | 38 } // namespace tracked_objects |
| 39 | 39 |
| 40 namespace media { | 40 namespace media { |
| 41 | 41 |
| 42 class MEDIA_EXPORT VideoCaptureDevice { | 42 class MEDIA_EXPORT VideoCaptureDevice { |
| 43 public: | 43 public: |
| (...skipping 264 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 308 // If deallocation is done asynchronously, then the device implementation must | 308 // If deallocation is done asynchronously, then the device implementation must |
| 309 // ensure that a subsequent AllocateAndStart() operation targeting the same ID | 309 // ensure that a subsequent AllocateAndStart() operation targeting the same ID |
| 310 // would be sequenced through the same task runner, so that deallocation | 310 // would be sequenced through the same task runner, so that deallocation |
| 311 // happens first. | 311 // happens first. |
| 312 virtual void StopAndDeAllocate() = 0; | 312 virtual void StopAndDeAllocate() = 0; |
| 313 | 313 |
| 314 // Asynchronously takes a photo, possibly reconfiguring the capture objects | 314 // Asynchronously takes a photo, possibly reconfiguring the capture objects |
| 315 // and/or interrupting the capture flow. Runs |callback| on the thread | 315 // and/or interrupting the capture flow. Runs |callback| on the thread |
| 316 // where TakePhoto() is called, if the photo was successfully taken. | 316 // where TakePhoto() is called, if the photo was successfully taken. |
| 317 using TakePhotoCallback = | 317 using TakePhotoCallback = |
| 318 base::Callback<void(mojo::String, mojo::Array<uint8_t>)>; | 318 mojo::Callback<void(mojo::String, mojo::Array<uint8_t>)>; |
| 319 virtual void TakePhoto(ScopedResultCallback<TakePhotoCallback> callback); | 319 virtual void TakePhoto(ScopedResultCallback<TakePhotoCallback> callback); |
| 320 | 320 |
| 321 // Gets the power line frequency, either from the params if specified by the | 321 // Gets the power line frequency, either from the params if specified by the |
| 322 // user or from the current system time zone. | 322 // user or from the current system time zone. |
| 323 PowerLineFrequency GetPowerLineFrequency( | 323 PowerLineFrequency GetPowerLineFrequency( |
| 324 const VideoCaptureParams& params) const; | 324 const VideoCaptureParams& params) const; |
| 325 | 325 |
| 326 private: | 326 private: |
| 327 // Gets the power line frequency from the current system time zone if this is | 327 // Gets the power line frequency from the current system time zone if this is |
| 328 // defined, otherwise returns 0. | 328 // defined, otherwise returns 0. |
| 329 PowerLineFrequency GetPowerLineFrequencyForLocation() const; | 329 PowerLineFrequency GetPowerLineFrequencyForLocation() const; |
| 330 }; | 330 }; |
| 331 | 331 |
| 332 } // namespace media | 332 } // namespace media |
| 333 | 333 |
| 334 #endif // MEDIA_CAPTURE_VIDEO_VIDEO_CAPTURE_DEVICE_H_ | 334 #endif // MEDIA_CAPTURE_VIDEO_VIDEO_CAPTURE_DEVICE_H_ |
| OLD | NEW |