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 <dlfcn.h> | 5 #include <dlfcn.h> |
6 #include <fcntl.h> | 6 #include <fcntl.h> |
7 #include <linux/videodev2.h> | 7 #include <linux/videodev2.h> |
8 | 8 |
9 #include "base/lazy_instance.h" | 9 #include "base/lazy_instance.h" |
10 #include "base/posix/eintr_wrapper.h" | 10 #include "base/posix/eintr_wrapper.h" |
(...skipping 134 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
145 | 145 |
146 bool TegraV4L2Device::Initialize() { | 146 bool TegraV4L2Device::Initialize() { |
147 const char* device_path = NULL; | 147 const char* device_path = NULL; |
148 switch (type_) { | 148 switch (type_) { |
149 case kDecoder: | 149 case kDecoder: |
150 device_path = kDecoderDevice; | 150 device_path = kDecoderDevice; |
151 break; | 151 break; |
152 case kEncoder: | 152 case kEncoder: |
153 device_path = kEncoderDevice; | 153 device_path = kEncoderDevice; |
154 break; | 154 break; |
155 case kImageProcessor: | 155 default: |
156 DVLOG(1) << "Device type " << type_ << " not supported on this platform"; | 156 DVLOG(1) << "Device type " << type_ << " not supported on this platform"; |
157 return false; | 157 return false; |
158 } | 158 } |
159 | 159 |
160 if (!g_tegra_function_symbol_finder_.Get().initialized()) { | 160 if (!g_tegra_function_symbol_finder_.Get().initialized()) { |
161 DLOG(ERROR) << "Unable to initialize functions"; | 161 DLOG(ERROR) << "Unable to initialize functions"; |
162 return false; | 162 return false; |
163 } | 163 } |
164 device_fd_ = HANDLE_EINTR( | 164 device_fd_ = HANDLE_EINTR( |
165 TegraV4L2_Open(device_path, O_RDWR | O_NONBLOCK | O_CLOEXEC)); | 165 TegraV4L2_Open(device_path, O_RDWR | O_NONBLOCK | O_CLOEXEC)); |
(...skipping 48 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
214 GLenum TegraV4L2Device::GetTextureTarget() { return GL_TEXTURE_2D; } | 214 GLenum TegraV4L2Device::GetTextureTarget() { return GL_TEXTURE_2D; } |
215 | 215 |
216 uint32 TegraV4L2Device::PreferredInputFormat() { | 216 uint32 TegraV4L2Device::PreferredInputFormat() { |
217 // TODO(posciak): We should support "dontcare" returns here once we | 217 // TODO(posciak): We should support "dontcare" returns here once we |
218 // implement proper handling (fallback, negotiation) for this in users. | 218 // implement proper handling (fallback, negotiation) for this in users. |
219 CHECK_EQ(type_, kEncoder); | 219 CHECK_EQ(type_, kEncoder); |
220 return V4L2_PIX_FMT_YUV420M; | 220 return V4L2_PIX_FMT_YUV420M; |
221 } | 221 } |
222 | 222 |
223 } // namespace content | 223 } // namespace content |
OLD | NEW |