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/file_video_capture_device_factory.h" | 5 #include "media/video/capture/file_video_capture_device_factory.h" |
6 | 6 |
7 #include "base/command_line.h" | 7 #include "base/command_line.h" |
8 #include "base/files/file_path.h" | 8 #include "base/files/file_path.h" |
9 #include "base/strings/sys_string_conversions.h" | 9 #include "base/strings/sys_string_conversions.h" |
10 #include "media/base/media_switches.h" | 10 #include "media/base/media_switches.h" |
(...skipping 33 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
44 #if defined(OS_WIN) | 44 #if defined(OS_WIN) |
45 device_names->push_back(VideoCaptureDevice::Name( | 45 device_names->push_back(VideoCaptureDevice::Name( |
46 base::SysWideToUTF8(command_line_file_path.value()), | 46 base::SysWideToUTF8(command_line_file_path.value()), |
47 kFileVideoCaptureDeviceName, | 47 kFileVideoCaptureDeviceName, |
48 VideoCaptureDevice::Name::DIRECT_SHOW)); | 48 VideoCaptureDevice::Name::DIRECT_SHOW)); |
49 #elif defined(OS_MACOSX) | 49 #elif defined(OS_MACOSX) |
50 device_names->push_back(VideoCaptureDevice::Name( | 50 device_names->push_back(VideoCaptureDevice::Name( |
51 command_line_file_path.value(), | 51 command_line_file_path.value(), |
52 kFileVideoCaptureDeviceName, | 52 kFileVideoCaptureDeviceName, |
53 VideoCaptureDevice::Name::AVFOUNDATION)); | 53 VideoCaptureDevice::Name::AVFOUNDATION)); |
| 54 #elif defined(OS_LINUX) |
| 55 device_names->push_back(VideoCaptureDevice::Name( |
| 56 command_line_file_path.value(), |
| 57 kFileVideoCaptureDeviceName, |
| 58 VideoCaptureDevice::Name::V4L2_SINGLE_PLANE)); |
54 #else | 59 #else |
55 device_names->push_back(VideoCaptureDevice::Name( | 60 device_names->push_back(VideoCaptureDevice::Name( |
56 command_line_file_path.value(), | 61 command_line_file_path.value(), |
57 kFileVideoCaptureDeviceName)); | 62 kFileVideoCaptureDeviceName)); |
58 #endif | 63 #endif |
59 } | 64 } |
60 | 65 |
61 void FileVideoCaptureDeviceFactory::GetDeviceSupportedFormats( | 66 void FileVideoCaptureDeviceFactory::GetDeviceSupportedFormats( |
62 const VideoCaptureDevice::Name& device, | 67 const VideoCaptureDevice::Name& device, |
63 VideoCaptureFormats* supported_formats) { | 68 VideoCaptureFormats* supported_formats) { |
64 DCHECK(thread_checker_.CalledOnValidThread()); | 69 DCHECK(thread_checker_.CalledOnValidThread()); |
65 base::File file = | 70 base::File file = |
66 FileVideoCaptureDevice::OpenFileForRead(GetFilePathFromCommandLine()); | 71 FileVideoCaptureDevice::OpenFileForRead(GetFilePathFromCommandLine()); |
67 if (!file.IsValid()) | 72 if (!file.IsValid()) |
68 return; | 73 return; |
69 VideoCaptureFormat capture_format; | 74 VideoCaptureFormat capture_format; |
70 FileVideoCaptureDevice::ParseFileAndExtractVideoFormat(&file, | 75 FileVideoCaptureDevice::ParseFileAndExtractVideoFormat(&file, |
71 &capture_format); | 76 &capture_format); |
72 supported_formats->push_back(capture_format); | 77 supported_formats->push_back(capture_format); |
73 } | 78 } |
74 | 79 |
75 } // namespace media | 80 } // namespace media |
OLD | NEW |