Chromium Code Reviews| OLD | NEW |
|---|---|
| 1 // Copyright 2014 The Chromium Authors. All rights reserved. | 1 // Copyright 2014 The Chromium Authors. All rights reserved. |
| 2 // Use of this source code is governed by a BSD-style license that can be | 2 // Use of this source code is governed by a BSD-style license that can be |
| 3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
| 4 | 4 |
| 5 #include <fcntl.h> | 5 #include <fcntl.h> |
| 6 #include <linux/videodev2.h> | 6 #include <linux/videodev2.h> |
| 7 #include <poll.h> | 7 #include <poll.h> |
| 8 #include <sys/eventfd.h> | 8 #include <sys/eventfd.h> |
| 9 #include <sys/ioctl.h> | 9 #include <sys/ioctl.h> |
| 10 #include <sys/mman.h> | 10 #include <sys/mman.h> |
| (...skipping 101 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 112 if (!input_format_fourcc_ || !output_format_fourcc_) { | 112 if (!input_format_fourcc_ || !output_format_fourcc_) { |
| 113 DLOG(ERROR) << "Unrecognized format(s)"; | 113 DLOG(ERROR) << "Unrecognized format(s)"; |
| 114 return false; | 114 return false; |
| 115 } | 115 } |
| 116 | 116 |
| 117 input_visible_size_ = input_visible_size; | 117 input_visible_size_ = input_visible_size; |
| 118 output_visible_size_ = output_visible_size; | 118 output_visible_size_ = output_visible_size; |
| 119 output_allocated_size_ = output_allocated_size; | 119 output_allocated_size_ = output_allocated_size; |
| 120 | 120 |
| 121 input_planes_count_ = media::VideoFrame::NumPlanes(input_format); | 121 input_planes_count_ = media::VideoFrame::NumPlanes(input_format); |
| 122 DCHECK_LE(input_planes_count_, VIDEO_MAX_PLANES); | 122 DCHECK_LE(static_cast<int>(input_planes_count_), VIDEO_MAX_PLANES); |
|
xhwang
2014/05/15 00:51:45
Can you do it the other way by casting VIDEO_MAX_P
yunlian
2014/05/15 16:34:13
Done.
| |
| 123 output_planes_count_ = media::VideoFrame::NumPlanes(output_format); | 123 output_planes_count_ = media::VideoFrame::NumPlanes(output_format); |
| 124 DCHECK_LE(output_planes_count_, VIDEO_MAX_PLANES); | 124 DCHECK_LE(static_cast<int>(output_planes_count_), VIDEO_MAX_PLANES); |
| 125 | 125 |
| 126 // Capabilities check. | 126 // Capabilities check. |
| 127 struct v4l2_capability caps; | 127 struct v4l2_capability caps; |
| 128 memset(&caps, 0, sizeof(caps)); | 128 memset(&caps, 0, sizeof(caps)); |
| 129 const __u32 kCapsRequired = V4L2_CAP_VIDEO_CAPTURE_MPLANE | | 129 const __u32 kCapsRequired = V4L2_CAP_VIDEO_CAPTURE_MPLANE | |
| 130 V4L2_CAP_VIDEO_OUTPUT_MPLANE | V4L2_CAP_STREAMING; | 130 V4L2_CAP_VIDEO_OUTPUT_MPLANE | V4L2_CAP_STREAMING; |
| 131 IOCTL_OR_ERROR_RETURN_FALSE(VIDIOC_QUERYCAP, &caps); | 131 IOCTL_OR_ERROR_RETURN_FALSE(VIDIOC_QUERYCAP, &caps); |
| 132 if ((caps.capabilities & kCapsRequired) != kCapsRequired) { | 132 if ((caps.capabilities & kCapsRequired) != kCapsRequired) { |
| 133 DLOG(ERROR) << "Initialize(): ioctl() failed: VIDIOC_QUERYCAP: " | 133 DLOG(ERROR) << "Initialize(): ioctl() failed: VIDIOC_QUERYCAP: " |
| 134 "caps check failed: 0x" << std::hex << caps.capabilities; | 134 "caps check failed: 0x" << std::hex << caps.capabilities; |
| (...skipping 573 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 708 output_record.at_device = false; | 708 output_record.at_device = false; |
| 709 if (!output_record.at_client) | 709 if (!output_record.at_client) |
| 710 free_output_buffers_.push_back(i); | 710 free_output_buffers_.push_back(i); |
| 711 } | 711 } |
| 712 output_buffer_queued_count_ = 0; | 712 output_buffer_queued_count_ = 0; |
| 713 | 713 |
| 714 return true; | 714 return true; |
| 715 } | 715 } |
| 716 | 716 |
| 717 } // namespace content | 717 } // namespace content |
| OLD | NEW |