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 |
| 295 gfx::Size min_resolution; |
296 v4l2_fmtdesc fmtdesc; | 296 v4l2_fmtdesc fmtdesc; |
297 memset(&fmtdesc, 0, sizeof(fmtdesc)); | 297 memset(&fmtdesc, 0, sizeof(fmtdesc)); |
298 fmtdesc.type = V4L2_BUF_TYPE_VIDEO_CAPTURE_MPLANE; | 298 fmtdesc.type = V4L2_BUF_TYPE_VIDEO_CAPTURE_MPLANE; |
299 for (; device_->Ioctl(VIDIOC_ENUM_FMT, &fmtdesc) == 0; ++fmtdesc.index) { | 299 for (; device_->Ioctl(VIDIOC_ENUM_FMT, &fmtdesc) == 0; ++fmtdesc.index) { |
| 300 device_->GetSupportedResolution(fmtdesc.pixelformat, |
| 301 &min_resolution, &profile.max_resolution); |
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 838 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1148 reqbufs.count = 0; | 1150 reqbufs.count = 0; |
1149 reqbufs.type = V4L2_BUF_TYPE_VIDEO_CAPTURE_MPLANE; | 1151 reqbufs.type = V4L2_BUF_TYPE_VIDEO_CAPTURE_MPLANE; |
1150 reqbufs.memory = V4L2_MEMORY_MMAP; | 1152 reqbufs.memory = V4L2_MEMORY_MMAP; |
1151 IOCTL_OR_LOG_ERROR(VIDIOC_REQBUFS, &reqbufs); | 1153 IOCTL_OR_LOG_ERROR(VIDIOC_REQBUFS, &reqbufs); |
1152 | 1154 |
1153 output_buffer_map_.clear(); | 1155 output_buffer_map_.clear(); |
1154 free_output_buffers_.clear(); | 1156 free_output_buffers_.clear(); |
1155 } | 1157 } |
1156 | 1158 |
1157 } // namespace content | 1159 } // namespace content |
OLD | NEW |