| 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 explicit VideoCaptureDeviceFactoryChromeOS( | |
| 20 scoped_refptr<base::SingleThreadTaskRunner> | |
| 21 task_runner_for_screen_observer); | |
| 22 | |
| 23 ~VideoCaptureDeviceFactoryChromeOS() override; | |
| 24 | |
| 25 // VideoCaptureDeviceFactory interface implementations. | |
| 26 std::unique_ptr<VideoCaptureDevice> CreateDevice( | |
| 27 const VideoCaptureDeviceDescriptor& device_descriptor) final; | |
| 28 void GetSupportedFormats( | |
| 29 const VideoCaptureDeviceDescriptor& device_descriptor, | |
| 30 VideoCaptureFormats* supported_formats) final; | |
| 31 void GetDeviceDescriptors( | |
| 32 VideoCaptureDeviceDescriptors* device_descriptors) final; | |
| 33 | |
| 34 // Initializes the factory. The factory is functional only after this call | |
| 35 // succeeds. | |
| 36 bool Init(); | |
| 37 | |
| 38 // A run-time check for whether we should enable | |
| 39 // VideoCaptureDeviceFactoryChromeOS on the device. | |
| 40 static bool ShouldEnable(); | |
| 41 | |
| 42 private: | |
| 43 const scoped_refptr<base::SingleThreadTaskRunner> | |
| 44 task_runner_for_screen_observer_; | |
| 45 | |
| 46 // The thread that all the Mojo operations of |camera_hal_delegate_| take | |
| 47 // place. Started in Init and stopped when the class instance is destroyed. | |
| 48 base::Thread camera_hal_ipc_thread_; | |
| 49 | |
| 50 // Communication interface to the camera HAL. |camera_hal_delegate_| is | |
| 51 // created on the thread on which Init is called. All the Mojo communication | |
| 52 // that |camera_hal_delegate_| issues and receives must be sequenced through | |
| 53 // |camera_hal_ipc_thread_|. | |
| 54 scoped_refptr<CameraHalDelegate> camera_hal_delegate_; | |
| 55 | |
| 56 DISALLOW_COPY_AND_ASSIGN(VideoCaptureDeviceFactoryChromeOS); | |
| 57 }; | |
| 58 | |
| 59 } // namespace media | |
| 60 | |
| 61 #endif // MEDIA_CAPTURE_VIDEO_CHROMEOS_VIDEO_CAPTURE_DEVICE_FACTORY_CHROMEOS_H_ | |
| OLD | NEW |