| OLD | NEW |
| 1 // Copyright 2013 The Chromium Authors. All rights reserved. | 1 // Copyright 2013 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.h" | 5 #include "media/video/capture/file_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/command_line.h" | 10 #include "base/command_line.h" |
| (...skipping 141 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 152 Name(base::SysWideToUTF8(command_line_file_path.value()), | 152 Name(base::SysWideToUTF8(command_line_file_path.value()), |
| 153 kFileVideoCaptureDeviceName)); | 153 kFileVideoCaptureDeviceName)); |
| 154 #else | 154 #else |
| 155 device_names->push_back(Name(command_line_file_path.value(), | 155 device_names->push_back(Name(command_line_file_path.value(), |
| 156 kFileVideoCaptureDeviceName)); | 156 kFileVideoCaptureDeviceName)); |
| 157 #endif // OS_WIN | 157 #endif // OS_WIN |
| 158 } | 158 } |
| 159 | 159 |
| 160 void FileVideoCaptureDevice::GetDeviceSupportedFormats( | 160 void FileVideoCaptureDevice::GetDeviceSupportedFormats( |
| 161 const Name& device, | 161 const Name& device, |
| 162 VideoCaptureCapabilities* formats) { | 162 VideoCaptureFormats* supported_formats) { |
| 163 base::PlatformFile file = OpenFileForRead(GetFilePathFromCommandLine()); | 163 base::PlatformFile file = OpenFileForRead(GetFilePathFromCommandLine()); |
| 164 VideoCaptureCapability capture_capability; | 164 VideoCaptureFormat capture_format; |
| 165 ParseFileAndExtractVideoFormat(file, &capture_capability.supported_format); | 165 ParseFileAndExtractVideoFormat(file, &capture_format); |
| 166 formats->push_back(capture_capability); | 166 supported_formats->push_back(capture_format); |
| 167 | 167 |
| 168 CHECK(base::ClosePlatformFile(file)); | 168 CHECK(base::ClosePlatformFile(file)); |
| 169 } | 169 } |
| 170 | 170 |
| 171 VideoCaptureDevice* FileVideoCaptureDevice::Create(const Name& device_name) { | 171 VideoCaptureDevice* FileVideoCaptureDevice::Create(const Name& device_name) { |
| 172 #if defined(OS_WIN) | 172 #if defined(OS_WIN) |
| 173 return new FileVideoCaptureDevice( | 173 return new FileVideoCaptureDevice( |
| 174 base::FilePath(base::SysUTF8ToWide(device_name.name()))); | 174 base::FilePath(base::SysUTF8ToWide(device_name.name()))); |
| 175 #else | 175 #else |
| 176 return new FileVideoCaptureDevice(base::FilePath(device_name.name())); | 176 return new FileVideoCaptureDevice(base::FilePath(device_name.name())); |
| (...skipping 116 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 293 capture_format_); | 293 capture_format_); |
| 294 // Reschedule next CaptureTask. | 294 // Reschedule next CaptureTask. |
| 295 base::MessageLoop::current()->PostDelayedTask( | 295 base::MessageLoop::current()->PostDelayedTask( |
| 296 FROM_HERE, | 296 FROM_HERE, |
| 297 base::Bind(&FileVideoCaptureDevice::OnCaptureTask, | 297 base::Bind(&FileVideoCaptureDevice::OnCaptureTask, |
| 298 base::Unretained(this)), | 298 base::Unretained(this)), |
| 299 base::TimeDelta::FromSeconds(1) / capture_format_.frame_rate); | 299 base::TimeDelta::FromSeconds(1) / capture_format_.frame_rate); |
| 300 } | 300 } |
| 301 | 301 |
| 302 } // namespace media | 302 } // namespace media |
| OLD | NEW |