Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(580)

Side by Side Diff: media/capture/video/file_video_capture_device_factory.cc

Issue 1291933002: File video capture device supports MJPEG format (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: address kcwu@ Created 5 years, 4 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
OLDNEW
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/file_video_capture_device_factory.h" 5 #include "media/capture/video/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 45 matching lines...) Expand 10 before | Expand all | Expand 10 after
56 #else 56 #else
57 device_names->push_back(VideoCaptureDevice::Name( 57 device_names->push_back(VideoCaptureDevice::Name(
58 command_line_file_path.value(), kFileVideoCaptureDeviceName)); 58 command_line_file_path.value(), kFileVideoCaptureDeviceName));
59 #endif 59 #endif
60 } 60 }
61 61
62 void FileVideoCaptureDeviceFactory::GetDeviceSupportedFormats( 62 void FileVideoCaptureDeviceFactory::GetDeviceSupportedFormats(
63 const VideoCaptureDevice::Name& device, 63 const VideoCaptureDevice::Name& device,
64 VideoCaptureFormats* supported_formats) { 64 VideoCaptureFormats* supported_formats) {
65 DCHECK(thread_checker_.CalledOnValidThread()); 65 DCHECK(thread_checker_.CalledOnValidThread());
66 base::File file = 66 scoped_ptr<base::MemoryMappedFile> mapped_file =
67 FileVideoCaptureDevice::OpenFileForRead(GetFilePathFromCommandLine()); 67 FileVideoCaptureDevice::OpenFileForRead(GetFilePathFromCommandLine());
68 if (!file.IsValid()) 68 if (mapped_file && !mapped_file->IsValid())
kcwu 2015/08/17 03:43:34 !mapped_file || !mapped_file->IsValid()
henryhsu 2015/08/17 06:09:21 Done.
69 return; 69 return;
70 VideoCaptureFormat capture_format; 70 VideoCaptureFormat capture_format;
71 FileVideoCaptureDevice::ParseFileAndExtractVideoFormat(&file, 71 int frame_size;
72 &capture_format); 72 if (FileVideoCaptureDevice::ParseFileAndExtractVideoFormat(
73 mapped_file.get(), &capture_format, &frame_size) < 0) {
74 return;
75 }
73 supported_formats->push_back(capture_format); 76 supported_formats->push_back(capture_format);
74 } 77 }
75 78
76 } // namespace media 79 } // namespace media
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698