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 267 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
278 // Otherwise, call the destroy task directly. | 278 // Otherwise, call the destroy task directly. |
279 DestroyTask(); | 279 DestroyTask(); |
280 } | 280 } |
281 | 281 |
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 std::vector<media::VideoEncodeAccelerator::SupportedProfile> | 288 media::VideoEncodeAccelerator::SupportedProfiles |
289 V4L2VideoEncodeAccelerator::GetSupportedProfiles() { | 289 V4L2VideoEncodeAccelerator::GetSupportedProfiles() { |
290 std::vector<SupportedProfile> profiles; | 290 SupportedProfiles profiles; |
291 SupportedProfile profile; | 291 SupportedProfile profile; |
292 profile.max_resolution.SetSize(1920, 1088); | 292 profile.max_resolution.SetSize(1920, 1088); |
293 profile.max_framerate_numerator = 30; | 293 profile.max_framerate_numerator = 30; |
294 profile.max_framerate_denominator = 1; | 294 profile.max_framerate_denominator = 1; |
295 | 295 |
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 switch (fmtdesc.pixelformat) { | 300 switch (fmtdesc.pixelformat) { |
301 case V4L2_PIX_FMT_H264: | 301 case V4L2_PIX_FMT_H264: |
302 profile.profile = media::H264PROFILE_MAIN; | 302 profile.profile = media::H264PROFILE_MAIN; |
303 profiles.push_back(profile); | 303 profiles.push_back(profile); |
304 break; | 304 break; |
305 case V4L2_PIX_FMT_VP8: | 305 case V4L2_PIX_FMT_VP8: |
306 profile.profile = media::VP8PROFILE_ANY; | 306 profile.profile = media::VP8PROFILE_ANY; |
307 profiles.push_back(profile); | 307 profiles.push_back(profile); |
308 break; | 308 break; |
| 309 case V4L2_PIX_FMT_VP9: |
| 310 profile.profile = media::VP9PROFILE_ANY; |
| 311 profiles.push_back(profile); |
| 312 break; |
309 } | 313 } |
310 } | 314 } |
311 | 315 |
312 return profiles; | 316 return profiles; |
313 } | 317 } |
314 | 318 |
315 void V4L2VideoEncodeAccelerator::FrameProcessed( | 319 void V4L2VideoEncodeAccelerator::FrameProcessed( |
316 bool force_keyframe, | 320 bool force_keyframe, |
317 const scoped_refptr<media::VideoFrame>& frame) { | 321 const scoped_refptr<media::VideoFrame>& frame) { |
318 DCHECK(child_message_loop_proxy_->BelongsToCurrentThread()); | 322 DCHECK(child_message_loop_proxy_->BelongsToCurrentThread()); |
(...skipping 826 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1145 reqbufs.count = 0; | 1149 reqbufs.count = 0; |
1146 reqbufs.type = V4L2_BUF_TYPE_VIDEO_CAPTURE_MPLANE; | 1150 reqbufs.type = V4L2_BUF_TYPE_VIDEO_CAPTURE_MPLANE; |
1147 reqbufs.memory = V4L2_MEMORY_MMAP; | 1151 reqbufs.memory = V4L2_MEMORY_MMAP; |
1148 IOCTL_OR_LOG_ERROR(VIDIOC_REQBUFS, &reqbufs); | 1152 IOCTL_OR_LOG_ERROR(VIDIOC_REQBUFS, &reqbufs); |
1149 | 1153 |
1150 output_buffer_map_.clear(); | 1154 output_buffer_map_.clear(); |
1151 free_output_buffers_.clear(); | 1155 free_output_buffers_.clear(); |
1152 } | 1156 } |
1153 | 1157 |
1154 } // namespace content | 1158 } // namespace content |
OLD | NEW |