Chromium Code Reviews| OLD | NEW |
|---|---|
| 1 // Copyright 2014 The Chromium Authors. All rights reserved. | 1 // Copyright 2014 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 // Implementation of a fake VideoCaptureDeviceFactory class. | |
| 6 | |
| 7 #ifndef MEDIA_CAPTURE_VIDEO_FAKE_VIDEO_CAPTURE_DEVICE_FACTORY_H_ | 5 #ifndef MEDIA_CAPTURE_VIDEO_FAKE_VIDEO_CAPTURE_DEVICE_FACTORY_H_ |
| 8 #define MEDIA_CAPTURE_VIDEO_FAKE_VIDEO_CAPTURE_DEVICE_FACTORY_H_ | 6 #define MEDIA_CAPTURE_VIDEO_FAKE_VIDEO_CAPTURE_DEVICE_FACTORY_H_ |
| 9 | 7 |
| 10 #include "media/capture/video/fake_video_capture_device.h" | 8 #include "media/capture/video/fake_video_capture_device.h" |
| 11 #include "media/capture/video/video_capture_device_factory.h" | 9 #include "media/capture/video/video_capture_device_factory.h" |
| 12 | 10 |
| 13 namespace media { | 11 namespace media { |
| 14 | 12 |
| 15 // Extension of VideoCaptureDeviceFactory to create and manipulate fake devices, | 13 // Implementation of VideoCaptureDeviceFactory that creates fake devices |
| 16 // not including file-based ones. | 14 // that generate test output frames. |
| 15 // By default, the factory has one device outputting I420. | |
| 16 // When increasing the number of devices using set_number_of_devices(), the | |
| 17 // second device will use Y16, and any devices beyond that will use I420. | |
| 18 // By default, the delivery mode of all devices is USE_OWN_BUFFERS. | |
| 19 // This, as well as other parameters, can be changed using command-line flags. | |
| 20 // See implementation of method ParseCommandLine() for details. | |
| 17 class CAPTURE_EXPORT FakeVideoCaptureDeviceFactory | 21 class CAPTURE_EXPORT FakeVideoCaptureDeviceFactory |
| 18 : public VideoCaptureDeviceFactory { | 22 : public VideoCaptureDeviceFactory { |
| 19 public: | 23 public: |
| 20 FakeVideoCaptureDeviceFactory(); | 24 FakeVideoCaptureDeviceFactory(); |
| 21 ~FakeVideoCaptureDeviceFactory() override {} | 25 ~FakeVideoCaptureDeviceFactory() override {} |
| 22 | 26 |
| 23 std::unique_ptr<VideoCaptureDevice> CreateDevice( | 27 std::unique_ptr<VideoCaptureDevice> CreateDevice( |
| 24 const VideoCaptureDeviceDescriptor& device_descriptor) override; | 28 const VideoCaptureDeviceDescriptor& device_descriptor) override; |
| 25 void GetDeviceDescriptors( | 29 void GetDeviceDescriptors( |
| 26 VideoCaptureDeviceDescriptors* device_descriptors) override; | 30 VideoCaptureDeviceDescriptors* device_descriptors) override; |
| 27 void GetSupportedFormats( | 31 void GetSupportedFormats( |
| 28 const VideoCaptureDeviceDescriptor& device_descriptor, | 32 const VideoCaptureDeviceDescriptor& device_descriptor, |
| 29 VideoCaptureFormats* supported_formats) override; | 33 VideoCaptureFormats* supported_formats) override; |
| 30 | 34 |
| 31 void set_number_of_devices(int number_of_devices) { | 35 void set_number_of_devices(int number_of_devices) { |
| 32 DCHECK(thread_checker_.CalledOnValidThread()); | 36 DCHECK(thread_checker_.CalledOnValidThread()); |
| 33 number_of_devices_ = number_of_devices; | 37 number_of_devices_ = number_of_devices; |
| 34 } | 38 } |
| 35 int number_of_devices() { | 39 int number_of_devices() { |
| 36 DCHECK(thread_checker_.CalledOnValidThread()); | 40 DCHECK(thread_checker_.CalledOnValidThread()); |
| 37 return number_of_devices_; | 41 return number_of_devices_; |
| 38 } | 42 } |
| 39 | 43 |
| 40 private: | 44 private: |
| 41 void ParseCommandLine(); | 45 void ParseCommandLine(); |
| 42 | 46 |
| 43 int number_of_devices_; | 47 int number_of_devices_; |
| 44 FakeVideoCaptureDevice::BufferOwnership fake_vcd_ownership_; | 48 FakeVideoCaptureDeviceMaker::DeliveryMode delivery_mode_; |
| 45 float frame_rate_; | 49 float output_frame_rate_; |
|
mcasas
2017/01/12 03:19:16
I'd leave this as |frame_rate_|, since is the only
chfremer
2017/01/18 01:29:52
Done.
| |
| 46 bool command_line_parsed_ = false; | 50 bool command_line_parsed_ = false; |
| 47 }; | 51 }; |
| 48 | 52 |
| 49 } // namespace media | 53 } // namespace media |
| 50 | 54 |
| 51 #endif // MEDIA_CAPTURE_VIDEO_FAKE_VIDEO_CAPTURE_DEVICE_FACTORY_H_ | 55 #endif // MEDIA_CAPTURE_VIDEO_FAKE_VIDEO_CAPTURE_DEVICE_FACTORY_H_ |
| OLD | NEW |