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

Side by Side Diff: media/capture/video/linux/video_capture_device_factory_linux.cc

Issue 2648743002: Rotate frames according to camera orientation (Closed)
Patch Set: removed {} for one-line blocks Created 3 years, 10 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
« no previous file with comments | « media/capture/video/linux/video_capture_device_chromeos.cc ('k') | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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/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>
11 11
12 #include "base/files/file_enumerator.h" 12 #include "base/files/file_enumerator.h"
13 #include "base/files/scoped_file.h" 13 #include "base/files/scoped_file.h"
14 #include "base/posix/eintr_wrapper.h" 14 #include "base/posix/eintr_wrapper.h"
15 #include "base/strings/stringprintf.h" 15 #include "base/strings/stringprintf.h"
16 #include "build/build_config.h" 16 #include "build/build_config.h"
17 17
18 #if defined(OS_OPENBSD) 18 #if defined(OS_OPENBSD)
19 #include <sys/videoio.h> 19 #include <sys/videoio.h>
20 #else 20 #else
21 #include <linux/videodev2.h> 21 #include <linux/videodev2.h>
22 #endif 22 #endif
23 23
24 #if defined(OS_CHROMEOS) 24 #if defined(OS_CHROMEOS)
25 #include "base/lazy_instance.h" 25 #include "base/lazy_instance.h"
26 #include "media/capture/video/linux/camera_facing_chromeos.h" 26 #include "media/capture/video/linux/camera_config_chromeos.h"
27 #include "media/capture/video/linux/video_capture_device_chromeos.h" 27 #include "media/capture/video/linux/video_capture_device_chromeos.h"
28 #endif 28 #endif
29 #include "media/capture/video/linux/video_capture_device_linux.h" 29 #include "media/capture/video/linux/video_capture_device_linux.h"
30 30
31 namespace media { 31 namespace media {
32 32
33 namespace { 33 namespace {
34 34
35 #if defined(OS_CHROMEOS) 35 #if defined(OS_CHROMEOS)
36 base::LazyInstance<media::CameraFacingChromeOS>::Leaky g_camera_facing_helper = 36 base::LazyInstance<media::CameraConfigChromeOS>::Leaky g_camera_config =
37 LAZY_INSTANCE_INITIALIZER; 37 LAZY_INSTANCE_INITIALIZER;
38 #endif 38 #endif
39 } 39 }
40 40
41 // USB VID and PID are both 4 bytes long. 41 // USB VID and PID are both 4 bytes long.
42 static const size_t kVidPidSize = 4; 42 static const size_t kVidPidSize = 4;
43 43
44 // /sys/class/video4linux/video{N}/device is a symlink to the corresponding 44 // /sys/class/video4linux/video{N}/device is a symlink to the corresponding
45 // USB device info directory. 45 // USB device info directory.
46 static const char kVidPathTemplate[] = 46 static const char kVidPathTemplate[] =
(...skipping 166 matching lines...) Expand 10 before | Expand all | Expand 10 after
213 if ((HANDLE_EINTR(ioctl(fd.get(), VIDIOC_QUERYCAP, &cap)) == 0) && 213 if ((HANDLE_EINTR(ioctl(fd.get(), VIDIOC_QUERYCAP, &cap)) == 0) &&
214 (cap.capabilities & V4L2_CAP_VIDEO_CAPTURE && 214 (cap.capabilities & V4L2_CAP_VIDEO_CAPTURE &&
215 !(cap.capabilities & V4L2_CAP_VIDEO_OUTPUT)) && 215 !(cap.capabilities & V4L2_CAP_VIDEO_OUTPUT)) &&
216 HasUsableFormats(fd.get(), cap.capabilities)) { 216 HasUsableFormats(fd.get(), cap.capabilities)) {
217 const std::string model_id = GetDeviceModelId(unique_id); 217 const std::string model_id = GetDeviceModelId(unique_id);
218 #if defined(OS_CHROMEOS) 218 #if defined(OS_CHROMEOS)
219 device_descriptors->emplace_back( 219 device_descriptors->emplace_back(
220 reinterpret_cast<char*>(cap.card), unique_id, model_id, 220 reinterpret_cast<char*>(cap.card), unique_id, model_id,
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_config.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 } 231 }
232 232
233 void VideoCaptureDeviceFactoryLinux::GetSupportedFormats( 233 void VideoCaptureDeviceFactoryLinux::GetSupportedFormats(
(...skipping 35 matching lines...) Expand 10 before | Expand all | Expand 10 after
269 } 269 }
270 270
271 // static 271 // static
272 VideoCaptureDeviceFactory* 272 VideoCaptureDeviceFactory*
273 VideoCaptureDeviceFactory::CreateVideoCaptureDeviceFactory( 273 VideoCaptureDeviceFactory::CreateVideoCaptureDeviceFactory(
274 scoped_refptr<base::SingleThreadTaskRunner> ui_task_runner) { 274 scoped_refptr<base::SingleThreadTaskRunner> ui_task_runner) {
275 return new VideoCaptureDeviceFactoryLinux(ui_task_runner); 275 return new VideoCaptureDeviceFactoryLinux(ui_task_runner);
276 } 276 }
277 277
278 } // namespace media 278 } // namespace media
OLDNEW
« no previous file with comments | « media/capture/video/linux/video_capture_device_chromeos.cc ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698