| OLD | NEW |
| 1 /* | 1 /* |
| 2 * Copyright (c) 2012 The WebRTC project authors. All Rights Reserved. | 2 * Copyright (c) 2012 The WebRTC project authors. All Rights Reserved. |
| 3 * | 3 * |
| 4 * Use of this source code is governed by a BSD-style license | 4 * Use of this source code is governed by a BSD-style license |
| 5 * that can be found in the LICENSE file in the root of the source | 5 * that can be found in the LICENSE file in the root of the source |
| 6 * tree. An additional intellectual property rights grant can be found | 6 * tree. An additional intellectual property rights grant can be found |
| 7 * in the file PATENTS. All contributing project authors may | 7 * in the file PATENTS. All contributing project authors may |
| 8 * be found in the AUTHORS file in the root of the source tree. | 8 * be found in the AUTHORS file in the root of the source tree. |
| 9 */ | 9 */ |
| 10 | 10 |
| (...skipping 269 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 280 if (ioctl(fd, VIDIOC_TRY_FMT, &video_fmt) >= 0) | 280 if (ioctl(fd, VIDIOC_TRY_FMT, &video_fmt) >= 0) |
| 281 { | 281 { |
| 282 if ((video_fmt.fmt.pix.width == size[i][0]) | 282 if ((video_fmt.fmt.pix.width == size[i][0]) |
| 283 && (video_fmt.fmt.pix.height == size[i][1])) | 283 && (video_fmt.fmt.pix.height == size[i][1])) |
| 284 { | 284 { |
| 285 VideoCaptureCapability cap; | 285 VideoCaptureCapability cap; |
| 286 cap.width = video_fmt.fmt.pix.width; | 286 cap.width = video_fmt.fmt.pix.width; |
| 287 cap.height = video_fmt.fmt.pix.height; | 287 cap.height = video_fmt.fmt.pix.height; |
| 288 if (videoFormats[fmts] == V4L2_PIX_FMT_YUYV) | 288 if (videoFormats[fmts] == V4L2_PIX_FMT_YUYV) |
| 289 { | 289 { |
| 290 cap.rawType = kVideoYUY2; | 290 cap.videoType = VideoType::kYUY2; |
| 291 } | 291 } |
| 292 else if (videoFormats[fmts] == V4L2_PIX_FMT_YUV420) | 292 else if (videoFormats[fmts] == V4L2_PIX_FMT_YUV420) |
| 293 { | 293 { |
| 294 cap.rawType = kVideoI420; | 294 cap.videoType = VideoType::kI420; |
| 295 } | 295 } |
| 296 else if (videoFormats[fmts] == V4L2_PIX_FMT_MJPEG) | 296 else if (videoFormats[fmts] == V4L2_PIX_FMT_MJPEG) |
| 297 { | 297 { |
| 298 cap.rawType = kVideoMJPEG; | 298 cap.videoType = VideoType::kMJPEG; |
| 299 } | 299 } |
| 300 else if (videoFormats[fmts] == V4L2_PIX_FMT_UYVY) | 300 else if (videoFormats[fmts] == V4L2_PIX_FMT_UYVY) |
| 301 { | 301 { |
| 302 cap.rawType = kVideoUYVY; | 302 cap.videoType = VideoType::kUYVY; |
| 303 } | 303 } |
| 304 | 304 |
| 305 // get fps of current camera mode | 305 // get fps of current camera mode |
| 306 // V4l2 does not have a stable method of knowing so we just
guess. | 306 // V4l2 does not have a stable method of knowing so we just
guess. |
| 307 if(cap.width >= 800 && cap.rawType != kVideoMJPEG) | 307 if (cap.width >= 800 && |
| 308 { | 308 cap.videoType != VideoType::kMJPEG) { |
| 309 cap.maxFPS = 15; | 309 cap.maxFPS = 15; |
| 310 } | 310 } |
| 311 else | 311 else |
| 312 { | 312 { |
| 313 cap.maxFPS = 30; | 313 cap.maxFPS = 30; |
| 314 } | 314 } |
| 315 | 315 |
| 316 _captureCapabilities.push_back(cap); | 316 _captureCapabilities.push_back(cap); |
| 317 index++; | 317 index++; |
| 318 WEBRTC_TRACE( | 318 WEBRTC_TRACE( |
| 319 webrtc::kTraceInfo, webrtc::kTraceVideoCapture, 0, | 319 webrtc::kTraceInfo, webrtc::kTraceVideoCapture, 0, |
| 320 "Camera capability, width:%d height:%d type:%d fps:%d", | 320 "Camera capability, width:%d height:%d type:%d fps:%d", |
| 321 cap.width, cap.height, cap.rawType, cap.maxFPS); | 321 cap.width, cap.height, cap.videoType, cap.maxFPS); |
| 322 } | 322 } |
| 323 } | 323 } |
| 324 } | 324 } |
| 325 } | 325 } |
| 326 | 326 |
| 327 WEBRTC_TRACE(webrtc::kTraceInfo, | 327 WEBRTC_TRACE(webrtc::kTraceInfo, |
| 328 webrtc::kTraceVideoCapture, | 328 webrtc::kTraceVideoCapture, |
| 329 0, | 329 0, |
| 330 "CreateCapabilityMap %u", | 330 "CreateCapabilityMap %u", |
| 331 static_cast<unsigned int>(_captureCapabilities.size())); | 331 static_cast<unsigned int>(_captureCapabilities.size())); |
| 332 return _captureCapabilities.size(); | 332 return _captureCapabilities.size(); |
| 333 } | 333 } |
| 334 | 334 |
| 335 } // namespace videocapturemodule | 335 } // namespace videocapturemodule |
| 336 } // namespace webrtc | 336 } // namespace webrtc |
| OLD | NEW |