| 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 { |
| (...skipping 11 matching lines...) Expand all Loading... |
| 22 return scoped_ptr<VideoCaptureDevice>(new FakeVideoCaptureDevice()); | 22 return scoped_ptr<VideoCaptureDevice>(new FakeVideoCaptureDevice()); |
| 23 } | 23 } |
| 24 return scoped_ptr<VideoCaptureDevice>(); | 24 return scoped_ptr<VideoCaptureDevice>(); |
| 25 } | 25 } |
| 26 | 26 |
| 27 void FakeVideoCaptureDeviceFactory::GetDeviceNames( | 27 void FakeVideoCaptureDeviceFactory::GetDeviceNames( |
| 28 VideoCaptureDevice::Names* const device_names) { | 28 VideoCaptureDevice::Names* const device_names) { |
| 29 DCHECK(thread_checker_.CalledOnValidThread()); | 29 DCHECK(thread_checker_.CalledOnValidThread()); |
| 30 DCHECK(device_names->empty()); | 30 DCHECK(device_names->empty()); |
| 31 for (int n = 0; n < number_of_devices_; ++n) { | 31 for (int n = 0; n < number_of_devices_; ++n) { |
| 32 #if !defined(OS_MACOSX) |
| 32 VideoCaptureDevice::Name name(base::StringPrintf("fake_device_%d", n), | 33 VideoCaptureDevice::Name name(base::StringPrintf("fake_device_%d", n), |
| 33 base::StringPrintf("/dev/video%d", n)); | 34 base::StringPrintf("/dev/video%d", n)); |
| 35 #else |
| 36 VideoCaptureDevice::Name name(base::StringPrintf("fake_device_%d", n), |
| 37 base::StringPrintf("/dev/video%d", n), |
| 38 VideoCaptureDevice::Name::AVFOUNDATION); |
| 39 #endif |
| 34 device_names->push_back(name); | 40 device_names->push_back(name); |
| 35 } | 41 } |
| 36 } | 42 } |
| 37 | 43 |
| 38 void FakeVideoCaptureDeviceFactory::GetDeviceSupportedFormats( | 44 void FakeVideoCaptureDeviceFactory::GetDeviceSupportedFormats( |
| 39 const VideoCaptureDevice::Name& device, | 45 const VideoCaptureDevice::Name& device, |
| 40 VideoCaptureFormats* supported_formats) { | 46 VideoCaptureFormats* supported_formats) { |
| 41 DCHECK(thread_checker_.CalledOnValidThread()); | 47 DCHECK(thread_checker_.CalledOnValidThread()); |
| 42 const int frame_rate = 1000 / FakeVideoCaptureDevice::kFakeCaptureTimeoutMs; | 48 const int frame_rate = 1000 / FakeVideoCaptureDevice::kFakeCaptureTimeoutMs; |
| 43 const gfx::Size supported_sizes[] = {gfx::Size(320, 240), | 49 const gfx::Size supported_sizes[] = {gfx::Size(320, 240), |
| 44 gfx::Size(640, 480), | 50 gfx::Size(640, 480), |
| 45 gfx::Size(1280, 720)}; | 51 gfx::Size(1280, 720)}; |
| 46 supported_formats->clear(); | 52 supported_formats->clear(); |
| 47 for (size_t i = 0; i < arraysize(supported_sizes); ++i) { | 53 for (size_t i = 0; i < arraysize(supported_sizes); ++i) { |
| 48 supported_formats->push_back(VideoCaptureFormat(supported_sizes[i], | 54 supported_formats->push_back(VideoCaptureFormat(supported_sizes[i], |
| 49 frame_rate, | 55 frame_rate, |
| 50 media::PIXEL_FORMAT_I420)); | 56 media::PIXEL_FORMAT_I420)); |
| 51 } | 57 } |
| 52 } | 58 } |
| 53 | 59 |
| 54 } // namespace media | 60 } // namespace media |
| OLD | NEW |