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 | 5 |
6 #include <fcntl.h> | 6 #include <fcntl.h> |
7 #include <libdrm/drm_fourcc.h> | 7 #include <libdrm/drm_fourcc.h> |
8 #include <linux/videodev2.h> | 8 #include <linux/videodev2.h> |
9 #include <poll.h> | 9 #include <poll.h> |
10 #include <sys/eventfd.h> | 10 #include <sys/eventfd.h> |
(...skipping 19 matching lines...) Expand all Loading... |
30 static const base::FilePath::CharType kV4l2Lib[] = | 30 static const base::FilePath::CharType kV4l2Lib[] = |
31 FILE_PATH_LITERAL("/usr/lib/libv4l2.so"); | 31 FILE_PATH_LITERAL("/usr/lib/libv4l2.so"); |
32 #endif | 32 #endif |
33 | 33 |
34 namespace content { | 34 namespace content { |
35 | 35 |
36 namespace { | 36 namespace { |
37 const char kDecoderDevice[] = "/dev/video-dec"; | 37 const char kDecoderDevice[] = "/dev/video-dec"; |
38 const char kEncoderDevice[] = "/dev/video-enc"; | 38 const char kEncoderDevice[] = "/dev/video-enc"; |
39 const char kImageProcessorDevice[] = "/dev/gsc0"; | 39 const char kImageProcessorDevice[] = "/dev/gsc0"; |
| 40 const char kJpegDecoderDevice[] = "/dev/jpeg-dec"; |
40 } | 41 } |
41 | 42 |
42 GenericV4L2Device::GenericV4L2Device(Type type) | 43 GenericV4L2Device::GenericV4L2Device(Type type) |
43 : type_(type), | 44 : type_(type), |
44 use_libv4l2_(false) { | 45 use_libv4l2_(false) { |
45 } | 46 } |
46 | 47 |
47 GenericV4L2Device::~GenericV4L2Device() { | 48 GenericV4L2Device::~GenericV4L2Device() { |
48 #if defined(USE_LIBV4L2) | 49 #if defined(USE_LIBV4L2) |
49 if (use_libv4l2_ && device_fd_.is_valid()) | 50 if (use_libv4l2_ && device_fd_.is_valid()) |
(...skipping 86 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
136 switch (type_) { | 137 switch (type_) { |
137 case kDecoder: | 138 case kDecoder: |
138 device_path = kDecoderDevice; | 139 device_path = kDecoderDevice; |
139 break; | 140 break; |
140 case kEncoder: | 141 case kEncoder: |
141 device_path = kEncoderDevice; | 142 device_path = kEncoderDevice; |
142 break; | 143 break; |
143 case kImageProcessor: | 144 case kImageProcessor: |
144 device_path = kImageProcessorDevice; | 145 device_path = kImageProcessorDevice; |
145 break; | 146 break; |
| 147 case kJpegDecoder: |
| 148 device_path = kJpegDecoderDevice; |
| 149 break; |
146 } | 150 } |
147 | 151 |
148 DVLOG(2) << "Initialize(): opening device: " << device_path; | 152 DVLOG(2) << "Initialize(): opening device: " << device_path; |
149 // Open the video device. | 153 // Open the video device. |
150 device_fd_.reset( | 154 device_fd_.reset( |
151 HANDLE_EINTR(open(device_path, O_RDWR | O_NONBLOCK | O_CLOEXEC))); | 155 HANDLE_EINTR(open(device_path, O_RDWR | O_NONBLOCK | O_CLOEXEC))); |
152 if (!device_fd_.is_valid()) { | 156 if (!device_fd_.is_valid()) { |
153 return false; | 157 return false; |
154 } | 158 } |
155 #if defined(USE_LIBV4L2) | 159 #if defined(USE_LIBV4L2) |
(...skipping 134 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
290 StubPathMap paths; | 294 StubPathMap paths; |
291 paths[kModuleV4l2].push_back(kV4l2Lib); | 295 paths[kModuleV4l2].push_back(kV4l2Lib); |
292 | 296 |
293 return InitializeStubs(paths); | 297 return InitializeStubs(paths); |
294 #else | 298 #else |
295 return true; | 299 return true; |
296 #endif | 300 #endif |
297 } | 301 } |
298 | 302 |
299 } // namespace content | 303 } // namespace content |
OLD | NEW |