Index: content/common/gpu/media/v4l2_device.cc |
diff --git a/content/common/gpu/media/v4l2_device.cc b/content/common/gpu/media/v4l2_device.cc |
index 7629bac5e19109bc35c7eb065b72950a5b4582e0..2d52efbf2d6d6d323e72e80cfcf6a31ccc737289 100644 |
--- a/content/common/gpu/media/v4l2_device.cc |
+++ b/content/common/gpu/media/v4l2_device.cc |
@@ -197,4 +197,30 @@ gfx::Size V4L2Device::CodedSizeFromV4L2Format(struct v4l2_format format) { |
return coded_size; |
} |
+// static |
+gfx::Size V4L2Device::GetSupportedMaxResolution( |
wuchengli
2015/04/20 14:05:16
s/GetSupportedMaxResolution/GetMaxSupportedResolut
henryhsu
2015/04/21 05:56:27
Done.
|
+ const scoped_refptr<V4L2Device>& device, |
+ unsigned int format) { |
wuchengli
2015/04/20 14:05:16
s/format/pixelformat/
henryhsu
2015/04/21 05:56:27
Done.
|
+ gfx::Size max_resolution; |
+ 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.
|
+ memset(&fsize, 0, sizeof(fsize)); |
+ fsize.pixel_format = format; |
+ int ret; |
wuchengli
2015/04/20 14:05:16
not needed
henryhsu
2015/04/21 05:56:27
Done.
|
+ for (; (ret = device->Ioctl(VIDIOC_ENUM_FRAMESIZES, &fsize)) == 0; |
+ ++fsize.index) { |
+ if (fsize.type == V4L2_FRMIVAL_TYPE_DISCRETE) { |
+ if (fsize.discrete.width > |
+ static_cast<unsigned int>(max_resolution.width()) && |
+ fsize.discrete.height > |
+ static_cast<unsigned int>(max_resolution.height())) { |
+ max_resolution.SetSize(fsize.discrete.width, fsize.discrete.height); |
+ } |
+ } else if (fsize.type == V4L2_FRMIVAL_TYPE_STEPWISE) { |
+ 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
|
+ fsize.stepwise.max_height); |
+ } |
wuchengli
2015/04/20 14:05:16
No need to consider V4L2_FRMIVAL_TYPE_CONTINUOUS?
henryhsu
2015/04/21 05:56:27
Done.
|
+ } |
+ return max_resolution; |
+} |
+ |
} // namespace content |