Chromium Code Reviews| 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 <libdrm/drm_fourcc.h> | 5 #include <libdrm/drm_fourcc.h> |
| 6 #include <linux/videodev2.h> | 6 #include <linux/videodev2.h> |
| 7 | 7 |
| 8 #include "base/numerics/safe_conversions.h" | 8 #include "base/numerics/safe_conversions.h" |
| 9 #include "content/common/gpu/media/generic_v4l2_device.h" | 9 #include "content/common/gpu/media/generic_v4l2_device.h" |
| 10 #if defined(ARCH_CPU_ARMEL) | 10 #if defined(ARCH_CPU_ARMEL) |
| (...skipping 179 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 190 | 190 |
| 191 // Sanity checks. Calculated coded size has to contain given visible size | 191 // Sanity checks. Calculated coded size has to contain given visible size |
| 192 // and fulfill buffer byte size requirements. | 192 // and fulfill buffer byte size requirements. |
| 193 DCHECK(gfx::Rect(coded_size).Contains(gfx::Rect(visible_size))); | 193 DCHECK(gfx::Rect(coded_size).Contains(gfx::Rect(visible_size))); |
| 194 DCHECK_LE(sizeimage, | 194 DCHECK_LE(sizeimage, |
| 195 media::VideoFrame::AllocationSize(frame_format, coded_size)); | 195 media::VideoFrame::AllocationSize(frame_format, coded_size)); |
| 196 | 196 |
| 197 return coded_size; | 197 return coded_size; |
| 198 } | 198 } |
| 199 | 199 |
| 200 // static | |
| 201 gfx::Size V4L2Device::GetSupportedMaxResolution( | |
|
wuchengli
2015/04/20 14:05:16
s/GetSupportedMaxResolution/GetMaxSupportedResolut
henryhsu
2015/04/21 05:56:27
Done.
| |
| 202 const scoped_refptr<V4L2Device>& device, | |
| 203 unsigned int format) { | |
|
wuchengli
2015/04/20 14:05:16
s/format/pixelformat/
henryhsu
2015/04/21 05:56:27
Done.
| |
| 204 gfx::Size max_resolution; | |
| 205 v4l2_frmsizeenum fsize; | |
|
wuchengli
2015/04/20 14:05:16
s/fsize/frame_size/ is more descriptive
henryhsu
2015/04/21 05:56:27
Done.
| |
| 206 memset(&fsize, 0, sizeof(fsize)); | |
| 207 fsize.pixel_format = format; | |
| 208 int ret; | |
|
wuchengli
2015/04/20 14:05:16
not needed
henryhsu
2015/04/21 05:56:27
Done.
| |
| 209 for (; (ret = device->Ioctl(VIDIOC_ENUM_FRAMESIZES, &fsize)) == 0; | |
| 210 ++fsize.index) { | |
| 211 if (fsize.type == V4L2_FRMIVAL_TYPE_DISCRETE) { | |
| 212 if (fsize.discrete.width > | |
| 213 static_cast<unsigned int>(max_resolution.width()) && | |
| 214 fsize.discrete.height > | |
| 215 static_cast<unsigned int>(max_resolution.height())) { | |
| 216 max_resolution.SetSize(fsize.discrete.width, fsize.discrete.height); | |
| 217 } | |
| 218 } else if (fsize.type == V4L2_FRMIVAL_TYPE_STEPWISE) { | |
| 219 max_resolution.SetSize(fsize.stepwise.max_width, | |
|
wuchengli
2015/04/20 14:05:16
Why don't we need to check if this is the maximum
henryhsu
2015/04/21 05:56:27
Because discrete type has many results. We need to
| |
| 220 fsize.stepwise.max_height); | |
| 221 } | |
|
wuchengli
2015/04/20 14:05:16
No need to consider V4L2_FRMIVAL_TYPE_CONTINUOUS?
henryhsu
2015/04/21 05:56:27
Done.
| |
| 222 } | |
| 223 return max_resolution; | |
| 224 } | |
| 225 | |
| 200 } // namespace content | 226 } // namespace content |
| OLD | NEW |