| OLD | NEW |
| (Empty) | |
| 1 // Copyright 2017 The Chromium Authors. All rights reserved. |
| 2 // Use of this source code is governed by a BSD-style license that can be |
| 3 // found in the LICENSE file. |
| 4 |
| 5 #ifndef MEDIA_CAPTURE_VIDEO_CHROMEOS_VIDEO_CAPTURE_DEVICE_FACTORY_CHROMEOS_H_ |
| 6 #define MEDIA_CAPTURE_VIDEO_CHROMEOS_VIDEO_CAPTURE_DEVICE_FACTORY_CHROMEOS_H_ |
| 7 |
| 8 #include <memory> |
| 9 |
| 10 #include "base/macros.h" |
| 11 #include "media/capture/video/chromeos/camera_hal_delegate.h" |
| 12 #include "media/capture/video/video_capture_device_factory.h" |
| 13 |
| 14 namespace media { |
| 15 |
| 16 class CAPTURE_EXPORT VideoCaptureDeviceFactoryChromeOS final |
| 17 : public VideoCaptureDeviceFactory { |
| 18 public: |
| 19 VideoCaptureDeviceFactoryChromeOS( |
| 20 scoped_refptr<base::SingleThreadTaskRunner> ui_task_runner); |
| 21 |
| 22 ~VideoCaptureDeviceFactoryChromeOS(); |
| 23 |
| 24 // VideoCaptureDeviceFactory interface implementations. |
| 25 std::unique_ptr<VideoCaptureDevice> CreateDevice( |
| 26 const VideoCaptureDeviceDescriptor& device_descriptor) final; |
| 27 void GetSupportedFormats( |
| 28 const VideoCaptureDeviceDescriptor& device_descriptor, |
| 29 VideoCaptureFormats* supported_formats) final; |
| 30 void GetDeviceDescriptors( |
| 31 VideoCaptureDeviceDescriptors* device_descriptors) final; |
| 32 |
| 33 // Initializes the factory. The factory is functional only after this call |
| 34 // succeeds. This method is called on the browser IO thread when the factory |
| 35 // instance is created. |
| 36 bool Init(); |
| 37 |
| 38 private: |
| 39 const scoped_refptr<base::SingleThreadTaskRunner> ui_task_runner_; |
| 40 |
| 41 // The thread that all the Mojo operations of |camera_hal_delegate_| take |
| 42 // place. Started in Init and stopped when the class instance is destroyed. |
| 43 base::Thread module_thread_; |
| 44 |
| 45 // Communication interface to the camera HAL. |camera_hal_delegate_| is |
| 46 // created on the thread where the VideoCaptureDeviceFactoryChromeOS was |
| 47 // instantiated. All the Mojo communication that |camera_hal_delegate_| |
| 48 // issues and receives must be sequenced through |module_thread_|. |
| 49 scoped_refptr<CameraHalDelegate> camera_hal_delegate_; |
| 50 |
| 51 DISALLOW_COPY_AND_ASSIGN(VideoCaptureDeviceFactoryChromeOS); |
| 52 }; |
| 53 |
| 54 } // namespace media |
| 55 |
| 56 #endif // MEDIA_CAPTURE_VIDEO_CHROMEOS_VIDEO_CAPTURE_DEVICE_FACTORY_CHROMEOS_H_ |
| OLD | NEW |