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 #include "media/video/capture/fake_video_capture_device_factory.h" | 5 #include "media/video/capture/fake_video_capture_device_factory.h" |
6 | 6 |
7 #include "base/strings/stringprintf.h" | 7 #include "base/strings/stringprintf.h" |
8 #include "media/video/capture/fake_video_capture_device.h" | 8 #include "media/video/capture/fake_video_capture_device.h" |
9 | 9 |
10 namespace media { | 10 namespace media { |
11 | 11 |
12 FakeVideoCaptureDeviceFactory::FakeVideoCaptureDeviceFactory() | 12 FakeVideoCaptureDeviceFactory::FakeVideoCaptureDeviceFactory() |
13 : number_of_devices_(1) { | 13 : number_of_devices_(1) { |
14 } | 14 } |
15 | 15 |
16 scoped_ptr<VideoCaptureDevice> FakeVideoCaptureDeviceFactory::Create( | 16 scoped_ptr<VideoCaptureDevice> FakeVideoCaptureDeviceFactory::Create( |
| 17 scoped_refptr<base::SingleThreadTaskRunner> ui_task_runner, |
17 const VideoCaptureDevice::Name& device_name) { | 18 const VideoCaptureDevice::Name& device_name) { |
18 for (int n = 0; n < number_of_devices_; ++n) { | 19 for (int n = 0; n < number_of_devices_; ++n) { |
19 std::string possible_id = base::StringPrintf("/dev/video%d", n); | 20 std::string possible_id = base::StringPrintf("/dev/video%d", n); |
20 if (device_name.id().compare(possible_id) == 0) | 21 if (device_name.id().compare(possible_id) == 0) |
21 return scoped_ptr<VideoCaptureDevice>(new FakeVideoCaptureDevice()); | 22 return scoped_ptr<VideoCaptureDevice>(new FakeVideoCaptureDevice()); |
22 } | 23 } |
23 return scoped_ptr<VideoCaptureDevice>(); | 24 return scoped_ptr<VideoCaptureDevice>(); |
24 } | 25 } |
25 | 26 |
26 void FakeVideoCaptureDeviceFactory::GetDeviceNames( | 27 void FakeVideoCaptureDeviceFactory::GetDeviceNames( |
(...skipping 15 matching lines...) Expand all Loading... |
42 gfx::Size(1280, 720)}; | 43 gfx::Size(1280, 720)}; |
43 supported_formats->clear(); | 44 supported_formats->clear(); |
44 for (size_t i = 0; i < arraysize(supported_sizes); ++i) { | 45 for (size_t i = 0; i < arraysize(supported_sizes); ++i) { |
45 supported_formats->push_back(VideoCaptureFormat(supported_sizes[i], | 46 supported_formats->push_back(VideoCaptureFormat(supported_sizes[i], |
46 frame_rate, | 47 frame_rate, |
47 media::PIXEL_FORMAT_I420)); | 48 media::PIXEL_FORMAT_I420)); |
48 } | 49 } |
49 } | 50 } |
50 | 51 |
51 } // namespace media | 52 } // namespace media |
OLD | NEW |