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 | |
Pawel Osciak
2015/04/22 08:50:56
And here as well.
henryhsu
2015/04/23 03:56:43
Done.
| |
300 profile.max_resolution = device_->GetMaxSupportedResolution( | |
301 fmtdesc.pixelformat); | |
300 switch (fmtdesc.pixelformat) { | 302 switch (fmtdesc.pixelformat) { |
301 case V4L2_PIX_FMT_H264: | 303 case V4L2_PIX_FMT_H264: |
302 profile.profile = media::H264PROFILE_MAIN; | 304 profile.profile = media::H264PROFILE_MAIN; |
303 profiles.push_back(profile); | 305 profiles.push_back(profile); |
304 break; | 306 break; |
305 case V4L2_PIX_FMT_VP8: | 307 case V4L2_PIX_FMT_VP8: |
306 profile.profile = media::VP8PROFILE_ANY; | 308 profile.profile = media::VP8PROFILE_ANY; |
307 profiles.push_back(profile); | 309 profiles.push_back(profile); |
308 break; | 310 break; |
309 case V4L2_PIX_FMT_VP9: | 311 case V4L2_PIX_FMT_VP9: |
(...skipping 839 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
1149 reqbufs.count = 0; | 1151 reqbufs.count = 0; |
1150 reqbufs.type = V4L2_BUF_TYPE_VIDEO_CAPTURE_MPLANE; | 1152 reqbufs.type = V4L2_BUF_TYPE_VIDEO_CAPTURE_MPLANE; |
1151 reqbufs.memory = V4L2_MEMORY_MMAP; | 1153 reqbufs.memory = V4L2_MEMORY_MMAP; |
1152 IOCTL_OR_LOG_ERROR(VIDIOC_REQBUFS, &reqbufs); | 1154 IOCTL_OR_LOG_ERROR(VIDIOC_REQBUFS, &reqbufs); |
1153 | 1155 |
1154 output_buffer_map_.clear(); | 1156 output_buffer_map_.clear(); |
1155 free_output_buffers_.clear(); | 1157 free_output_buffers_.clear(); |
1156 } | 1158 } |
1157 | 1159 |
1158 } // namespace content | 1160 } // namespace content |
OLD | NEW |