| 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 <linux/videodev2.h> | 5 #include <linux/videodev2.h> |
| 6 | 6 |
| 7 #include "base/numerics/safe_conversions.h" | 7 #include "base/numerics/safe_conversions.h" |
| 8 #include "content/common/gpu/media/generic_v4l2_video_device.h" | 8 #include "content/common/gpu/media/generic_v4l2_video_device.h" |
| 9 #if defined(ARCH_CPU_ARMEL) |
| 9 #include "content/common/gpu/media/tegra_v4l2_video_device.h" | 10 #include "content/common/gpu/media/tegra_v4l2_video_device.h" |
| 11 #endif |
| 10 | 12 |
| 11 namespace content { | 13 namespace content { |
| 12 | 14 |
| 13 V4L2Device::~V4L2Device() {} | 15 V4L2Device::~V4L2Device() {} |
| 14 | 16 |
| 15 // static | 17 // static |
| 16 scoped_ptr<V4L2Device> V4L2Device::Create(Type type) { | 18 scoped_ptr<V4L2Device> V4L2Device::Create(Type type) { |
| 17 DVLOG(3) << __PRETTY_FUNCTION__; | 19 DVLOG(3) << __PRETTY_FUNCTION__; |
| 18 | 20 |
| 19 scoped_ptr<GenericV4L2Device> generic_device(new GenericV4L2Device(type)); | 21 scoped_ptr<GenericV4L2Device> generic_device(new GenericV4L2Device(type)); |
| 20 if (generic_device->Initialize()) | 22 if (generic_device->Initialize()) |
| 21 return generic_device.Pass(); | 23 return generic_device.Pass(); |
| 22 | 24 |
| 25 #if defined(ARCH_CPU_ARMEL) |
| 23 scoped_ptr<TegraV4L2Device> tegra_device(new TegraV4L2Device(type)); | 26 scoped_ptr<TegraV4L2Device> tegra_device(new TegraV4L2Device(type)); |
| 24 if (tegra_device->Initialize()) | 27 if (tegra_device->Initialize()) |
| 25 return tegra_device.Pass(); | 28 return tegra_device.Pass(); |
| 29 #endif |
| 26 | 30 |
| 27 LOG(ERROR) << "Failed to create V4L2Device"; | 31 LOG(ERROR) << "Failed to create V4L2Device"; |
| 28 return scoped_ptr<V4L2Device>(); | 32 return scoped_ptr<V4L2Device>(); |
| 29 } | 33 } |
| 30 | 34 |
| 31 // static | 35 // static |
| 32 media::VideoFrame::Format V4L2Device::V4L2PixFmtToVideoFrameFormat( | 36 media::VideoFrame::Format V4L2Device::V4L2PixFmtToVideoFrameFormat( |
| 33 uint32 pix_fmt) { | 37 uint32 pix_fmt) { |
| 34 switch (pix_fmt) { | 38 switch (pix_fmt) { |
| 35 case V4L2_PIX_FMT_NV12: | 39 case V4L2_PIX_FMT_NV12: |
| (...skipping 116 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 152 // Sanity checks. Calculated coded size has to contain given visible size | 156 // Sanity checks. Calculated coded size has to contain given visible size |
| 153 // and fulfill buffer byte size requirements. | 157 // and fulfill buffer byte size requirements. |
| 154 DCHECK(gfx::Rect(coded_size).Contains(gfx::Rect(visible_size))); | 158 DCHECK(gfx::Rect(coded_size).Contains(gfx::Rect(visible_size))); |
| 155 DCHECK_LE(sizeimage, | 159 DCHECK_LE(sizeimage, |
| 156 media::VideoFrame::AllocationSize(frame_format, coded_size)); | 160 media::VideoFrame::AllocationSize(frame_format, coded_size)); |
| 157 | 161 |
| 158 return coded_size; | 162 return coded_size; |
| 159 } | 163 } |
| 160 | 164 |
| 161 } // namespace content | 165 } // namespace content |
| OLD | NEW |