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 #include "media/capture/video/linux/video_capture_device_factory_linux.h" | 5 #include "media/capture/video/linux/video_capture_device_factory_linux.h" |
| 6 | 6 |
| 7 #include <errno.h> | 7 #include <errno.h> |
| 8 #include <fcntl.h> | 8 #include <fcntl.h> |
| 9 #include <stdint.h> | 9 #include <stdint.h> |
| 10 #include <sys/ioctl.h> | 10 #include <sys/ioctl.h> |
| (...skipping 210 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 221 VideoCaptureApi::LINUX_V4L2_SINGLE_PLANE, | 221 VideoCaptureApi::LINUX_V4L2_SINGLE_PLANE, |
| 222 VideoCaptureTransportType::OTHER_TRANSPORT, | 222 VideoCaptureTransportType::OTHER_TRANSPORT, |
| 223 g_camera_facing_helper.Get().GetCameraFacing(unique_id, model_id)); | 223 g_camera_facing_helper.Get().GetCameraFacing(unique_id, model_id)); |
| 224 #else | 224 #else |
| 225 device_descriptors->emplace_back( | 225 device_descriptors->emplace_back( |
| 226 reinterpret_cast<char*>(cap.card), unique_id, model_id, | 226 reinterpret_cast<char*>(cap.card), unique_id, model_id, |
| 227 VideoCaptureApi::LINUX_V4L2_SINGLE_PLANE); | 227 VideoCaptureApi::LINUX_V4L2_SINGLE_PLANE); |
| 228 #endif | 228 #endif |
| 229 } | 229 } |
| 230 } | 230 } |
| 231 #if defined(OS_CHROMEOS) | |
| 232 // Since JS doesn't have API to get camera facing, we sort the list to make | |
| 233 // apps can use the front camera by default. | |
|
mcasas
2017/01/25 17:35:15
nit: s/to make apps can use/to make sure apps use/
henryhsu
2017/01/26 02:22:54
Done.
| |
| 234 // TODO(henryhsu): remove this after JS API completed (crbug.com/543997). | |
|
Guido Urdaneta
2017/01/25 10:24:47
Is this comment valid?
It is true that once crbug.
henryhsu
2017/01/25 10:38:01
Once crbug.com/543997 is fixed, caller should have
| |
| 235 std::sort(device_descriptors->begin(), device_descriptors->end()); | |
| 236 #endif | |
| 231 } | 237 } |
| 232 | 238 |
| 233 void VideoCaptureDeviceFactoryLinux::GetSupportedFormats( | 239 void VideoCaptureDeviceFactoryLinux::GetSupportedFormats( |
| 234 const VideoCaptureDeviceDescriptor& device, | 240 const VideoCaptureDeviceDescriptor& device, |
| 235 VideoCaptureFormats* supported_formats) { | 241 VideoCaptureFormats* supported_formats) { |
| 236 DCHECK(thread_checker_.CalledOnValidThread()); | 242 DCHECK(thread_checker_.CalledOnValidThread()); |
| 237 if (device.device_id.empty()) | 243 if (device.device_id.empty()) |
| 238 return; | 244 return; |
| 239 base::ScopedFD fd(HANDLE_EINTR(open(device.device_id.c_str(), O_RDONLY))); | 245 base::ScopedFD fd(HANDLE_EINTR(open(device.device_id.c_str(), O_RDONLY))); |
| 240 if (!fd.is_valid()) // Failed to open this device. | 246 if (!fd.is_valid()) // Failed to open this device. |
| (...skipping 28 matching lines...) Expand all Loading... | |
| 269 } | 275 } |
| 270 | 276 |
| 271 // static | 277 // static |
| 272 VideoCaptureDeviceFactory* | 278 VideoCaptureDeviceFactory* |
| 273 VideoCaptureDeviceFactory::CreateVideoCaptureDeviceFactory( | 279 VideoCaptureDeviceFactory::CreateVideoCaptureDeviceFactory( |
| 274 scoped_refptr<base::SingleThreadTaskRunner> ui_task_runner) { | 280 scoped_refptr<base::SingleThreadTaskRunner> ui_task_runner) { |
| 275 return new VideoCaptureDeviceFactoryLinux(ui_task_runner); | 281 return new VideoCaptureDeviceFactoryLinux(ui_task_runner); |
| 276 } | 282 } |
| 277 | 283 |
| 278 } // namespace media | 284 } // namespace media |
| OLD | NEW |