| 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 <string.h> | 9 #include <string.h> |
| 10 #include <sys/eventfd.h> | 10 #include <sys/eventfd.h> |
| (...skipping 118 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 129 output_visible_size_ = output_visible_size; | 129 output_visible_size_ = output_visible_size; |
| 130 output_allocated_size_ = output_allocated_size; | 130 output_allocated_size_ = output_allocated_size; |
| 131 | 131 |
| 132 // Capabilities check. | 132 // Capabilities check. |
| 133 struct v4l2_capability caps; | 133 struct v4l2_capability caps; |
| 134 memset(&caps, 0, sizeof(caps)); | 134 memset(&caps, 0, sizeof(caps)); |
| 135 const __u32 kCapsRequired = V4L2_CAP_VIDEO_M2M_MPLANE | V4L2_CAP_STREAMING; | 135 const __u32 kCapsRequired = V4L2_CAP_VIDEO_M2M_MPLANE | V4L2_CAP_STREAMING; |
| 136 IOCTL_OR_ERROR_RETURN_FALSE(VIDIOC_QUERYCAP, &caps); | 136 IOCTL_OR_ERROR_RETURN_FALSE(VIDIOC_QUERYCAP, &caps); |
| 137 if ((caps.capabilities & kCapsRequired) != kCapsRequired) { | 137 if ((caps.capabilities & kCapsRequired) != kCapsRequired) { |
| 138 LOG(ERROR) << "Initialize(): ioctl() failed: VIDIOC_QUERYCAP: " | 138 LOG(ERROR) << "Initialize(): ioctl() failed: VIDIOC_QUERYCAP: " |
| 139 "caps check failed: 0x" | 139 << "caps check failed: 0x" << std::hex << caps.capabilities; |
| 140 << std::hex << caps.capabilities; | |
| 141 return false; | 140 return false; |
| 142 } | 141 } |
| 143 | 142 |
| 144 if (!CreateInputBuffers() || !CreateOutputBuffers()) | 143 if (!CreateInputBuffers() || !CreateOutputBuffers()) |
| 145 return false; | 144 return false; |
| 146 | 145 |
| 147 if (!device_thread_.Start()) { | 146 if (!device_thread_.Start()) { |
| 148 LOG(ERROR) << "Initialize(): encoder thread failed to start"; | 147 LOG(ERROR) << "Initialize(): encoder thread failed to start"; |
| 149 return false; | 148 return false; |
| 150 } | 149 } |
| (...skipping 562 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 713 return true; | 712 return true; |
| 714 } | 713 } |
| 715 | 714 |
| 716 void V4L2ImageProcessor::FrameReady(const FrameReadyCB& cb, | 715 void V4L2ImageProcessor::FrameReady(const FrameReadyCB& cb, |
| 717 int output_buffer_index) { | 716 int output_buffer_index) { |
| 718 DCHECK(child_task_runner_->BelongsToCurrentThread()); | 717 DCHECK(child_task_runner_->BelongsToCurrentThread()); |
| 719 cb.Run(output_buffer_index); | 718 cb.Run(output_buffer_index); |
| 720 } | 719 } |
| 721 | 720 |
| 722 } // namespace media | 721 } // namespace media |
| OLD | NEW |