Merge the supporting to UYVY on Linux video capture in crbug/410202 to webrtc standalone.

BUG=3765
TEST=Manual
R=perkj@webrtc.org

Review URL: https://webrtc-codereview.appspot.com/28579004

git-svn-id: http://webrtc.googlecode.com/svn/trunk@7427 4adac7df-926f-26a2-2b94-8c16560cd09d
This commit is contained in:
braveyao@webrtc.org 2014-10-13 02:13:00 +00:00
parent 651c05e4fc
commit c502df54f8

View File

@ -153,18 +153,20 @@ int32_t VideoCaptureModuleV4L2::StartCapture(
// Supported video formats in preferred order.
// If the requested resolution is larger than VGA, we prefer MJPEG. Go for
// I420 otherwise.
const int nFormats = 4;
const int nFormats = 5;
unsigned int fmts[nFormats];
if (capability.width > 640 || capability.height > 480) {
fmts[0] = V4L2_PIX_FMT_MJPEG;
fmts[1] = V4L2_PIX_FMT_YUV420;
fmts[2] = V4L2_PIX_FMT_YUYV;
fmts[3] = V4L2_PIX_FMT_JPEG;
fmts[3] = V4L2_PIX_FMT_UYVY;
fmts[4] = V4L2_PIX_FMT_JPEG;
} else {
fmts[0] = V4L2_PIX_FMT_YUV420;
fmts[1] = V4L2_PIX_FMT_YUYV;
fmts[2] = V4L2_PIX_FMT_MJPEG;
fmts[3] = V4L2_PIX_FMT_JPEG;
fmts[2] = V4L2_PIX_FMT_UYVY;
fmts[3] = V4L2_PIX_FMT_MJPEG;
fmts[4] = V4L2_PIX_FMT_JPEG;
}
// Enumerate image formats.
@ -214,6 +216,8 @@ int32_t VideoCaptureModuleV4L2::StartCapture(
_captureVideoType = kVideoYUY2;
else if (video_fmt.fmt.pix.pixelformat == V4L2_PIX_FMT_YUV420)
_captureVideoType = kVideoI420;
else if (video_fmt.fmt.pix.pixelformat == V4L2_PIX_FMT_UYVY)
_captureVideoType = kVideoUYVY;
else if (video_fmt.fmt.pix.pixelformat == V4L2_PIX_FMT_MJPEG ||
video_fmt.fmt.pix.pixelformat == V4L2_PIX_FMT_JPEG)
_captureVideoType = kVideoMJPEG;