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 271 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
282 // Set to kError state just in case. | 282 // Set to kError state just in case. |
283 encoder_state_ = kError; | 283 encoder_state_ = kError; |
284 | 284 |
285 delete this; | 285 delete this; |
286 } | 286 } |
287 | 287 |
288 media::VideoEncodeAccelerator::SupportedProfiles | 288 media::VideoEncodeAccelerator::SupportedProfiles |
289 V4L2VideoEncodeAccelerator::GetSupportedProfiles() { | 289 V4L2VideoEncodeAccelerator::GetSupportedProfiles() { |
290 SupportedProfiles profiles; | 290 SupportedProfiles profiles; |
291 SupportedProfile profile; | 291 SupportedProfile profile; |
292 profile.max_resolution.SetSize(1920, 1088); | |
293 profile.max_framerate_numerator = 30; | 292 profile.max_framerate_numerator = 30; |
294 profile.max_framerate_denominator = 1; | 293 profile.max_framerate_denominator = 1; |
295 | 294 |
296 v4l2_fmtdesc fmtdesc; | 295 v4l2_fmtdesc fmtdesc; |
297 memset(&fmtdesc, 0, sizeof(fmtdesc)); | 296 memset(&fmtdesc, 0, sizeof(fmtdesc)); |
298 fmtdesc.type = V4L2_BUF_TYPE_VIDEO_CAPTURE_MPLANE; | 297 fmtdesc.type = V4L2_BUF_TYPE_VIDEO_CAPTURE_MPLANE; |
299 for (; device_->Ioctl(VIDIOC_ENUM_FMT, &fmtdesc) == 0; ++fmtdesc.index) { | 298 for (; device_->Ioctl(VIDIOC_ENUM_FMT, &fmtdesc) == 0; ++fmtdesc.index) { |
299 // Get maximum resolution for each format | |
300 profile.max_resolution = V4L2Device::GetSupportedMaxResolution( | |
301 device_, fmtdesc.pixelformat); | |
302 if (profile.max_resolution.IsEmpty()) { | |
wuchengli
2015/04/20 14:05:16
remove
henryhsu
2015/04/21 05:56:28
Done.
| |
303 LOG(ERROR) << "GetSupportedMaxResolution failed for format " | |
304 << std::hex << fmtdesc.pixelformat; | |
305 profile.max_resolution.SetSize(1920, 1088); | |
306 } | |
300 switch (fmtdesc.pixelformat) { | 307 switch (fmtdesc.pixelformat) { |
301 case V4L2_PIX_FMT_H264: | 308 case V4L2_PIX_FMT_H264: |
302 profile.profile = media::H264PROFILE_MAIN; | 309 profile.profile = media::H264PROFILE_MAIN; |
303 profiles.push_back(profile); | 310 profiles.push_back(profile); |
304 break; | 311 break; |
305 case V4L2_PIX_FMT_VP8: | 312 case V4L2_PIX_FMT_VP8: |
306 profile.profile = media::VP8PROFILE_ANY; | 313 profile.profile = media::VP8PROFILE_ANY; |
307 profiles.push_back(profile); | 314 profiles.push_back(profile); |
308 break; | 315 break; |
309 case V4L2_PIX_FMT_VP9: | 316 case V4L2_PIX_FMT_VP9: |
(...skipping 839 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
1149 reqbufs.count = 0; | 1156 reqbufs.count = 0; |
1150 reqbufs.type = V4L2_BUF_TYPE_VIDEO_CAPTURE_MPLANE; | 1157 reqbufs.type = V4L2_BUF_TYPE_VIDEO_CAPTURE_MPLANE; |
1151 reqbufs.memory = V4L2_MEMORY_MMAP; | 1158 reqbufs.memory = V4L2_MEMORY_MMAP; |
1152 IOCTL_OR_LOG_ERROR(VIDIOC_REQBUFS, &reqbufs); | 1159 IOCTL_OR_LOG_ERROR(VIDIOC_REQBUFS, &reqbufs); |
1153 | 1160 |
1154 output_buffer_map_.clear(); | 1161 output_buffer_map_.clear(); |
1155 free_output_buffers_.clear(); | 1162 free_output_buffers_.clear(); |
1156 } | 1163 } |
1157 | 1164 |
1158 } // namespace content | 1165 } // namespace content |
OLD | NEW |