| OLD | NEW |
| 1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2012 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.h" | 5 #include "media/video/capture/fake_video_capture_device.h" |
| 6 | 6 |
| 7 #include <string> | 7 #include <string> |
| 8 | 8 |
| 9 #include "base/bind.h" | 9 #include "base/bind.h" |
| 10 #include "base/memory/scoped_ptr.h" | 10 #include "base/memory/scoped_ptr.h" |
| (...skipping 19 matching lines...) Expand all Loading... |
| 30 for (int n = 0; n < kNumberOfFakeDevices; n++) { | 30 for (int n = 0; n < kNumberOfFakeDevices; n++) { |
| 31 Name name(base::StringPrintf("fake_device_%d", n), | 31 Name name(base::StringPrintf("fake_device_%d", n), |
| 32 base::StringPrintf("/dev/video%d", n)); | 32 base::StringPrintf("/dev/video%d", n)); |
| 33 device_names->push_back(name); | 33 device_names->push_back(name); |
| 34 } | 34 } |
| 35 } | 35 } |
| 36 | 36 |
| 37 void FakeVideoCaptureDevice::GetDeviceSupportedFormats( | 37 void FakeVideoCaptureDevice::GetDeviceSupportedFormats( |
| 38 const Name& device, | 38 const Name& device, |
| 39 VideoCaptureCapabilities* formats) { | 39 VideoCaptureCapabilities* formats) { |
| 40 VideoCaptureCapability capture_format; | 40 formats->clear(); |
| 41 capture_format.color = media::PIXEL_FORMAT_I420; | 41 VideoCaptureCapability capture_format_640x480; |
| 42 capture_format.width = 640; | 42 capture_format_640x480.color = media::PIXEL_FORMAT_I420; |
| 43 capture_format.height = 480; | 43 capture_format_640x480.width = 640; |
| 44 capture_format.frame_rate = 1000 / kFakeCaptureTimeoutMs; | 44 capture_format_640x480.height = 480; |
| 45 formats->push_back(capture_format); | 45 capture_format_640x480.frame_rate = 1000 / kFakeCaptureTimeoutMs; |
| 46 formats->push_back(capture_format_640x480); |
| 47 VideoCaptureCapability capture_format_320x240; |
| 48 capture_format_320x240.color = media::PIXEL_FORMAT_I420; |
| 49 capture_format_320x240.width = 320; |
| 50 capture_format_320x240.height = 240; |
| 51 capture_format_320x240.frame_rate = 1000 / kFakeCaptureTimeoutMs; |
| 52 formats->push_back(capture_format_320x240); |
| 46 } | 53 } |
| 47 | 54 |
| 48 VideoCaptureDevice* FakeVideoCaptureDevice::Create(const Name& device_name) { | 55 VideoCaptureDevice* FakeVideoCaptureDevice::Create(const Name& device_name) { |
| 49 if (fail_next_create_) { | 56 if (fail_next_create_) { |
| 50 fail_next_create_ = false; | 57 fail_next_create_ = false; |
| 51 return NULL; | 58 return NULL; |
| 52 } | 59 } |
| 53 for (int n = 0; n < kNumberOfFakeDevices; ++n) { | 60 for (int n = 0; n < kNumberOfFakeDevices; ++n) { |
| 54 std::string possible_id = base::StringPrintf("/dev/video%d", n); | 61 std::string possible_id = base::StringPrintf("/dev/video%d", n); |
| 55 if (device_name.id().compare(possible_id) == 0) { | 62 if (device_name.id().compare(possible_id) == 0) { |
| (...skipping 175 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 231 media::VideoCaptureCapability(800, | 238 media::VideoCaptureCapability(800, |
| 232 600, | 239 600, |
| 233 30, | 240 30, |
| 234 PIXEL_FORMAT_I420, | 241 PIXEL_FORMAT_I420, |
| 235 VariableResolutionVideoCaptureDevice)); | 242 VariableResolutionVideoCaptureDevice)); |
| 236 | 243 |
| 237 capabilities_roster_index_ = 0; | 244 capabilities_roster_index_ = 0; |
| 238 } | 245 } |
| 239 | 246 |
| 240 } // namespace media | 247 } // namespace media |
| OLD | NEW |