| 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 <errno.h> | 5 #include <errno.h> |
| 6 #include <fcntl.h> | 6 #include <fcntl.h> |
| 7 #include <linux/videodev2.h> | 7 #include <linux/videodev2.h> |
| 8 #include <poll.h> | 8 #include <poll.h> |
| 9 #include <sys/eventfd.h> | 9 #include <sys/eventfd.h> |
| 10 #include <sys/ioctl.h> | 10 #include <sys/ioctl.h> |
| (...skipping 117 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 128 output_allocated_size_ = output_allocated_size; | 128 output_allocated_size_ = output_allocated_size; |
| 129 | 129 |
| 130 input_planes_count_ = media::VideoFrame::NumPlanes(input_format); | 130 input_planes_count_ = media::VideoFrame::NumPlanes(input_format); |
| 131 DCHECK_LE(input_planes_count_, static_cast<size_t>(VIDEO_MAX_PLANES)); | 131 DCHECK_LE(input_planes_count_, static_cast<size_t>(VIDEO_MAX_PLANES)); |
| 132 output_planes_count_ = media::VideoFrame::NumPlanes(output_format); | 132 output_planes_count_ = media::VideoFrame::NumPlanes(output_format); |
| 133 DCHECK_LE(output_planes_count_, static_cast<size_t>(VIDEO_MAX_PLANES)); | 133 DCHECK_LE(output_planes_count_, static_cast<size_t>(VIDEO_MAX_PLANES)); |
| 134 | 134 |
| 135 // Capabilities check. | 135 // Capabilities check. |
| 136 struct v4l2_capability caps; | 136 struct v4l2_capability caps; |
| 137 memset(&caps, 0, sizeof(caps)); | 137 memset(&caps, 0, sizeof(caps)); |
| 138 const __u32 kCapsRequired = V4L2_CAP_VIDEO_CAPTURE_MPLANE | | 138 const __u32 kCapsRequired = V4L2_CAP_VIDEO_M2M_MPLANE | V4L2_CAP_STREAMING; |
| 139 V4L2_CAP_VIDEO_OUTPUT_MPLANE | V4L2_CAP_STREAMING; | |
| 140 IOCTL_OR_ERROR_RETURN_FALSE(VIDIOC_QUERYCAP, &caps); | 139 IOCTL_OR_ERROR_RETURN_FALSE(VIDIOC_QUERYCAP, &caps); |
| 141 if ((caps.capabilities & kCapsRequired) != kCapsRequired) { | 140 if ((caps.capabilities & kCapsRequired) != kCapsRequired) { |
| 142 LOG(ERROR) << "Initialize(): ioctl() failed: VIDIOC_QUERYCAP: " | 141 LOG(ERROR) << "Initialize(): ioctl() failed: VIDIOC_QUERYCAP: " |
| 143 "caps check failed: 0x" << std::hex << caps.capabilities; | 142 "caps check failed: 0x" << std::hex << caps.capabilities; |
| 144 return false; | 143 return false; |
| 145 } | 144 } |
| 146 | 145 |
| 147 if (!CreateInputBuffers() || !CreateOutputBuffers()) | 146 if (!CreateInputBuffers() || !CreateOutputBuffers()) |
| 148 return false; | 147 return false; |
| 149 | 148 |
| (...skipping 568 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 718 output_record.at_device = false; | 717 output_record.at_device = false; |
| 719 if (!output_record.at_client) | 718 if (!output_record.at_client) |
| 720 free_output_buffers_.push_back(i); | 719 free_output_buffers_.push_back(i); |
| 721 } | 720 } |
| 722 output_buffer_queued_count_ = 0; | 721 output_buffer_queued_count_ = 0; |
| 723 | 722 |
| 724 return true; | 723 return true; |
| 725 } | 724 } |
| 726 | 725 |
| 727 } // namespace content | 726 } // namespace content |
| OLD | NEW |