OLD | NEW |
1 // Copyright 2016 The Chromium Authors. All rights reserved. | 1 // Copyright 2016 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 "services/video_capture/mock_device_factory.h" | 5 #include "services/video_capture/mock_device_factory.h" |
6 | 6 |
7 #include <sstream> | 7 #include <sstream> |
8 | 8 |
9 #include "base/logging.h" | 9 #include "base/logging.h" |
10 #include "base/strings/stringprintf.h" | 10 #include "base/strings/stringprintf.h" |
11 #include "media/capture/video/fake_video_capture_device.h" | 11 #include "media/capture/video/fake_video_capture_device.h" |
12 #include "services/video_capture/device_mock_to_media_adapter.h" | 12 #include "services/video_capture/device_mock_to_media_adapter.h" |
13 | 13 |
| 14 namespace { |
| 15 // Report a single hard-coded supported format to clients. |
| 16 media::VideoCaptureFormat kSupportedFormat(gfx::Size(), |
| 17 25.0f, |
| 18 media::PIXEL_FORMAT_I420, |
| 19 media::PIXEL_STORAGE_CPU); |
| 20 } |
| 21 |
14 namespace video_capture { | 22 namespace video_capture { |
15 | 23 |
16 MockDeviceFactory::MockDeviceFactory() = default; | 24 MockDeviceFactory::MockDeviceFactory() = default; |
17 | 25 |
18 MockDeviceFactory::~MockDeviceFactory() = default; | 26 MockDeviceFactory::~MockDeviceFactory() = default; |
19 | 27 |
20 void MockDeviceFactory::AddMockDevice( | 28 void MockDeviceFactory::AddMockDevice( |
21 mojom::MockVideoCaptureDevicePtr device, | 29 mojom::MockVideoCaptureDevicePtr device, |
22 const media::VideoCaptureDeviceDescriptor& descriptor) { | 30 const media::VideoCaptureDeviceDescriptor& descriptor) { |
23 devices_[descriptor] = std::move(device); | 31 devices_[descriptor] = std::move(device); |
(...skipping 10 matching lines...) Expand all Loading... |
34 | 42 |
35 void MockDeviceFactory::GetDeviceDescriptors( | 43 void MockDeviceFactory::GetDeviceDescriptors( |
36 media::VideoCaptureDeviceDescriptors* device_descriptors) { | 44 media::VideoCaptureDeviceDescriptors* device_descriptors) { |
37 for (const auto& entry : devices_) | 45 for (const auto& entry : devices_) |
38 device_descriptors->push_back(entry.first); | 46 device_descriptors->push_back(entry.first); |
39 } | 47 } |
40 | 48 |
41 void MockDeviceFactory::GetSupportedFormats( | 49 void MockDeviceFactory::GetSupportedFormats( |
42 const media::VideoCaptureDeviceDescriptor& device_descriptor, | 50 const media::VideoCaptureDeviceDescriptor& device_descriptor, |
43 media::VideoCaptureFormats* supported_formats) { | 51 media::VideoCaptureFormats* supported_formats) { |
44 NOTIMPLEMENTED(); | 52 supported_formats->push_back(kSupportedFormat); |
45 } | 53 } |
46 | 54 |
47 } // namespace video_capture | 55 } // namespace video_capture |
OLD | NEW |