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 239 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
250 int32_t DeviceInfoLinux::FillCapabilities(int fd) | 250 int32_t DeviceInfoLinux::FillCapabilities(int fd) |
251 { | 251 { |
252 | 252 |
253 // set image format | 253 // set image format |
254 struct v4l2_format video_fmt; | 254 struct v4l2_format video_fmt; |
255 memset(&video_fmt, 0, sizeof(struct v4l2_format)); | 255 memset(&video_fmt, 0, sizeof(struct v4l2_format)); |
256 | 256 |
257 video_fmt.type = V4L2_BUF_TYPE_VIDEO_CAPTURE; | 257 video_fmt.type = V4L2_BUF_TYPE_VIDEO_CAPTURE; |
258 video_fmt.fmt.pix.sizeimage = 0; | 258 video_fmt.fmt.pix.sizeimage = 0; |
259 | 259 |
260 int totalFmts = 3; | 260 int totalFmts = 4; |
261 unsigned int videoFormats[] = { | 261 unsigned int videoFormats[] = { |
262 V4L2_PIX_FMT_MJPEG, | 262 V4L2_PIX_FMT_MJPEG, |
263 V4L2_PIX_FMT_YUV420, | 263 V4L2_PIX_FMT_YUV420, |
264 V4L2_PIX_FMT_YUYV }; | 264 V4L2_PIX_FMT_YUYV, |
| 265 V4L2_PIX_FMT_UYVY }; |
265 | 266 |
266 int sizes = 13; | 267 int sizes = 13; |
267 unsigned int size[][2] = { { 128, 96 }, { 160, 120 }, { 176, 144 }, | 268 unsigned int size[][2] = { { 128, 96 }, { 160, 120 }, { 176, 144 }, |
268 { 320, 240 }, { 352, 288 }, { 640, 480 }, | 269 { 320, 240 }, { 352, 288 }, { 640, 480 }, |
269 { 704, 576 }, { 800, 600 }, { 960, 720 }, | 270 { 704, 576 }, { 800, 600 }, { 960, 720 }, |
270 { 1280, 720 }, { 1024, 768 }, { 1440, 1080 }, | 271 { 1280, 720 }, { 1024, 768 }, { 1440, 1080 }, |
271 { 1920, 1080 } }; | 272 { 1920, 1080 } }; |
272 | 273 |
273 int index = 0; | 274 int index = 0; |
274 for (int fmts = 0; fmts < totalFmts; fmts++) | 275 for (int fmts = 0; fmts < totalFmts; fmts++) |
(...skipping 18 matching lines...) Expand all Loading... |
293 cap.rawType = kVideoYUY2; | 294 cap.rawType = kVideoYUY2; |
294 } | 295 } |
295 else if (videoFormats[fmts] == V4L2_PIX_FMT_YUV420) | 296 else if (videoFormats[fmts] == V4L2_PIX_FMT_YUV420) |
296 { | 297 { |
297 cap.rawType = kVideoI420; | 298 cap.rawType = kVideoI420; |
298 } | 299 } |
299 else if (videoFormats[fmts] == V4L2_PIX_FMT_MJPEG) | 300 else if (videoFormats[fmts] == V4L2_PIX_FMT_MJPEG) |
300 { | 301 { |
301 cap.rawType = kVideoMJPEG; | 302 cap.rawType = kVideoMJPEG; |
302 } | 303 } |
| 304 else if (videoFormats[fmts] == V4L2_PIX_FMT_UYVY) |
| 305 { |
| 306 cap.rawType = kVideoUYVY; |
| 307 } |
303 | 308 |
304 // get fps of current camera mode | 309 // get fps of current camera mode |
305 // V4l2 does not have a stable method of knowing so we just
guess. | 310 // V4l2 does not have a stable method of knowing so we just
guess. |
306 if(cap.width >= 800 && cap.rawType != kVideoMJPEG) | 311 if(cap.width >= 800 && cap.rawType != kVideoMJPEG) |
307 { | 312 { |
308 cap.maxFPS = 15; | 313 cap.maxFPS = 15; |
309 } | 314 } |
310 else | 315 else |
311 { | 316 { |
312 cap.maxFPS = 30; | 317 cap.maxFPS = 30; |
(...skipping 12 matching lines...) Expand all Loading... |
325 WEBRTC_TRACE(webrtc::kTraceInfo, | 330 WEBRTC_TRACE(webrtc::kTraceInfo, |
326 webrtc::kTraceVideoCapture, | 331 webrtc::kTraceVideoCapture, |
327 _id, | 332 _id, |
328 "CreateCapabilityMap %u", | 333 "CreateCapabilityMap %u", |
329 static_cast<unsigned int>(_captureCapabilities.size())); | 334 static_cast<unsigned int>(_captureCapabilities.size())); |
330 return _captureCapabilities.size(); | 335 return _captureCapabilities.size(); |
331 } | 336 } |
332 | 337 |
333 } // namespace videocapturemodule | 338 } // namespace videocapturemodule |
334 } // namespace webrtc | 339 } // namespace webrtc |
OLD | NEW |