From 6b6eb44cca941838dba9ad6b6ff1983c829d5664 Mon Sep 17 00:00:00 2001 From: "braveyao@webrtc.org" Date: Thu, 28 Feb 2013 10:08:02 +0000 Subject: [PATCH] Add supporting to V4L2_PIX_FMT_JPEG since it works same as MJPEG. ISSUE=529 TEST=unittest Review URL: https://webrtc-codereview.appspot.com/1120006 git-svn-id: http://webrtc.googlecode.com/svn/trunk@3580 4adac7df-926f-26a2-2b94-8c16560cd09d --- webrtc/modules/video_capture/linux/video_capture_linux.cc | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/webrtc/modules/video_capture/linux/video_capture_linux.cc b/webrtc/modules/video_capture/linux/video_capture_linux.cc index efd262a6a..de4958e43 100644 --- a/webrtc/modules/video_capture/linux/video_capture_linux.cc +++ b/webrtc/modules/video_capture/linux/video_capture_linux.cc @@ -153,16 +153,18 @@ WebRtc_Word32 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 = 3; + const int nFormats = 4; 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; } 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; } // Enumerate image formats. @@ -212,7 +214,8 @@ WebRtc_Word32 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_MJPEG) + else if (video_fmt.fmt.pix.pixelformat == V4L2_PIX_FMT_MJPEG || + video_fmt.fmt.pix.pixelformat == V4L2_PIX_FMT_JPEG) _captureVideoType = kVideoMJPEG; //set format and frame size now